blob: ddba0d46cc011ba8d351b9cb1df034f0d360b591 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Satyanarayana Dash6f438272015-03-03 18:01:06 +05302 * Copyright (c) 2012-2015 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
112 { /*Est Cap present size is 8 + 2 byte at present*/
113 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];
138
139 if ( NULL == pBuf )
140 {
141 limLog( pMac, LOGE,
142 FL("Invalid Buffer Address"));
143 return;
144 }
145 if(NULL == pDst)
146 {
147 PELOGE(limLog(pMac, LOGE,
148 FL("NULL pDst pointer"));)
149 return ;
150 }
151
152 if ( DOT11F_EID_EXTCAP != pBuf[0] ||
153 pBuf[1] > DOT11F_IE_EXTCAP_MAX_LEN )
154 {
Mahesh A Saptasagare00ff532014-10-17 19:05:14 +0530155 limLog( pMac, LOG1,
Kalikinkar dhara205da782014-03-21 15:49:32 -0700156 FL("Invalid IEs eid = %d elem_len=%d "),
157 pBuf[0],pBuf[1]);
158 return;
159 }
160 vos_mem_set(( tANI_U8* )&pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, 0);
161 /* conversion should follow 4, 2, 2 byte order */
162 limUtilsframeshtonl(pMac, &pOut[0],*((tANI_U32*)&pBuf[2]),0);
163 limUtilsframeshtons(pMac, &pOut[4],*((tANI_U16*)&pBuf[6]),0);
164 limUtilsframeshtons(pMac, &pOut[6],*((tANI_U16*)&pBuf[8]),0);
165
166 if ( DOT11F_PARSE_SUCCESS != dot11fUnpackIeExtCap( pMac,
167 &pOut[0], DOT11F_IE_EXTCAP_MAX_LEN, pDst) )
168 {
169 limLog( pMac, LOGE,
170 FL("dot11fUnpackIeExtCap Parse Error "));
171 }
172}
173
174tSirRetStatus limStripOffExtCapIEAndUpdateStruct(tpAniSirGlobal pMac,
175 tANI_U8* addIE,
176 tANI_U16 *addnIELen,
177 tDot11fIEExtCap * pDst )
178{
179 tANI_U8 pExtractedExtCapIEBuf[DOT11F_IE_EXTCAP_MAX_LEN + 2];
180 tSirRetStatus nSirStatus;
181
182 vos_mem_set(( tANI_U8* )&pExtractedExtCapIEBuf[0],
183 DOT11F_IE_EXTCAP_MAX_LEN + 2, 0);
184 nSirStatus = limStripOffExtCapIE(pMac, addIE, addnIELen,
185 pExtractedExtCapIEBuf);
186 if ( eSIR_SUCCESS != nSirStatus )
187 {
188 limLog( pMac, LOG1, FL("Failed to strip off in"
189 "limStripOffExtCapIE status = (%d)."),
190 nSirStatus );
191 return nSirStatus;
192 }
193 /* update the extracted ExtCap to struct*/
194 limUpdateExtCapIEtoStruct(pMac, pExtractedExtCapIEBuf, pDst);
195 return nSirStatus;
196}
197
198void limMergeExtCapIEStruct(tDot11fIEExtCap *pDst,
199 tDot11fIEExtCap *pSrc)
200{
201 tANI_U8 *tempDst = (tANI_U8 *)pDst;
202 tANI_U8 *tempSrc = (tANI_U8 *)pSrc;
203 tANI_U8 structlen = sizeof(tDot11fIEExtCap);
204
205 while(tempDst && tempSrc && structlen--)
206 {
207 *tempDst |= *tempSrc;
208 tempDst++;
209 tempSrc++;
210 }
211}
Jeff Johnson295189b2012-06-20 16:38:30 -0700212
213/**
214 *
215 * \brief This function is called by various LIM modules to prepare the
216 * 802.11 frame MAC header
217 *
218 *
219 * \param pMac Pointer to Global MAC structure
220 *
221 * \param pBD Pointer to the frame buffer that needs to be populate
222 *
223 * \param type Type of the frame
224 *
225 * \param subType Subtype of the frame
226 *
227 * \return eHalStatus
228 *
229 *
230 * The pFrameBuf argument points to the beginning of the frame buffer to
231 * which - a) The 802.11 MAC header is set b) Following this MAC header
232 * will be the MGMT frame payload The payload itself is populated by the
233 * caller API
234 *
235 *
236 */
237
238tSirRetStatus limPopulateMacHeader( tpAniSirGlobal pMac,
239 tANI_U8* pBD,
240 tANI_U8 type,
241 tANI_U8 subType,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530242 tSirMacAddr peerAddr, tSirMacAddr selfMacAddr)
Jeff Johnson295189b2012-06-20 16:38:30 -0700243{
244 tSirRetStatus statusCode = eSIR_SUCCESS;
245 tpSirMacMgmtHdr pMacHdr;
246
247 /// Prepare MAC management header
248 pMacHdr = (tpSirMacMgmtHdr) (pBD);
249
250 // Prepare FC
251 pMacHdr->fc.protVer = SIR_MAC_PROTOCOL_VERSION;
252 pMacHdr->fc.type = type;
253 pMacHdr->fc.subType = subType;
254
255 // Prepare Address 1
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530256 vos_mem_copy( (tANI_U8 *) pMacHdr->da,
Jeff Johnson295189b2012-06-20 16:38:30 -0700257 (tANI_U8 *) peerAddr,
258 sizeof( tSirMacAddr ));
259
260 // Prepare Address 2
Jeff Johnson295189b2012-06-20 16:38:30 -0700261 sirCopyMacAddr(pMacHdr->sa,selfMacAddr);
262
263 // Prepare Address 3
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530264 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700265 (tANI_U8 *) peerAddr,
266 sizeof( tSirMacAddr ));
267 return statusCode;
268} /*** end limPopulateMacHeader() ***/
269
270/**
271 * \brief limSendProbeReqMgmtFrame
272 *
273 *
274 * \param pMac Pointer to Global MAC structure
275 *
276 * \param pSsid SSID to be sent in Probe Request frame
277 *
278 * \param bssid BSSID to be sent in Probe Request frame
279 *
280 * \param nProbeDelay probe delay to be used before sending Probe Request
281 * frame
282 *
283 * \param nChannelNum Channel # on which the Probe Request is going out
284 *
285 * \param nAdditionalIELen if non-zero, include pAdditionalIE in the Probe Request frame
286 *
287 * \param pAdditionalIE if nAdditionalIELen is non zero, include this field in the Probe Request frame
288 *
289 * This function is called by various LIM modules to send Probe Request frame
290 * during active scan/learn phase.
291 * Probe request is sent out in the following scenarios:
292 * --heartbeat failure: session needed
293 * --join req: session needed
294 * --foreground scan: no session
295 * --background scan: no session
296 * --schBeaconProcessing: to get EDCA parameters: session needed
297 *
298 *
299 */
300tSirRetStatus
301limSendProbeReqMgmtFrame(tpAniSirGlobal pMac,
302 tSirMacSSid *pSsid,
303 tSirMacAddr bssid,
304 tANI_U8 nChannelNum,
305 tSirMacAddr SelfMacAddr,
306 tANI_U32 dot11mode,
307 tANI_U32 nAdditionalIELen,
308 tANI_U8 *pAdditionalIE)
309{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530310 tDot11fProbeRequest pr;
311 tANI_U32 nStatus, nBytes, nPayload;
312 tSirRetStatus nSirStatus;
313 tANI_U8 *pFrame;
314 void *pPacket;
315 eHalStatus halstatus;
316 tpPESession psessionEntry;
317 tANI_U8 sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 tANI_U8 *p2pIe = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530319 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700320
321#ifndef GEN4_SCAN
322 return eSIR_FAILURE;
323#endif
324
325#if defined ( ANI_DVT_DEBUG )
326 return eSIR_FAILURE;
327#endif
328
Abhishek Singh4beed422014-02-03 16:47:17 +0530329 /* The probe req should not send 11ac capabilieties if band is 2.4GHz,
330 * unless enableVhtFor24GHz is enabled in INI. So if enableVhtFor24GHz
331 * is false and dot11mode is 11ac set it to 11n.
332 */
333 if ( nChannelNum <= SIR_11B_CHANNEL_END &&
334 ( FALSE == pMac->roam.configParam.enableVhtFor24GHz ) &&
335 ( WNI_CFG_DOT11_MODE_11AC == dot11mode ||
336 WNI_CFG_DOT11_MODE_11AC_ONLY == dot11mode ) )
337 dot11mode = WNI_CFG_DOT11_MODE_11N;
Jeff Johnson295189b2012-06-20 16:38:30 -0700338 /*
339 * session context may or may not be present, when probe request needs to be sent out.
340 * following cases exist:
341 * --heartbeat failure: session needed
342 * --join req: session needed
343 * --foreground scan: no session
344 * --background scan: no session
345 * --schBeaconProcessing: to get EDCA parameters: session needed
346 * If session context does not exist, some IEs will be populated from CFGs,
347 * e.g. Supported and Extended rate set IEs
348 */
349 psessionEntry = peFindSessionByBssid(pMac,bssid,&sessionId);
350
351 // The scheme here is to fill out a 'tDot11fProbeRequest' structure
352 // and then hand it off to 'dot11fPackProbeRequest' (for
353 // serialization). We start by zero-initializing the structure:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530354 vos_mem_set(( tANI_U8* )&pr, sizeof( pr ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700355
356 // & delegating to assorted helpers:
357 PopulateDot11fSSID( pMac, pSsid, &pr.SSID );
358
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 if( nAdditionalIELen && pAdditionalIE )
360 {
361 p2pIe = limGetP2pIEPtr(pMac, pAdditionalIE, nAdditionalIELen);
362 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700363 /* Don't include 11b rate only when device is doing P2P Search */
364 if( ( WNI_CFG_DOT11_MODE_11B != dot11mode ) &&
365 ( p2pIe != NULL ) &&
366 /* Don't include 11b rate if it is a P2P serach or probe request is sent by P2P Client */
367 ( ( ( pMac->lim.gpLimMlmScanReq != NULL ) &&
368 pMac->lim.gpLimMlmScanReq->p2pSearch ) ||
369 ( ( psessionEntry != NULL ) &&
370 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
371 )
372 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 {
374 /* In the below API pass channel number > 14, do that it fills only
375 * 11a rates in supported rates */
376 PopulateDot11fSuppRates( pMac, 15, &pr.SuppRates,psessionEntry);
377 }
378 else
379 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 PopulateDot11fSuppRates( pMac, nChannelNum,
381 &pr.SuppRates,psessionEntry);
382
383 if ( WNI_CFG_DOT11_MODE_11B != dot11mode )
384 {
385 PopulateDot11fExtSuppRates1( pMac, nChannelNum, &pr.ExtSuppRates );
386 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700388
389#if defined WLAN_FEATURE_VOWIFI
390 //Table 7-14 in IEEE Std. 802.11k-2008 says
391 //DS params "can" be present in RRM is disabled and "is" present if
392 //RRM is enabled. It should be ok even if we add it into probe req when
393 //RRM is not enabled.
394 PopulateDot11fDSParams( pMac, &pr.DSParams, nChannelNum, psessionEntry );
395 //Call RRM module to get the tx power for management used.
396 {
397 tANI_U8 txPower = (tANI_U8) rrmGetMgmtTxPower( pMac, psessionEntry );
398 PopulateDot11fWFATPC( pMac, &pr.WFATPC, txPower, 0 );
399 }
400#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700401
402 if (psessionEntry != NULL ) {
Jeff Johnsone7245742012-09-05 17:12:55 -0700403 psessionEntry->htCapability = IS_DOT11_MODE_HT(dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 //Include HT Capability IE
Jeff Johnsone7245742012-09-05 17:12:55 -0700405 if (psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700407 PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -0700408 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700409 } else { //psessionEntry == NULL
410 if (IS_DOT11_MODE_HT(dot11mode))
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700412 PopulateDot11fHTCaps( pMac, psessionEntry, &pr.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 }
414 }
Gopichand Nakkala40bc6502012-12-20 16:55:36 -0800415
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +0530416 if((nChannelNum <= SIR_11B_CHANNEL_END)
417 && (!IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
418 && (!pMac->roam.configParam.channelBondingMode24GHz))
Gopichand Nakkala40bc6502012-12-20 16:55:36 -0800419 {
420 pr.HTCaps.supportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
421 pr.HTCaps.shortGI40MHz = 0;
422 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700423#ifdef WLAN_FEATURE_11AC
424 if (psessionEntry != NULL ) {
425 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(dot11mode);
426 //Include HT Capability IE
427 if (psessionEntry->vhtCapability)
428 {
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530429 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps,
430 psessionEntry->currentOperChannel , eSIR_FALSE );
Jeff Johnsone7245742012-09-05 17:12:55 -0700431 }
432 } else {
433 if (IS_DOT11_MODE_VHT(dot11mode))
434 {
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530435 PopulateDot11fVHTCaps( pMac, &pr.VHTCaps, nChannelNum, eSIR_FALSE );
Jeff Johnsone7245742012-09-05 17:12:55 -0700436 }
437 }
438#endif
439
Jeff Johnson295189b2012-06-20 16:38:30 -0700440
441 // That's it-- now we pack it. First, how much space are we going to
442 // need?
443 nStatus = dot11fGetPackedProbeRequestSize( pMac, &pr, &nPayload );
444 if ( DOT11F_FAILED( nStatus ) )
445 {
446 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700447 "or a Probe Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 // We'll fall back on the worst case scenario:
449 nPayload = sizeof( tDot11fProbeRequest );
450 }
451 else if ( DOT11F_WARNED( nStatus ) )
452 {
453 limLog( pMac, LOGW, FL("There were warnings while calculating"
454 "the packed size for a Probe Request ("
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700455 "0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 }
457
458 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAdditionalIELen;
459
460 // Ok-- try to allocate some memory:
461 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
462 ( tANI_U16 )nBytes, ( void** ) &pFrame,
463 ( void** ) &pPacket );
464 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
465 {
466 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700467 "be Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 return eSIR_MEM_ALLOC_FAILED;
469 }
470
471 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530472 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700473
474 // Next, we fill out the buffer descriptor:
475 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530476 SIR_MAC_MGMT_PROBE_REQ, bssid, SelfMacAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 if ( eSIR_SUCCESS != nSirStatus )
478 {
479 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700480 "tor for a Probe Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 nSirStatus );
482 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
483 ( void* ) pFrame, ( void* ) pPacket );
484 return nSirStatus; // allocated!
485 }
486
487 // That done, pack the Probe Request:
488 nStatus = dot11fPackProbeRequest( pMac, &pr, pFrame +
489 sizeof( tSirMacMgmtHdr ),
490 nPayload, &nPayload );
491 if ( DOT11F_FAILED( nStatus ) )
492 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700493 limLog( pMac, LOGE, FL("Failed to pack a Probe Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 nStatus );
495 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
496 return eSIR_FAILURE; // allocated!
497 }
498 else if ( DOT11F_WARNED( nStatus ) )
499 {
500 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800501 "robe Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 }
503
504 // Append any AddIE if present.
505 if( nAdditionalIELen )
506 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530507 vos_mem_copy( pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 pAdditionalIE, nAdditionalIELen );
509 nPayload += nAdditionalIELen;
510 }
511
512 /* If this probe request is sent during P2P Search State, then we need
513 * to send it at OFDM rate.
514 */
515 if( ( SIR_BAND_5_GHZ == limGetRFBand(nChannelNum))
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 || (( pMac->lim.gpLimMlmScanReq != NULL) &&
517 pMac->lim.gpLimMlmScanReq->p2pSearch )
Gopichand Nakkala67967212013-02-15 17:31:15 +0530518 /* For unicast probe req mgmt from Join function
519 we don't set above variables. So we need to add
520 one more check whether it is pePersona is P2P_CLIENT or not */
521 || ( ( psessionEntry != NULL ) &&
522 ( VOS_P2P_CLIENT_MODE == psessionEntry->pePersona ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 )
524 {
525 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
526 }
527
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +0530528 if( ( psessionEntry != NULL ) && ( psessionEntry->is11Gonly == true ) &&
529 ( !IS_BROADCAST_MAC(bssid) ) ){
530 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
531 }
532
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload,
534 HAL_TXRX_FRM_802_11_MGMT,
535 ANI_TXDIR_TODS,
536 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
537 limTxComplete, pFrame, txFlag );
538 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
539 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700540 limLog( pMac, LOGE, FL("could not send Probe Request frame!" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 //Pkt will be freed up by the callback
542 return eSIR_FAILURE;
543 }
544
545 return eSIR_SUCCESS;
546} // End limSendProbeReqMgmtFrame.
547
Jeff Johnson295189b2012-06-20 16:38:30 -0700548tSirRetStatus limGetAddnIeForProbeResp(tpAniSirGlobal pMac,
549 tANI_U8* addIE, tANI_U16 *addnIELen,
550 tANI_U8 probeReqP2pIe)
551{
552 /* If Probe request doesn't have P2P IE, then take out P2P IE
553 from additional IE */
554 if(!probeReqP2pIe)
555 {
556 tANI_U8* tempbuf = NULL;
557 tANI_U16 tempLen = 0;
558 int left = *addnIELen;
559 v_U8_t *ptr = addIE;
560 v_U8_t elem_id, elem_len;
561
562 if(NULL == addIE)
563 {
564 PELOGE(limLog(pMac, LOGE,
565 FL(" NULL addIE pointer"));)
566 return eSIR_FAILURE;
567 }
568
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530569 tempbuf = vos_mem_malloc(left);
570 if ( NULL == tempbuf )
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 {
572 PELOGE(limLog(pMac, LOGE,
573 FL("Unable to allocate memory to store addn IE"));)
574 return eSIR_MEM_ALLOC_FAILED;
575 }
576
577 while(left >= 2)
578 {
579 elem_id = ptr[0];
580 elem_len = ptr[1];
581 left -= 2;
582 if(elem_len > left)
583 {
584 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700585 FL("****Invalid IEs eid = %d elem_len=%d left=%d*****"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700586 elem_id,elem_len,left);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530587 vos_mem_free(tempbuf);
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 return eSIR_FAILURE;
589 }
590 if ( !( (SIR_MAC_EID_VENDOR == elem_id) &&
591 (memcmp(&ptr[2], SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE)==0) ) )
592 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530593 vos_mem_copy (tempbuf + tempLen, &ptr[0], elem_len + 2);
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 tempLen += (elem_len + 2);
595 }
596 left -= elem_len;
597 ptr += (elem_len + 2);
598 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530599 vos_mem_copy (addIE, tempbuf, tempLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 *addnIELen = tempLen;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530601 vos_mem_free(tempbuf);
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 }
603 return eSIR_SUCCESS;
604}
Jeff Johnson295189b2012-06-20 16:38:30 -0700605
606void
607limSendProbeRspMgmtFrame(tpAniSirGlobal pMac,
608 tSirMacAddr peerMacAddr,
609 tpAniSSID pSsid,
610 short nStaId,
611 tANI_U8 nKeepAlive,
612 tpPESession psessionEntry,
613 tANI_U8 probeReqP2pIe)
614{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700615 tDot11fProbeResponse *pFrm;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530616 tSirRetStatus nSirStatus;
c_hpothubcd78652014-04-28 22:31:08 +0530617 tANI_U32 cfg, nPayload, nStatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530618 tpSirMacMgmtHdr pMacHdr;
619 tANI_U8 *pFrame;
620 void *pPacket;
621 eHalStatus halstatus;
622 tANI_U32 addnIEPresent;
623 tANI_U32 addnIE1Len=0;
624 tANI_U32 addnIE2Len=0;
625 tANI_U32 addnIE3Len=0;
626 tANI_U16 totalAddnIeLen = 0;
627 tANI_U32 wpsApEnable=0, tmp;
628 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 tANI_U8 *addIE = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530630 tANI_U8 *pP2pIe = NULL;
631 tANI_U8 noaLen = 0;
632 tANI_U8 total_noaLen = 0;
633 tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 + SIR_P2P_IE_HEADER_LEN];
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +0530635 tANI_U8 noaIe[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN];
Kalikinkar dhara205da782014-03-21 15:49:32 -0700636 tDot11fIEExtCap extractedExtCap;
637 tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE;
c_hpothubcd78652014-04-28 22:31:08 +0530638 tANI_U32 nBytes = 0;
639
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 if(pMac->gDriverType == eDRIVER_TYPE_MFG) // We don't answer requests
641 {
642 return; // in this case.
643 }
644
645 if(NULL == psessionEntry)
646 {
647 return;
648 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530649
650 pFrm = vos_mem_malloc(sizeof(tDot11fProbeResponse));
651 if ( NULL == pFrm )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700652 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530653 limLog(pMac, LOGE, FL("Unable to allocate memory in limSendProbeRspMgmtFrame") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700654 return;
655 }
656
Girish Gowli0e826792014-05-17 17:56:44 +0530657 vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0);
658
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 // Fill out 'frm', after which we'll just hand the struct off to
660 // 'dot11fPackProbeResponse'.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530661 vos_mem_set(( tANI_U8* )pFrm, sizeof( tDot11fProbeResponse ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700662
663 // Timestamp to be updated by TFP, below.
664
665 // Beacon Interval:
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
667 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700668 pFrm->BeaconInterval.interval = pMac->sch.schObject.gSchBeaconInterval;
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 }
670 else
671 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800672 nSirStatus = wlan_cfgGetInt( pMac, WNI_CFG_BEACON_INTERVAL, &cfg);
673 if (eSIR_SUCCESS != nSirStatus)
674 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700675 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BEACON_INTERVAL from CFG (%d)."),
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800676 nSirStatus );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530677 vos_mem_free(pFrm);
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800678 return;
679 }
680 pFrm->BeaconInterval.interval = ( tANI_U16 ) cfg;
Madan Mohan Koyyalamudic0d1b3f2012-11-13 10:41:07 -0800681 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700682
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700683 PopulateDot11fCapabilities( pMac, &pFrm->Capabilities, psessionEntry );
684 PopulateDot11fSSID( pMac, ( tSirMacSSid* )pSsid, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -0700685 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700686 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700687
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700688 PopulateDot11fDSParams( pMac, &pFrm->DSParams, psessionEntry->currentOperChannel,psessionEntry);
689 PopulateDot11fIBSSParams( pMac, &pFrm->IBSSParams, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700690
Jeff Johnson295189b2012-06-20 16:38:30 -0700691
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
693 {
694 if(psessionEntry->wps_state != SAP_WPS_DISABLED)
695 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700696 PopulateDot11fProbeResWPSIEs(pMac, &pFrm->WscProbeRes, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 }
698 }
699 else
700 {
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800701 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_ENABLE, &tmp) != eSIR_SUCCESS)
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700702 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_ENABLE );
Jeff Johnson295189b2012-06-20 16:38:30 -0700703
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800704 wpsApEnable = tmp & WNI_CFG_WPS_ENABLE_AP;
Jeff Johnson295189b2012-06-20 16:38:30 -0700705
Jeff Johnson3c3e1782013-02-27 10:48:42 -0800706 if (wpsApEnable)
707 {
708 PopulateDot11fWscInProbeRes(pMac, &pFrm->WscProbeRes);
709 }
710
711 if (pMac->lim.wscIeInfo.probeRespWscEnrollmentState == eLIM_WSC_ENROLL_BEGIN)
712 {
713 PopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
714 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_IN_PROGRESS;
715 }
716
717 if (pMac->lim.wscIeInfo.wscEnrollmentState == eLIM_WSC_ENROLL_END)
718 {
719 DePopulateDot11fWscRegistrarInfoInProbeRes(pMac, &pFrm->WscProbeRes);
720 pMac->lim.wscIeInfo.probeRespWscEnrollmentState = eLIM_WSC_ENROLL_NOOP;
721 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700723
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700724 PopulateDot11fCountry( pMac, &pFrm->Country, psessionEntry);
725 PopulateDot11fEDCAParamSet( pMac, &pFrm->EDCAParamSet, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700726
Jeff Johnson295189b2012-06-20 16:38:30 -0700727
728 if (psessionEntry->dot11mode != WNI_CFG_DOT11_MODE_11B)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700729 PopulateDot11fERPInfo( pMac, &pFrm->ERPInfo, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700730
731
732 // N.B. In earlier implementations, the RSN IE would be placed in
733 // the frame here, before the WPA IE, if 'RSN_BEFORE_WPA' was defined.
734 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700735 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700736
737 //Populate HT IEs, when operating in 11n or Taurus modes.
Jeff Johnsone7245742012-09-05 17:12:55 -0700738 if ( psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700740 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700741 PopulateDot11fHTInfo( pMac, &pFrm->HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700742 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530743
744#ifdef WLAN_FEATURE_AP_HT40_24G
745 /* Populate Overlapping BSS Scan Parameters IEs,
746 * when operating in HT40 in 2.4GHz.
747 */
Hardik Kantilal Patel3c235242015-01-02 17:56:18 +0530748 if ((pMac->roam.configParam.apHT40_24GEnabled)
749 && (IS_DOT11_MODE_HT(psessionEntry->dot11mode)))
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530750 {
751 PopulateDot11fOBSSScanParameters( pMac, &pFrm->OBSSScanParameters,
752 psessionEntry);
Hardik Kantilal Patelee5874c2015-01-14 15:23:28 +0530753 /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in
754 * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK
755 * Mode in 40 MHz bit in HT capablity.
756 */
757 pFrm->HTCaps.dsssCckMode40MHz = 1;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530758 }
759#endif
760
761 PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
762
Jeff Johnsone7245742012-09-05 17:12:55 -0700763#ifdef WLAN_FEATURE_11AC
764 if(psessionEntry->vhtCapability)
765 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800766 limLog( pMac, LOG1, FL("Populate VHT IE in Probe Response"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530767 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps,
768 psessionEntry->currentOperChannel, eSIR_TRUE );
769 PopulateDot11fVHTOperation( pMac, &pFrm->VHTOperation ,
770 psessionEntry->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -0700771 // we do not support multi users yet
772 //PopulateDot11fVHTExtBssLoad( pMac, &frm.VHTExtBssLoad );
773 }
774#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700775
Sandeep Puligilla60342762014-01-30 21:05:37 +0530776
Hardik Kantilal Patelee5874c2015-01-14 15:23:28 +0530777 if ( psessionEntry->pLimStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 {
779 PopulateDot11fWPA( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700780 &pFrm->WPA );
Chet Lanctot4b9abd72013-06-27 11:14:56 -0700781 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
782 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 }
784
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700785 PopulateDot11fWMM( pMac, &pFrm->WMMInfoAp, &pFrm->WMMParams, &pFrm->WMMCaps, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -0700786
787#if defined(FEATURE_WLAN_WAPI)
788 if( psessionEntry->pLimStartBssReq )
789 {
790 PopulateDot11fWAPI( pMac, &( psessionEntry->pLimStartBssReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700791 &pFrm->WAPI );
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 }
793
794#endif // defined(FEATURE_WLAN_WAPI)
795
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 addnIEPresent = false;
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 if( pMac->lim.gpLimRemainOnChanReq )
798 {
799 nBytes += (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq ) );
800 }
801 //Only use CFG for non-listen mode. This CFG is not working for concurrency
802 //In listening mode, probe rsp IEs is passed in the message from SME to PE
803 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700804 {
805
806 if (wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_ADDNIE_FLAG,
807 &addnIEPresent) != eSIR_SUCCESS)
808 {
809 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_FLAG"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530810 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 return;
812 }
813 }
814
815 if (addnIEPresent)
816 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530817
818 addIE = vos_mem_malloc(WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN*3);
819 if ( NULL == addIE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 {
821 PELOGE(limLog(pMac, LOGE,
822 FL("Unable to allocate memory to store addn IE"));)
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530823 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 return;
825 }
826
827 //Probe rsp IE available
828 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
829 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addnIE1Len) )
830 {
831 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530832 vos_mem_free(addIE);
833 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 return;
835 }
836 if (addnIE1Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA1_LEN && addnIE1Len &&
837 (nBytes + addnIE1Len) <= SIR_MAX_PACKET_SIZE)
838 {
839 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
840 WNI_CFG_PROBE_RSP_ADDNIE_DATA1, &addIE[0],
841 &addnIE1Len) )
842 {
843 limLog(pMac, LOGP,
844 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA1 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530845 vos_mem_free(addIE);
846 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 return;
848 }
849 }
850
851 //Probe rsp IE available
852 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
853 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addnIE2Len) )
854 {
855 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530856 vos_mem_free(addIE);
857 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 return;
859 }
860 if (addnIE2Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA2_LEN && addnIE2Len &&
861 (nBytes + addnIE2Len) <= SIR_MAX_PACKET_SIZE)
862 {
863 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
864 WNI_CFG_PROBE_RSP_ADDNIE_DATA2, &addIE[addnIE1Len],
865 &addnIE2Len) )
866 {
867 limLog(pMac, LOGP,
868 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA2 String"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530869 vos_mem_free(addIE);
870 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 return;
872 }
873 }
874
875 //Probe rsp IE available
876 if ( eSIR_SUCCESS != wlan_cfgGetStrLen(pMac,
877 WNI_CFG_PROBE_RSP_ADDNIE_DATA3, &addnIE3Len) )
878 {
879 limLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 length"));
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530880 vos_mem_free(addIE);
881 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700882 return;
883 }
884 if (addnIE3Len <= WNI_CFG_PROBE_RSP_ADDNIE_DATA3_LEN && addnIE3Len &&
885 (nBytes + addnIE3Len) <= SIR_MAX_PACKET_SIZE)
886 {
887 if ( eSIR_SUCCESS != wlan_cfgGetStr(pMac,
888 WNI_CFG_PROBE_RSP_ADDNIE_DATA3,
889 &addIE[addnIE1Len + addnIE2Len],
890 &addnIE3Len) )
891 {
892 limLog(pMac, LOGP,
893 FL("Unable to get WNI_CFG_PROBE_RSP_ADDNIE_DATA3 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 totalAddnIeLen = addnIE1Len + addnIE2Len + addnIE3Len;
900
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 if(eSIR_SUCCESS != limGetAddnIeForProbeResp(pMac, addIE, &totalAddnIeLen, probeReqP2pIe))
902 {
903 limLog(pMac, LOGP,
904 FL("Unable to get final Additional IE for Probe Req"));
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 }
Kalikinkar dhara205da782014-03-21 15:49:32 -0700909
Kalikinkar dhara205da782014-03-21 15:49:32 -0700910 nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac,
911 addIE,
912 &totalAddnIeLen,
913 &extractedExtCap );
914 if(eSIR_SUCCESS != nSirStatus )
915 {
916 extractedExtCapFlag = eANI_BOOLEAN_FALSE;
917 limLog(pMac, LOG1,
918 FL("Unable to Stripoff ExtCap IE from Probe Rsp"));
919 }
920
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 nBytes = nBytes + totalAddnIeLen;
Kaushik, Sushanta5ee77a2014-07-30 19:35:25 +0530922 limLog(pMac, LOG1,
923 FL("probe rsp packet size is %d "), nBytes);
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 if (probeReqP2pIe)
925 {
926 pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], totalAddnIeLen);
927 if (pP2pIe != NULL)
928 {
929 //get NoA attribute stream P2P IE
930 noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry);
931 if (noaLen != 0)
932 {
933 total_noaLen = limBuildP2pIe(pMac, &noaIe[0],
934 &noaStream[0], noaLen);
935 nBytes = nBytes + total_noaLen;
Kaushik, Sushanta5ee77a2014-07-30 19:35:25 +0530936 limLog(pMac, LOG1,
937 FL("p2p probe rsp packet size is %d, noalength is %d"),
938 nBytes, total_noaLen);
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 }
940 }
941 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700942 }
943
c_hpothubcd78652014-04-28 22:31:08 +0530944 /*merge ExtCap IE*/
945 if (extractedExtCapFlag && extractedExtCap.present)
946 {
947 limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap);
948 }
949
950 nStatus = dot11fGetPackedProbeResponseSize( pMac, pFrm, &nPayload );
951 if ( DOT11F_FAILED( nStatus ) )
952 {
953 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
954 "or a Probe Response (0x%08x)."),
955 nStatus );
956 // We'll fall back on the worst case scenario:
957 nPayload = sizeof( tDot11fProbeResponse );
958 }
959 else if ( DOT11F_WARNED( nStatus ) )
960 {
961 limLog( pMac, LOGW, FL("There were warnings while calculating"
962 "the packed size for a Probe Response "
963 "(0x%08x)."), nStatus );
964 }
965
966 nBytes += nPayload + sizeof( tSirMacMgmtHdr );
967
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
969 ( tANI_U16 )nBytes, ( void** ) &pFrame,
970 ( void** ) &pPacket );
971 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
972 {
973 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Pro"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700974 "be Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 if ( addIE != NULL )
976 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530977 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700978 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530979 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 return;
981 }
982
983 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530984 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700985
986 // Next, we fill out the buffer descriptor:
987 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
988 SIR_MAC_MGMT_PROBE_RSP, peerMacAddr,psessionEntry->selfMacAddr);
989 if ( eSIR_SUCCESS != nSirStatus )
990 {
991 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -0700992 "tor for a Probe Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 nSirStatus );
994 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
995 ( void* ) pFrame, ( void* ) pPacket );
996 if ( addIE != NULL )
997 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +0530998 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301000 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 return;
1002 }
1003
1004 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1005
1006 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1007
1008 // That done, pack the Probe Response:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001009 nStatus = dot11fPackProbeResponse( pMac, pFrm, pFrame + sizeof(tSirMacMgmtHdr),
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 nPayload, &nPayload );
1011 if ( DOT11F_FAILED( nStatus ) )
1012 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001013 limLog( pMac, LOGE, FL("Failed to pack a Probe Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001014 nStatus );
1015 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1016 if ( addIE != NULL )
1017 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301018 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301020 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 return; // allocated!
1022 }
1023 else if ( DOT11F_WARNED( nStatus ) )
1024 {
1025 limLog( pMac, LOGW, FL("There were warnings while packing a P"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001026 "robe Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 }
1028
1029 PELOG3(limLog( pMac, LOG3, FL("Sending Probe Response frame to ") );
1030 limPrintMacAddr( pMac, peerMacAddr, LOG3 );)
1031
1032 pMac->sys.probeRespond++;
1033
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 if( pMac->lim.gpLimRemainOnChanReq )
1035 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301036 vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload,
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 pMac->lim.gpLimRemainOnChanReq->probeRspIe, (pMac->lim.gpLimRemainOnChanReq->length - sizeof( tSirRemainOnChnReq )) );
1038 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001039
1040 if ( addnIEPresent )
1041 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301042 vos_mem_copy(pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], totalAddnIeLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 if (noaLen != 0)
1045 {
Krunal Soni81b24262013-05-15 17:46:41 -07001046 if (total_noaLen > (SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN))
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 {
1048 limLog(pMac, LOGE,
Kaushik, Sushant96ac9d72013-12-11 19:28:10 +05301049 FL("Not able to insert NoA because of length constraint."
1050 "Total Length is :%d"),total_noaLen);
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301051 vos_mem_free(addIE);
1052 vos_mem_free(pFrm);
Krunal Soni81b24262013-05-15 17:46:41 -07001053 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1054 ( void* ) pFrame, ( void* ) pPacket );
1055 return;
1056 }
1057 else
1058 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301059 vos_mem_copy( &pFrame[nBytes - (total_noaLen)],
Krunal Soni81b24262013-05-15 17:46:41 -07001060 &noaIe[0], total_noaLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 }
1062 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001063
1064 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1066 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 )
1068 {
1069 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1070 }
1071
1072 // Queue Probe Response frame in high priority WQ
1073 halstatus = halTxFrame( ( tHalHandle ) pMac, pPacket,
1074 ( tANI_U16 ) nBytes,
1075 HAL_TXRX_FRM_802_11_MGMT,
1076 ANI_TXDIR_TODS,
1077 7,//SMAC_SWBD_TX_TID_MGMT_LOW,
1078 limTxComplete, pFrame, txFlag );
1079 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1080 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001081 limLog( pMac, LOGE, FL("Could not send Probe Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 //Pkt will be freed up by the callback
1083 }
1084
1085 if ( addIE != NULL )
1086 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301087 vos_mem_free(addIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 }
1089
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301090 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07001091 return;
1092
1093
Jeff Johnson295189b2012-06-20 16:38:30 -07001094} // End limSendProbeRspMgmtFrame.
1095
1096void
1097limSendAddtsReqActionFrame(tpAniSirGlobal pMac,
1098 tSirMacAddr peerMacAddr,
1099 tSirAddtsReqInfo *pAddTS,
1100 tpPESession psessionEntry)
1101{
1102 tANI_U16 i;
1103 tANI_U8 *pFrame;
1104 tSirRetStatus nSirStatus;
1105 tDot11fAddTSRequest AddTSReq;
1106 tDot11fWMMAddTSRequest WMMAddTSReq;
1107 tANI_U32 nPayload, nBytes, nStatus;
1108 tpSirMacMgmtHdr pMacHdr;
1109 void *pPacket;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001110#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001111 tANI_U32 phyMode;
1112#endif
1113 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301114 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001115
1116 if(NULL == psessionEntry)
1117 {
1118 return;
1119 }
1120
1121 if ( ! pAddTS->wmeTspecPresent )
1122 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301123 vos_mem_set(( tANI_U8* )&AddTSReq, sizeof( AddTSReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001124
1125 AddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
1126 AddTSReq.DialogToken.token = pAddTS->dialogToken;
1127 AddTSReq.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1128 if ( pAddTS->lleTspecPresent )
1129 {
1130 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSReq.TSPEC );
1131 }
1132 else
1133 {
1134 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSReq.WMMTSPEC );
1135 }
1136
1137 if ( pAddTS->lleTspecPresent )
1138 {
1139 AddTSReq.num_WMMTCLAS = 0;
1140 AddTSReq.num_TCLAS = pAddTS->numTclas;
1141 for ( i = 0; i < pAddTS->numTclas; ++i)
1142 {
1143 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
1144 &AddTSReq.TCLAS[i] );
1145 }
1146 }
1147 else
1148 {
1149 AddTSReq.num_TCLAS = 0;
1150 AddTSReq.num_WMMTCLAS = pAddTS->numTclas;
1151 for ( i = 0; i < pAddTS->numTclas; ++i)
1152 {
1153 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1154 &AddTSReq.WMMTCLAS[i] );
1155 }
1156 }
1157
1158 if ( pAddTS->tclasProcPresent )
1159 {
1160 if ( pAddTS->lleTspecPresent )
1161 {
1162 AddTSReq.TCLASSPROC.processing = pAddTS->tclasProc;
1163 AddTSReq.TCLASSPROC.present = 1;
1164 }
1165 else
1166 {
1167 AddTSReq.WMMTCLASPROC.version = 1;
1168 AddTSReq.WMMTCLASPROC.processing = pAddTS->tclasProc;
1169 AddTSReq.WMMTCLASPROC.present = 1;
1170 }
1171 }
1172
1173 nStatus = dot11fGetPackedAddTSRequestSize( pMac, &AddTSReq, &nPayload );
1174 if ( DOT11F_FAILED( nStatus ) )
1175 {
1176 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001177 "or an Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001178 nStatus );
1179 // We'll fall back on the worst case scenario:
1180 nPayload = sizeof( tDot11fAddTSRequest );
1181 }
1182 else if ( DOT11F_WARNED( nStatus ) )
1183 {
1184 limLog( pMac, LOGW, FL("There were warnings while calculating"
1185 "the packed size for an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001186 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 }
1188 }
1189 else
1190 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301191 vos_mem_set(( tANI_U8* )&WMMAddTSReq, sizeof( WMMAddTSReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001192
1193 WMMAddTSReq.Action.action = SIR_MAC_QOS_ADD_TS_REQ;
1194 WMMAddTSReq.DialogToken.token = pAddTS->dialogToken;
1195 WMMAddTSReq.Category.category = SIR_MAC_ACTION_WME;
1196
1197 // WMM spec 2.2.10 - status code is only filled in for ADDTS response
1198 WMMAddTSReq.StatusCode.statusCode = 0;
1199
1200 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSReq.WMMTSPEC );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001201#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001202 limGetPhyMode(pMac, &phyMode, psessionEntry);
1203
1204 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
1205 {
1206 pAddTS->tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
1207 }
1208 else
1209 {
1210 pAddTS->tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
1211 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001212 PopulateDot11TSRSIE(pMac,&pAddTS->tsrsIE, &WMMAddTSReq.ESETrafStrmRateSet,sizeof(tANI_U8));
Jeff Johnson295189b2012-06-20 16:38:30 -07001213#endif
1214 // fillWmeTspecIE
1215
1216 nStatus = dot11fGetPackedWMMAddTSRequestSize( pMac, &WMMAddTSReq, &nPayload );
1217 if ( DOT11F_FAILED( nStatus ) )
1218 {
1219 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001220 "or a WMM Add TS Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001221 nStatus );
1222 // We'll fall back on the worst case scenario:
1223 nPayload = sizeof( tDot11fAddTSRequest );
1224 }
1225 else if ( DOT11F_WARNED( nStatus ) )
1226 {
1227 limLog( pMac, LOGW, FL("There were warnings while calculating"
1228 "the packed size for a WMM Add TS Requ"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001229 "est (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 }
1231 }
1232
1233 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1234
1235 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1236 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1237 ( void** ) &pPacket );
1238 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1239 {
1240 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001241 "d TS Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 return;
1243 }
1244
1245 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301246 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001247
1248 // Next, we fill out the buffer descriptor:
1249 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1250 SIR_MAC_MGMT_ACTION, peerMacAddr,psessionEntry->selfMacAddr);
1251 if ( eSIR_SUCCESS != nSirStatus )
1252 {
1253 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001254 "tor for an Add TS Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 nSirStatus );
1256 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1257 ( void* ) pFrame, ( void* ) pPacket );
1258 return;
1259 }
1260
1261 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1262
1263 #if 0
1264 cfgLen = SIR_MAC_ADDR_LENGTH;
1265 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1266 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1267 {
1268 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001269 "e sending an Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001270 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1271 ( void* ) pFrame, ( void* ) pPacket );
1272 return;
1273 }
1274 #endif //TO SUPPORT BT-AMP
1275
1276 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1277
Chet Lanctot186b5732013-03-18 10:26:30 -07001278#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001279 limSetProtectedBit(pMac, psessionEntry, peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001280#endif
1281
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 // That done, pack the struct:
1283 if ( ! pAddTS->wmeTspecPresent )
1284 {
1285 nStatus = dot11fPackAddTSRequest( pMac, &AddTSReq,
1286 pFrame + sizeof(tSirMacMgmtHdr),
1287 nPayload, &nPayload );
1288 if ( DOT11F_FAILED( nStatus ) )
1289 {
1290 limLog( pMac, LOGE, FL("Failed to pack an Add TS Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001291 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 nStatus );
1293 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1294 return; // allocated!
1295 }
1296 else if ( DOT11F_WARNED( nStatus ) )
1297 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001298 limLog( pMac, LOGW, FL("There were warnings while packing "
1299 "an Add TS Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 }
1301 }
1302 else
1303 {
1304 nStatus = dot11fPackWMMAddTSRequest( pMac, &WMMAddTSReq,
1305 pFrame + sizeof(tSirMacMgmtHdr),
1306 nPayload, &nPayload );
1307 if ( DOT11F_FAILED( nStatus ) )
1308 {
1309 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001310 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 nStatus );
1312 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1313 return; // allocated!
1314 }
1315 else if ( DOT11F_WARNED( nStatus ) )
1316 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001317 limLog( pMac, LOGW, FL("There were warnings while packing "
1318 "a WMM Add TS Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 }
1320 }
1321
Abhishek Singh127a8442014-12-15 17:31:27 +05301322 limLog( pMac, LOG1, FL("Sending an Add TS Request frame to ") );
1323 limPrintMacAddr( pMac, peerMacAddr, LOG1 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001324
1325 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1327 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 )
1329 {
1330 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1331 }
1332
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301333 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
1334 psessionEntry->peSessionId,
1335 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 // Queue Addts Response frame in high priority WQ
1337 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1338 HAL_TXRX_FRM_802_11_MGMT,
1339 ANI_TXDIR_TODS,
1340 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1341 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301342 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
1343 psessionEntry->peSessionId,
1344 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1346 {
1347 limLog( pMac, LOGE, FL( "*** Could not send an Add TS Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001348 " (%X) ***" ), halstatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 //Pkt will be freed up by the callback
1350 }
1351
1352} // End limSendAddtsReqActionFrame.
1353
Jeff Johnson295189b2012-06-20 16:38:30 -07001354
1355
1356void
1357limSendAssocRspMgmtFrame(tpAniSirGlobal pMac,
1358 tANI_U16 statusCode,
1359 tANI_U16 aid,
1360 tSirMacAddr peerMacAddr,
1361 tANI_U8 subType,
1362 tpDphHashNode pSta,tpPESession psessionEntry)
1363{
1364 static tDot11fAssocResponse frm;
1365 tANI_U8 *pFrame, *macAddr;
1366 tpSirMacMgmtHdr pMacHdr;
1367 tSirRetStatus nSirStatus;
1368 tANI_U8 lleMode = 0, fAddTS, edcaInclude = 0;
1369 tHalBitVal qosMode, wmeMode;
c_hpothubcd78652014-04-28 22:31:08 +05301370 tANI_U32 nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 void *pPacket;
1372 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301373 tUpdateBeaconParams beaconParams;
1374 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 tANI_U32 addnIEPresent = false;
1376 tANI_U32 addnIELen=0;
1377 tANI_U8 addIE[WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN];
1378 tpSirAssocReq pAssocReq = NULL;
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301379 tANI_U16 addStripoffIELen = 0;
1380 tDot11fIEExtCap extractedExtCap;
1381 tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_FALSE;
c_hpothubcd78652014-04-28 22:31:08 +05301382 tANI_U32 nBytes = 0;
Kalikinkar dhara205da782014-03-21 15:49:32 -07001383
Chet Lanctot8cecea22014-02-11 19:09:36 -08001384#ifdef WLAN_FEATURE_11W
1385 tANI_U32 retryInterval;
1386 tANI_U32 maxRetries;
1387#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001388
1389 if(NULL == psessionEntry)
1390 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301391 limLog( pMac, LOGE, FL("psessionEntry is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 return;
1393 }
1394
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301395 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001396
1397 limGetQosMode(psessionEntry, &qosMode);
1398 limGetWmeMode(psessionEntry, &wmeMode);
1399
1400 // An Add TS IE is added only if the AP supports it and the requesting
1401 // STA sent a traffic spec.
1402 fAddTS = ( qosMode && pSta && pSta->qos.addtsPresent ) ? 1 : 0;
1403
1404 PopulateDot11fCapabilities( pMac, &frm.Capabilities, psessionEntry );
1405
1406 frm.Status.status = statusCode;
1407
1408 frm.AID.associd = aid | LIM_AID_MASK;
1409
1410 if ( NULL == pSta )
1411 {
1412 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.SuppRates,psessionEntry);
1413 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL, &frm.ExtSuppRates, psessionEntry );
1414 }
1415 else
1416 {
1417 PopulateDot11fAssocRspRates( pMac, &frm.SuppRates, &frm.ExtSuppRates,
1418 pSta->supportedRates.llbRates, pSta->supportedRates.llaRates );
1419 }
1420
Jeff Johnson295189b2012-06-20 16:38:30 -07001421 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1422 {
1423 if( pSta != NULL && eSIR_SUCCESS == statusCode )
1424 {
1425 pAssocReq =
1426 (tpSirAssocReq) psessionEntry->parsedAssocReq[pSta->assocId];
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 /* populate P2P IE in AssocRsp when assocReq from the peer includes P2P IE */
1428 if( pAssocReq != NULL && pAssocReq->addIEPresent ) {
1429 PopulateDot11AssocResP2PIE(pMac, &frm.P2PAssocRes, pAssocReq);
1430 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 }
1432 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001433
1434 if ( NULL != pSta )
1435 {
1436 if ( eHAL_SET == qosMode )
1437 {
1438 if ( pSta->lleEnabled )
1439 {
1440 lleMode = 1;
1441 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) )
1442 {
1443 PopulateDot11fEDCAParamSet( pMac, &frm.EDCAParamSet, psessionEntry);
1444
1445// FramesToDo:...
1446// if ( fAddTS )
1447// {
1448// tANI_U8 *pAf = pBody;
1449// *pAf++ = SIR_MAC_QOS_ACTION_EID;
1450// tANI_U32 tlen;
1451// status = sirAddtsRspFill(pMac, pAf, statusCode, &pSta->qos.addts, NULL,
1452// &tlen, bufLen - frameLen);
1453// } // End if on Add TS.
1454 }
1455 } // End if on .11e enabled in 'pSta'.
1456 } // End if on QOS Mode on.
1457
1458 if ( ( ! lleMode ) && ( eHAL_SET == wmeMode ) && pSta->wmeEnabled )
1459 {
1460 if ( ( ! pSta->aniPeer ) || ( ! PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1461 {
1462
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 PopulateDot11fWMMParams( pMac, &frm.WMMParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001464
1465 if ( pSta->wsmEnabled )
1466 {
1467 PopulateDot11fWMMCaps(&frm.WMMCaps );
1468 }
1469 }
1470 }
1471
1472 if ( pSta->aniPeer )
1473 {
1474 if ( ( lleMode && PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) ) ||
1475 ( pSta->wmeEnabled && PROP_CAPABILITY_GET( WME, pSta->propCapability ) ) )
1476 {
1477 edcaInclude = 1;
1478 }
1479
1480 } // End if on Airgo peer.
1481
1482 if ( pSta->mlmStaContext.htCapability &&
Jeff Johnsone7245742012-09-05 17:12:55 -07001483 psessionEntry->htCapability )
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05301485 limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Response"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001486 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Sachin Ahujac3a26232014-09-23 22:27:30 +05301487 /*
1488 *Check the STA capability and update the HTCaps accordingly
1489 */
1490 frm.HTCaps.supportedChannelWidthSet =
1491 (pSta->htSupportedChannelWidthSet < psessionEntry->htSupportedChannelWidthSet) ?
1492 pSta->htSupportedChannelWidthSet : psessionEntry->htSupportedChannelWidthSet ;
1493
1494 if (!frm.HTCaps.supportedChannelWidthSet)
1495 frm.HTCaps.shortGI40MHz = 0;
1496
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 PopulateDot11fHTInfo( pMac, &frm.HTInfo, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001499
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301500#ifdef WLAN_FEATURE_AP_HT40_24G
1501 /* Populate Overlapping BSS Scan Parameters IEs,
1502 * when operating in HT40 in 2.4GHz.
1503 */
Hardik Kantilal Patel3c235242015-01-02 17:56:18 +05301504 if ((pMac->roam.configParam.apHT40_24GEnabled)
1505 && (IS_DOT11_MODE_HT(psessionEntry->dot11mode)))
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301506 {
1507 PopulateDot11fOBSSScanParameters( pMac, &frm.OBSSScanParameters,
1508 psessionEntry);
Hardik Kantilal Patelee5874c2015-01-14 15:23:28 +05301509 /* 10.15.8 Support of DSSS/CCK in 40 MHz, An associated HT STA in
1510 * a 20/40 MHz BSS may generate DSSS/CCK transmissions.Set DSSS/CCK
1511 * Mode in 40 MHz bit in HT capablity.
1512 */
1513 frm.HTCaps.dsssCckMode40MHz = 1;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301514 }
1515#endif
1516
1517 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07001518#ifdef WLAN_FEATURE_11AC
1519 if( pSta->mlmStaContext.vhtCapability &&
1520 psessionEntry->vhtCapability )
1521 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -08001522 limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Response"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05301523 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
1524 psessionEntry->currentOperChannel, eSIR_TRUE );
1525 PopulateDot11fVHTOperation( pMac, &frm.VHTOperation,
1526 psessionEntry->currentOperChannel);
Jeff Johnsone7245742012-09-05 17:12:55 -07001527 }
1528#endif
1529
Chet Lanctot8cecea22014-02-11 19:09:36 -08001530#ifdef WLAN_FEATURE_11W
Dino Myclea7f18452014-04-24 08:55:31 +05301531 if( eSIR_MAC_TRY_AGAIN_LATER == statusCode )
1532 {
Chet Lanctotfadc8e32014-04-24 14:50:52 -07001533 if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_MAX_RETRIES,
1534 &maxRetries ) != eSIR_SUCCESS )
1535 limLog( pMac, LOGE,
1536 FL("Could not retrieve PMF SA Query maximum retries value") );
1537 else
1538 if ( wlan_cfgGetInt(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL,
1539 &retryInterval ) != eSIR_SUCCESS)
1540 limLog( pMac, LOGE,
1541 FL("Could not retrieve PMF SA Query timer interval value") );
Dino Myclea7f18452014-04-24 08:55:31 +05301542 else
Chet Lanctotfadc8e32014-04-24 14:50:52 -07001543 PopulateDot11fTimeoutInterval(
1544 pMac, &frm.TimeoutInterval, SIR_MAC_TI_TYPE_ASSOC_COMEBACK,
1545 (maxRetries - pSta->pmfSaQueryRetryCount) * retryInterval );
Dino Myclea7f18452014-04-24 08:55:31 +05301546 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08001547#endif
Dino Myclea7f18452014-04-24 08:55:31 +05301548 } // End if on non-NULL 'pSta'.
Jeff Johnson295189b2012-06-20 16:38:30 -07001549
Chet Lanctot8cecea22014-02-11 19:09:36 -08001550 vos_mem_set(( tANI_U8* )&beaconParams, sizeof( tUpdateBeaconParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001551
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 if( psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1553 if(psessionEntry->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
1554 limDecideApProtection(pMac, peerMacAddr, &beaconParams,psessionEntry);
1555 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001556
1557 limUpdateShortPreamble(pMac, peerMacAddr, &beaconParams, psessionEntry);
1558 limUpdateShortSlotTime(pMac, peerMacAddr, &beaconParams, psessionEntry);
1559
1560 beaconParams.bssIdx = psessionEntry->bssIdx;
1561
1562 //Send message to HAL about beacon parameter change.
1563 if(beaconParams.paramChangeBitmap)
1564 {
1565 schSetFixedBeaconFields(pMac,psessionEntry);
1566 limSendBeaconParams(pMac, &beaconParams, psessionEntry );
1567 }
1568
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 if ( pAssocReq != NULL )
1570 {
1571 if (wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_FLAG,
1572 &addnIEPresent) != eSIR_SUCCESS)
1573 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301574 limLog(pMac, LOGP, FL("Unable to get "
1575 "WNI_CFG_ASSOC_RSP_ADDNIE_FLAG"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001576 return;
1577 }
1578
1579 if (addnIEPresent)
1580 {
1581 //Assoc rsp IE available
1582 if (wlan_cfgGetStrLen(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1583 &addnIELen) != eSIR_SUCCESS)
1584 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301585 limLog(pMac, LOGP, FL("Unable to get "
1586 "WNI_CFG_ASSOC_RSP_ADDNIE_DATA length"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 return;
1588 }
1589
1590 if (addnIELen <= WNI_CFG_ASSOC_RSP_ADDNIE_DATA_LEN && addnIELen &&
1591 (nBytes + addnIELen) <= SIR_MAX_PACKET_SIZE)
1592 {
1593 if (wlan_cfgGetStr(pMac, WNI_CFG_ASSOC_RSP_ADDNIE_DATA,
1594 &addIE[0], &addnIELen) == eSIR_SUCCESS)
1595 {
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301596
1597 vos_mem_set(( tANI_U8* )&extractedExtCap,
1598 sizeof( tDot11fIEExtCap ), 0);
Mahesh A Saptasagare00ff532014-10-17 19:05:14 +05301599 addStripoffIELen = addnIELen;
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301600 nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac,
1601 &addIE[0],
1602 &addStripoffIELen,
1603 &extractedExtCap );
1604 if(eSIR_SUCCESS != nSirStatus)
1605 {
1606 limLog(pMac, LOG1,
1607 FL("Unable to Stripoff ExtCap IE from Assoc Rsp"));
1608 }
1609 else
1610 {
1611 addnIELen = addStripoffIELen;
1612 extractedExtCapFlag = eANI_BOOLEAN_TRUE;
1613 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 nBytes = nBytes + addnIELen;
1615 }
1616 }
1617 }
1618 }
1619
Mahesh A Saptasagar38c177e2014-10-17 18:55:48 +05301620 /* merge the ExtCap struct*/
1621 if (extractedExtCapFlag && extractedExtCap.present)
1622 {
1623 limMergeExtCapIEStruct(&(frm.ExtCap), &extractedExtCap);
1624 }
1625
c_hpothubcd78652014-04-28 22:31:08 +05301626 nStatus = dot11fGetPackedAssocResponseSize( pMac, &frm, &nPayload );
1627 if ( DOT11F_FAILED( nStatus ) )
1628 {
1629 limLog( pMac, LOGE, FL("Failed to calculate the packed size f"
1630 "or an Association Response (0x%08x)."),
1631 nStatus );
1632 return;
1633 }
1634 else if ( DOT11F_WARNED( nStatus ) )
1635 {
1636 limLog( pMac, LOGW, FL("There were warnings while calculating "
1637 "the packed size for an Association Re"
1638 "sponse (0x%08x)."), nStatus );
1639 }
1640
1641 nBytes += sizeof( tSirMacMgmtHdr ) + nPayload;
1642
Jeff Johnson295189b2012-06-20 16:38:30 -07001643 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1644 ( tANI_U16 )nBytes, ( void** ) &pFrame,
1645 ( void** ) &pPacket );
1646 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1647 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001648 limLog(pMac, LOGP, FL("Call to bufAlloc failed for RE/ASSOC RSP."));
Jeff Johnson295189b2012-06-20 16:38:30 -07001649 return;
1650 }
1651
1652 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301653 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001654
1655 // Next, we fill out the buffer descriptor:
1656 nSirStatus = limPopulateMacHeader( pMac,
1657 pFrame,
1658 SIR_MAC_MGMT_FRAME,
1659 ( LIM_ASSOC == subType ) ?
1660 SIR_MAC_MGMT_ASSOC_RSP :
1661 SIR_MAC_MGMT_REASSOC_RSP,
1662 peerMacAddr,psessionEntry->selfMacAddr);
1663 if ( eSIR_SUCCESS != nSirStatus )
1664 {
1665 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001666 "tor for an Association Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 nSirStatus );
1668 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1669 ( void* ) pFrame, ( void* ) pPacket );
1670 return;
1671 }
1672
1673 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1674
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1676
1677 nStatus = dot11fPackAssocResponse( pMac, &frm,
1678 pFrame + sizeof( tSirMacMgmtHdr ),
1679 nPayload, &nPayload );
1680 if ( DOT11F_FAILED( nStatus ) )
1681 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301682 limLog( pMac, LOGE, FL("Failed to pack an Association Response"
1683 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
1685 ( void* ) pFrame, ( void* ) pPacket );
1686 return; // allocated!
1687 }
1688 else if ( DOT11F_WARNED( nStatus ) )
1689 {
1690 limLog( pMac, LOGW, FL("There were warnings while packing an "
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001691 "Association Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 }
1693
1694 macAddr = pMacHdr->da;
1695
1696 if (subType == LIM_ASSOC)
1697 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301698 limLog(pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 FL("*** Sending Assoc Resp status %d aid %d to "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301700 statusCode, aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 }
1702 else{
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301703 limLog(pMac, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 FL("*** Sending ReAssoc Resp status %d aid %d to "),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301705 statusCode, aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 }
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301707 limPrintMacAddr(pMac, pMacHdr->da, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001708
1709 if ( addnIEPresent )
1710 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301711 vos_mem_copy ( pFrame+sizeof(tSirMacMgmtHdr)+nPayload, &addIE[0], addnIELen ) ;
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 }
1713
1714 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
1716 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001717 )
1718 {
1719 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
1720 }
1721
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05301722 limLog( pMac, LOG1, FL("Sending Assoc resp over WQ5 to "MAC_ADDRESS_STR
1723 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
1724 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
1725
1726 txFlag |= HAL_USE_FW_IN_TX_PATH;
1727
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301728 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
1729 psessionEntry->peSessionId,
1730 pMacHdr->fc.subType));
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05301731
1732 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
1733 {
1734 limLog(pMac, LOG1, FL("Re/AssocRsp - txBdToken %u"), pMac->lim.txBdToken);
1735 /// Queue Association Response frame in high priority WQ
1736 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
1737 HAL_TXRX_FRM_802_11_MGMT,
1738 ANI_TXDIR_TODS,
1739 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1740 limTxComplete, pFrame, limTxBdComplete,
1741 txFlag, pMac->lim.txBdToken );
1742 pMac->lim.txBdToken++;
1743 }
1744 else
1745 {
1746 /// Queue Association Response frame in high priority WQ
1747 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
1748 HAL_TXRX_FRM_802_11_MGMT,
1749 ANI_TXDIR_TODS,
1750 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
1751 limTxComplete, pFrame, txFlag );
1752 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05301753 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
1754 psessionEntry->peSessionId,
1755 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1757 {
1758 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001759 FL("*** Could not Send Re/AssocRsp, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001760 nSirStatus);
1761
1762 //Pkt will be freed up by the callback
1763 }
1764
1765 // update the ANI peer station count
1766 //FIXME_PROTECTION : take care of different type of station
1767 // counter inside this function.
1768 limUtilCountStaAdd(pMac, pSta, psessionEntry);
1769
1770} // End limSendAssocRspMgmtFrame.
1771
1772
1773
1774void
1775limSendAddtsRspActionFrame(tpAniSirGlobal pMac,
1776 tSirMacAddr peer,
1777 tANI_U16 nStatusCode,
1778 tSirAddtsReqInfo *pAddTS,
1779 tSirMacScheduleIE *pSchedule,
1780 tpPESession psessionEntry)
1781{
1782 tANI_U8 *pFrame;
1783 tpSirMacMgmtHdr pMacHdr;
1784 tDot11fAddTSResponse AddTSRsp;
1785 tDot11fWMMAddTSResponse WMMAddTSRsp;
1786 tSirRetStatus nSirStatus;
1787 tANI_U32 i, nBytes, nPayload, nStatus;
1788 void *pPacket;
1789 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05301790 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001791
1792 if(NULL == psessionEntry)
1793 {
1794 return;
1795 }
1796
1797 if ( ! pAddTS->wmeTspecPresent )
1798 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301799 vos_mem_set( ( tANI_U8* )&AddTSRsp, sizeof( AddTSRsp ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001800
1801 AddTSRsp.Category.category = SIR_MAC_ACTION_QOS_MGMT;
1802 AddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1803 AddTSRsp.DialogToken.token = pAddTS->dialogToken;
1804 AddTSRsp.Status.status = nStatusCode;
1805
1806 // The TsDelay information element is only filled in for a specific
1807 // status code:
1808 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == nStatusCode )
1809 {
1810 if ( pAddTS->wsmTspecPresent )
1811 {
1812 AddTSRsp.WMMTSDelay.version = 1;
1813 AddTSRsp.WMMTSDelay.delay = 10;
1814 AddTSRsp.WMMTSDelay.present = 1;
1815 }
1816 else
1817 {
1818 AddTSRsp.TSDelay.delay = 10;
1819 AddTSRsp.TSDelay.present = 1;
1820 }
1821 }
1822
1823 if ( pAddTS->wsmTspecPresent )
1824 {
1825 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &AddTSRsp.WMMTSPEC );
1826 }
1827 else
1828 {
1829 PopulateDot11fTSPEC( &pAddTS->tspec, &AddTSRsp.TSPEC );
1830 }
1831
1832 if ( pAddTS->wsmTspecPresent )
1833 {
1834 AddTSRsp.num_WMMTCLAS = 0;
1835 AddTSRsp.num_TCLAS = pAddTS->numTclas;
1836 for ( i = 0; i < AddTSRsp.num_TCLAS; ++i)
1837 {
1838 PopulateDot11fTCLAS( pMac, &pAddTS->tclasInfo[i],
1839 &AddTSRsp.TCLAS[i] );
1840 }
1841 }
1842 else
1843 {
1844 AddTSRsp.num_TCLAS = 0;
1845 AddTSRsp.num_WMMTCLAS = pAddTS->numTclas;
1846 for ( i = 0; i < AddTSRsp.num_WMMTCLAS; ++i)
1847 {
1848 PopulateDot11fWMMTCLAS( pMac, &pAddTS->tclasInfo[i],
1849 &AddTSRsp.WMMTCLAS[i] );
1850 }
1851 }
1852
1853 if ( pAddTS->tclasProcPresent )
1854 {
1855 if ( pAddTS->wsmTspecPresent )
1856 {
1857 AddTSRsp.WMMTCLASPROC.version = 1;
1858 AddTSRsp.WMMTCLASPROC.processing = pAddTS->tclasProc;
1859 AddTSRsp.WMMTCLASPROC.present = 1;
1860 }
1861 else
1862 {
1863 AddTSRsp.TCLASSPROC.processing = pAddTS->tclasProc;
1864 AddTSRsp.TCLASSPROC.present = 1;
1865 }
1866 }
1867
1868 // schedule element is included only if requested in the tspec and we are
1869 // using hcca (or both edca and hcca)
1870 // 11e-D8.0 is inconsistent on whether the schedule element is included
1871 // based on tspec schedule bit or not. Sec 7.4.2.2. says one thing but
1872 // pg 46, line 17-18 says something else. So just include it and let the
1873 // sta figure it out
1874 if ((pSchedule != NULL) &&
1875 ((pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_HCCA) ||
1876 (pAddTS->tspec.tsinfo.traffic.accessPolicy == SIR_MAC_ACCESSPOLICY_BOTH)))
1877 {
1878 if ( pAddTS->wsmTspecPresent )
1879 {
1880 PopulateDot11fWMMSchedule( pSchedule, &AddTSRsp.WMMSchedule );
1881 }
1882 else
1883 {
1884 PopulateDot11fSchedule( pSchedule, &AddTSRsp.Schedule );
1885 }
1886 }
1887
1888 nStatus = dot11fGetPackedAddTSResponseSize( pMac, &AddTSRsp, &nPayload );
1889 if ( DOT11F_FAILED( nStatus ) )
1890 {
1891 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001892 "ze for an Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001893 nStatus );
1894 // We'll fall back on the worst case scenario:
1895 nPayload = sizeof( tDot11fAddTSResponse );
1896 }
1897 else if ( DOT11F_WARNED( nStatus ) )
1898 {
1899 limLog( pMac, LOGW, FL("There were warnings while calcula"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001900 "ting the packed size for an Add TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001901 " Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 }
1903 }
1904 else
1905 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301906 vos_mem_set( ( tANI_U8* )&WMMAddTSRsp, sizeof( WMMAddTSRsp ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001907
1908 WMMAddTSRsp.Category.category = SIR_MAC_ACTION_WME;
1909 WMMAddTSRsp.Action.action = SIR_MAC_QOS_ADD_TS_RSP;
1910 WMMAddTSRsp.DialogToken.token = pAddTS->dialogToken;
1911 WMMAddTSRsp.StatusCode.statusCode = (tANI_U8)nStatusCode;
1912
1913 PopulateDot11fWMMTSPEC( &pAddTS->tspec, &WMMAddTSRsp.WMMTSPEC );
1914
1915 nStatus = dot11fGetPackedWMMAddTSResponseSize( pMac, &WMMAddTSRsp, &nPayload );
1916 if ( DOT11F_FAILED( nStatus ) )
1917 {
1918 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001919 "ze for a WMM Add TS Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 nStatus );
1921 // We'll fall back on the worst case scenario:
1922 nPayload = sizeof( tDot11fWMMAddTSResponse );
1923 }
1924 else if ( DOT11F_WARNED( nStatus ) )
1925 {
1926 limLog( pMac, LOGW, FL("There were warnings while calcula"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001927 "ting the packed size for a WMM Add"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001928 "TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 }
1930 }
1931
1932 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
1933
1934 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
1935 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
1936 {
1937 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001938 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 return;
1940 }
1941
1942 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05301943 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001944
1945 // Next, we fill out the buffer descriptor:
1946 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
1947 SIR_MAC_MGMT_ACTION, peer,psessionEntry->selfMacAddr);
1948 if ( eSIR_SUCCESS != nSirStatus )
1949 {
1950 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001951 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 nSirStatus );
1953 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1954 return; // allocated!
1955 }
1956
1957 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
1958
1959
1960 #if 0
1961 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
1962 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
1963 {
1964 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001965 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1967 return; // allocated!
1968 }
1969 #endif //TO SUPPORT BT-AMP
1970 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
1971
Chet Lanctot186b5732013-03-18 10:26:30 -07001972#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001973 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07001974#endif
1975
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 // That done, pack the struct:
1977 if ( ! pAddTS->wmeTspecPresent )
1978 {
1979 nStatus = dot11fPackAddTSResponse( pMac, &AddTSRsp,
1980 pFrame + sizeof( tSirMacMgmtHdr ),
1981 nPayload, &nPayload );
1982 if ( DOT11F_FAILED( nStatus ) )
1983 {
1984 limLog( pMac, LOGE, FL("Failed to pack an Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07001985 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001986 nStatus );
1987 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
1988 return;
1989 }
1990 else if ( DOT11F_WARNED( nStatus ) )
1991 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001992 limLog( pMac, LOGW, FL("There were warnings while packing "
1993 "an Add TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 }
1995 }
1996 else
1997 {
1998 nStatus = dot11fPackWMMAddTSResponse( pMac, &WMMAddTSRsp,
1999 pFrame + sizeof( tSirMacMgmtHdr ),
2000 nPayload, &nPayload );
2001 if ( DOT11F_FAILED( nStatus ) )
2002 {
2003 limLog( pMac, LOGE, FL("Failed to pack a WMM Add TS Response "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002004 "(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 nStatus );
2006 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2007 return;
2008 }
2009 else if ( DOT11F_WARNED( nStatus ) )
2010 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002011 limLog( pMac, LOGW, FL("There were warnings while packing "
2012 "a WMM Add TS Response (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 }
2014 }
2015
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302016 limLog( pMac, LOG1, FL("Sending an Add TS Response (status %d) to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 nStatusCode );
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302018 limPrintMacAddr( pMac, pMacHdr->da, LOG1 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002019
2020 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002021 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2022 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 )
2024 {
2025 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2026 }
2027
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302028 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
2029 psessionEntry->peSessionId,
2030 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 // Queue the frame in high priority WQ:
2032 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
2033 HAL_TXRX_FRM_802_11_MGMT,
2034 ANI_TXDIR_TODS,
2035 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2036 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302037 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
2038 psessionEntry->peSessionId,
2039 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2041 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002042 limLog( pMac, LOGE, FL("Failed to send Add TS Response (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 nSirStatus );
2044 //Pkt will be freed up by the callback
2045 }
2046
2047} // End limSendAddtsRspActionFrame.
2048
2049void
2050limSendDeltsReqActionFrame(tpAniSirGlobal pMac,
2051 tSirMacAddr peer,
2052 tANI_U8 wmmTspecPresent,
2053 tSirMacTSInfo *pTsinfo,
2054 tSirMacTspecIE *pTspecIe,
2055 tpPESession psessionEntry)
2056{
2057 tANI_U8 *pFrame;
2058 tpSirMacMgmtHdr pMacHdr;
2059 tDot11fDelTS DelTS;
2060 tDot11fWMMDelTS WMMDelTS;
2061 tSirRetStatus nSirStatus;
2062 tANI_U32 nBytes, nPayload, nStatus;
2063 void *pPacket;
2064 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302065 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002066
2067 if(NULL == psessionEntry)
2068 {
2069 return;
2070 }
2071
2072 if ( ! wmmTspecPresent )
2073 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302074 vos_mem_set( ( tANI_U8* )&DelTS, sizeof( DelTS ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002075
2076 DelTS.Category.category = SIR_MAC_ACTION_QOS_MGMT;
2077 DelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
2078 PopulateDot11fTSInfo( pTsinfo, &DelTS.TSInfo );
2079
2080 nStatus = dot11fGetPackedDelTSSize( pMac, &DelTS, &nPayload );
2081 if ( DOT11F_FAILED( nStatus ) )
2082 {
2083 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002084 "ze for a Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 nStatus );
2086 // We'll fall back on the worst case scenario:
2087 nPayload = sizeof( tDot11fDelTS );
2088 }
2089 else if ( DOT11F_WARNED( nStatus ) )
2090 {
2091 limLog( pMac, LOGW, FL("There were warnings while calcula"
2092 "ting the packed size for a Del TS"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002093 " (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 }
2095 }
2096 else
2097 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302098 vos_mem_set( ( tANI_U8* )&WMMDelTS, sizeof( WMMDelTS ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002099
2100 WMMDelTS.Category.category = SIR_MAC_ACTION_WME;
2101 WMMDelTS.Action.action = SIR_MAC_QOS_DEL_TS_REQ;
2102 WMMDelTS.DialogToken.token = 0;
2103 WMMDelTS.StatusCode.statusCode = 0;
2104 PopulateDot11fWMMTSPEC( pTspecIe, &WMMDelTS.WMMTSPEC );
2105 nStatus = dot11fGetPackedWMMDelTSSize( pMac, &WMMDelTS, &nPayload );
2106 if ( DOT11F_FAILED( nStatus ) )
2107 {
2108 limLog( pMac, LOGP, FL("Failed to calculate the packed si"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002109 "ze for a WMM Del TS (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 nStatus );
2111 // We'll fall back on the worst case scenario:
2112 nPayload = sizeof( tDot11fDelTS );
2113 }
2114 else if ( DOT11F_WARNED( nStatus ) )
2115 {
2116 limLog( pMac, LOGW, FL("There were warnings while calcula"
2117 "ting the packed size for a WMM De"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002118 "l TS (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 }
2120 }
2121
2122 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
2123
2124 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
2125 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2126 {
2127 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an Ad"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002128 "d TS Response."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 return;
2130 }
2131
2132 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302133 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002134
2135 // Next, we fill out the buffer descriptor:
2136 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2137 SIR_MAC_MGMT_ACTION, peer,
2138 psessionEntry->selfMacAddr);
2139 if ( eSIR_SUCCESS != nSirStatus )
2140 {
2141 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002142 "tor for an Add TS Response (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 nSirStatus );
2144 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2145 return; // allocated!
2146 }
2147
2148 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
2149
2150 #if 0
2151
2152 cfgLen = SIR_MAC_ADDR_LENGTH;
2153 if ( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID,
2154 ( tANI_U8* )pMacHdr->bssId, &cfgLen ) )
2155 {
2156 limLog( pMac, LOGP, FL("Failed to retrieve WNI_CFG_BSSID whil"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002157 "e sending an Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2159 return; // allocated!
2160 }
2161 #endif //TO SUPPORT BT-AMP
2162 sirCopyMacAddr(pMacHdr->bssId, psessionEntry->bssId);
2163
Chet Lanctot186b5732013-03-18 10:26:30 -07002164#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002165 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07002166#endif
2167
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 // That done, pack the struct:
2169 if ( !wmmTspecPresent )
2170 {
2171 nStatus = dot11fPackDelTS( pMac, &DelTS,
2172 pFrame + sizeof( tSirMacMgmtHdr ),
2173 nPayload, &nPayload );
2174 if ( DOT11F_FAILED( nStatus ) )
2175 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002176 limLog( pMac, LOGE, FL("Failed to pack a Del TS frame (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 nStatus );
2178 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2179 return; // allocated!
2180 }
2181 else if ( DOT11F_WARNED( nStatus ) )
2182 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002183 limLog( pMac, LOGW, FL("There were warnings while packing "
2184 "a Del TS frame (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 }
2186 }
2187 else
2188 {
2189 nStatus = dot11fPackWMMDelTS( pMac, &WMMDelTS,
2190 pFrame + sizeof( tSirMacMgmtHdr ),
2191 nPayload, &nPayload );
2192 if ( DOT11F_FAILED( nStatus ) )
2193 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002194 limLog( pMac, LOGE, FL("Failed to pack a WMM Del TS frame (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 nStatus );
2196 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
2197 return; // allocated!
2198 }
2199 else if ( DOT11F_WARNED( nStatus ) )
2200 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002201 limLog( pMac, LOGW, FL("There were warnings while packing "
2202 "a WMM Del TS frame (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 }
2204 }
2205
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302206 limLog(pMac, LOG1, FL("Sending DELTS REQ (size %d) to "), nBytes);
2207 limPrintMacAddr(pMac, pMacHdr->da, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07002208
2209 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2211 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 )
2213 {
2214 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2215 }
2216
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302217 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
2218 psessionEntry->peSessionId,
2219 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
2221 HAL_TXRX_FRM_802_11_MGMT,
2222 ANI_TXDIR_TODS,
2223 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2224 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302225 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
2226 psessionEntry->peSessionId,
2227 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2229 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002230 limLog( pMac, LOGE, FL("Failed to send Del TS (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 nSirStatus );
2232 //Pkt will be freed up by the callback
2233 }
2234
2235} // End limSendDeltsReqActionFrame.
2236
2237void
2238limSendAssocReqMgmtFrame(tpAniSirGlobal pMac,
2239 tLimMlmAssocReq *pMlmAssocReq,
2240 tpPESession psessionEntry)
2241{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002242 tDot11fAssocRequest *pFrm;
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 tANI_U16 caps;
2244 tANI_U8 *pFrame;
2245 tSirRetStatus nSirStatus;
2246 tLimMlmAssocCnf mlmAssocCnf;
c_hpothubcd78652014-04-28 22:31:08 +05302247 tANI_U32 nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2249 void *pPacket;
2250 eHalStatus halstatus;
2251 tANI_U16 nAddIELen;
2252 tANI_U8 *pAddIE;
2253 tANI_U8 *wpsIe = NULL;
2254#if defined WLAN_FEATURE_VOWIFI
2255 tANI_U8 PowerCapsPopulated = FALSE;
2256#endif
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302257 tANI_U32 txFlag = 0;
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302258 tpSirMacMgmtHdr pMacHdr;
Kalikinkar dhara205da782014-03-21 15:49:32 -07002259 tDot11fIEExtCap extractedExtCap;
2260 tANI_BOOLEAN extractedExtCapFlag = eANI_BOOLEAN_TRUE;
c_hpothubcd78652014-04-28 22:31:08 +05302261 tANI_U32 nBytes = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002262
2263 if(NULL == psessionEntry)
2264 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302265 limLog(pMac, LOGE, FL("psessionEntry is NULL") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 return;
2267 }
2268
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 /* check this early to avoid unncessary operation */
2270 if(NULL == psessionEntry->pLimJoinReq)
2271 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302272 limLog(pMac, LOGE, FL("psessionEntry->pLimJoinReq is NULL") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 return;
2274 }
2275 nAddIELen = psessionEntry->pLimJoinReq->addIEAssoc.length;
2276 pAddIE = psessionEntry->pLimJoinReq->addIEAssoc.addIEdata;
2277
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302278 pFrm = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2279 if ( NULL == pFrm )
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002280 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302281 limLog(pMac, LOGE, FL("Unable to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002282 return;
2283 }
2284
2285
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302286 vos_mem_set( ( tANI_U8* )pFrm, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002287
Kalikinkar dhara205da782014-03-21 15:49:32 -07002288 vos_mem_set(( tANI_U8* )&extractedExtCap, sizeof( tDot11fIEExtCap ), 0);
2289 nSirStatus = limStripOffExtCapIEAndUpdateStruct(pMac, pAddIE,
2290 &nAddIELen,
2291 &extractedExtCap );
2292 if(eSIR_SUCCESS != nSirStatus )
2293 {
2294 extractedExtCapFlag = eANI_BOOLEAN_FALSE;
2295 limLog(pMac, LOG1,
2296 FL("Unable to Stripoff ExtCap IE from Assoc Req"));
2297 }
Leela Venkata Kiran Kumar Reddy Chirala2f9b5712014-05-06 00:09:42 -07002298 /* TODO:remove this code once driver provides the call back function
2299 * to supplicant for set_qos_map
2300 */
2301 else
2302 {
2303 if(extractedExtCap.interworkingService)
2304 {
2305 extractedExtCap.qosMap = 1;
2306 }
Abhishek Singh15d95602015-03-24 15:52:57 +05302307 /* No need to merge the EXT Cap from Supplicant
2308 * if interworkingService is not set, as currently
2309 * driver is only interested in interworkingService
2310 * capability from supplicant. if in
2311 * future any other EXT Cap info is required from
2312 * supplicant it needs to be handled here.
2313 */
2314 else
2315 {
2316 extractedExtCapFlag = eANI_BOOLEAN_FALSE;
2317 }
Leela Venkata Kiran Kumar Reddy Chirala2f9b5712014-05-06 00:09:42 -07002318 }
Kalikinkar dhara205da782014-03-21 15:49:32 -07002319
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 caps = pMlmAssocReq->capabilityInfo;
2321 if ( PROP_CAPABILITY_GET( 11EQOS, psessionEntry->limCurrentBssPropCap ) )
2322 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2323#if defined(FEATURE_WLAN_WAPI)
2324 /* CR: 262463 :
2325 According to WAPI standard:
2326 7.3.1.4 Capability Information field
2327 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2328 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2329 Reassociation management frames. */
2330 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2331 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2332#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002333 swapBitField16(caps, ( tANI_U16* )&pFrm->Capabilities );
Jeff Johnson295189b2012-06-20 16:38:30 -07002334
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002335 pFrm->ListenInterval.interval = pMlmAssocReq->listenInterval;
2336 PopulateDot11fSSID2( pMac, &pFrm->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002338 &pFrm->SuppRates,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002339
2340 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2341 SIR_MAC_GET_QOS( psessionEntry->limCurrentBssCaps );
2342
2343 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2344 LIM_BSS_CAPS_GET( WME, psessionEntry->limCurrentBssQosCaps );
2345
2346 // We prefer .11e asociations:
2347 if ( fQosEnabled ) fWmeEnabled = false;
2348
2349 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2350 LIM_BSS_CAPS_GET( WSM, psessionEntry->limCurrentBssQosCaps );
2351
2352 if ( psessionEntry->lim11hEnable &&
2353 psessionEntry->pLimJoinReq->spectrumMgtIndicator == eSIR_TRUE )
2354 {
2355#if defined WLAN_FEATURE_VOWIFI
2356 PowerCapsPopulated = TRUE;
2357
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002358 PopulateDot11fPowerCaps( pMac, &pFrm->PowerCaps, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002359#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002360 PopulateDot11fSuppChannels( pMac, &pFrm->SuppChannels, LIM_ASSOC,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002361
2362 }
2363
2364#if defined WLAN_FEATURE_VOWIFI
2365 if( pMac->rrm.rrmPEContext.rrmEnable &&
2366 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2367 {
2368 if (PowerCapsPopulated == FALSE)
2369 {
2370 PowerCapsPopulated = TRUE;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002371 PopulateDot11fPowerCaps(pMac, &pFrm->PowerCaps, LIM_ASSOC, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002372 }
2373 }
2374#endif
2375
2376 if ( fQosEnabled &&
2377 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limCurrentBssPropCap)))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002378 PopulateDot11fQOSCapsStation( pMac, &pFrm->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002379
2380 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002381 &pFrm->ExtSuppRates, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002382
2383#if defined WLAN_FEATURE_VOWIFI
2384 if( pMac->rrm.rrmPEContext.rrmEnable &&
2385 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2386 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002387 PopulateDot11fRRMIe( pMac, &pFrm->RRMEnabledCap, psessionEntry );
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 }
2389#endif
2390 // The join request *should* contain zero or one of the WPA and RSN
2391 // IEs. The payload send along with the request is a
2392 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2393
2394 // typedef struct sSirRSNie
2395 // {
2396 // tANI_U16 length;
2397 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2398 // } tSirRSNie, *tpSirRSNie;
2399
2400 // So, we should be able to make the following two calls harmlessly,
2401 // since they do nothing if they don't find the given IE in the
2402 // bytestream with which they're provided.
2403
2404 // The net effect of this will be to faithfully transmit whatever
2405 // security IE is in the join request.
2406
2407 // *However*, if we're associating for the purpose of WPS
2408 // enrollment, and we've been configured to indicate that by
2409 // eliding the WPA or RSN IE, we just skip this:
2410 if( nAddIELen && pAddIE )
2411 {
2412 wpsIe = limGetWscIEPtr (pMac, pAddIE, nAddIELen);
2413 }
2414 if ( NULL == wpsIe )
2415 {
2416 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002417 &pFrm->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002419 &pFrm->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002420#if defined(FEATURE_WLAN_WAPI)
2421 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimJoinReq->rsnIE ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002422 &pFrm->WAPIOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002423#endif // defined(FEATURE_WLAN_WAPI)
2424 }
2425
2426 // include WME EDCA IE as well
2427 if ( fWmeEnabled )
2428 {
2429 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limCurrentBssPropCap ) )
2430 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002431 PopulateDot11fWMMInfoStation( pMac, &pFrm->WMMInfoStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 }
2433
2434 if ( fWsmEnabled &&
2435 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limCurrentBssPropCap )))
2436 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002437 PopulateDot11fWMMCaps( &pFrm->WMMCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 }
2439 }
2440
2441 //Populate HT IEs, when operating in 11n or Taurus modes AND
2442 //when AP is also operating in 11n mode.
Jeff Johnsone7245742012-09-05 17:12:55 -07002443 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002444 pMac->lim.htCapabilityPresentInBeacon)
2445 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302446 limLog(pMac, LOG1, FL("Populate HT IEs in Assoc Request"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002447 PopulateDot11fHTCaps( pMac, psessionEntry, &pFrm->HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002448#ifdef DISABLE_GF_FOR_INTEROP
2449
2450 /*
2451 * To resolve the interop problem with Broadcom AP,
2452 * where TQ STA could not pass traffic with GF enabled,
2453 * TQ STA will do Greenfield only with TQ AP, for
2454 * everybody else it will be turned off.
2455 */
2456
2457 if( (psessionEntry->pLimJoinReq != NULL) && (!psessionEntry->pLimJoinReq->bssDescription.aniIndicator))
2458 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302459 limLog( pMac, LOG1, FL("Sending Assoc Req to Non-TQ AP,"
2460 " Turning off Greenfield"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002461 pFrm->HTCaps.greenField = WNI_CFG_GREENFIELD_CAPABILITY_DISABLE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002462 }
2463#endif
2464
2465 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002466#ifdef WLAN_FEATURE_11AC
2467 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002468 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07002469 {
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002470 limLog( pMac, LOG1, FL("Populate VHT IEs in Assoc Request"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05302471 PopulateDot11fVHTCaps( pMac, &pFrm->VHTCaps,
2472 psessionEntry->currentOperChannel, eSIR_FALSE );
Abhishek Singhe038dc62015-05-22 11:36:45 +05302473
Jeff Johnsone7245742012-09-05 17:12:55 -07002474 }
2475#endif
Sandeep Puligilla60342762014-01-30 21:05:37 +05302476 PopulateDot11fExtCap( pMac, &pFrm->ExtCap, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002477
2478#if defined WLAN_FEATURE_VOWIFI_11R
2479 if (psessionEntry->pLimJoinReq->is11Rconnection)
2480 {
2481#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002482 limLog( pMac, LOG1, FL("mdie = %02x %02x %02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[0],
2484 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[1],
2485 (unsigned int)psessionEntry->pLimJoinReq->bssDescription.mdie[2]);
2486#endif
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302487 PopulateMDIE( pMac, &pFrm->MobilityDomain,
2488 psessionEntry->pLimJoinReq->bssDescription.mdie);
Jeff Johnson295189b2012-06-20 16:38:30 -07002489 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302490 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002491 {
2492 // No 11r IEs dont send any MDIE
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302493 limLog( pMac, LOG1, FL("MDIE not present"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 }
2495#endif
2496
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002497#ifdef FEATURE_WLAN_ESE
2498 /* For ESE Associations fill the ESE IEs */
2499 if (psessionEntry->isESEconnection &&
2500 psessionEntry->pLimJoinReq->isESEFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002502#ifndef FEATURE_DISABLE_RM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002503 PopulateDot11fESERadMgmtCap(&pFrm->ESERadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002504#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002505 PopulateDot11fESEVersion(&pFrm->ESEVersion);
Jeff Johnson295189b2012-06-20 16:38:30 -07002506 }
2507#endif
2508
c_hpothubcd78652014-04-28 22:31:08 +05302509 /* merge the ExtCap struct*/
2510 if (extractedExtCapFlag && extractedExtCap.present)
2511 {
2512 limMergeExtCapIEStruct(&pFrm->ExtCap, &extractedExtCap);
2513 }
2514
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002515 nStatus = dot11fGetPackedAssocRequestSize( pMac, pFrm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07002516 if ( DOT11F_FAILED( nStatus ) )
2517 {
2518 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002519 "or an Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 nStatus );
2521 // We'll fall back on the worst case scenario:
2522 nPayload = sizeof( tDot11fAssocRequest );
2523 }
2524 else if ( DOT11F_WARNED( nStatus ) )
2525 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002526 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 "the packed size for an Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002528 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 }
2530
2531 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
2532
2533 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2534 ( tANI_U16 )nBytes, ( void** ) &pFrame,
2535 ( void** ) &pPacket );
2536 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2537 {
2538 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for an As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002539 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002540
2541 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002542 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002543
2544
2545 /* Update PE session id*/
2546 mlmAssocCnf.sessionId = psessionEntry->peSessionId;
2547
2548 mlmAssocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2549
2550 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2551 ( void* ) pFrame, ( void* ) pPacket );
2552
2553 limPostSmeMessage( pMac, LIM_MLM_ASSOC_CNF,
2554 ( tANI_U32* ) &mlmAssocCnf);
2555
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302556 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002557 return;
2558 }
2559
2560 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302561 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002562
2563 // Next, we fill out the buffer descriptor:
2564 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
2565 SIR_MAC_MGMT_ASSOC_REQ, psessionEntry->bssId,psessionEntry->selfMacAddr);
2566 if ( eSIR_SUCCESS != nSirStatus )
2567 {
2568 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002569 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 nSirStatus );
2571 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302572 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 return;
2574 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002575
Abhishek Singh57aebef2014-02-03 18:47:44 +05302576 // That done, pack the Assoc Request:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002577 nStatus = dot11fPackAssocRequest( pMac, pFrm, pFrame +
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 sizeof(tSirMacMgmtHdr),
2579 nPayload, &nPayload );
2580 if ( DOT11F_FAILED( nStatus ) )
2581 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302582 limLog( pMac, LOGE, FL("Failed to pack a Assoc Request (0x%0"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002583 "8x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002584 nStatus );
2585 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2586 ( void* ) pFrame, ( void* ) pPacket );
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302587 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 return;
2589 }
2590 else if ( DOT11F_WARNED( nStatus ) )
2591 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302592 limLog( pMac, LOGW, FL("There were warnings while packing a Assoc"
2593 "Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 }
2595
2596 PELOG1(limLog( pMac, LOG1, FL("*** Sending Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002597 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07002598 nBytes );)
2599 // limPrintMacAddr( pMac, bssid, LOG1 );
2600
2601 if( psessionEntry->assocReq != NULL )
2602 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302603 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 psessionEntry->assocReq = NULL;
2605 }
2606
2607 if( nAddIELen )
2608 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302609 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
2610 pAddIE,
2611 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07002612 nPayload += nAddIELen;
2613 }
2614
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302615 psessionEntry->assocReq = vos_mem_malloc(nPayload);
2616 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002617 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302618 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store "
2619 "assoc request"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 }
2621 else
2622 {
2623 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302624 vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07002625 psessionEntry->assocReqLen = nPayload;
2626 }
2627
2628 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
2630 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 )
2632 {
2633 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2634 }
2635
Sushant Kaushike8681d22015-04-21 12:08:25 +05302636 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
2637 psessionEntry->pePersona == VOS_STA_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08002638 {
2639 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
2640 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302641
2642 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05302643 limLog( pMac, LOG1, FL("Sending Assoc req over WQ5 to "MAC_ADDRESS_STR
2644 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
2645 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
2646 txFlag |= HAL_USE_FW_IN_TX_PATH;
2647
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302648 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
2649 psessionEntry->peSessionId,
2650 pMacHdr->fc.subType));
Katya Nigam63902932014-06-26 19:04:23 +05302651
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05302652 if( ( psessionEntry->is11Gonly == true ) &&
2653 ( !IS_BROADCAST_MAC(pMlmAssocReq->peerMacAddr) ) ){
2654 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
2655 }
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05302656 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
2657 {
2658 limLog(pMac, LOG1, FL("Assoc Req - txBdToken %u"), pMac->lim.txBdToken);
2659 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
2660 ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
2661 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
2662 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2663 limTxComplete, pFrame, limTxBdComplete, txFlag,
2664 pMac->lim.txBdToken);
2665 pMac->lim.txBdToken++;
2666 }
2667 else
2668 {
2669 halstatus = halTxFrame( pMac, pPacket,
2670 ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
2671 HAL_TXRX_FRM_802_11_MGMT,
2672 ANI_TXDIR_TODS,
2673 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
2674 limTxComplete, pFrame, txFlag );
2675 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302676 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
2677 psessionEntry->peSessionId,
2678 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2680 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002681 limLog( pMac, LOGE, FL("Failed to send Association Request (%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002682 halstatus );
2683 //Pkt will be freed up by the callback
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302684 vos_mem_free(pFrm);
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 return;
2686 }
2687
Katya Nigamccaeda72015-04-20 18:51:22 +05302688 //Enable caching only if Assoc Request is successfully submitted to the h/w
2689 WLANTL_EnableCaching(psessionEntry->staId);
2690
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302692 vos_mem_free(pMlmAssocReq);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002693 pMlmAssocReq = NULL;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302694 vos_mem_free(pFrm);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002695 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07002696} // End limSendAssocReqMgmtFrame
2697
2698
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002699#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002700/*------------------------------------------------------------------------------------
2701 *
2702 * Send Reassoc Req with FTIEs.
2703 *
2704 *-----------------------------------------------------------------------------------
2705 */
2706void
2707limSendReassocReqWithFTIEsMgmtFrame(tpAniSirGlobal pMac,
2708 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
2709{
2710 static tDot11fReAssocRequest frm;
2711 tANI_U16 caps;
2712 tANI_U8 *pFrame;
2713 tSirRetStatus nSirStatus;
2714 tANI_U32 nBytes, nPayload, nStatus;
2715 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
2716 void *pPacket;
2717 eHalStatus halstatus;
2718#if defined WLAN_FEATURE_VOWIFI
2719 tANI_U8 PowerCapsPopulated = FALSE;
2720#endif
2721 tANI_U16 ft_ies_length = 0;
2722 tANI_U8 *pBody;
2723 tANI_U16 nAddIELen;
2724 tANI_U8 *pAddIE;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002725#if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002726 tANI_U8 *wpsIe = NULL;
2727#endif
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05302728 tANI_U32 txFlag = 0;
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05302729 tpSirMacMgmtHdr pMacHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002730
2731 if (NULL == psessionEntry)
2732 {
2733 return;
2734 }
2735
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 /* check this early to avoid unncessary operation */
2737 if(NULL == psessionEntry->pLimReAssocReq)
2738 {
2739 return;
2740 }
2741 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
2742 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002743 limLog( pMac, LOG1, FL("limSendReassocReqWithFTIEsMgmtFrame received in "
2744 "state (%d)."), psessionEntry->limMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002745
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302746 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002747
2748 caps = pMlmReassocReq->capabilityInfo;
2749 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
2750 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
2751#if defined(FEATURE_WLAN_WAPI)
2752 /* CR: 262463 :
2753 According to WAPI standard:
2754 7.3.1.4 Capability Information field
2755 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
2756 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
2757 Reassociation management frames. */
2758 if ( psessionEntry->encryptType == eSIR_ED_WPI)
2759 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
2760#endif
2761 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
2762
2763 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
2764
2765 // Get the old bssid of the older AP.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302766 vos_mem_copy( ( tANI_U8* )frm.CurrentAPAddress.mac,
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, 6);
2768
2769 PopulateDot11fSSID2( pMac, &frm.SSID );
2770 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2771 &frm.SuppRates,psessionEntry);
2772
2773 fQosEnabled = ( psessionEntry->limQosEnabled) &&
2774 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
2775
2776 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
2777 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
2778
2779 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
2780 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
2781
2782 if ( psessionEntry->lim11hEnable &&
2783 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
2784 {
2785#if defined WLAN_FEATURE_VOWIFI
2786 PowerCapsPopulated = TRUE;
2787
2788 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
2789 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
2790#endif
2791 }
2792
2793#if defined WLAN_FEATURE_VOWIFI
2794 if( pMac->rrm.rrmPEContext.rrmEnable &&
2795 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
2796 {
2797 if (PowerCapsPopulated == FALSE)
2798 {
2799 PowerCapsPopulated = TRUE;
2800 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
2801 }
2802 }
2803#endif
2804
2805 if ( fQosEnabled &&
2806 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
2807 {
2808 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
2809 }
2810
2811 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
2812 &frm.ExtSuppRates, psessionEntry );
2813
2814#if defined WLAN_FEATURE_VOWIFI
2815 if( pMac->rrm.rrmPEContext.rrmEnable &&
2816 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
2817 {
2818 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
2819 }
2820#endif
2821
2822 // Ideally this should be enabled for 11r also. But 11r does
2823 // not follow the usual norm of using the Opaque object
2824 // for rsnie and fties. Instead we just add
2825 // the rsnie and fties at the end of the pack routine for 11r.
2826 // This should ideally! be fixed.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002827#if defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002828 //
2829 // The join request *should* contain zero or one of the WPA and RSN
2830 // IEs. The payload send along with the request is a
2831 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
2832
2833 // typedef struct sSirRSNie
2834 // {
2835 // tANI_U16 length;
2836 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
2837 // } tSirRSNie, *tpSirRSNie;
2838
2839 // So, we should be able to make the following two calls harmlessly,
2840 // since they do nothing if they don't find the given IE in the
2841 // bytestream with which they're provided.
2842
2843 // The net effect of this will be to faithfully transmit whatever
2844 // security IE is in the join request.
2845
2846 // *However*, if we're associating for the purpose of WPS
2847 // enrollment, and we've been configured to indicate that by
2848 // eliding the WPA or RSN IE, we just skip this:
2849 if (!psessionEntry->is11Rconnection)
2850 {
2851 if( nAddIELen && pAddIE )
2852 {
2853 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
2854 }
2855 if ( NULL == wpsIe )
2856 {
2857 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2858 &frm.RSNOpaque );
2859 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
2860 &frm.WPAOpaque );
2861 }
2862
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002863#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302864 if (psessionEntry->pLimReAssocReq->cckmIE.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002866 PopulateDot11fESECckmOpaque( pMac, &( psessionEntry->pLimReAssocReq->cckmIE ),
2867 &frm.ESECckmOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002868 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002869#endif //FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002870 }
2871
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002872#ifdef FEATURE_WLAN_ESE
2873 // For ESE Associations fill the ESE IEs
2874 if (psessionEntry->isESEconnection &&
2875 psessionEntry->pLimReAssocReq->isESEFeatureIniEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 {
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002877#ifndef FEATURE_DISABLE_RM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002878 PopulateDot11fESERadMgmtCap(&frm.ESERadMgmtCap);
Varun Reddy Yeturu30779b42013-04-09 09:57:16 -07002879#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002880 PopulateDot11fESEVersion(&frm.ESEVersion);
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002882#endif //FEATURE_WLAN_ESE
2883#endif //FEATURE_WLAN_ESE || FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -07002884
2885 // include WME EDCA IE as well
2886 if ( fWmeEnabled )
2887 {
2888 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
2889 {
2890 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
2891 }
2892
2893 if ( fWsmEnabled &&
2894 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
2895 {
2896 PopulateDot11fWMMCaps( &frm.WMMCaps );
2897 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002898#ifdef FEATURE_WLAN_ESE
2899 if (psessionEntry->isESEconnection)
Jeff Johnson295189b2012-06-20 16:38:30 -07002900 {
2901 PopulateDot11fReAssocTspec(pMac, &frm, psessionEntry);
2902
2903 // Populate the TSRS IE if TSPEC is included in the reassoc request
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002904 if (psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs)
Jeff Johnson295189b2012-06-20 16:38:30 -07002905 {
2906 tANI_U32 phyMode;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002907 tSirMacESETSRSIE tsrsIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 limGetPhyMode(pMac, &phyMode, psessionEntry);
2909
2910 tsrsIE.tsid = 0;
2911 if( phyMode == WNI_CFG_PHY_MODE_11G || phyMode == WNI_CFG_PHY_MODE_11A)
2912 {
2913 tsrsIE.rates[0] = TSRS_11AG_RATE_6MBPS;
2914 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302915 else
Jeff Johnson295189b2012-06-20 16:38:30 -07002916 {
2917 tsrsIE.rates[0] = TSRS_11B_RATE_5_5MBPS;
2918 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002919 PopulateDot11TSRSIE(pMac,&tsrsIE, &frm.ESETrafStrmRateSet, sizeof(tANI_U8));
Jeff Johnson295189b2012-06-20 16:38:30 -07002920 }
2921 }
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05302922#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002923 }
2924
Jeff Johnsone7245742012-09-05 17:12:55 -07002925 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07002926 pMac->lim.htCapabilityPresentInBeacon)
2927 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002928 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002929 }
2930
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002931#if defined WLAN_FEATURE_VOWIFI_11R
Kanchanapally, Vidyullatha4f84f682014-04-29 20:40:34 +05302932 if ( psessionEntry->pLimReAssocReq->bssDescription.mdiePresent &&
2933 (pMac->ft.ftSmeContext.addMDIE == TRUE)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002934#if defined FEATURE_WLAN_ESE
2935 && !psessionEntry->isESEconnection
Gopichand Nakkala0ac55062013-04-08 14:43:07 +05302936#endif
2937 )
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08002938 {
2939 PopulateMDIE( pMac, &frm.MobilityDomain, psessionEntry->pLimReAssocReq->bssDescription.mdie);
2940 }
2941#endif
2942
Chet Lanctotf19c1f62013-12-13 13:56:21 -08002943#ifdef WLAN_FEATURE_11AC
2944 if ( psessionEntry->vhtCapability &&
2945 psessionEntry->vhtCapabilityPresentInBeacon)
2946 {
2947 limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05302948 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
2949 psessionEntry->currentOperChannel, eSIR_FALSE );
Abhishek Singhe038dc62015-05-22 11:36:45 +05302950
Chet Lanctotf19c1f62013-12-13 13:56:21 -08002951 }
2952#endif
Sandeep Puligilla60342762014-01-30 21:05:37 +05302953 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Chet Lanctotf19c1f62013-12-13 13:56:21 -08002954
Jeff Johnson295189b2012-06-20 16:38:30 -07002955 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
2956 if ( DOT11F_FAILED( nStatus ) )
2957 {
2958 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002959 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002960 nStatus );
2961 // We'll fall back on the worst case scenario:
2962 nPayload = sizeof( tDot11fReAssocRequest );
2963 }
2964 else if ( DOT11F_WARNED( nStatus ) )
2965 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08002966 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07002967 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002968 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 }
2970
Madan Mohan Koyyalamudi4e31b132012-11-02 13:13:52 -07002971 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
Jeff Johnson295189b2012-06-20 16:38:30 -07002972
2973#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002974 limLog( pMac, LOG1, FL("FT IE Reassoc Req (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 pMac->ft.ftSmeContext.reassoc_ft_ies_length);
2976#endif
2977
2978#if defined WLAN_FEATURE_VOWIFI_11R
2979 if (psessionEntry->is11Rconnection)
2980 {
2981 ft_ies_length = pMac->ft.ftSmeContext.reassoc_ft_ies_length;
2982 }
2983#endif
2984
2985 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
2986 ( tANI_U16 )nBytes+ft_ies_length, ( void** ) &pFrame,
2987 ( void** ) &pPacket );
2988 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
2989 {
2990 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07002991 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002992 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07002993 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07002994 goto end;
2995 }
2996
2997 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05302998 vos_mem_set( pFrame, nBytes + ft_ies_length, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002999
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003000#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08003001 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07003002#endif
3003 // Next, we fill out the buffer descriptor:
3004 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3005 SIR_MAC_MGMT_REASSOC_REQ,
3006 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
3007 if ( eSIR_SUCCESS != nSirStatus )
3008 {
3009 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003010 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 nSirStatus );
3012 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3013 goto end;
3014 }
3015
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303016 pMacHdr = (tpSirMacMgmtHdr) pFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07003017 // That done, pack the ReAssoc Request:
3018 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
3019 sizeof(tSirMacMgmtHdr),
3020 nPayload, &nPayload );
3021 if ( DOT11F_FAILED( nStatus ) )
3022 {
3023 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003024 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 nStatus );
3026 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3027 goto end;
3028 }
3029 else if ( DOT11F_WARNED( nStatus ) )
3030 {
3031 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003032 "e-Association Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 }
3034
3035 PELOG3(limLog( pMac, LOG3,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003036 FL("*** Sending Re-Association Request length %d %d to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003037 nBytes, nPayload );)
3038 if( psessionEntry->assocReq != NULL )
3039 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303040 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003041 psessionEntry->assocReq = NULL;
3042 }
3043
3044 if( nAddIELen )
3045 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303046 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
3047 pAddIE,
3048 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07003049 nPayload += nAddIELen;
3050 }
3051
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303052 psessionEntry->assocReq = vos_mem_malloc(nPayload);
3053 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003054 {
3055 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07003056 }
3057 else
3058 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303060 vos_mem_copy( psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07003062 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003063
3064 if (psessionEntry->is11Rconnection)
3065 {
3066 {
3067 int i = 0;
3068
3069 pBody = pFrame + nBytes;
3070 for (i=0; i<ft_ies_length; i++)
3071 {
3072 *pBody = pMac->ft.ftSmeContext.reassoc_ft_ies[i];
3073 pBody++;
3074 }
3075 }
3076 }
3077
3078#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003079 PELOGE(limLog(pMac, LOG1, FL("Re-assoc Req Frame is: "));
3080 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003081 (tANI_U8 *)pFrame,
3082 (nBytes + ft_ies_length));)
3083#endif
3084
3085
3086 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003087 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3088 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003089 )
3090 {
3091 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3092 }
3093
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003094 if( NULL != psessionEntry->assocReq )
3095 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303096 vos_mem_free(psessionEntry->assocReq);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003097 psessionEntry->assocReq = NULL;
3098 }
3099
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303100 psessionEntry->assocReq = vos_mem_malloc(ft_ies_length);
3101 if ( NULL == psessionEntry->assocReq )
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003102 {
3103 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003104 psessionEntry->assocReqLen = 0;
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003105 }
3106 else
3107 {
3108 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303109 vos_mem_copy( psessionEntry->assocReq, pMac->ft.ftSmeContext.reassoc_ft_ies,
3110 (ft_ies_length));
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07003111 psessionEntry->assocReqLen = (ft_ies_length);
3112 }
3113
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303114 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
3115 psessionEntry->peSessionId,
3116 pMacHdr->fc.subType));
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303117 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
3118 {
3119 limLog( pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken);
3120 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
3121 ( tANI_U16 ) (nBytes + ft_ies_length),
3122 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
3123 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3124 limTxComplete, pFrame, limTxBdComplete, txFlag,
3125 pMac->lim.txBdToken);
3126 pMac->lim.txBdToken++;
3127 }
3128 else
3129 {
3130 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (nBytes + ft_ies_length),
3131 HAL_TXRX_FRM_802_11_MGMT,
3132 ANI_TXDIR_TODS,
3133 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3134 limTxComplete, pFrame, txFlag );
3135 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303136 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
3137 psessionEntry->peSessionId,
3138 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3140 {
3141 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003142 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003143 nSirStatus );
3144 //Pkt will be freed up by the callback
3145 goto end;
3146 }
3147
Katya Nigamccaeda72015-04-20 18:51:22 +05303148 // Enable TL cahching in case of roaming
3149 WLANTL_EnableCaching(psessionEntry->staId);
3150
Jeff Johnson295189b2012-06-20 16:38:30 -07003151end:
3152 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303153 vos_mem_free( pMlmReassocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -07003154 psessionEntry->pLimMlmReassocReq = NULL;
3155
3156}
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003157
3158void limSendRetryReassocReqFrame(tpAniSirGlobal pMac,
3159 tLimMlmReassocReq *pMlmReassocReq,
3160 tpPESession psessionEntry)
3161{
3162 tLimMlmReassocCnf mlmReassocCnf; // keep sme
3163 tLimMlmReassocReq *pTmpMlmReassocReq = NULL;
Sachin Ahuja07a43012015-01-30 17:04:38 +05303164#ifdef FEATURE_WLAN_ESE
3165 tANI_U32 val=0;
3166#endif
3167 if (pMlmReassocReq == NULL)
3168 {
3169 limLog(pMac, LOGE,
3170 FL("Invalid pMlmReassocReq"));
3171 goto end;
3172 }
Hema Aparna Medicharla43d0f7b2015-02-12 17:07:59 +05303173
3174 pTmpMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
3175 if ( NULL == pTmpMlmReassocReq ) goto end;
3176 vos_mem_set( pTmpMlmReassocReq, sizeof(tLimMlmReassocReq), 0);
3177 vos_mem_copy( pTmpMlmReassocReq, pMlmReassocReq, sizeof(tLimMlmReassocReq));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003178
3179 // Prepare and send Reassociation request frame
3180 // start reassoc timer.
Sachin Ahuja07a43012015-01-30 17:04:38 +05303181#ifdef FEATURE_WLAN_ESE
3182 /*
3183 * In case of Ese Reassociation, change the reassoc timer
3184 * value.
3185 */
3186 val = pMlmReassocReq->reassocFailureTimeout;
3187 if (psessionEntry->isESEconnection)
3188 {
3189 val = val/LIM_MAX_REASSOC_RETRY_LIMIT;
3190 }
3191 if (tx_timer_deactivate(&pMac->lim.limTimers.gLimReassocFailureTimer) !=
3192 TX_SUCCESS)
3193 {
3194 limLog(pMac, LOGP,
3195 FL("unable to deactivate Reassoc failure timer"));
3196 }
3197 val = SYS_MS_TO_TICKS(val);
3198 if (tx_timer_change(&pMac->lim.limTimers.gLimReassocFailureTimer,
3199 val, 0) != TX_SUCCESS)
3200 {
3201 limLog(pMac, LOGP,
3202 FL("unable to change Reassociation failure timer"));
3203 }
3204#endif
3205
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003206 pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = psessionEntry->peSessionId;
3207 // Start reassociation failure timer
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08003208 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_REASSOC_FAIL_TIMER));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003209 if (tx_timer_activate(&pMac->lim.limTimers.gLimReassocFailureTimer)
3210 != TX_SUCCESS)
3211 {
3212 // Could not start reassoc failure timer.
3213 // Log error
3214 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003215 FL("could not start Reassociation failure timer"));
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003216 // Return Reassoc confirm with
3217 // Resources Unavailable
3218 mlmReassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3219 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3220 goto end;
3221 }
3222
3223 limSendReassocReqWithFTIEsMgmtFrame(pMac, pTmpMlmReassocReq, psessionEntry);
3224 return;
3225
3226end:
3227 // Free up buffer allocated for reassocReq
3228 if (pMlmReassocReq != NULL)
3229 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303230 vos_mem_free(pMlmReassocReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003231 pMlmReassocReq = NULL;
3232 }
3233 if (pTmpMlmReassocReq != NULL)
3234 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303235 vos_mem_free(pTmpMlmReassocReq);
Madan Mohan Koyyalamudi61bc5662012-11-02 14:33:10 -07003236 pTmpMlmReassocReq = NULL;
3237 }
3238 mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE;
3239 mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS;
3240 /* Update PE sessio Id*/
3241 mlmReassocCnf.sessionId = psessionEntry->peSessionId;
3242
3243 limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf);
3244}
3245
Jeff Johnson295189b2012-06-20 16:38:30 -07003246#endif /* WLAN_FEATURE_VOWIFI_11R */
3247
3248
3249void
3250limSendReassocReqMgmtFrame(tpAniSirGlobal pMac,
3251 tLimMlmReassocReq *pMlmReassocReq,tpPESession psessionEntry)
3252{
3253 static tDot11fReAssocRequest frm;
3254 tANI_U16 caps;
3255 tANI_U8 *pFrame;
3256 tSirRetStatus nSirStatus;
3257 tANI_U32 nBytes, nPayload, nStatus;
3258 tANI_U8 fQosEnabled, fWmeEnabled, fWsmEnabled;
3259 void *pPacket;
3260 eHalStatus halstatus;
3261 tANI_U16 nAddIELen;
3262 tANI_U8 *pAddIE;
3263 tANI_U8 *wpsIe = NULL;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303264 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003265#if defined WLAN_FEATURE_VOWIFI
3266 tANI_U8 PowerCapsPopulated = FALSE;
3267#endif
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303268 tpSirMacMgmtHdr pMacHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -07003269
3270 if(NULL == psessionEntry)
3271 {
3272 return;
3273 }
3274
3275 /* check this early to avoid unncessary operation */
3276 if(NULL == psessionEntry->pLimReAssocReq)
3277 {
3278 return;
3279 }
3280 nAddIELen = psessionEntry->pLimReAssocReq->addIEAssoc.length;
3281 pAddIE = psessionEntry->pLimReAssocReq->addIEAssoc.addIEdata;
3282
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303283 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003284
3285 caps = pMlmReassocReq->capabilityInfo;
3286 if (PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap))
3287 ((tSirMacCapabilityInfo *) &caps)->qos = 0;
3288#if defined(FEATURE_WLAN_WAPI)
3289 /* CR: 262463 :
3290 According to WAPI standard:
3291 7.3.1.4 Capability Information field
3292 In WAPI, non-AP STAs within an ESS set the Privacy subfield to 0 in transmitted
3293 Association or Reassociation management frames. APs ignore the Privacy subfield within received Association and
3294 Reassociation management frames. */
3295 if ( psessionEntry->encryptType == eSIR_ED_WPI)
3296 ((tSirMacCapabilityInfo *) &caps)->privacy = 0;
3297#endif
3298 swapBitField16(caps, ( tANI_U16* )&frm.Capabilities );
3299
3300 frm.ListenInterval.interval = pMlmReassocReq->listenInterval;
3301
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303302 vos_mem_copy(( tANI_U8* )frm.CurrentAPAddress.mac,
3303 ( tANI_U8* )psessionEntry->bssId, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003304
3305 PopulateDot11fSSID2( pMac, &frm.SSID );
3306 PopulateDot11fSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
3307 &frm.SuppRates,psessionEntry);
3308
3309 fQosEnabled = ( psessionEntry->limQosEnabled ) &&
3310 SIR_MAC_GET_QOS( psessionEntry->limReassocBssCaps );
3311
3312 fWmeEnabled = ( psessionEntry->limWmeEnabled ) &&
3313 LIM_BSS_CAPS_GET( WME, psessionEntry->limReassocBssQosCaps );
3314
3315 fWsmEnabled = ( psessionEntry->limWsmEnabled ) && fWmeEnabled &&
3316 LIM_BSS_CAPS_GET( WSM, psessionEntry->limReassocBssQosCaps );
3317
3318
3319 if ( psessionEntry->lim11hEnable &&
3320 psessionEntry->pLimReAssocReq->spectrumMgtIndicator == eSIR_TRUE )
3321 {
3322#if defined WLAN_FEATURE_VOWIFI
3323 PowerCapsPopulated = TRUE;
3324 PopulateDot11fPowerCaps( pMac, &frm.PowerCaps, LIM_REASSOC,psessionEntry);
3325 PopulateDot11fSuppChannels( pMac, &frm.SuppChannels, LIM_REASSOC,psessionEntry);
3326#endif
3327 }
3328
3329#if defined WLAN_FEATURE_VOWIFI
3330 if( pMac->rrm.rrmPEContext.rrmEnable &&
3331 SIR_MAC_GET_RRM( psessionEntry->limCurrentBssCaps ) )
3332 {
3333 if (PowerCapsPopulated == FALSE)
3334 {
3335 PowerCapsPopulated = TRUE;
3336 PopulateDot11fPowerCaps(pMac, &frm.PowerCaps, LIM_REASSOC, psessionEntry);
3337 }
3338 }
3339#endif
3340
3341 if ( fQosEnabled &&
3342 ( ! PROP_CAPABILITY_GET(11EQOS, psessionEntry->limReassocBssPropCap ) ))
3343 {
3344 PopulateDot11fQOSCapsStation( pMac, &frm.QOSCapsStation );
3345 }
3346
3347 PopulateDot11fExtSuppRates( pMac, POPULATE_DOT11F_RATES_OPERATIONAL,
3348 &frm.ExtSuppRates, psessionEntry );
3349
3350#if defined WLAN_FEATURE_VOWIFI
3351 if( pMac->rrm.rrmPEContext.rrmEnable &&
3352 SIR_MAC_GET_RRM( psessionEntry->limReassocBssCaps ) )
3353 {
3354 PopulateDot11fRRMIe( pMac, &frm.RRMEnabledCap, psessionEntry );
3355 }
3356#endif
3357 // The join request *should* contain zero or one of the WPA and RSN
3358 // IEs. The payload send along with the request is a
3359 // 'tSirSmeJoinReq'; the IE portion is held inside a 'tSirRSNie':
3360
3361 // typedef struct sSirRSNie
3362 // {
3363 // tANI_U16 length;
3364 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
3365 // } tSirRSNie, *tpSirRSNie;
3366
3367 // So, we should be able to make the following two calls harmlessly,
3368 // since they do nothing if they don't find the given IE in the
3369 // bytestream with which they're provided.
3370
3371 // The net effect of this will be to faithfully transmit whatever
3372 // security IE is in the join request.
3373
3374 // *However*, if we're associating for the purpose of WPS
3375 // enrollment, and we've been configured to indicate that by
3376 // eliding the WPA or RSN IE, we just skip this:
3377 if( nAddIELen && pAddIE )
3378 {
3379 wpsIe = limGetWscIEPtr(pMac, pAddIE, nAddIELen);
3380 }
3381 if ( NULL == wpsIe )
3382 {
3383 PopulateDot11fRSNOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
3384 &frm.RSNOpaque );
3385 PopulateDot11fWPAOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
3386 &frm.WPAOpaque );
3387#if defined(FEATURE_WLAN_WAPI)
3388 PopulateDot11fWAPIOpaque( pMac, &( psessionEntry->pLimReAssocReq->rsnIE ),
3389 &frm.WAPIOpaque );
3390#endif // defined(FEATURE_WLAN_WAPI)
3391 }
3392
3393 // include WME EDCA IE as well
3394 if ( fWmeEnabled )
3395 {
3396 if ( ! PROP_CAPABILITY_GET( WME, psessionEntry->limReassocBssPropCap ) )
3397 {
3398 PopulateDot11fWMMInfoStation( pMac, &frm.WMMInfoStation );
3399 }
3400
3401 if ( fWsmEnabled &&
3402 ( ! PROP_CAPABILITY_GET(WSM, psessionEntry->limReassocBssPropCap )))
3403 {
3404 PopulateDot11fWMMCaps( &frm.WMMCaps );
3405 }
3406 }
3407
Jeff Johnsone7245742012-09-05 17:12:55 -07003408 if ( psessionEntry->htCapability &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 pMac->lim.htCapabilityPresentInBeacon)
3410 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003411 PopulateDot11fHTCaps( pMac, psessionEntry, &frm.HTCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003413#ifdef WLAN_FEATURE_11AC
3414 if ( psessionEntry->vhtCapability &&
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003415 psessionEntry->vhtCapabilityPresentInBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -07003416 {
Chet Lanctotf19c1f62013-12-13 13:56:21 -08003417 limLog( pMac, LOG1, FL("Populate VHT IEs in Re-Assoc Request"));
Abhishek Singh33f76ea2015-06-04 12:27:30 +05303418 PopulateDot11fVHTCaps( pMac, &frm.VHTCaps,
3419 psessionEntry->currentOperChannel, eSIR_FALSE );
Sandeep Puligilla60342762014-01-30 21:05:37 +05303420 PopulateDot11fExtCap( pMac, &frm.ExtCap, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07003421 }
3422#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003423
3424 nStatus = dot11fGetPackedReAssocRequestSize( pMac, &frm, &nPayload );
3425 if ( DOT11F_FAILED( nStatus ) )
3426 {
3427 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003428 "or a Re-Association Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 nStatus );
3430 // We'll fall back on the worst case scenario:
3431 nPayload = sizeof( tDot11fReAssocRequest );
3432 }
3433 else if ( DOT11F_WARNED( nStatus ) )
3434 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003435 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07003436 "the packed size for a Re-Association Re "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003437 "quest(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003438 }
3439
3440 nBytes = nPayload + sizeof( tSirMacMgmtHdr ) + nAddIELen;
3441
3442 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
3443 ( tANI_U16 )nBytes, ( void** ) &pFrame,
3444 ( void** ) &pPacket );
3445 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3446 {
3447 psessionEntry->limMlmState = psessionEntry->limPrevMlmState;
Jeff Johnsone7245742012-09-05 17:12:55 -07003448 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003449 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Re-As"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003450 "sociation Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 goto end;
3452 }
3453
3454 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303455 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003456
3457 // Next, we fill out the buffer descriptor:
3458 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
3459 SIR_MAC_MGMT_REASSOC_REQ,
3460 psessionEntry->limReAssocbssId,psessionEntry->selfMacAddr);
3461 if ( eSIR_SUCCESS != nSirStatus )
3462 {
3463 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003464 "tor for an Association Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003465 nSirStatus );
3466 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3467 goto end;
3468 }
3469
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303470 pMacHdr = (tpSirMacMgmtHdr) pFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07003471 // That done, pack the Probe Request:
3472 nStatus = dot11fPackReAssocRequest( pMac, &frm, pFrame +
3473 sizeof(tSirMacMgmtHdr),
3474 nPayload, &nPayload );
3475 if ( DOT11F_FAILED( nStatus ) )
3476 {
3477 limLog( pMac, LOGE, FL("Failed to pack a Re-Association Reque"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003478 "st (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003479 nStatus );
3480 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3481 goto end;
3482 }
3483 else if ( DOT11F_WARNED( nStatus ) )
3484 {
3485 limLog( pMac, LOGW, FL("There were warnings while packing a R"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08003486 "e-Association Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07003487 }
3488
3489 PELOG1(limLog( pMac, LOG1, FL("*** Sending Re-Association Request length %d"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003490 "to "),
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 nBytes );)
3492
3493 if( psessionEntry->assocReq != NULL )
3494 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303495 vos_mem_free(psessionEntry->assocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003496 psessionEntry->assocReq = NULL;
3497 }
3498
3499 if( nAddIELen )
3500 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303501 vos_mem_copy( pFrame + sizeof(tSirMacMgmtHdr) + nPayload,
3502 pAddIE,
3503 nAddIELen );
Jeff Johnson295189b2012-06-20 16:38:30 -07003504 nPayload += nAddIELen;
3505 }
3506
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303507 psessionEntry->assocReq = vos_mem_malloc(nPayload);
3508 if ( NULL == psessionEntry->assocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 {
3510 PELOGE(limLog(pMac, LOGE, FL("Unable to allocate memory to store assoc request"));)
Jeff Johnson43971f52012-07-17 12:26:56 -07003511 }
3512 else
3513 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003514 //Store the Assoc request. This is sent to csr/hdd in join cnf response.
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303515 vos_mem_copy(psessionEntry->assocReq, pFrame + sizeof(tSirMacMgmtHdr), nPayload);
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 psessionEntry->assocReqLen = nPayload;
Jeff Johnson43971f52012-07-17 12:26:56 -07003517 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003518
3519 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003520 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3521 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07003522 )
3523 {
3524 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3525 }
3526
Sushant Kaushike8681d22015-04-21 12:08:25 +05303527 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
3528 psessionEntry->pePersona == VOS_STA_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08003529 {
3530 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3531 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003532
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303533 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
3534 psessionEntry->peSessionId,
3535 pMacHdr->fc.subType));
Katya Nigam63902932014-06-26 19:04:23 +05303536
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303537 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
3538 {
3539 limLog(pMac, LOG1, FL("Reassoc req - txBdToken %u"), pMac->lim.txBdToken);
3540 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
3541 ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
3542 HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS,
3543 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3544 limTxComplete, pFrame, limTxBdComplete,
3545 txFlag, pMac->lim.txBdToken );
3546 pMac->lim.txBdToken++;
3547 }
3548 else
3549 {
3550 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) (sizeof(tSirMacMgmtHdr) + nPayload),
3551 HAL_TXRX_FRM_802_11_MGMT,
3552 ANI_TXDIR_TODS,
3553 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3554 limTxComplete, pFrame, txFlag );
3555 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303556 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
3557 psessionEntry->peSessionId,
3558 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07003559 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3560 {
3561 limLog( pMac, LOGE, FL("Failed to send Re-Association Request"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003562 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 nSirStatus );
3564 //Pkt will be freed up by the callback
3565 goto end;
3566 }
3567
Katya Nigamccaeda72015-04-20 18:51:22 +05303568 // enable caching
3569 WLANTL_EnableCaching(psessionEntry->staId);
3570
Jeff Johnson295189b2012-06-20 16:38:30 -07003571end:
3572 // Free up buffer allocated for mlmAssocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303573 vos_mem_free( pMlmReassocReq );
Jeff Johnson295189b2012-06-20 16:38:30 -07003574 psessionEntry->pLimMlmReassocReq = NULL;
3575
3576} // limSendReassocReqMgmtFrame
3577
Sushant Kaushik9e923872015-04-02 17:09:31 +05303578eHalStatus limAuthTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303579{
Sushant Kaushik9e923872015-04-02 17:09:31 +05303580 tANI_U32 txCompleteSuccess;
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303581 tpSirTxBdStatus pTxBdStatus;
Sushant Kaushik9e923872015-04-02 17:09:31 +05303582
3583 if (!pData)
3584 {
3585 limLog(pMac, LOG1,
3586 FL(" pData is NULL"));
3587 return eHAL_STATUS_FAILURE;
3588 }
Sushant Kaushik9e923872015-04-02 17:09:31 +05303589
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303590 if (IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
3591 {
3592 pTxBdStatus = (tpSirTxBdStatus) pData;
3593 txCompleteSuccess = pTxBdStatus->txCompleteStatus;
3594 limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
3595 pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
3596 }
3597 else
3598 {
3599 txCompleteSuccess = *((tANI_U32*) pData);
3600 limLog(pMac, LOG1,
3601 FL("txCompleteSuccess= %d"), txCompleteSuccess);
3602 }
3603
Sushant Kaushik9e923872015-04-02 17:09:31 +05303604 if(txCompleteSuccess)
3605 {
3606 pMac->authAckStatus = LIM_AUTH_ACK_RCD_SUCCESS;
3607 // 'Change' timer for future activations
3608 limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER);
3609 }
3610 else
3611 pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE;
3612 return eHAL_STATUS_SUCCESS;
3613}
3614
Jeff Johnson295189b2012-06-20 16:38:30 -07003615/**
3616 * \brief Send an Authentication frame
3617 *
3618 *
3619 * \param pMac Pointer to Global MAC structure
3620 *
3621 * \param pAuthFrameBody Pointer to Authentication frame structure that need
3622 * to be sent
3623 *
3624 * \param peerMacAddr MAC address of the peer entity to which Authentication
3625 * frame is destined
3626 *
3627 * \param wepBit Indicates whether wep bit to be set in FC while sending
3628 * Authentication frame3
3629 *
3630 *
3631 * This function is called by limProcessMlmMessages(). Authentication frame
3632 * is formatted and sent when this function is called.
3633 *
3634 *
3635 */
3636
3637void
3638limSendAuthMgmtFrame(tpAniSirGlobal pMac,
3639 tpSirMacAuthFrameBody pAuthFrameBody,
3640 tSirMacAddr peerMacAddr,
3641 tANI_U8 wepBit,
Sushant Kaushik9e923872015-04-02 17:09:31 +05303642 tpPESession psessionEntry,
3643 tAniBool waitForAck
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 )
3645{
3646 tANI_U8 *pFrame, *pBody;
3647 tANI_U32 frameLen = 0, bodyLen = 0;
3648 tpSirMacMgmtHdr pMacHdr;
3649 tANI_U16 i;
3650 void *pPacket;
3651 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05303652 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003653
3654 if(NULL == psessionEntry)
3655 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303656 limLog(pMac, LOGE, FL("Error: psession Entry is NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003657 return;
3658 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05303659
3660 limLog(pMac, LOG1,
3661 FL("Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR),
3662 pAuthFrameBody->authTransactionSeqNumber,
3663 pAuthFrameBody->authStatusCode,
3664 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
3665 MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003666 if (wepBit == LIM_WEP_IN_FC)
3667 {
3668 /// Auth frame3 to be sent with encrypted framebody
3669 /**
3670 * Allocate buffer for Authenticaton frame of size equal
3671 * to management frame header length plus 2 bytes each for
3672 * auth algorithm number, transaction number, status code,
3673 * 128 bytes for challenge text and 4 bytes each for
3674 * IV & ICV.
3675 */
3676
3677 frameLen = sizeof(tSirMacMgmtHdr) + LIM_ENCR_AUTH_BODY_LEN;
3678
3679 bodyLen = LIM_ENCR_AUTH_BODY_LEN;
3680 } // if (wepBit == LIM_WEP_IN_FC)
3681 else
3682 {
3683 switch (pAuthFrameBody->authTransactionSeqNumber)
3684 {
3685 case SIR_MAC_AUTH_FRAME_1:
3686 /**
3687 * Allocate buffer for Authenticaton frame of size
3688 * equal to management frame header length plus 2 bytes
3689 * each for auth algorithm number, transaction number
3690 * and status code.
3691 */
3692
3693 frameLen = sizeof(tSirMacMgmtHdr) +
3694 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3695 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3696
3697#if defined WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003698 if (pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH)
3699 {
3700 if (0 != pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
Jeff Johnson295189b2012-06-20 16:38:30 -07003701 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003702 frameLen += pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length;
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003703 limLog(pMac, LOG3, FL("Auth frame, FTIES length added=%d"),
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003704 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 }
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003706 else
3707 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303708 limLog(pMac, LOG3, FL("Auth frame, Does not contain "
3709 "FTIES!!!"));
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003710 frameLen += (2+SIR_MDIE_SIZE);
3711 }
3712 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003713#endif
3714 break;
3715
3716 case SIR_MAC_AUTH_FRAME_2:
3717 if ((pAuthFrameBody->authAlgoNumber == eSIR_OPEN_SYSTEM) ||
3718 ((pAuthFrameBody->authAlgoNumber == eSIR_SHARED_KEY) &&
3719 (pAuthFrameBody->authStatusCode != eSIR_MAC_SUCCESS_STATUS)))
3720 {
3721 /**
3722 * Allocate buffer for Authenticaton frame of size
3723 * equal to management frame header length plus
3724 * 2 bytes each for auth algorithm number,
3725 * transaction number and status code.
3726 */
3727
3728 frameLen = sizeof(tSirMacMgmtHdr) +
3729 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3730 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3731 }
3732 else
3733 {
3734 // Shared Key algorithm with challenge text
3735 // to be sent
3736 /**
3737 * Allocate buffer for Authenticaton frame of size
3738 * equal to management frame header length plus
3739 * 2 bytes each for auth algorithm number,
3740 * transaction number, status code and 128 bytes
3741 * for challenge text.
3742 */
3743
3744 frameLen = sizeof(tSirMacMgmtHdr) +
3745 sizeof(tSirMacAuthFrame);
3746 bodyLen = sizeof(tSirMacAuthFrameBody);
3747 }
3748
3749 break;
3750
3751 case SIR_MAC_AUTH_FRAME_3:
3752 /// Auth frame3 to be sent without encrypted framebody
3753 /**
3754 * Allocate buffer for Authenticaton frame of size equal
3755 * to management frame header length plus 2 bytes each
3756 * for auth algorithm number, transaction number and
3757 * status code.
3758 */
3759
3760 frameLen = sizeof(tSirMacMgmtHdr) +
3761 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3762 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3763
3764 break;
3765
3766 case SIR_MAC_AUTH_FRAME_4:
3767 /**
3768 * Allocate buffer for Authenticaton frame of size equal
3769 * to management frame header length plus 2 bytes each
3770 * for auth algorithm number, transaction number and
3771 * status code.
3772 */
3773
3774 frameLen = sizeof(tSirMacMgmtHdr) +
3775 SIR_MAC_AUTH_CHALLENGE_OFFSET;
3776 bodyLen = SIR_MAC_AUTH_CHALLENGE_OFFSET;
3777
3778 break;
3779 } // switch (pAuthFrameBody->authTransactionSeqNumber)
3780 } // end if (wepBit == LIM_WEP_IN_FC)
3781
3782
3783 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )frameLen, ( void** ) &pFrame, ( void** ) &pPacket );
3784
3785 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3786 {
3787 // Log error
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003788 limLog(pMac, LOGP, FL("call to bufAlloc failed for AUTH frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003789
3790 return;
3791 }
3792
3793 for (i = 0; i < frameLen; i++)
3794 pFrame[i] = 0;
3795
3796 // Prepare BD
3797 if (limPopulateMacHeader(pMac, pFrame, SIR_MAC_MGMT_FRAME,
3798 SIR_MAC_MGMT_AUTH, peerMacAddr,psessionEntry->selfMacAddr) != eSIR_SUCCESS)
3799 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05303800 limLog(pMac, LOGE, FL("call to limPopulateMacHeader failed for "
3801 "AUTH frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003802 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
3803 return;
3804 }
3805
3806 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
3807 pMacHdr->fc.wep = wepBit;
3808
3809 // Prepare BSSId
3810 if( (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )
3811 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303812 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
3813 (tANI_U8 *) psessionEntry->bssId,
3814 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003815 }
3816
3817 /// Prepare Authentication frame body
3818 pBody = pFrame + sizeof(tSirMacMgmtHdr);
3819
3820 if (wepBit == LIM_WEP_IN_FC)
3821 {
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303822 vos_mem_copy(pBody, (tANI_U8 *) pAuthFrameBody, bodyLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07003823
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303824 limLog(pMac, LOG1,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303825 FL("*** Sending Auth seq# 3 status %d (%d) to"MAC_ADDRESS_STR),
Jeff Johnson295189b2012-06-20 16:38:30 -07003826 pAuthFrameBody->authStatusCode,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303827 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303828 MAC_ADDR_ARRAY(pMacHdr->da));
Jeff Johnson295189b2012-06-20 16:38:30 -07003829
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 }
3831 else
3832 {
3833 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authAlgoNumber);
3834 pBody += sizeof(tANI_U16);
3835 bodyLen -= sizeof(tANI_U16);
3836
3837 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authTransactionSeqNumber);
3838 pBody += sizeof(tANI_U16);
3839 bodyLen -= sizeof(tANI_U16);
3840
3841 *((tANI_U16 *)(pBody)) = sirSwapU16ifNeeded(pAuthFrameBody->authStatusCode);
3842 pBody += sizeof(tANI_U16);
3843 bodyLen -= sizeof(tANI_U16);
Leela Venkata Kiran Kumar Reddy Chirala7d3fa552013-08-28 10:52:21 -07003844 if ( bodyLen <= (sizeof (pAuthFrameBody->type) +
3845 sizeof (pAuthFrameBody->length) +
3846 sizeof (pAuthFrameBody->challengeText)))
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05303847 vos_mem_copy(pBody, (tANI_U8 *) &pAuthFrameBody->type, bodyLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07003848
3849#if defined WLAN_FEATURE_VOWIFI_11R
3850 if ((pAuthFrameBody->authAlgoNumber == eSIR_FT_AUTH) &&
3851 (pAuthFrameBody->authTransactionSeqNumber == SIR_MAC_AUTH_FRAME_1))
3852 {
3853
3854 {
3855 int i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003856 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length)
3857 {
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003858#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowdad63eb492014-02-06 12:21:47 -08003859 PELOG2(limLog(pMac, LOG2, FL("Auth1 Frame FTIE is: "));
3860 sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2,
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 (tANI_U8 *)pBody,
3862 (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003863#endif
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003864 for (i=0; i<pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies_length; i++)
3865 {
Madan Mohan Koyyalamudi6a00a802012-11-28 16:12:11 -08003866 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[i];
3867 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003868 }
3869 }
3870 else
3871 {
3872 /* MDID attr is 54*/
3873 *pBody = 54;
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 pBody++;
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003875 *pBody = SIR_MDIE_SIZE;
3876 pBody++;
3877 for(i=0;i<SIR_MDIE_SIZE;i++)
3878 {
3879 *pBody = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription->mdie[i];
3880 pBody++;
3881 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 }
3883 }
3884 }
3885#endif
3886
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303887 limLog(pMac, LOG1,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303888 FL("*** Sending Auth seq# %d status %d (%d) to "MAC_ADDRESS_STR),
Jeff Johnson295189b2012-06-20 16:38:30 -07003889 pAuthFrameBody->authTransactionSeqNumber,
3890 pAuthFrameBody->authStatusCode,
Abhishek Singh57aebef2014-02-03 18:47:44 +05303891 (pAuthFrameBody->authStatusCode == eSIR_MAC_SUCCESS_STATUS),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303892 MAC_ADDR_ARRAY(pMacHdr->da));
Jeff Johnson295189b2012-06-20 16:38:30 -07003893 }
3894 PELOG2(sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG2, pFrame, frameLen);)
3895
3896 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07003897 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
3898 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003899#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05303900 || ((NULL != pMac->ft.ftPEContext.pFTPreAuthReq)
Jeff Johnsone7245742012-09-05 17:12:55 -07003901 && ( SIR_BAND_5_GHZ == limGetRFBand(pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)))
3902#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 )
3904 {
3905 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3906 }
3907
Sushant Kaushike8681d22015-04-21 12:08:25 +05303908 if(psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ||
3909 psessionEntry->pePersona == VOS_STA_MODE)
Ganesh K08bce952012-12-13 15:04:41 -08003910 {
3911 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
3912 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08003913
Sushant Kaushik9e923872015-04-02 17:09:31 +05303914 limLog( pMac, LOG1,
3915 FL("Sending Auth Frame over WQ5 with waitForAck %d to "MAC_ADDRESS_STR
3916 " From " MAC_ADDRESS_STR), waitForAck, MAC_ADDR_ARRAY(pMacHdr->da),
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05303917 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
3918
3919 txFlag |= HAL_USE_FW_IN_TX_PATH;
3920
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303921 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
3922 psessionEntry->peSessionId,
3923 pMacHdr->fc.subType));
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05303924
3925 if( ( psessionEntry->is11Gonly == true ) &&
3926 ( !IS_BROADCAST_MAC(peerMacAddr) ) ){
3927 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
3928 }
Sushant Kaushik9e923872015-04-02 17:09:31 +05303929 if(eSIR_TRUE == waitForAck)
3930 {
3931 pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD;
Sushant Kaushik0b343422015-05-25 17:15:55 +05303932 limLog(pMac, LOG1, FL("Auth frame - txBdToken %u"),
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303933 pMac->lim.txBdToken);
Sushant Kaushik9e923872015-04-02 17:09:31 +05303934 halstatus = halTxFrameWithTxComplete( pMac, pPacket,
3935 ( tANI_U16 ) frameLen,
3936 HAL_TXRX_FRM_802_11_MGMT,
3937 ANI_TXDIR_TODS,
3938 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Ganesh Kondabattiniffc00b12015-03-18 13:11:33 +05303939 limTxComplete, pFrame, limAuthTxCompleteCnf, txFlag,
3940 pMac->lim.txBdToken);
3941 pMac->lim.txBdToken++;
Sushant Kaushik9e923872015-04-02 17:09:31 +05303942 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
3943 psessionEntry->peSessionId,
3944 halstatus));
3945 if (!HAL_STATUS_SUCCESS(halstatus))
3946 {
3947 limLog( pMac, LOGE,
3948 FL("Could not send Auth frame, retCode=%X "),
3949 halstatus );
3950 pMac->authAckStatus = LIM_AUTH_ACK_RCD_FAILURE;
3951 //Pkt will be freed up by the callback
3952 }
3953 }
3954 else
3955 {
3956 /// Queue Authentication frame in high priority WQ
3957 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) frameLen,
Jeff Johnson295189b2012-06-20 16:38:30 -07003958 HAL_TXRX_FRM_802_11_MGMT,
3959 ANI_TXDIR_TODS,
3960 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
3961 limTxComplete, pFrame, txFlag );
Sushant Kaushik9e923872015-04-02 17:09:31 +05303962 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05303963 psessionEntry->peSessionId,
3964 halstatus));
Sushant Kaushik9e923872015-04-02 17:09:31 +05303965 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
3966 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003968 FL("*** Could not send Auth frame, retCode=%X ***"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003969 halstatus);
3970
3971 //Pkt will be freed up by the callback
Sushant Kaushik9e923872015-04-02 17:09:31 +05303972 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 }
3974
3975 return;
3976} /*** end limSendAuthMgmtFrame() ***/
3977
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003978eHalStatus limSendDeauthCnf(tpAniSirGlobal pMac)
3979{
3980 tANI_U16 aid;
3981 tpDphHashNode pStaDs;
3982 tLimMlmDeauthReq *pMlmDeauthReq;
3983 tLimMlmDeauthCnf mlmDeauthCnf;
3984 tpPESession psessionEntry;
3985
3986 pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq;
3987 if (pMlmDeauthReq)
3988 {
3989 if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer))
3990 {
3991 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
3992 }
3993
3994 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDeauthReq->sessionId))== NULL)
3995 {
3996
3997 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07003998 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003999 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4000 goto end;
4001 }
4002
4003 pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4004 if (pStaDs == NULL)
4005 {
4006 mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4007 goto end;
4008 }
4009
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004010 /// Receive path cleanup with dummy packet
4011 limCleanupRxPath(pMac, pStaDs,psessionEntry);
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304012
4013#ifdef WLAN_FEATURE_VOWIFI_11R
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304014 if ( psessionEntry->limSystemRole == eLIM_STA_ROLE )
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304015 {
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304016 PELOGE(limLog(pMac, LOG1,
4017 FL("FT Preauth SessionId %d Cleanup"
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304018#ifdef FEATURE_WLAN_ESE
4019 " isESE %d"
4020#endif
4021#ifdef FEATURE_WLAN_LFR
4022 " isLFR %d"
4023#endif
4024 " is11r %d, Deauth reason %d Trigger = %d"),
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304025 psessionEntry->peSessionId,
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304026#ifdef FEATURE_WLAN_ESE
4027 psessionEntry->isESEconnection,
4028#endif
4029#ifdef FEATURE_WLAN_LFR
4030 psessionEntry->isFastRoamIniFeatureEnabled,
4031#endif
4032 psessionEntry->is11Rconnection,
4033 pMlmDeauthReq->reasonCode,
4034 pMlmDeauthReq->deauthTrigger););
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304035
4036 limFTCleanup(pMac);
Abhishek Singhcf4590b2014-04-16 18:58:08 +05304037 }
4038#endif
4039
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004040 /// Free up buffer allocated for mlmDeauthReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304041 vos_mem_free(pMlmDeauthReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004042 pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL;
4043 }
4044 return eHAL_STATUS_SUCCESS;
4045end:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304046 vos_mem_copy( (tANI_U8 *) &mlmDeauthCnf.peerMacAddr,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004047 (tANI_U8 *) pMlmDeauthReq->peerMacAddr,
4048 sizeof(tSirMacAddr));
4049 mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger;
4050 mlmDeauthCnf.aid = pMlmDeauthReq->aid;
4051 mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId;
4052
4053 // Free up buffer allocated
4054 // for mlmDeauthReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304055 vos_mem_free(pMlmDeauthReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004056
4057 limPostSmeMessage(pMac,
4058 LIM_MLM_DEAUTH_CNF,
4059 (tANI_U32 *) &mlmDeauthCnf);
4060 return eHAL_STATUS_SUCCESS;
4061}
4062
4063eHalStatus limSendDisassocCnf(tpAniSirGlobal pMac)
4064{
4065 tANI_U16 aid;
4066 tpDphHashNode pStaDs;
4067 tLimMlmDisassocCnf mlmDisassocCnf;
4068 tpPESession psessionEntry;
4069 tLimMlmDisassocReq *pMlmDisassocReq;
4070
4071 pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq;
4072 if (pMlmDisassocReq)
4073 {
4074 if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer))
4075 {
4076 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
4077 }
4078
4079 if((psessionEntry = peFindSessionBySessionId(pMac, pMlmDisassocReq->sessionId))== NULL)
4080 {
4081
4082 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004083 FL("session does not exist for given sessionId"));)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004084 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4085 goto end;
4086 }
4087
4088 pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
4089 if (pStaDs == NULL)
4090 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304091 limLog(pMac, LOGE,
4092 FL("StaDs Null"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004093 mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS;
4094 goto end;
4095 }
4096
4097 /// Receive path cleanup with dummy packet
4098 if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs, psessionEntry))
4099 {
4100 mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05304101 limLog(pMac, LOGE,
4102 FL("CleanupRxPath error"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004103 goto end;
4104 }
4105
4106#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004107 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE ) &&
Gopichand Nakkala0ae39db2013-06-10 20:35:49 +05304108 (pMlmDisassocReq->reasonCode !=
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004109 eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON))
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004110 {
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304111 PELOGE(limLog(pMac, LOG1,
4112 FL("FT Preauth SessionId %d Cleanup"
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004113#ifdef FEATURE_WLAN_ESE
4114 " isESE %d"
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004115#endif
4116#ifdef FEATURE_WLAN_LFR
4117 " isLFR %d"
4118#endif
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004119 " is11r %d reason %d"),
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304120 psessionEntry->peSessionId,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004121#ifdef FEATURE_WLAN_ESE
4122 psessionEntry->isESEconnection,
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004123#endif
4124#ifdef FEATURE_WLAN_LFR
4125 psessionEntry->isFastRoamIniFeatureEnabled,
4126#endif
4127 psessionEntry->is11Rconnection,
4128 pMlmDisassocReq->reasonCode););
Mukul Sharma0820d0e2014-11-11 19:49:02 +05304129 limFTCleanup(pMac);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004130 }
4131#endif
4132
4133 /// Free up buffer allocated for mlmDisassocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304134 vos_mem_free(pMlmDisassocReq);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004135 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
4136 return eHAL_STATUS_SUCCESS;
4137 }
4138 else
4139 {
4140 return eHAL_STATUS_SUCCESS;
4141 }
4142end:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304143 vos_mem_copy( (tANI_U8 *) &mlmDisassocCnf.peerMacAddr,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004144 (tANI_U8 *) pMlmDisassocReq->peerMacAddr,
4145 sizeof(tSirMacAddr));
4146 mlmDisassocCnf.aid = pMlmDisassocReq->aid;
4147 mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger;
4148
4149 /* Update PE session ID*/
4150 mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId;
4151
Madan Mohan Koyyalamudib7f5a672012-11-29 11:17:46 -08004152 if(pMlmDisassocReq != NULL)
4153 {
4154 /// Free up buffer allocated for mlmDisassocReq
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304155 vos_mem_free(pMlmDisassocReq);
Madan Mohan Koyyalamudib7f5a672012-11-29 11:17:46 -08004156 pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL;
4157 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004158
4159 limPostSmeMessage(pMac,
4160 LIM_MLM_DISASSOC_CNF,
4161 (tANI_U32 *) &mlmDisassocCnf);
4162 return eHAL_STATUS_SUCCESS;
4163}
4164
Ganesh Kondabattini358fc9b2015-03-11 16:14:25 +05304165eHalStatus limDisassocTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004166{
Ganesh Kondabattinib18b3292015-03-16 16:59:26 +05304167 if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
4168 {
4169 tpSirTxBdStatus pTxBdStatus;
4170 pTxBdStatus = (tpSirTxBdStatus) pData;
4171 limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
4172 pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
4173 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004174 return limSendDisassocCnf(pMac);
4175}
4176
Ganesh Kondabattini358fc9b2015-03-11 16:14:25 +05304177eHalStatus limDeauthTxCompleteCnf(tpAniSirGlobal pMac, void *pData)
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004178{
Ganesh Kondabattinib18b3292015-03-16 16:59:26 +05304179 if (pData && IS_FEATURE_SUPPORTED_BY_FW(ENHANCED_TXBD_COMPLETION))
4180 {
4181 tpSirTxBdStatus pTxBdStatus;
4182 pTxBdStatus = (tpSirTxBdStatus) pData;
4183 limLog(pMac, LOG1, FL("txCompleteStatus %u, txBdToken %u"),
4184 pTxBdStatus->txCompleteStatus, pTxBdStatus->txBdToken);
4185 }
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004186 return limSendDeauthCnf(pMac);
4187}
4188
Jeff Johnson295189b2012-06-20 16:38:30 -07004189/**
4190 * \brief This function is called to send Disassociate frame.
4191 *
4192 *
4193 * \param pMac Pointer to Global MAC structure
4194 *
4195 * \param nReason Indicates the reason that need to be sent in
4196 * Disassociation frame
4197 *
4198 * \param peerMacAddr MAC address of the STA to which Disassociation frame is
4199 * sent
4200 *
4201 *
4202 */
4203
4204void
4205limSendDisassocMgmtFrame(tpAniSirGlobal pMac,
4206 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004207 tSirMacAddr peer,
4208 tpPESession psessionEntry,
4209 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004210{
4211 tDot11fDisassociation frm;
4212 tANI_U8 *pFrame;
4213 tSirRetStatus nSirStatus;
4214 tpSirMacMgmtHdr pMacHdr;
4215 tANI_U32 nBytes, nPayload, nStatus;
4216 void *pPacket;
4217 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304218 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004219 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 if(NULL == psessionEntry)
4221 {
4222 return;
4223 }
4224
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304225 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004226
4227 frm.Reason.code = nReason;
4228
4229 nStatus = dot11fGetPackedDisassociationSize( pMac, &frm, &nPayload );
4230 if ( DOT11F_FAILED( nStatus ) )
4231 {
4232 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004233 "or a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004234 nStatus );
4235 // We'll fall back on the worst case scenario:
4236 nPayload = sizeof( tDot11fDisassociation );
4237 }
4238 else if ( DOT11F_WARNED( nStatus ) )
4239 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004240 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004241 "the packed size for a Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004242 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004243 }
4244
4245 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4246
4247 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4248 ( tANI_U16 )nBytes, ( void** ) &pFrame,
4249 ( void** ) &pPacket );
4250 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4251 {
4252 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Dis"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004253 "association."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 return;
4255 }
4256
4257 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304258 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004259
4260 // Next, we fill out the buffer descriptor:
4261 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4262 SIR_MAC_MGMT_DISASSOC, peer,psessionEntry->selfMacAddr);
4263 if ( eSIR_SUCCESS != nSirStatus )
4264 {
4265 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004266 "tor for a Disassociation (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 nSirStatus );
4268 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4269 ( void* ) pFrame, ( void* ) pPacket );
4270 return; // just allocated...
4271 }
4272
4273 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4274
4275 // Prepare the BSSID
4276 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
4277
Chet Lanctot186b5732013-03-18 10:26:30 -07004278#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004279 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004280#endif
4281
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 nStatus = dot11fPackDisassociation( pMac, &frm, pFrame +
4283 sizeof(tSirMacMgmtHdr),
4284 nPayload, &nPayload );
4285 if ( DOT11F_FAILED( nStatus ) )
4286 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004287 limLog( pMac, LOGE, FL("Failed to pack a Disassociation (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 nStatus );
4289 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4290 ( void* ) pFrame, ( void* ) pPacket );
4291 return; // allocated!
4292 }
4293 else if ( DOT11F_WARNED( nStatus ) )
4294 {
4295 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004296 "isassociation (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004297 }
4298
Abhishek Singhcd09b562013-12-24 16:02:20 +05304299 limLog( pMac, LOG1, FL("***Sessionid %d Sending Disassociation frame with "
4300 "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From "
4301 MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck,
4302 MAC_ADDR_ARRAY(pMacHdr->da),
4303 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004304
4305 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4307 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004308 )
4309 {
4310 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4311 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004312
Sushant Kaushike8681d22015-04-21 12:08:25 +05304313 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004314
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304315 if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
4316 {
4317 /* This frame will be sent on air by firmware,
4318 which will ensure that this frame goes out
4319 even though DEL_STA is sent immediately */
4320 /* Without this for DEL_STA command there is
4321 risk of flushing frame in BTQM queue without
4322 sending on air */
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05304323 limLog( pMac, LOG1, FL("Sending Disassoc Frame over WQ5 to "MAC_ADDRESS_STR
4324 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
4325 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304326 txFlag |= HAL_USE_FW_IN_TX_PATH;
4327 }
4328
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004329 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004330 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304331 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4332 psessionEntry->peSessionId,
4333 pMacHdr->fc.subType));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004334 // Queue Disassociation frame in high priority WQ
4335 /* get the duration from the request */
4336 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
4337 HAL_TXRX_FRM_802_11_MGMT,
4338 ANI_TXDIR_TODS,
4339 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4340 limTxComplete, pFrame, limDisassocTxCompleteCnf,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05304341 txFlag,
4342 pMac->lim.txBdToken++);
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304343 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4344 psessionEntry->peSessionId,
4345 halstatus));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004346 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
Jeff Johnson295189b2012-06-20 16:38:30 -07004347
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004348 if (tx_timer_change(
4349 &pMac->lim.limTimers.gLimDisassocAckTimer, val, 0)
4350 != TX_SUCCESS)
4351 {
4352 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004353 FL("Unable to change Disassoc ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004354 return;
4355 }
4356 else if(TX_SUCCESS != tx_timer_activate(
4357 &pMac->lim.limTimers.gLimDisassocAckTimer))
4358 {
4359 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004360 FL("Unable to activate Disassoc ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004361 limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER);
4362 return;
4363 }
4364 }
Madan Mohan Koyyalamudib6af0612012-11-19 13:45:45 -08004365 else
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004366 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304367 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4368 psessionEntry->peSessionId,
4369 pMacHdr->fc.subType));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004370 // Queue Disassociation frame in high priority WQ
4371 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4372 HAL_TXRX_FRM_802_11_MGMT,
4373 ANI_TXDIR_TODS,
4374 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4375 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304376 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4377 psessionEntry->peSessionId,
4378 halstatus));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004379 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4380 {
4381 limLog( pMac, LOGE, FL("Failed to send Disassociation "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004382 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004383 nSirStatus );
4384 //Pkt will be freed up by the callback
4385 return;
4386 }
4387 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004388} // End limSendDisassocMgmtFrame.
4389
4390/**
4391 * \brief This function is called to send a Deauthenticate frame
4392 *
4393 *
4394 * \param pMac Pointer to global MAC structure
4395 *
4396 * \param nReason Indicates the reason that need to be sent in the
4397 * Deauthenticate frame
4398 *
4399 * \param peeer address of the STA to which the frame is to be sent
4400 *
4401 *
4402 */
4403
4404void
4405limSendDeauthMgmtFrame(tpAniSirGlobal pMac,
4406 tANI_U16 nReason,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004407 tSirMacAddr peer,
4408 tpPESession psessionEntry,
4409 tANI_BOOLEAN waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004410{
4411 tDot11fDeAuth frm;
4412 tANI_U8 *pFrame;
4413 tSirRetStatus nSirStatus;
4414 tpSirMacMgmtHdr pMacHdr;
4415 tANI_U32 nBytes, nPayload, nStatus;
4416 void *pPacket;
4417 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304418 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004419 tANI_U32 val = 0;
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004420#ifdef FEATURE_WLAN_TDLS
4421 tANI_U16 aid;
4422 tpDphHashNode pStaDs;
4423#endif
4424
Jeff Johnson295189b2012-06-20 16:38:30 -07004425 if(NULL == psessionEntry)
4426 {
4427 return;
4428 }
4429
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304430 vos_mem_set( ( tANI_U8* ) &frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004431
4432 frm.Reason.code = nReason;
4433
4434 nStatus = dot11fGetPackedDeAuthSize( pMac, &frm, &nPayload );
4435 if ( DOT11F_FAILED( nStatus ) )
4436 {
4437 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004438 "or a De-Authentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004439 nStatus );
4440 // We'll fall back on the worst case scenario:
4441 nPayload = sizeof( tDot11fDeAuth );
4442 }
4443 else if ( DOT11F_WARNED( nStatus ) )
4444 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004445 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004446 "the packed size for a De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004447 "(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004448 }
4449
4450 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4451
4452 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4453 ( tANI_U16 )nBytes, ( void** ) &pFrame,
4454 ( void** ) &pPacket );
4455 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4456 {
4457 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004458 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004459 return;
4460 }
4461
4462 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304463 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004464
4465 // Next, we fill out the buffer descriptor:
4466 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4467 SIR_MAC_MGMT_DEAUTH, peer,psessionEntry->selfMacAddr);
4468 if ( eSIR_SUCCESS != nSirStatus )
4469 {
4470 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004471 "tor for a De-Authentication (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004472 nSirStatus );
4473 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4474 ( void* ) pFrame, ( void* ) pPacket );
4475 return; // just allocated...
4476 }
4477
4478 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4479
4480 // Prepare the BSSID
4481 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
4482
Chet Lanctot186b5732013-03-18 10:26:30 -07004483#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004484 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004485#endif
4486
Jeff Johnson295189b2012-06-20 16:38:30 -07004487 nStatus = dot11fPackDeAuth( pMac, &frm, pFrame +
4488 sizeof(tSirMacMgmtHdr),
4489 nPayload, &nPayload );
4490 if ( DOT11F_FAILED( nStatus ) )
4491 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004492 limLog( pMac, LOGE, FL("Failed to pack a DeAuthentication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 nStatus );
4494 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT,
4495 ( void* ) pFrame, ( void* ) pPacket );
4496 return;
4497 }
4498 else if ( DOT11F_WARNED( nStatus ) )
4499 {
4500 limLog( pMac, LOGW, FL("There were warnings while packing a D"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004501 "e-Authentication (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004502 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05304503 limLog( pMac, LOG1, FL("***Sessionid %d Sending Deauth frame with "
4504 "reason %u and waitForAck %d to "MAC_ADDRESS_STR" ,From "
4505 MAC_ADDRESS_STR), psessionEntry->peSessionId, nReason, waitForAck,
4506 MAC_ADDR_ARRAY(pMacHdr->da),
4507 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004508
4509 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
4511 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 )
4513 {
4514 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
4515 }
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004516
Sushant Kaushike8681d22015-04-21 12:08:25 +05304517 txFlag |= HAL_USE_PEER_STA_REQUESTED_MASK;
Madan Mohan Koyyalamudi7ff89c12012-11-28 15:50:13 -08004518
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304519 if( IS_FW_IN_TX_PATH_FEATURE_ENABLE )
4520 {
4521 /* This frame will be sent on air by firmware,
4522 which will ensure that this frame goes out
4523 even though DEL_STA is sent immediately */
4524 /* Without this for DEL_STA command there is
4525 risk of flushing frame in BTQM queue without
4526 sending on air */
Agarwal Ashisha8e81f52014-04-02 01:59:52 +05304527 limLog( pMac, LOG1, FL("Sending Deauth Frame over WQ5 to "MAC_ADDRESS_STR
4528 " From " MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMacHdr->da),
4529 MAC_ADDR_ARRAY(psessionEntry->selfMacAddr));
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304530 txFlag |= HAL_USE_FW_IN_TX_PATH;
4531 }
4532
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004533#ifdef FEATURE_WLAN_TDLS
4534 pStaDs = dphLookupHashEntry(pMac, peer, &aid, &psessionEntry->dph.dphHashTable);
4535#endif
4536
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004537 if (waitForAck)
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304539 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4540 psessionEntry->peSessionId,
4541 pMacHdr->fc.subType));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004542 // Queue Disassociation frame in high priority WQ
4543 halstatus = halTxFrameWithTxComplete( pMac, pPacket, ( tANI_U16 ) nBytes,
4544 HAL_TXRX_FRM_802_11_MGMT,
4545 ANI_TXDIR_TODS,
4546 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Ganesh Kondabattini10e67352015-03-16 17:41:57 +05304547 limTxComplete, pFrame, limDeauthTxCompleteCnf, txFlag,
4548 pMac->lim.txBdToken++);
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304549 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4550 psessionEntry->peSessionId,
4551 halstatus));
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304552 if (!HAL_STATUS_SUCCESS(halstatus))
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004553 {
4554 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304555 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004556 nSirStatus );
Gopichand Nakkala4261ea52012-12-31 16:43:00 -08004557 //Pkt will be freed up by the callback limTxComplete
4558
4559 /*Call limProcessDeauthAckTimeout which will send
4560 * DeauthCnf for this frame
4561 */
4562 limProcessDeauthAckTimeout(pMac);
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004563 return;
4564 }
4565
4566 val = SYS_MS_TO_TICKS(LIM_DISASSOC_DEAUTH_ACK_TIMEOUT);
4567
4568 if (tx_timer_change(
4569 &pMac->lim.limTimers.gLimDeauthAckTimer, val, 0)
4570 != TX_SUCCESS)
4571 {
4572 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004573 FL("Unable to change Deauth ack Timer val"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004574 return;
4575 }
4576 else if(TX_SUCCESS != tx_timer_activate(
4577 &pMac->lim.limTimers.gLimDeauthAckTimer))
4578 {
4579 limLog(pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004580 FL("Unable to activate Deauth ack Timer"));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004581 limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER);
4582 return;
4583 }
4584 }
4585 else
4586 {
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304587 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4588 psessionEntry->peSessionId,
4589 pMacHdr->fc.subType));
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004590#ifdef FEATURE_WLAN_TDLS
4591 if ((NULL != pStaDs) && (STA_ENTRY_TDLS_PEER == pStaDs->staType))
4592 {
4593 // Queue Disassociation frame in high priority WQ
4594 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004595 HAL_TXRX_FRM_802_11_MGMT,
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004596 ANI_TXDIR_IBSS,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004597 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4598 limTxComplete, pFrame, txFlag );
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08004599 }
4600 else
4601 {
4602#endif
4603 // Queue Disassociation frame in high priority WQ
4604 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4605 HAL_TXRX_FRM_802_11_MGMT,
4606 ANI_TXDIR_TODS,
4607 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4608 limTxComplete, pFrame, txFlag );
4609#ifdef FEATURE_WLAN_TDLS
4610 }
4611#endif
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304612 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4613 psessionEntry->peSessionId,
4614 halstatus));
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004615 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4616 {
4617 limLog( pMac, LOGE, FL("Failed to send De-Authentication "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004618 "(%X)!"),
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08004619 nSirStatus );
4620 //Pkt will be freed up by the callback
4621 return;
4622 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 }
4624
4625} // End limSendDeauthMgmtFrame.
4626
4627
4628#ifdef ANI_SUPPORT_11H
4629/**
4630 * \brief Send a Measurement Report Action frame
4631 *
4632 *
4633 * \param pMac Pointer to the global MAC structure
4634 *
4635 * \param pMeasReqFrame Address of a tSirMacMeasReqActionFrame
4636 *
4637 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4638 *
4639 *
4640 */
4641
4642tSirRetStatus
4643limSendMeasReportFrame(tpAniSirGlobal pMac,
4644 tpSirMacMeasReqActionFrame pMeasReqFrame,
4645 tSirMacAddr peer)
4646{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304647 tDot11fMeasurementReport frm;
4648 tANI_U8 *pFrame;
4649 tSirRetStatus nSirStatus;
4650 tpSirMacMgmtHdr pMacHdr;
4651 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4652 void *pPacket;
4653 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004654
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304655 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004656
4657 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4658 frm.Action.action = SIR_MAC_ACTION_MEASURE_REPORT_ID;
4659 frm.DialogToken.token = pMeasReqFrame->actionHeader.dialogToken;
4660
4661 switch ( pMeasReqFrame->measReqIE.measType )
4662 {
4663 case SIR_MAC_BASIC_MEASUREMENT_TYPE:
4664 nSirStatus =
4665 PopulateDot11fMeasurementReport0( pMac, pMeasReqFrame,
4666 &frm.MeasurementReport );
4667 break;
4668 case SIR_MAC_CCA_MEASUREMENT_TYPE:
4669 nSirStatus =
4670 PopulateDot11fMeasurementReport1( pMac, pMeasReqFrame,
4671 &frm.MeasurementReport );
4672 break;
4673 case SIR_MAC_RPI_MEASUREMENT_TYPE:
4674 nSirStatus =
4675 PopulateDot11fMeasurementReport2( pMac, pMeasReqFrame,
4676 &frm.MeasurementReport );
4677 break;
4678 default:
4679 limLog( pMac, LOGE, FL("Unknown measurement type %d in limSen"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004680 "dMeasReportFrame."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004681 pMeasReqFrame->measReqIE.measType );
4682 return eSIR_FAILURE;
4683 }
4684
4685 if ( eSIR_SUCCESS != nSirStatus ) return eSIR_FAILURE;
4686
4687 nStatus = dot11fGetPackedMeasurementReportSize( pMac, &frm, &nPayload );
4688 if ( DOT11F_FAILED( nStatus ) )
4689 {
4690 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004691 "or a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004692 nStatus );
4693 // We'll fall back on the worst case scenario:
4694 nPayload = sizeof( tDot11fMeasurementReport );
4695 }
4696 else if ( DOT11F_WARNED( nStatus ) )
4697 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004698 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004699 "the packed size for a Measurement Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004700 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004701 }
4702
4703 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4704
4705 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4706 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4707 {
4708 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a De-"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004709 "Authentication."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004710 return eSIR_FAILURE;
4711 }
4712
4713 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304714 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004715
4716 // Next, we fill out the buffer descriptor:
4717 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4718 SIR_MAC_MGMT_ACTION, peer);
4719 if ( eSIR_SUCCESS != nSirStatus )
4720 {
4721 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004722 "tor for a Measurement Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004723 nSirStatus );
4724 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4725 return eSIR_FAILURE; // just allocated...
4726 }
4727
4728 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4729
4730 nCfg = 6;
4731 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4732 if ( eSIR_SUCCESS != nSirStatus )
4733 {
4734 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004735 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004736 nSirStatus );
4737 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4738 return eSIR_FAILURE; // just allocated...
4739 }
4740
Chet Lanctot186b5732013-03-18 10:26:30 -07004741#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004742 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004743#endif
4744
Jeff Johnson295189b2012-06-20 16:38:30 -07004745 nStatus = dot11fPackMeasurementReport( pMac, &frm, pFrame +
4746 sizeof(tSirMacMgmtHdr),
4747 nPayload, &nPayload );
4748 if ( DOT11F_FAILED( nStatus ) )
4749 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004750 limLog( pMac, LOGE, FL("Failed to pack a Measurement Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004751 nStatus );
4752 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4753 return eSIR_FAILURE; // allocated!
4754 }
4755 else if ( DOT11F_WARNED( nStatus ) )
4756 {
4757 limLog( pMac, LOGW, FL("There were warnings while packing a M"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004758 "easurement Report (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004759 }
4760
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304761 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4762 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4763 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07004764 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4765 HAL_TXRX_FRM_802_11_MGMT,
4766 ANI_TXDIR_TODS,
4767 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4768 limTxComplete, pFrame, 0 );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304769 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4770 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4771 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07004772 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4773 {
4774 limLog( pMac, LOGE, FL("Failed to send a Measurement Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004775 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 nSirStatus );
4777 //Pkt will be freed up by the callback
4778 return eSIR_FAILURE; // just allocated...
4779 }
4780
4781 return eSIR_SUCCESS;
4782
4783} // End limSendMeasReportFrame.
4784
4785
4786/**
4787 * \brief Send a TPC Request Action frame
4788 *
4789 *
4790 * \param pMac Pointer to the global MAC datastructure
4791 *
4792 * \param peer MAC address to which the frame should be sent
4793 *
4794 *
4795 */
4796
4797void
4798limSendTpcRequestFrame(tpAniSirGlobal pMac,
4799 tSirMacAddr peer)
4800{
4801 tDot11fTPCRequest frm;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304802 tANI_U8 *pFrame;
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 tSirRetStatus nSirStatus;
4804 tpSirMacMgmtHdr pMacHdr;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304805 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4806 void *pPacket;
4807 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004808
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304809 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004810
4811 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4812 frm.Action.action = SIR_MAC_ACTION_TPC_REQUEST_ID;
4813 frm.DialogToken.token = 1;
4814 frm.TPCRequest.present = 1;
4815
4816 nStatus = dot11fGetPackedTPCRequestSize( pMac, &frm, &nPayload );
4817 if ( DOT11F_FAILED( nStatus ) )
4818 {
4819 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004820 "or a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004821 nStatus );
4822 // We'll fall back on the worst case scenario:
4823 nPayload = sizeof( tDot11fTPCRequest );
4824 }
4825 else if ( DOT11F_WARNED( nStatus ) )
4826 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004827 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 "the packed size for a TPC Request (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004829 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004830 }
4831
4832 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4833
4834 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4835 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4836 {
4837 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004838 " Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004839 return;
4840 }
4841
4842 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304843 vos_mem_set(pFrame, nBytes,0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004844
4845 // Next, we fill out the buffer descriptor:
4846 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4847 SIR_MAC_MGMT_ACTION, peer);
4848 if ( eSIR_SUCCESS != nSirStatus )
4849 {
4850 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004851 "tor for a TPC Request (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 nSirStatus );
4853 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4854 return; // just allocated...
4855 }
4856
4857 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4858
4859 nCfg = 6;
4860 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4861 if ( eSIR_SUCCESS != nSirStatus )
4862 {
4863 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004864 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 nSirStatus );
4866 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4867 return; // just allocated...
4868 }
4869
Chet Lanctot186b5732013-03-18 10:26:30 -07004870#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07004871 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07004872#endif
4873
Jeff Johnson295189b2012-06-20 16:38:30 -07004874 nStatus = dot11fPackTPCRequest( pMac, &frm, pFrame +
4875 sizeof(tSirMacMgmtHdr),
4876 nPayload, &nPayload );
4877 if ( DOT11F_FAILED( nStatus ) )
4878 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004879 limLog( pMac, LOGE, FL("Failed to pack a TPC Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004880 nStatus );
4881 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4882 return; // allocated!
4883 }
4884 else if ( DOT11F_WARNED( nStatus ) )
4885 {
4886 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004887 "PC Request (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 }
4889
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304890 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
4891 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4892 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07004893 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
4894 HAL_TXRX_FRM_802_11_MGMT,
4895 ANI_TXDIR_TODS,
4896 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
4897 limTxComplete, pFrame, 0 );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05304898 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
4899 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
4900 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4902 {
4903 limLog( pMac, LOGE, FL("Failed to send a TPC Request "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004904 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004905 nSirStatus );
4906 //Pkt will be freed up by the callback
4907 return;
4908 }
4909
4910} // End limSendTpcRequestFrame.
4911
4912
4913/**
4914 * \brief Send a TPC Report Action frame
4915 *
4916 *
4917 * \param pMac Pointer to the global MAC datastructure
4918 *
4919 * \param pTpcReqFrame Pointer to the received TPC Request
4920 *
4921 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
4922 *
4923 *
4924 */
4925
4926tSirRetStatus
4927limSendTpcReportFrame(tpAniSirGlobal pMac,
4928 tpSirMacTpcReqActionFrame pTpcReqFrame,
4929 tSirMacAddr peer)
4930{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05304931 tDot11fTPCReport frm;
4932 tANI_U8 *pFrame;
4933 tSirRetStatus nSirStatus;
4934 tpSirMacMgmtHdr pMacHdr;
4935 tANI_U32 nBytes, nPayload, nStatus, nCfg;
4936 void *pPacket;
4937 eHalStatus halstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07004938
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304939 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004940
4941 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
4942 frm.Action.action = SIR_MAC_ACTION_TPC_REPORT_ID;
4943 frm.DialogToken.token = pTpcReqFrame->actionHeader.dialogToken;
4944
4945 // FramesToDo: On the Gen4_TVM branch, there was a comment:
4946 // "misplaced this function, need to replace:
4947 // txPower = halGetRateToPwrValue(pMac, staid,
4948 // pMac->lim.gLimCurrentChannelId, 0);
4949 frm.TPCReport.tx_power = 0;
4950 frm.TPCReport.link_margin = 0;
4951 frm.TPCReport.present = 1;
4952
4953 nStatus = dot11fGetPackedTPCReportSize( pMac, &frm, &nPayload );
4954 if ( DOT11F_FAILED( nStatus ) )
4955 {
4956 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004957 "or a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004958 nStatus );
4959 // We'll fall back on the worst case scenario:
4960 nPayload = sizeof( tDot11fTPCReport );
4961 }
4962 else if ( DOT11F_WARNED( nStatus ) )
4963 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08004964 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07004965 "the packed size for a TPC Report (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004966 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07004967 }
4968
4969 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
4970
4971 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
4972 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
4973 {
4974 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004975 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004976 return eSIR_FAILURE;
4977 }
4978
4979 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05304980 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004981
4982 // Next, we fill out the buffer descriptor:
4983 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
4984 SIR_MAC_MGMT_ACTION, peer);
4985 if ( eSIR_SUCCESS != nSirStatus )
4986 {
4987 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07004988 "tor for a TPC Report (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004989 nSirStatus );
4990 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
4991 return eSIR_FAILURE; // just allocated...
4992 }
4993
4994 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
4995
4996 nCfg = 6;
4997 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
4998 if ( eSIR_SUCCESS != nSirStatus )
4999 {
5000 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005001 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005002 nSirStatus );
5003 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5004 return eSIR_FAILURE; // just allocated...
5005 }
5006
Chet Lanctot186b5732013-03-18 10:26:30 -07005007#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005008 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005009#endif
5010
Jeff Johnson295189b2012-06-20 16:38:30 -07005011 nStatus = dot11fPackTPCReport( pMac, &frm, pFrame +
5012 sizeof(tSirMacMgmtHdr),
5013 nPayload, &nPayload );
5014 if ( DOT11F_FAILED( nStatus ) )
5015 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005016 limLog( pMac, LOGE, FL("Failed to pack a TPC Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005017 nStatus );
5018 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5019 return eSIR_FAILURE; // allocated!
5020 }
5021 else if ( DOT11F_WARNED( nStatus ) )
5022 {
5023 limLog( pMac, LOGW, FL("There were warnings while packing a T"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005024 "PC Report (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005025 }
5026
5027
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305028 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5029 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
5030 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5032 HAL_TXRX_FRM_802_11_MGMT,
5033 ANI_TXDIR_TODS,
5034 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5035 limTxComplete, pFrame, 0 );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305036 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5037 ((psessionEntry)? psessionEntry->peSessionId : NO_SESSION),
5038 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07005039 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5040 {
5041 limLog( pMac, LOGE, FL("Failed to send a TPC Report "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005042 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005043 nSirStatus );
5044 //Pkt will be freed up by the callback
5045 return eSIR_FAILURE; // just allocated...
5046 }
5047
5048 return eSIR_SUCCESS;
5049
5050} // End limSendTpcReportFrame.
5051#endif //ANI_SUPPORT_11H
5052
5053
Jeff Johnson295189b2012-06-20 16:38:30 -07005054/**
5055 * \brief Send a Channel Switch Announcement
5056 *
5057 *
5058 * \param pMac Pointer to the global MAC datastructure
5059 *
5060 * \param peer MAC address to which this frame will be sent
5061 *
5062 * \param nMode
5063 *
5064 * \param nNewChannel
5065 *
5066 * \param nCount
5067 *
5068 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5069 *
5070 *
5071 */
5072
5073tSirRetStatus
5074limSendChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
5075 tSirMacAddr peer,
Jeff Johnsone7245742012-09-05 17:12:55 -07005076 tANI_U8 nMode,
5077 tANI_U8 nNewChannel,
5078 tANI_U8 nCount,
5079 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07005080{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305081 tDot11fChannelSwitch frm;
5082 tANI_U8 *pFrame;
5083 tSirRetStatus nSirStatus;
5084 tpSirMacMgmtHdr pMacHdr;
5085 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
5086 void *pPacket;
5087 eHalStatus halstatus;
5088 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005089
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305090 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005091
5092 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
5093 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
5094 frm.ChanSwitchAnn.switchMode = nMode;
5095 frm.ChanSwitchAnn.newChannel = nNewChannel;
5096 frm.ChanSwitchAnn.switchCount = nCount;
5097 frm.ChanSwitchAnn.present = 1;
5098
5099 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
5100 if ( DOT11F_FAILED( nStatus ) )
5101 {
5102 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005103 "or a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005104 nStatus );
5105 // We'll fall back on the worst case scenario:
5106 nPayload = sizeof( tDot11fChannelSwitch );
5107 }
5108 else if ( DOT11F_WARNED( nStatus ) )
5109 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005110 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07005111 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005112 "%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005113 }
5114
5115 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5116
5117 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5118 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5119 {
5120 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005121 " Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005122 return eSIR_FAILURE;
5123 }
5124
5125 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305126 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005127
5128 // Next, we fill out the buffer descriptor:
5129 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
Jeff Johnsone7245742012-09-05 17:12:55 -07005130 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
5131 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305132 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
5133 (tANI_U8 *) psessionEntry->bssId,
5134 sizeof( tSirMacAddr ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005135 if ( eSIR_SUCCESS != nSirStatus )
5136 {
5137 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005138 "tor for a Channel Switch (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 nSirStatus );
5140 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5141 return eSIR_FAILURE; // just allocated...
5142 }
5143
Jeff Johnsone7245742012-09-05 17:12:55 -07005144#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07005145 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
5146
5147 nCfg = 6;
5148 nSirStatus = wlan_cfgGetStr( pMac, WNI_CFG_BSSID, pMacHdr->bssId, &nCfg );
5149 if ( eSIR_SUCCESS != nSirStatus )
5150 {
5151 limLog( pMac, LOGE, FL("Failed to retrieve WNI_CFG_BSSID from"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005152 " CFG (%d)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005153 nSirStatus );
5154 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5155 return eSIR_FAILURE; // just allocated...
5156 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005157#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07005158
5159#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005160 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005161#endif
5162
Jeff Johnson295189b2012-06-20 16:38:30 -07005163 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
5164 sizeof(tSirMacMgmtHdr),
5165 nPayload, &nPayload );
5166 if ( DOT11F_FAILED( nStatus ) )
5167 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005168 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005169 nStatus );
5170 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5171 return eSIR_FAILURE; // allocated!
5172 }
5173 else if ( DOT11F_WARNED( nStatus ) )
5174 {
5175 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005176 "hannel Switch (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005177 }
5178
Jeff Johnsone7245742012-09-05 17:12:55 -07005179 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnsone7245742012-09-05 17:12:55 -07005180 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5181 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnsone7245742012-09-05 17:12:55 -07005182 )
5183 {
5184 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5185 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305186
5187 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5188 psessionEntry->peSessionId,
5189 pMacHdr->fc.subType));
Jeff Johnson295189b2012-06-20 16:38:30 -07005190 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5191 HAL_TXRX_FRM_802_11_MGMT,
5192 ANI_TXDIR_TODS,
5193 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
Jeff Johnsone7245742012-09-05 17:12:55 -07005194 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305195 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5196 psessionEntry->peSessionId,
5197 halstatus));
Jeff Johnson295189b2012-06-20 16:38:30 -07005198 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5199 {
5200 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005201 "(%X)!"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005202 nSirStatus );
5203 //Pkt will be freed up by the callback
5204 return eSIR_FAILURE;
5205 }
5206
5207 return eSIR_SUCCESS;
5208
5209} // End limSendChannelSwitchMgmtFrame.
5210
Jeff Johnson295189b2012-06-20 16:38:30 -07005211
5212
Mohit Khanna4a70d262012-09-11 16:30:12 -07005213#ifdef WLAN_FEATURE_11AC
5214tSirRetStatus
5215limSendVHTOpmodeNotificationFrame(tpAniSirGlobal pMac,
5216 tSirMacAddr peer,
5217 tANI_U8 nMode,
5218 tpPESession psessionEntry )
5219{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305220 tDot11fOperatingMode frm;
5221 tANI_U8 *pFrame;
5222 tSirRetStatus nSirStatus;
5223 tpSirMacMgmtHdr pMacHdr;
5224 tANI_U32 nBytes, nPayload = 0, nStatus;//, nCfg;
5225 void *pPacket;
5226 eHalStatus halstatus;
5227 tANI_U32 txFlag = 0;
Mohit Khanna4a70d262012-09-11 16:30:12 -07005228
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305229 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005230
5231 frm.Category.category = SIR_MAC_ACTION_VHT;
5232 frm.Action.action = SIR_MAC_VHT_OPMODE_NOTIFICATION;
5233 frm.OperatingMode.chanWidth = nMode;
5234 frm.OperatingMode.rxNSS = 0;
5235 frm.OperatingMode.rxNSSType = 0;
5236
5237 nStatus = dot11fGetPackedOperatingModeSize( pMac, &frm, &nPayload );
5238 if ( DOT11F_FAILED( nStatus ) )
5239 {
5240 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005241 "or a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005242 nStatus );
5243 // We'll fall back on the worst case scenario:
5244 nPayload = sizeof( tDot11fOperatingMode);
5245 }
5246 else if ( DOT11F_WARNED( nStatus ) )
5247 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005248 limLog( pMac, LOGW, FL("There were warnings while calculating "
Mohit Khanna4a70d262012-09-11 16:30:12 -07005249 "the packed size for a Operating Mode (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005250 "%08x)."), nStatus );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005251 }
5252
5253 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5254
5255 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5256 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5257 {
5258 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Operating Mode"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005259 " Report."), nBytes );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005260 return eSIR_FAILURE;
5261 }
5262
5263 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305264 vos_mem_set( pFrame, nBytes, 0 );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005265
5266
5267 // Next, we fill out the buffer descriptor:
5268 if(psessionEntry->pePersona == VOS_STA_SAP_MODE) {
5269 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
5270 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
5271 } else
5272 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
5273 SIR_MAC_MGMT_ACTION, psessionEntry->bssId, psessionEntry->selfMacAddr);
5274 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305275 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
5276 (tANI_U8 *) psessionEntry->bssId,
5277 sizeof( tSirMacAddr ));
Mohit Khanna4a70d262012-09-11 16:30:12 -07005278 if ( eSIR_SUCCESS != nSirStatus )
5279 {
5280 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005281 "tor for a Operating Mode (%d)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005282 nSirStatus );
5283 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5284 return eSIR_FAILURE; // just allocated...
5285 }
5286 nStatus = dot11fPackOperatingMode( pMac, &frm, pFrame +
5287 sizeof(tSirMacMgmtHdr),
5288 nPayload, &nPayload );
5289 if ( DOT11F_FAILED( nStatus ) )
5290 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005291 limLog( pMac, LOGE, FL("Failed to pack a Operating Mode (0x%08x)."),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005292 nStatus );
5293 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5294 return eSIR_FAILURE; // allocated!
5295 }
5296 else if ( DOT11F_WARNED( nStatus ) )
5297 {
5298 limLog( pMac, LOGW, FL("There were warnings while packing a Operating Mode"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005299 " (0x%08x)."), nStatus );
Mohit Khanna4a70d262012-09-11 16:30:12 -07005300 }
5301 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Mohit Khanna4a70d262012-09-11 16:30:12 -07005302 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5303 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Mohit Khanna4a70d262012-09-11 16:30:12 -07005304 )
5305 {
5306 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5307 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305308
5309 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5310 psessionEntry->peSessionId,
5311 pMacHdr->fc.subType));
Mohit Khanna4a70d262012-09-11 16:30:12 -07005312 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5313 HAL_TXRX_FRM_802_11_MGMT,
5314 ANI_TXDIR_TODS,
5315 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5316 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305317 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5318 psessionEntry->peSessionId,
5319 halstatus));
Mohit Khanna4a70d262012-09-11 16:30:12 -07005320 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5321 {
5322 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005323 "(%X)!"),
Mohit Khanna4a70d262012-09-11 16:30:12 -07005324 nSirStatus );
5325 //Pkt will be freed up by the callback
5326 return eSIR_FAILURE;
5327 }
5328
5329 return eSIR_SUCCESS;
5330}
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005331
5332/**
5333 * \brief Send a VHT Channel Switch Announcement
5334 *
5335 *
5336 * \param pMac Pointer to the global MAC datastructure
5337 *
5338 * \param peer MAC address to which this frame will be sent
5339 *
5340 * \param nChanWidth
5341 *
5342 * \param nNewChannel
5343 *
5344 *
5345 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
5346 *
5347 *
5348 */
5349
5350tSirRetStatus
5351limSendVHTChannelSwitchMgmtFrame(tpAniSirGlobal pMac,
5352 tSirMacAddr peer,
5353 tANI_U8 nChanWidth,
5354 tANI_U8 nNewChannel,
5355 tANI_U8 ncbMode,
5356 tpPESession psessionEntry )
5357{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305358 tDot11fChannelSwitch frm;
5359 tANI_U8 *pFrame;
5360 tSirRetStatus nSirStatus;
5361 tpSirMacMgmtHdr pMacHdr;
5362 tANI_U32 nBytes, nPayload, nStatus;//, nCfg;
5363 void *pPacket;
5364 eHalStatus halstatus;
5365 tANI_U32 txFlag = 0;
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005366
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305367 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005368
5369
5370 frm.Category.category = SIR_MAC_ACTION_SPECTRUM_MGMT;
5371 frm.Action.action = SIR_MAC_ACTION_CHANNEL_SWITCH_ID;
5372 frm.ChanSwitchAnn.switchMode = 1;
5373 frm.ChanSwitchAnn.newChannel = nNewChannel;
5374 frm.ChanSwitchAnn.switchCount = 1;
5375 frm.ExtChanSwitchAnn.secondaryChannelOffset = limGetHTCBState(ncbMode);
5376 frm.ExtChanSwitchAnn.present = 1;
5377 frm.WiderBWChanSwitchAnn.newChanWidth = nChanWidth;
5378 frm.WiderBWChanSwitchAnn.newCenterChanFreq0 = limGetCenterChannel(pMac,nNewChannel,ncbMode,nChanWidth);
5379 frm.WiderBWChanSwitchAnn.newCenterChanFreq1 = 0;
5380 frm.ChanSwitchAnn.present = 1;
5381 frm.WiderBWChanSwitchAnn.present = 1;
5382
5383 nStatus = dot11fGetPackedChannelSwitchSize( pMac, &frm, &nPayload );
5384 if ( DOT11F_FAILED( nStatus ) )
5385 {
5386 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005387 "or a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005388 nStatus );
5389 // We'll fall back on the worst case scenario:
5390 nPayload = sizeof( tDot11fChannelSwitch );
5391 }
5392 else if ( DOT11F_WARNED( nStatus ) )
5393 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005394 limLog( pMac, LOGW, FL("There were warnings while calculating "
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005395 "the packed size for a Channel Switch (0x"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005396 "%08x)."), nStatus );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005397 }
5398
5399 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
5400
5401 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
5402 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5403 {
5404 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a TPC"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005405 " Report."), nBytes );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005406 return eSIR_FAILURE;
5407 }
5408 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305409 vos_mem_set( pFrame, nBytes, 0 );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005410
5411 // Next, we fill out the buffer descriptor:
5412 nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME,
5413 SIR_MAC_MGMT_ACTION, peer, psessionEntry->selfMacAddr);
5414 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305415 vos_mem_copy( (tANI_U8 *) pMacHdr->bssId,
5416 (tANI_U8 *) psessionEntry->bssId,
5417 sizeof( tSirMacAddr ));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005418 if ( eSIR_SUCCESS != nSirStatus )
5419 {
5420 limLog( pMac, LOGE, FL("Failed to populate the buffer descrip"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005421 "tor for a Channel Switch (%d)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005422 nSirStatus );
5423 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5424 return eSIR_FAILURE; // just allocated...
5425 }
5426 nStatus = dot11fPackChannelSwitch( pMac, &frm, pFrame +
5427 sizeof(tSirMacMgmtHdr),
5428 nPayload, &nPayload );
5429 if ( DOT11F_FAILED( nStatus ) )
5430 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005431 limLog( pMac, LOGE, FL("Failed to pack a Channel Switch (0x%08x)."),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005432 nStatus );
5433 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
5434 return eSIR_FAILURE; // allocated!
5435 }
5436 else if ( DOT11F_WARNED( nStatus ) )
5437 {
5438 limLog( pMac, LOGW, FL("There were warnings while packing a C"
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005439 "hannel Switch (0x%08x)."), nStatus );
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005440 }
5441
5442 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005443 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5444 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005445 )
5446 {
5447 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5448 }
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305449
5450 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5451 psessionEntry->peSessionId,
5452 pMacHdr->fc.subType));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005453 halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) nBytes,
5454 HAL_TXRX_FRM_802_11_MGMT,
5455 ANI_TXDIR_TODS,
5456 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5457 limTxComplete, pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305458 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5459 psessionEntry->peSessionId,
5460 halstatus));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005461 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
5462 {
5463 limLog( pMac, LOGE, FL("Failed to send a Channel Switch "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005464 "(%X)!"),
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07005465 nSirStatus );
5466 //Pkt will be freed up by the callback
5467 return eSIR_FAILURE;
5468 }
5469
5470 return eSIR_SUCCESS;
5471
5472} // End limSendVHTChannelSwitchMgmtFrame.
5473
5474
5475
Mohit Khanna4a70d262012-09-11 16:30:12 -07005476#endif
5477
Jeff Johnson295189b2012-06-20 16:38:30 -07005478/**
5479 * \brief Send an ADDBA Req Action Frame to peer
5480 *
5481 * \sa limSendAddBAReq
5482 *
5483 * \param pMac The global tpAniSirGlobal object
5484 *
5485 * \param pMlmAddBAReq A pointer to tLimMlmAddBAReq. This contains
5486 * the necessary parameters reqd by PE send the ADDBA Req Action
5487 * Frame to the peer
5488 *
5489 * \return eSIR_SUCCESS if setup completes successfully
5490 * eSIR_FAILURE is some problem is encountered
5491 */
5492tSirRetStatus limSendAddBAReq( tpAniSirGlobal pMac,
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305493 tpLimMlmAddBAReq pMlmAddBAReq, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07005494{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305495 tDot11fAddBAReq frmAddBAReq;
5496 tANI_U8 *pAddBAReqBuffer = NULL;
5497 tpSirMacMgmtHdr pMacHdr;
5498 tANI_U32 frameLen = 0, nStatus, nPayload;
5499 tSirRetStatus statusCode;
5500 eHalStatus halStatus;
5501 void *pPacket;
5502 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005503
5504 if(NULL == psessionEntry)
5505 {
5506 return eSIR_FAILURE;
5507 }
5508
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305509 vos_mem_set( (void *) &frmAddBAReq, sizeof( frmAddBAReq ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005510
5511 // Category - 3 (BA)
5512 frmAddBAReq.Category.category = SIR_MAC_ACTION_BLKACK;
5513
5514 // Action - 0 (ADDBA Req)
5515 frmAddBAReq.Action.action = SIR_MAC_BLKACK_ADD_REQ;
5516
5517 // FIXME - Dialog Token, generalize this...
5518 frmAddBAReq.DialogToken.token = pMlmAddBAReq->baDialogToken;
5519
5520 // Fill the ADDBA Parameter Set
5521 frmAddBAReq.AddBAParameterSet.tid = pMlmAddBAReq->baTID;
5522 frmAddBAReq.AddBAParameterSet.policy = pMlmAddBAReq->baPolicy;
5523 frmAddBAReq.AddBAParameterSet.bufferSize = pMlmAddBAReq->baBufferSize;
5524
5525 // BA timeout
5526 // 0 - indicates no BA timeout
5527 frmAddBAReq.BATimeout.timeout = pMlmAddBAReq->baTimeout;
5528
Abhishek Singh1f6e6532014-06-05 17:35:08 +05305529 /* Send SSN whatever we get from FW.
5530 */
5531 frmAddBAReq.BAStartingSequenceControl.ssn = pMlmAddBAReq->baSSN;
Jeff Johnson295189b2012-06-20 16:38:30 -07005532
5533 nStatus = dot11fGetPackedAddBAReqSize( pMac, &frmAddBAReq, &nPayload );
5534
5535 if( DOT11F_FAILED( nStatus ))
5536 {
5537 limLog( pMac, LOGW,
5538 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005539 "an ADDBA Request (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005540 nStatus );
5541
5542 // We'll fall back on the worst case scenario:
5543 nPayload = sizeof( tDot11fAddBAReq );
5544 }
5545 else if( DOT11F_WARNED( nStatus ))
5546 {
5547 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005548 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005549 "the packed size for an ADDBA Req (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005550 nStatus );
5551 }
5552
5553 // Add the MGMT header to frame length
5554 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5555
5556 // Need to allocate a buffer for ADDBA AF
5557 if( eHAL_STATUS_SUCCESS !=
5558 (halStatus = palPktAlloc( pMac->hHdd,
5559 HAL_TXRX_FRM_802_11_MGMT,
5560 (tANI_U16) frameLen,
5561 (void **) &pAddBAReqBuffer,
5562 (void **) &pPacket )))
5563 {
5564 // Log error
5565 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005566 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005567 frameLen,
5568 halStatus );
5569
5570 statusCode = eSIR_MEM_ALLOC_FAILED;
5571 goto returnAfterError;
5572 }
5573
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305574 vos_mem_set( (void *) pAddBAReqBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005575
5576 // Copy necessary info to BD
5577 if( eSIR_SUCCESS !=
5578 (statusCode = limPopulateMacHeader( pMac,
5579 pAddBAReqBuffer,
5580 SIR_MAC_MGMT_FRAME,
5581 SIR_MAC_MGMT_ACTION,
5582 pMlmAddBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
5583 goto returnAfterError;
5584
5585 // Update A3 with the BSSID
5586 pMacHdr = ( tpSirMacMgmtHdr ) pAddBAReqBuffer;
5587
5588 #if 0
5589 cfgLen = SIR_MAC_ADDR_LENGTH;
5590 if( eSIR_SUCCESS != cfgGetStr( pMac,
5591 WNI_CFG_BSSID,
5592 (tANI_U8 *) pMacHdr->bssId,
5593 &cfgLen ))
5594 {
5595 limLog( pMac, LOGP,
5596 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005597 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005598
5599 // FIXME - Need to convert to tSirRetStatus
5600 statusCode = eSIR_FAILURE;
5601 goto returnAfterError;
5602 }
5603 #endif//TO SUPPORT BT-AMP
5604 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5605
Chet Lanctot186b5732013-03-18 10:26:30 -07005606#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005607 limSetProtectedBit(pMac, psessionEntry, pMlmAddBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005608#endif
5609
Jeff Johnson295189b2012-06-20 16:38:30 -07005610 // Now, we're ready to "pack" the frames
5611 nStatus = dot11fPackAddBAReq( pMac,
5612 &frmAddBAReq,
5613 pAddBAReqBuffer + sizeof( tSirMacMgmtHdr ),
5614 nPayload,
5615 &nPayload );
5616
5617 if( DOT11F_FAILED( nStatus ))
5618 {
5619 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005620 FL( "Failed to pack an ADDBA Req (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005621 nStatus );
5622
5623 // FIXME - Need to convert to tSirRetStatus
5624 statusCode = eSIR_FAILURE;
5625 goto returnAfterError;
5626 }
5627 else if( DOT11F_WARNED( nStatus ))
5628 {
5629 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005630 FL( "There were warnings while packing an ADDBA Req (0x%08x)."),
5631 nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07005632 }
5633
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05305634 limLog( pMac, LOG1, FL( "Sending an ADDBA REQ to "MAC_ADDRESS_STR " with"
5635 " tid = %d policy = %d buffsize = %d "
5636 " amsduSupported = %d"),
5637 MAC_ADDR_ARRAY(pMlmAddBAReq->peerMacAddr),
5638 frmAddBAReq.AddBAParameterSet.tid,
5639 frmAddBAReq.AddBAParameterSet.policy,
5640 frmAddBAReq.AddBAParameterSet.bufferSize,
5641 frmAddBAReq.AddBAParameterSet.amsduSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -07005642
Abhishek Singh1f6e6532014-06-05 17:35:08 +05305643 limLog( pMac, LOG1, FL( "ssn = %d fragNum = %d" ),
5644 frmAddBAReq.BAStartingSequenceControl.ssn,
5645 frmAddBAReq.BAStartingSequenceControl.fragNumber);
5646
Jeff Johnson295189b2012-06-20 16:38:30 -07005647 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005648 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5649 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005650 )
5651 {
5652 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5653 }
5654
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305655 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5656 psessionEntry->peSessionId,
5657 pMacHdr->fc.subType));
5658 halStatus = halTxFrame( pMac,
5659 pPacket,
5660 (tANI_U16) frameLen,
5661 HAL_TXRX_FRM_802_11_MGMT,
5662 ANI_TXDIR_TODS,
5663 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5664 limTxComplete,
5665 pAddBAReqBuffer, txFlag );
5666 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5667 psessionEntry->peSessionId,
5668 halStatus));
5669 if( eHAL_STATUS_SUCCESS != halStatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07005670 {
5671 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005672 FL( "halTxFrame FAILED! Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005673 halStatus );
5674
5675 // FIXME - Need to convert eHalStatus to tSirRetStatus
5676 statusCode = eSIR_FAILURE;
5677 //Pkt will be freed up by the callback
5678 return statusCode;
5679 }
5680 else
5681 return eSIR_SUCCESS;
5682
5683returnAfterError:
5684
5685 // Release buffer, if allocated
5686 if( NULL != pAddBAReqBuffer )
5687 palPktFree( pMac->hHdd,
5688 HAL_TXRX_FRM_802_11_MGMT,
5689 (void *) pAddBAReqBuffer,
5690 (void *) pPacket );
5691
5692 return statusCode;
5693}
5694
5695/**
5696 * \brief Send an ADDBA Rsp Action Frame to peer
5697 *
5698 * \sa limSendAddBARsp
5699 *
5700 * \param pMac The global tpAniSirGlobal object
5701 *
5702 * \param pMlmAddBARsp A pointer to tLimMlmAddBARsp. This contains
5703 * the necessary parameters reqd by PE send the ADDBA Rsp Action
5704 * Frame to the peer
5705 *
5706 * \return eSIR_SUCCESS if setup completes successfully
5707 * eSIR_FAILURE is some problem is encountered
5708 */
5709tSirRetStatus limSendAddBARsp( tpAniSirGlobal pMac,
5710 tpLimMlmAddBARsp pMlmAddBARsp,
5711 tpPESession psessionEntry)
5712{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305713 tDot11fAddBARsp frmAddBARsp;
5714 tANI_U8 *pAddBARspBuffer = NULL;
5715 tpSirMacMgmtHdr pMacHdr;
5716 tANI_U32 frameLen = 0, nStatus, nPayload;
5717 tSirRetStatus statusCode;
5718 eHalStatus halStatus;
5719 void *pPacket;
5720 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005721
5722 if(NULL == psessionEntry)
5723 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005724 PELOGE(limLog(pMac, LOGE, FL("Session entry is NULL!!!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005725 return eSIR_FAILURE;
5726 }
5727
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305728 vos_mem_set( (void *) &frmAddBARsp, sizeof( frmAddBARsp ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005729
5730 // Category - 3 (BA)
5731 frmAddBARsp.Category.category = SIR_MAC_ACTION_BLKACK;
5732 // Action - 1 (ADDBA Rsp)
5733 frmAddBARsp.Action.action = SIR_MAC_BLKACK_ADD_RSP;
5734
5735 // Should be same as the one we received in the ADDBA Req
5736 frmAddBARsp.DialogToken.token = pMlmAddBARsp->baDialogToken;
5737
5738 // ADDBA Req status
5739 frmAddBARsp.Status.status = pMlmAddBARsp->addBAResultCode;
5740
5741 // Fill the ADDBA Parameter Set as provided by caller
5742 frmAddBARsp.AddBAParameterSet.tid = pMlmAddBARsp->baTID;
5743 frmAddBARsp.AddBAParameterSet.policy = pMlmAddBARsp->baPolicy;
5744 frmAddBARsp.AddBAParameterSet.bufferSize = pMlmAddBARsp->baBufferSize;
krunal soni5afa96c2013-09-06 22:19:02 -07005745
5746 if(psessionEntry->isAmsduSupportInAMPDU)
5747 {
5748 frmAddBARsp.AddBAParameterSet.amsduSupported =
5749 psessionEntry->amsduSupportedInBA;
5750 }
5751 else
5752 {
5753 frmAddBARsp.AddBAParameterSet.amsduSupported = 0;
5754 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005755
5756 // BA timeout
5757 // 0 - indicates no BA timeout
5758 frmAddBARsp.BATimeout.timeout = pMlmAddBARsp->baTimeout;
5759
5760 nStatus = dot11fGetPackedAddBARspSize( pMac, &frmAddBARsp, &nPayload );
5761
5762 if( DOT11F_FAILED( nStatus ))
5763 {
5764 limLog( pMac, LOGW,
5765 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005766 "an ADDBA Response (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005767 nStatus );
5768
5769 // We'll fall back on the worst case scenario:
5770 nPayload = sizeof( tDot11fAddBARsp );
5771 }
5772 else if( DOT11F_WARNED( nStatus ))
5773 {
5774 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005775 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005776 "the packed size for an ADDBA Rsp (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005777 nStatus );
5778 }
5779
5780 // Need to allocate a buffer for ADDBA AF
5781 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5782
5783 // Allocate shared memory
5784 if( eHAL_STATUS_SUCCESS !=
5785 (halStatus = palPktAlloc( pMac->hHdd,
5786 HAL_TXRX_FRM_802_11_MGMT,
5787 (tANI_U16) frameLen,
5788 (void **) &pAddBARspBuffer,
5789 (void **) &pPacket )))
5790 {
5791 // Log error
5792 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005793 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005794 frameLen,
5795 halStatus );
5796
5797 statusCode = eSIR_MEM_ALLOC_FAILED;
5798 goto returnAfterError;
5799 }
5800
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305801 vos_mem_set( (void *) pAddBARspBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005802
5803 // Copy necessary info to BD
5804 if( eSIR_SUCCESS !=
5805 (statusCode = limPopulateMacHeader( pMac,
5806 pAddBARspBuffer,
5807 SIR_MAC_MGMT_FRAME,
5808 SIR_MAC_MGMT_ACTION,
5809 pMlmAddBARsp->peerMacAddr,psessionEntry->selfMacAddr)))
5810 goto returnAfterError;
5811
5812 // Update A3 with the BSSID
5813
5814 pMacHdr = ( tpSirMacMgmtHdr ) pAddBARspBuffer;
5815
5816 #if 0
5817 cfgLen = SIR_MAC_ADDR_LENGTH;
5818 if( eSIR_SUCCESS != wlan_cfgGetStr( pMac,
5819 WNI_CFG_BSSID,
5820 (tANI_U8 *) pMacHdr->bssId,
5821 &cfgLen ))
5822 {
5823 limLog( pMac, LOGP,
5824 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005825 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005826
5827 // FIXME - Need to convert to tSirRetStatus
5828 statusCode = eSIR_FAILURE;
5829 goto returnAfterError;
5830 }
5831 #endif // TO SUPPORT BT-AMP
5832 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
5833
Chet Lanctot186b5732013-03-18 10:26:30 -07005834#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07005835 limSetProtectedBit(pMac, psessionEntry, pMlmAddBARsp->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07005836#endif
5837
Jeff Johnson295189b2012-06-20 16:38:30 -07005838 // Now, we're ready to "pack" the frames
5839 nStatus = dot11fPackAddBARsp( pMac,
5840 &frmAddBARsp,
5841 pAddBARspBuffer + sizeof( tSirMacMgmtHdr ),
5842 nPayload,
5843 &nPayload );
5844
5845 if( DOT11F_FAILED( nStatus ))
5846 {
5847 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005848 FL( "Failed to pack an ADDBA Rsp (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005849 nStatus );
5850
5851 // FIXME - Need to convert to tSirRetStatus
5852 statusCode = eSIR_FAILURE;
5853 goto returnAfterError;
5854 }
5855 else if( DOT11F_WARNED( nStatus ))
5856 {
5857 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005858 FL( "There were warnings while packing an ADDBA Rsp (0x%08x)." ),
5859 nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07005860 }
5861
Abhishek Singh02d9f6c2014-05-12 14:07:53 +05305862 limLog( pMac, LOG1, FL( "Sending an ADDBA RSP to "MAC_ADDRESS_STR " with"
5863 " tid = %d policy = %d buffsize = %d"
5864 " amsduSupported = %d status %d"),
5865 MAC_ADDR_ARRAY(pMlmAddBARsp->peerMacAddr),
5866 frmAddBARsp.AddBAParameterSet.tid,
5867 frmAddBARsp.AddBAParameterSet.policy,
5868 frmAddBARsp.AddBAParameterSet.bufferSize,
5869 frmAddBARsp.AddBAParameterSet.amsduSupported,
5870 frmAddBARsp.Status.status);
5871
Jeff Johnson295189b2012-06-20 16:38:30 -07005872
5873 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07005874 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
5875 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 )
5877 {
5878 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
5879 }
5880
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05305881 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
5882 psessionEntry->peSessionId,
5883 pMacHdr->fc.subType));
5884 halStatus = halTxFrame( pMac,
5885 pPacket,
5886 (tANI_U16) frameLen,
5887 HAL_TXRX_FRM_802_11_MGMT,
5888 ANI_TXDIR_TODS,
5889 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
5890 limTxComplete,
5891 pAddBARspBuffer, txFlag );
5892 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
5893 psessionEntry->peSessionId,
5894 halStatus));
5895 if( eHAL_STATUS_SUCCESS != halStatus )
5896 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005897 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005898 FL( "halTxFrame FAILED! Status [%d]" ),
Jeff Johnson295189b2012-06-20 16:38:30 -07005899 halStatus );
5900
5901 // FIXME - HAL error codes are different from PE error
5902 // codes!! And, this routine is returning tSirRetStatus
5903 statusCode = eSIR_FAILURE;
5904 //Pkt will be freed up by the callback
5905 return statusCode;
5906 }
5907 else
5908 return eSIR_SUCCESS;
5909
5910 returnAfterError:
Jeff Johnson295189b2012-06-20 16:38:30 -07005911 // Release buffer, if allocated
5912 if( NULL != pAddBARspBuffer )
5913 palPktFree( pMac->hHdd,
5914 HAL_TXRX_FRM_802_11_MGMT,
5915 (void *) pAddBARspBuffer,
5916 (void *) pPacket );
5917
5918 return statusCode;
5919}
5920
5921/**
5922 * \brief Send a DELBA Indication Action Frame to peer
5923 *
5924 * \sa limSendDelBAInd
5925 *
5926 * \param pMac The global tpAniSirGlobal object
5927 *
5928 * \param peerMacAddr MAC Address of peer
5929 *
5930 * \param reasonCode Reason for the DELBA notification
5931 *
5932 * \param pBAParameterSet The DELBA Parameter Set.
5933 * This identifies the TID for which the BA session is
5934 * being deleted.
5935 *
5936 * \return eSIR_SUCCESS if setup completes successfully
5937 * eSIR_FAILURE is some problem is encountered
5938 */
5939tSirRetStatus limSendDelBAInd( tpAniSirGlobal pMac,
5940 tpLimMlmDelBAReq pMlmDelBAReq,tpPESession psessionEntry)
5941{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305942 tDot11fDelBAInd frmDelBAInd;
5943 tANI_U8 *pDelBAIndBuffer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07005944 //tANI_U32 val;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05305945 tpSirMacMgmtHdr pMacHdr;
5946 tANI_U32 frameLen = 0, nStatus, nPayload;
5947 tSirRetStatus statusCode;
5948 eHalStatus halStatus;
5949 void *pPacket;
5950 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005951
5952 if(NULL == psessionEntry)
5953 {
5954 return eSIR_FAILURE;
5955 }
5956
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05305957 vos_mem_set( (void *) &frmDelBAInd, sizeof( frmDelBAInd ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07005958
5959 // Category - 3 (BA)
5960 frmDelBAInd.Category.category = SIR_MAC_ACTION_BLKACK;
5961 // Action - 2 (DELBA)
5962 frmDelBAInd.Action.action = SIR_MAC_BLKACK_DEL;
5963
5964 // Fill the DELBA Parameter Set as provided by caller
5965 frmDelBAInd.DelBAParameterSet.tid = pMlmDelBAReq->baTID;
5966 frmDelBAInd.DelBAParameterSet.initiator = pMlmDelBAReq->baDirection;
5967
5968 // BA Starting Sequence Number
5969 // Fragment number will always be zero
5970 frmDelBAInd.Reason.code = pMlmDelBAReq->delBAReasonCode;
5971
5972 nStatus = dot11fGetPackedDelBAIndSize( pMac, &frmDelBAInd, &nPayload );
5973
5974 if( DOT11F_FAILED( nStatus ))
5975 {
5976 limLog( pMac, LOGW,
5977 FL( "Failed to calculate the packed size for "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005978 "an DELBA Indication (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005979 nStatus );
5980
5981 // We'll fall back on the worst case scenario:
5982 nPayload = sizeof( tDot11fDelBAInd );
5983 }
5984 else if( DOT11F_WARNED( nStatus ))
5985 {
5986 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08005987 FL( "There were warnings while calculating "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07005988 "the packed size for an DELBA Ind (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07005989 nStatus );
5990 }
5991
5992 // Add the MGMT header to frame length
5993 frameLen = nPayload + sizeof( tSirMacMgmtHdr );
5994
5995 // Allocate shared memory
5996 if( eHAL_STATUS_SUCCESS !=
5997 (halStatus = palPktAlloc( pMac->hHdd,
5998 HAL_TXRX_FRM_802_11_MGMT,
5999 (tANI_U16) frameLen,
6000 (void **) &pDelBAIndBuffer,
6001 (void **) &pPacket )))
6002 {
6003 // Log error
6004 limLog( pMac, LOGP,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006005 FL("palPktAlloc FAILED! Length [%d], Status [%d]"),
Jeff Johnson295189b2012-06-20 16:38:30 -07006006 frameLen,
6007 halStatus );
6008
6009 statusCode = eSIR_MEM_ALLOC_FAILED;
6010 goto returnAfterError;
6011 }
6012
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306013 vos_mem_set( (void *) pDelBAIndBuffer, frameLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006014
6015 // Copy necessary info to BD
6016 if( eSIR_SUCCESS !=
6017 (statusCode = limPopulateMacHeader( pMac,
6018 pDelBAIndBuffer,
6019 SIR_MAC_MGMT_FRAME,
6020 SIR_MAC_MGMT_ACTION,
6021 pMlmDelBAReq->peerMacAddr,psessionEntry->selfMacAddr)))
6022 goto returnAfterError;
6023
6024 // Update A3 with the BSSID
6025 pMacHdr = ( tpSirMacMgmtHdr ) pDelBAIndBuffer;
6026
6027 #if 0
6028 cfgLen = SIR_MAC_ADDR_LENGTH;
6029 if( eSIR_SUCCESS != cfgGetStr( pMac,
6030 WNI_CFG_BSSID,
6031 (tANI_U8 *) pMacHdr->bssId,
6032 &cfgLen ))
6033 {
6034 limLog( pMac, LOGP,
6035 FL( "Failed to retrieve WNI_CFG_BSSID while"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006036 "sending an ACTION Frame" ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006037
6038 // FIXME - Need to convert to tSirRetStatus
6039 statusCode = eSIR_FAILURE;
6040 goto returnAfterError;
6041 }
6042 #endif //TO SUPPORT BT-AMP
6043 sirCopyMacAddr(pMacHdr->bssId,psessionEntry->bssId);
6044
Chet Lanctot186b5732013-03-18 10:26:30 -07006045#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006046 limSetProtectedBit(pMac, psessionEntry, pMlmDelBAReq->peerMacAddr, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006047#endif
6048
Jeff Johnson295189b2012-06-20 16:38:30 -07006049 // Now, we're ready to "pack" the frames
6050 nStatus = dot11fPackDelBAInd( pMac,
6051 &frmDelBAInd,
6052 pDelBAIndBuffer + sizeof( tSirMacMgmtHdr ),
6053 nPayload,
6054 &nPayload );
6055
6056 if( DOT11F_FAILED( nStatus ))
6057 {
6058 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006059 FL( "Failed to pack an DELBA Ind (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006060 nStatus );
6061
6062 // FIXME - Need to convert to tSirRetStatus
6063 statusCode = eSIR_FAILURE;
6064 goto returnAfterError;
6065 }
6066 else if( DOT11F_WARNED( nStatus ))
6067 {
6068 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006069 FL( "There were warnings while packing an DELBA Ind (0x%08x)." ),
6070 nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07006071 }
6072
Abhishek Singh1f6e6532014-06-05 17:35:08 +05306073 limLog( pMac, LOG1,
6074 FL( "Sending a DELBA IND to: "MAC_ADDRESS_STR" with Tid = %d"
6075 " initiator = %d reason = %d" ),
6076 MAC_ADDR_ARRAY(pMlmDelBAReq->peerMacAddr),
6077 frmDelBAInd.DelBAParameterSet.tid,
6078 frmDelBAInd.DelBAParameterSet.initiator,
6079 frmDelBAInd.Reason.code);
6080
Jeff Johnson295189b2012-06-20 16:38:30 -07006081
6082 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006083 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6084 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006085 )
6086 {
6087 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6088 }
6089
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306090 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6091 psessionEntry->peSessionId,
6092 pMacHdr->fc.subType));
6093 halStatus = halTxFrame( pMac,
6094 pPacket,
6095 (tANI_U16) frameLen,
6096 HAL_TXRX_FRM_802_11_MGMT,
6097 ANI_TXDIR_TODS,
6098 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6099 limTxComplete,
6100 pDelBAIndBuffer, txFlag );
6101 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6102 psessionEntry->peSessionId,
6103 halStatus));
6104 if( eHAL_STATUS_SUCCESS != halStatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006105 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006106 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halStatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006107 statusCode = eSIR_FAILURE;
6108 //Pkt will be freed up by the callback
6109 return statusCode;
6110 }
6111 else
6112 return eSIR_SUCCESS;
6113
6114 returnAfterError:
6115
6116 // Release buffer, if allocated
6117 if( NULL != pDelBAIndBuffer )
6118 palPktFree( pMac->hHdd,
6119 HAL_TXRX_FRM_802_11_MGMT,
6120 (void *) pDelBAIndBuffer,
6121 (void *) pPacket );
6122
6123 return statusCode;
6124}
6125
6126#if defined WLAN_FEATURE_VOWIFI
6127
6128/**
6129 * \brief Send a Neighbor Report Request Action frame
6130 *
6131 *
6132 * \param pMac Pointer to the global MAC structure
6133 *
6134 * \param pNeighborReq Address of a tSirMacNeighborReportReq
6135 *
6136 * \param peer mac address of peer station.
6137 *
6138 * \param psessionEntry address of session entry.
6139 *
6140 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
6141 *
6142 *
6143 */
6144
6145tSirRetStatus
6146limSendNeighborReportRequestFrame(tpAniSirGlobal pMac,
6147 tpSirMacNeighborReportReq pNeighborReq,
6148 tSirMacAddr peer,
6149 tpPESession psessionEntry
6150 )
6151{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306152 tSirRetStatus statusCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006153 tDot11fNeighborReportRequest frm;
6154 tANI_U8 *pFrame;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306155 tpSirMacMgmtHdr pMacHdr;
6156 tANI_U32 nBytes, nPayload, nStatus;
6157 void *pPacket;
6158 eHalStatus halstatus;
6159 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006160
6161 if ( psessionEntry == NULL )
6162 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006163 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Neighbor Report request action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07006164 return eSIR_FAILURE;
6165 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306166 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006167
6168 frm.Category.category = SIR_MAC_ACTION_RRM;
6169 frm.Action.action = SIR_MAC_RRM_NEIGHBOR_REQ;
6170 frm.DialogToken.token = pNeighborReq->dialogToken;
6171
6172
6173 if( pNeighborReq->ssid_present )
6174 {
6175 PopulateDot11fSSID( pMac, &pNeighborReq->ssid, &frm.SSID );
6176 }
6177
6178 nStatus = dot11fGetPackedNeighborReportRequestSize( pMac, &frm, &nPayload );
6179 if ( DOT11F_FAILED( nStatus ) )
6180 {
6181 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006182 "or a Neighbor Report Request(0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006183 nStatus );
6184 // We'll fall back on the worst case scenario:
6185 nPayload = sizeof( tDot11fNeighborReportRequest );
6186 }
6187 else if ( DOT11F_WARNED( nStatus ) )
6188 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006189 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07006190 "the packed size for a Neighbor Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006191 "ort Request(0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006192 }
6193
6194 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6195
6196 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6197 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6198 {
6199 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Neighbor "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006200 "Report Request."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006201 return eSIR_FAILURE;
6202 }
6203
6204 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306205 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006206
6207 // Copy necessary info to BD
6208 if( eSIR_SUCCESS !=
6209 (statusCode = limPopulateMacHeader( pMac,
6210 pFrame,
6211 SIR_MAC_MGMT_FRAME,
6212 SIR_MAC_MGMT_ACTION,
6213 peer, psessionEntry->selfMacAddr)))
6214 goto returnAfterError;
6215
6216 // Update A3 with the BSSID
6217 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6218
6219 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6220
Chet Lanctot186b5732013-03-18 10:26:30 -07006221#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006222 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006223#endif
6224
Jeff Johnson295189b2012-06-20 16:38:30 -07006225 // Now, we're ready to "pack" the frames
6226 nStatus = dot11fPackNeighborReportRequest( pMac,
6227 &frm,
6228 pFrame + sizeof( tSirMacMgmtHdr ),
6229 nPayload,
6230 &nPayload );
6231
6232 if( DOT11F_FAILED( nStatus ))
6233 {
6234 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006235 FL( "Failed to pack an Neighbor Report Request (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006236 nStatus );
6237
6238 // FIXME - Need to convert to tSirRetStatus
6239 statusCode = eSIR_FAILURE;
6240 goto returnAfterError;
6241 }
6242 else if( DOT11F_WARNED( nStatus ))
6243 {
6244 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006245 FL( "There were warnings while packing Neighbor Report "
6246 "Request (0x%08x)." ), nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07006247 }
6248
6249 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006250 FL( "Sending a Neighbor Report Request to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006251 limPrintMacAddr( pMac, peer, LOGW );
6252
6253 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006254 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6255 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006256 )
6257 {
6258 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6259 }
6260
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306261 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6262 psessionEntry->peSessionId,
6263 pMacHdr->fc.subType));
6264 halstatus = halTxFrame( pMac,
6265 pPacket,
6266 (tANI_U16) nBytes,
6267 HAL_TXRX_FRM_802_11_MGMT,
6268 ANI_TXDIR_TODS,
6269 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6270 limTxComplete,
6271 pFrame, txFlag );
6272 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6273 psessionEntry->peSessionId,
6274 halstatus));
6275 if( eHAL_STATUS_SUCCESS != halstatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006276 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006277 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006278 statusCode = eSIR_FAILURE;
6279 //Pkt will be freed up by the callback
6280 return statusCode;
6281 }
6282 else
6283 return eSIR_SUCCESS;
6284
6285returnAfterError:
6286 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6287
6288 return statusCode;
6289} // End limSendNeighborReportRequestFrame.
6290
6291/**
6292 * \brief Send a Link Report Action frame
6293 *
6294 *
6295 * \param pMac Pointer to the global MAC structure
6296 *
6297 * \param pLinkReport Address of a tSirMacLinkReport
6298 *
6299 * \param peer mac address of peer station.
6300 *
6301 * \param psessionEntry address of session entry.
6302 *
6303 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
6304 *
6305 *
6306 */
6307
6308tSirRetStatus
6309limSendLinkReportActionFrame(tpAniSirGlobal pMac,
6310 tpSirMacLinkReport pLinkReport,
6311 tSirMacAddr peer,
6312 tpPESession psessionEntry
6313 )
6314{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306315 tSirRetStatus statusCode = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006316 tDot11fLinkMeasurementReport frm;
6317 tANI_U8 *pFrame;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306318 tpSirMacMgmtHdr pMacHdr;
6319 tANI_U32 nBytes, nPayload, nStatus;
6320 void *pPacket;
6321 eHalStatus halstatus;
6322 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006323
6324
6325 if ( psessionEntry == NULL )
6326 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006327 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Link Report action frame") );
Jeff Johnson295189b2012-06-20 16:38:30 -07006328 return eSIR_FAILURE;
6329 }
6330
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306331 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006332
6333 frm.Category.category = SIR_MAC_ACTION_RRM;
6334 frm.Action.action = SIR_MAC_RRM_LINK_MEASUREMENT_RPT;
6335 frm.DialogToken.token = pLinkReport->dialogToken;
6336
6337
6338 //IEEE Std. 802.11 7.3.2.18. for the report element.
6339 //Even though TPC report an IE, it is represented using fixed fields since it is positioned
6340 //in the middle of other fixed fields in the link report frame(IEEE Std. 802.11k section7.4.6.4
6341 //and frame parser always expects IEs to come after all fixed fields. It is easier to handle
6342 //such case this way than changing the frame parser.
6343 frm.TPCEleID.TPCId = SIR_MAC_TPC_RPT_EID;
6344 frm.TPCEleLen.TPCLen = 2;
6345 frm.TxPower.txPower = pLinkReport->txPower;
6346 frm.LinkMargin.linkMargin = 0;
6347
6348 frm.RxAntennaId.antennaId = pLinkReport->rxAntenna;
6349 frm.TxAntennaId.antennaId = pLinkReport->txAntenna;
6350 frm.RCPI.rcpi = pLinkReport->rcpi;
6351 frm.RSNI.rsni = pLinkReport->rsni;
6352
6353 nStatus = dot11fGetPackedLinkMeasurementReportSize( pMac, &frm, &nPayload );
6354 if ( DOT11F_FAILED( nStatus ) )
6355 {
6356 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006357 "or a Link Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006358 nStatus );
6359 // We'll fall back on the worst case scenario:
6360 nPayload = sizeof( tDot11fLinkMeasurementReport );
6361 }
6362 else if ( DOT11F_WARNED( nStatus ) )
6363 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006364 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07006365 "the packed size for a Link Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006366 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006367 }
6368
6369 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6370
6371 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6372 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6373 {
6374 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Link "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006375 "Report."), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006376 return eSIR_FAILURE;
6377 }
6378
6379 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306380 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006381
6382 // Copy necessary info to BD
6383 if( eSIR_SUCCESS !=
6384 (statusCode = limPopulateMacHeader( pMac,
6385 pFrame,
6386 SIR_MAC_MGMT_FRAME,
6387 SIR_MAC_MGMT_ACTION,
6388 peer, psessionEntry->selfMacAddr)))
6389 goto returnAfterError;
6390
6391 // Update A3 with the BSSID
6392 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6393
6394 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6395
Chet Lanctot186b5732013-03-18 10:26:30 -07006396#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006397 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006398#endif
6399
Jeff Johnson295189b2012-06-20 16:38:30 -07006400 // Now, we're ready to "pack" the frames
6401 nStatus = dot11fPackLinkMeasurementReport( pMac,
6402 &frm,
6403 pFrame + sizeof( tSirMacMgmtHdr ),
6404 nPayload,
6405 &nPayload );
6406
6407 if( DOT11F_FAILED( nStatus ))
6408 {
6409 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006410 FL( "Failed to pack an Link Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006411 nStatus );
6412
6413 // FIXME - Need to convert to tSirRetStatus
6414 statusCode = eSIR_FAILURE;
6415 goto returnAfterError;
6416 }
6417 else if( DOT11F_WARNED( nStatus ))
6418 {
6419 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006420 FL( "There were warnings while packing Link Report (0x%08x)." ),
6421 nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006422 }
6423
6424 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006425 FL( "Sending a Link Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006426 limPrintMacAddr( pMac, peer, LOGW );
6427
6428 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006429 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6430 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006431 )
6432 {
6433 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6434 }
6435
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306436 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6437 psessionEntry->peSessionId,
6438 pMacHdr->fc.subType));
6439 halstatus = halTxFrame( pMac,
6440 pPacket,
6441 (tANI_U16) nBytes,
6442 HAL_TXRX_FRM_802_11_MGMT,
6443 ANI_TXDIR_TODS,
6444 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6445 limTxComplete,
6446 pFrame, txFlag );
6447 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6448 psessionEntry->peSessionId,
6449 halstatus));
6450 if( eHAL_STATUS_SUCCESS != halstatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006451 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006452 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006453 statusCode = eSIR_FAILURE;
6454 //Pkt will be freed up by the callback
6455 return statusCode;
6456 }
6457 else
6458 return eSIR_SUCCESS;
6459
6460returnAfterError:
6461 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6462
6463 return statusCode;
6464} // End limSendLinkReportActionFrame.
6465
6466/**
6467 * \brief Send a Beacon Report Action frame
6468 *
6469 *
6470 * \param pMac Pointer to the global MAC structure
6471 *
6472 * \param dialog_token dialog token to be used in the action frame.
6473 *
6474 * \param num_report number of reports in pRRMReport.
6475 *
6476 * \param pRRMReport Address of a tSirMacRadioMeasureReport.
6477 *
6478 * \param peer mac address of peer station.
6479 *
6480 * \param psessionEntry address of session entry.
6481 *
6482 * \return eSIR_SUCCESS on success, eSIR_FAILURE else
6483 *
6484 *
6485 */
6486
6487tSirRetStatus
6488limSendRadioMeasureReportActionFrame(tpAniSirGlobal pMac,
6489 tANI_U8 dialog_token,
6490 tANI_U8 num_report,
6491 tpSirMacRadioMeasureReport pRRMReport,
6492 tSirMacAddr peer,
6493 tpPESession psessionEntry
6494 )
6495{
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306496 tSirRetStatus statusCode = eSIR_SUCCESS;
6497 tANI_U8 *pFrame;
6498 tpSirMacMgmtHdr pMacHdr;
6499 tANI_U32 nBytes, nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07006500 void *pPacket;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306501 eHalStatus halstatus;
6502 tANI_U8 i;
6503 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006504
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006505 tDot11fRadioMeasurementReport *frm =
6506 vos_mem_malloc(sizeof(tDot11fRadioMeasurementReport));
6507 if (!frm) {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006508 limLog( pMac, LOGE, FL("Not enough memory to allocate tDot11fRadioMeasurementReport") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006509 return eSIR_FAILURE;
6510 }
6511
Jeff Johnson295189b2012-06-20 16:38:30 -07006512 if ( psessionEntry == NULL )
6513 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006514 limLog( pMac, LOGE, FL("(psession == NULL) in Request to send Beacon Report action frame") );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006515 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006516 return eSIR_FAILURE;
6517 }
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306518 vos_mem_set( ( tANI_U8* )frm, sizeof( *frm ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006519
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006520 frm->Category.category = SIR_MAC_ACTION_RRM;
6521 frm->Action.action = SIR_MAC_RRM_RADIO_MEASURE_RPT;
6522 frm->DialogToken.token = dialog_token;
Jeff Johnson295189b2012-06-20 16:38:30 -07006523
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006524 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 -07006525
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006526 for( i = 0 ; i < frm->num_MeasurementReport ; i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07006527 {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006528 frm->MeasurementReport[i].type = pRRMReport[i].type;
6529 frm->MeasurementReport[i].token = pRRMReport[i].token;
6530 frm->MeasurementReport[i].late = 0; //IEEE 802.11k section 7.3.22. (always zero in rrm)
Jeff Johnson295189b2012-06-20 16:38:30 -07006531 switch( pRRMReport[i].type )
6532 {
6533 case SIR_MAC_RRM_BEACON_TYPE:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006534 PopulateDot11fBeaconReport( pMac, &frm->MeasurementReport[i], &pRRMReport[i].report.beaconReport );
6535 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
6536 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
6537 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07006538 break;
6539 default:
Gopichand Nakkala72717fd2013-02-08 12:23:45 +05306540 frm->MeasurementReport[i].incapable = pRRMReport[i].incapable;
6541 frm->MeasurementReport[i].refused = pRRMReport[i].refused;
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006542 frm->MeasurementReport[i].present = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07006543 break;
6544 }
6545 }
6546
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006547 nStatus = dot11fGetPackedRadioMeasurementReportSize( pMac, frm, &nPayload );
Jeff Johnson295189b2012-06-20 16:38:30 -07006548 if ( DOT11F_FAILED( nStatus ) )
6549 {
6550 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006551 "or a Radio Measure Report (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07006552 nStatus );
6553 // We'll fall back on the worst case scenario:
6554 nPayload = sizeof( tDot11fLinkMeasurementReport );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006555 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006556 return eSIR_FAILURE;
6557 }
6558 else if ( DOT11F_WARNED( nStatus ) )
6559 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006560 limLog( pMac, LOGW, FL("There were warnings while calculating "
Jeff Johnson295189b2012-06-20 16:38:30 -07006561 "the packed size for a Radio Measure Rep"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006562 "ort (0x%08x)."), nStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07006563 }
6564
6565 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6566
6567 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6568 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6569 {
6570 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a Radio Measure "
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006571 "Report."), nBytes );
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006572 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006573 return eSIR_FAILURE;
6574 }
6575
6576 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306577 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006578
6579 // Copy necessary info to BD
6580 if( eSIR_SUCCESS !=
6581 (statusCode = limPopulateMacHeader( pMac,
6582 pFrame,
6583 SIR_MAC_MGMT_FRAME,
6584 SIR_MAC_MGMT_ACTION,
6585 peer, psessionEntry->selfMacAddr)))
6586 goto returnAfterError;
6587
6588 // Update A3 with the BSSID
6589 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6590
6591 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6592
Chet Lanctot186b5732013-03-18 10:26:30 -07006593#ifdef WLAN_FEATURE_11W
Chet Lanctot4b9abd72013-06-27 11:14:56 -07006594 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Chet Lanctot186b5732013-03-18 10:26:30 -07006595#endif
6596
Jeff Johnson295189b2012-06-20 16:38:30 -07006597 // Now, we're ready to "pack" the frames
6598 nStatus = dot11fPackRadioMeasurementReport( pMac,
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006599 frm,
Jeff Johnson295189b2012-06-20 16:38:30 -07006600 pFrame + sizeof( tSirMacMgmtHdr ),
6601 nPayload,
6602 &nPayload );
6603
6604 if( DOT11F_FAILED( nStatus ))
6605 {
6606 limLog( pMac, LOGE,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006607 FL( "Failed to pack an Radio Measure Report (0x%08x)." ),
Jeff Johnson295189b2012-06-20 16:38:30 -07006608 nStatus );
6609
6610 // FIXME - Need to convert to tSirRetStatus
6611 statusCode = eSIR_FAILURE;
6612 goto returnAfterError;
6613 }
6614 else if( DOT11F_WARNED( nStatus ))
6615 {
6616 limLog( pMac, LOGW,
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006617 FL( "There were warnings while packing Radio "
6618 "Measure Report (0x%08x)." ), nStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07006619 }
6620
6621 limLog( pMac, LOGW,
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006622 FL( "Sending a Radio Measure Report to " ));
Jeff Johnson295189b2012-06-20 16:38:30 -07006623 limPrintMacAddr( pMac, peer, LOGW );
6624
6625 if( ( SIR_BAND_5_GHZ == limGetRFBand(psessionEntry->currentOperChannel))
Jeff Johnson295189b2012-06-20 16:38:30 -07006626 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6627 ( psessionEntry->pePersona == VOS_P2P_GO_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07006628 )
6629 {
6630 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6631 }
6632
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306633 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6634 psessionEntry->peSessionId,
6635 pMacHdr->fc.subType));
6636 halstatus = halTxFrame( pMac,
6637 pPacket,
6638 (tANI_U16) nBytes,
6639 HAL_TXRX_FRM_802_11_MGMT,
6640 ANI_TXDIR_TODS,
6641 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6642 limTxComplete,
6643 pFrame, txFlag );
6644 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6645 psessionEntry->peSessionId,
6646 halstatus));
6647 if( eHAL_STATUS_SUCCESS != halstatus )
Jeff Johnson295189b2012-06-20 16:38:30 -07006648 {
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006649 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
Jeff Johnson295189b2012-06-20 16:38:30 -07006650 statusCode = eSIR_FAILURE;
6651 //Pkt will be freed up by the callback
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006652 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006653 return statusCode;
6654 }
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07006655 else {
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006656 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006657 return eSIR_SUCCESS;
Madan Mohan Koyyalamudieeb56b12012-10-31 15:10:04 -07006658 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006659
6660returnAfterError:
Madan Mohan Koyyalamudi8f207c12012-10-30 18:18:38 -07006661 vos_mem_free(frm);
Jeff Johnson295189b2012-06-20 16:38:30 -07006662 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
Jeff Johnson295189b2012-06-20 16:38:30 -07006663 return statusCode;
6664} // End limSendBeaconReportActionFrame.
6665
6666#endif
6667
6668#ifdef WLAN_FEATURE_11W
6669/**
Chet Lanctot8cecea22014-02-11 19:09:36 -08006670 * \brief Send SA query request action frame to peer
6671 *
6672 * \sa limSendSaQueryRequestFrame
6673 *
6674 *
6675 * \param pMac The global tpAniSirGlobal object
6676 *
6677 * \param transId Transaction identifier
6678 *
6679 * \param peer The Mac address of the station to which this action frame is addressed
6680 *
6681 * \param psessionEntry The PE session entry
6682 *
6683 * \return eSIR_SUCCESS if setup completes successfully
6684 * eSIR_FAILURE is some problem is encountered
6685 */
6686
6687tSirRetStatus limSendSaQueryRequestFrame( tpAniSirGlobal pMac, tANI_U8 *transId,
6688 tSirMacAddr peer, tpPESession psessionEntry )
6689{
6690
6691 tDot11fSaQueryReq frm; // SA query request action frame
6692 tANI_U8 *pFrame;
6693 tSirRetStatus nSirStatus;
6694 tpSirMacMgmtHdr pMacHdr;
6695 tANI_U32 nBytes, nPayload, nStatus;
6696 void *pPacket;
6697 eHalStatus halstatus;
6698 tANI_U8 txFlag = 0;
6699
6700 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
6701 frm.Category.category = SIR_MAC_ACTION_SA_QUERY;
6702 /* 11w action field is :
6703 action: 0 --> SA Query Request action frame
6704 action: 1 --> SA Query Response action frame */
6705 frm.Action.action = SIR_MAC_SA_QUERY_REQ;
6706 /* 11w SA Query Request transId */
6707 vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 );
6708
6709 nStatus = dot11fGetPackedSaQueryReqSize(pMac, &frm, &nPayload);
6710 if ( DOT11F_FAILED( nStatus ) )
6711 {
6712 limLog( pMac, LOGP, FL("Failed to calculate the packed size "
6713 "for an SA Query Request (0x%08x)."),
6714 nStatus );
6715 // We'll fall back on the worst case scenario:
6716 nPayload = sizeof( tDot11fSaQueryReq );
6717 }
6718 else if ( DOT11F_WARNED( nStatus ) )
6719 {
6720 limLog( pMac, LOGW, FL("There were warnings while calculating "
6721 "the packed size for an SA Query Request"
6722 " (0x%08x)."), nStatus );
6723 }
6724
6725 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6726 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6727 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6728 {
6729 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA Query Request "
6730 "action frame"), nBytes );
6731 return eSIR_FAILURE;
6732 }
6733
6734 // Paranoia:
6735 vos_mem_set( pFrame, nBytes, 0 );
6736
6737 // Copy necessary info to BD
6738 nSirStatus = limPopulateMacHeader( pMac,
6739 pFrame,
6740 SIR_MAC_MGMT_FRAME,
6741 SIR_MAC_MGMT_ACTION,
6742 peer, psessionEntry->selfMacAddr );
6743 if ( eSIR_SUCCESS != nSirStatus )
6744 goto returnAfterError;
6745
6746 // Update A3 with the BSSID
6747 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6748
6749 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
6750
6751 // Since this is a SA Query Request, set the "protect" (aka WEP) bit
6752 // in the FC
6753 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
6754
6755 // Pack 11w SA Query Request frame
6756 nStatus = dot11fPackSaQueryReq( pMac,
6757 &frm,
6758 pFrame + sizeof( tSirMacMgmtHdr ),
6759 nPayload,
6760 &nPayload );
6761
6762 if ( DOT11F_FAILED( nStatus ))
6763 {
6764 limLog( pMac, LOGE,
6765 FL( "Failed to pack an SA Query Request (0x%08x)." ),
6766 nStatus );
6767 // FIXME - Need to convert to tSirRetStatus
6768 nSirStatus = eSIR_FAILURE;
6769 goto returnAfterError;
6770 }
6771 else if ( DOT11F_WARNED( nStatus ))
6772 {
6773 limLog( pMac, LOGW,
6774 FL( "There were warnings while packing SA Query Request (0x%08x)." ),
6775 nStatus);
6776 }
6777
6778 limLog( pMac, LOG1,
6779 FL( "Sending an SA Query Request to " ));
6780 limPrintMacAddr( pMac, peer, LOG1 );
6781 limPrintMacAddr( pMac, peer, LOGE );
6782 limLog( pMac, LOGE,
6783 FL( "Sending an SA Query Request from " ));
6784 limPrintMacAddr( pMac, psessionEntry->selfMacAddr, LOGE );
6785
6786 if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) )
6787#ifdef WLAN_FEATURE_P2P
6788 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6789 ( psessionEntry->pePersona == VOS_P2P_GO_MODE )
6790#endif
6791 )
6792 {
6793 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6794 }
6795
6796 halstatus = halTxFrame( pMac,
6797 pPacket,
6798 (tANI_U16) nBytes,
6799 HAL_TXRX_FRM_802_11_MGMT,
6800 ANI_TXDIR_TODS,
6801 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6802 limTxComplete,
6803 pFrame, txFlag );
6804 if ( eHAL_STATUS_SUCCESS != halstatus )
6805 {
6806 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
6807 nSirStatus = eSIR_FAILURE;
6808 //Pkt will be freed up by the callback
6809 return nSirStatus;
6810 }
6811 else {
6812 return eSIR_SUCCESS;
6813 }
6814
6815returnAfterError:
6816 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6817 return nSirStatus;
6818} // End limSendSaQueryRequestFrame
6819
6820/**
Jeff Johnson295189b2012-06-20 16:38:30 -07006821 * \brief Send SA query response action frame to peer
6822 *
6823 * \sa limSendSaQueryResponseFrame
6824 *
6825 *
6826 * \param pMac The global tpAniSirGlobal object
6827 *
Chet Lanctot186b5732013-03-18 10:26:30 -07006828 * \param transId Transaction identifier received in SA query request action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07006829 *
Chet Lanctot186b5732013-03-18 10:26:30 -07006830 * \param peer The Mac address of the AP to which this action frame is addressed
6831 *
6832 * \param psessionEntry The PE session entry
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 *
6834 * \return eSIR_SUCCESS if setup completes successfully
6835 * eSIR_FAILURE is some problem is encountered
6836 */
6837
Chet Lanctot186b5732013-03-18 10:26:30 -07006838tSirRetStatus limSendSaQueryResponseFrame( tpAniSirGlobal pMac, tANI_U8 *transId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006839tSirMacAddr peer,tpPESession psessionEntry)
6840{
6841
Chet Lanctot186b5732013-03-18 10:26:30 -07006842 tDot11fSaQueryRsp frm; // SA query reponse action frame
Jeff Johnson295189b2012-06-20 16:38:30 -07006843 tANI_U8 *pFrame;
6844 tSirRetStatus nSirStatus;
6845 tpSirMacMgmtHdr pMacHdr;
Chet Lanctot186b5732013-03-18 10:26:30 -07006846 tANI_U32 nBytes, nPayload, nStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07006847 void *pPacket;
6848 eHalStatus halstatus;
Kanchanapally, Vidyullathaf9426e52013-12-24 17:28:54 +05306849 tANI_U32 txFlag = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006850
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306851 vos_mem_set( ( tANI_U8* )&frm, sizeof( frm ), 0 );
Chet Lanctot186b5732013-03-18 10:26:30 -07006852 frm.Category.category = SIR_MAC_ACTION_SA_QUERY;
6853 /*11w action field is :
Jeff Johnson295189b2012-06-20 16:38:30 -07006854 action: 0 --> SA query request action frame
6855 action: 1 --> SA query response action frame */
Chet Lanctot186b5732013-03-18 10:26:30 -07006856 frm.Action.action = SIR_MAC_SA_QUERY_RSP;
6857 /*11w SA query response transId is same as
Jeff Johnson295189b2012-06-20 16:38:30 -07006858 SA query request transId*/
Chet Lanctot186b5732013-03-18 10:26:30 -07006859 vos_mem_copy( &frm.TransactionId.transId[0], &transId[0], 2 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006860
Chet Lanctot186b5732013-03-18 10:26:30 -07006861 nStatus = dot11fGetPackedSaQueryRspSize(pMac, &frm, &nPayload);
6862 if ( DOT11F_FAILED( nStatus ) )
6863 {
6864 limLog( pMac, LOGP, FL("Failed to calculate the packed size f"
6865 "or a SA Query Response (0x%08x)."),
6866 nStatus );
6867 // We'll fall back on the worst case scenario:
6868 nPayload = sizeof( tDot11fSaQueryRsp );
6869 }
6870 else if ( DOT11F_WARNED( nStatus ) )
6871 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08006872 limLog( pMac, LOGW, FL("There were warnings while calculating "
Chet Lanctot186b5732013-03-18 10:26:30 -07006873 "the packed size for an SA Query Response"
6874 " (0x%08x)."), nStatus );
6875 }
6876
Jeff Johnson295189b2012-06-20 16:38:30 -07006877 nBytes = nPayload + sizeof( tSirMacMgmtHdr );
6878 halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, nBytes, ( void** ) &pFrame, ( void** ) &pPacket );
6879 if ( ! HAL_STATUS_SUCCESS ( halstatus ) )
6880 {
6881 limLog( pMac, LOGP, FL("Failed to allocate %d bytes for a SA query response"
Kiran Kumar Lokere5be73a62013-04-01 18:40:00 -07006882 " action frame"), nBytes );
Jeff Johnson295189b2012-06-20 16:38:30 -07006883 return eSIR_FAILURE;
6884 }
6885
6886 // Paranoia:
Bansidhar Gopalachari12731232013-07-11 10:56:36 +05306887 vos_mem_set( pFrame, nBytes, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07006888
Chet Lanctot186b5732013-03-18 10:26:30 -07006889 // Copy necessary info to BD
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006890 nSirStatus = limPopulateMacHeader( pMac,
Chet Lanctot186b5732013-03-18 10:26:30 -07006891 pFrame,
6892 SIR_MAC_MGMT_FRAME,
6893 SIR_MAC_MGMT_ACTION,
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006894 peer, psessionEntry->selfMacAddr );
6895 if ( eSIR_SUCCESS != nSirStatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07006896 goto returnAfterError;
Jeff Johnson295189b2012-06-20 16:38:30 -07006897
Chet Lanctot186b5732013-03-18 10:26:30 -07006898 // Update A3 with the BSSID
Jeff Johnson295189b2012-06-20 16:38:30 -07006899 pMacHdr = ( tpSirMacMgmtHdr ) pFrame;
6900
Chet Lanctot186b5732013-03-18 10:26:30 -07006901 sirCopyMacAddr( pMacHdr->bssId, psessionEntry->bssId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006902
Chet Lanctot186b5732013-03-18 10:26:30 -07006903 // Since this is a SA Query Response, set the "protect" (aka WEP) bit
6904 // in the FC
Chet Lanctot8cecea22014-02-11 19:09:36 -08006905 limSetProtectedBit(pMac, psessionEntry, peer, pMacHdr);
Jeff Johnson295189b2012-06-20 16:38:30 -07006906
Chet Lanctot186b5732013-03-18 10:26:30 -07006907 // Pack 11w SA query response frame
6908 nStatus = dot11fPackSaQueryRsp( pMac,
6909 &frm,
6910 pFrame + sizeof( tSirMacMgmtHdr ),
6911 nPayload,
6912 &nPayload );
6913
6914 if ( DOT11F_FAILED( nStatus ))
6915 {
6916 limLog( pMac, LOGE,
6917 FL( "Failed to pack an SA Query Response (0x%08x)." ),
6918 nStatus );
6919 // FIXME - Need to convert to tSirRetStatus
6920 nSirStatus = eSIR_FAILURE;
6921 goto returnAfterError;
6922 }
6923 else if ( DOT11F_WARNED( nStatus ))
6924 {
6925 limLog( pMac, LOGW,
6926 FL( "There were warnings while packing SA Query Response (0x%08x)." ),
6927 nStatus);
6928 }
6929
6930 limLog( pMac, LOG1,
6931 FL( "Sending a SA Query Response to " ));
6932 limPrintMacAddr( pMac, peer, LOGW );
6933
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006934 if ( ( SIR_BAND_5_GHZ == limGetRFBand( psessionEntry->currentOperChannel ) )
Chet Lanctot186b5732013-03-18 10:26:30 -07006935#ifdef WLAN_FEATURE_P2P
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006936 || ( psessionEntry->pePersona == VOS_P2P_CLIENT_MODE ) ||
6937 ( psessionEntry->pePersona == VOS_P2P_GO_MODE )
Chet Lanctot186b5732013-03-18 10:26:30 -07006938#endif
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006939 )
6940 {
6941 txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME;
6942 }
Chet Lanctot186b5732013-03-18 10:26:30 -07006943
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306944 MTRACE(macTrace(pMac, TRACE_CODE_TX_MGMT,
6945 psessionEntry->peSessionId,
6946 pMacHdr->fc.subType));
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006947 halstatus = halTxFrame( pMac,
6948 pPacket,
6949 (tANI_U16) nBytes,
6950 HAL_TXRX_FRM_802_11_MGMT,
6951 ANI_TXDIR_TODS,
6952 7,//SMAC_SWBD_TX_TID_MGMT_HIGH,
6953 limTxComplete,
6954 pFrame, txFlag );
Edhar Mahesh Kumarf956b902013-12-05 09:35:46 +05306955 MTRACE(macTrace(pMac, TRACE_CODE_TX_COMPLETE,
6956 psessionEntry->peSessionId,
6957 halstatus));
Chet Lanctotb2b0d552013-03-22 16:58:44 -07006958 if ( eHAL_STATUS_SUCCESS != halstatus )
Chet Lanctot186b5732013-03-18 10:26:30 -07006959 {
6960 PELOGE(limLog( pMac, LOGE, FL( "halTxFrame FAILED! Status [%d]" ), halstatus );)
6961 nSirStatus = eSIR_FAILURE;
6962 //Pkt will be freed up by the callback
6963 return nSirStatus;
6964 }
6965 else {
6966 return eSIR_SUCCESS;
6967 }
6968
6969returnAfterError:
6970 palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket );
6971 return nSirStatus;
6972} // End limSendSaQueryResponseFrame
Jeff Johnson295189b2012-06-20 16:38:30 -07006973#endif