blob: d0cb17f248c2915263b2084cfbc2e2fcc055c209 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Sravan Kumar Kairamcebb2182016-01-25 20:50:11 +05302 * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -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 */
Kiet Lamaa8e15a2014-02-11 23:30:06 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file parserApi.cc contains the code for parsing
30 * 802.11 messages.
31 * Author: Pierre Vandwalle
32 * Date: 03/18/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38
39#include "sirApi.h"
40#include "aniGlobal.h"
41#include "parserApi.h"
42#include "cfgApi.h"
43#include "limUtils.h"
44#include "utilsParser.h"
45#include "limSerDesUtils.h"
46#include "schApi.h"
47#include "palApi.h"
48#include "wmmApsd.h"
49#if defined WLAN_FEATURE_VOWIFI
50#include "rrmApi.h"
51#endif
52
Agrawal Ashisha8e8a722016-10-18 19:07:45 +053053#define DOT11F_RSN_VERSION 1 /* current supported version */
54#define DOT11F_RSN_OUI_SIZE 4
55#define DOT11F_RSN_CSE_NULL 0x00
56#define DOT11F_RSN_CSE_WEP40 0x01
57#define DOT11F_RSN_CSE_TKIP 0x02
58#define DOT11F_RSN_CSE_WRAP 0x03
59#define DOT11F_RSN_CSE_CCMP 0x04
60#define DOT11F_RSN_CSE_WEP104 0x05
61#define DOT11F_RSN_CSE_AES_CMAC 0x06
62
63static const tANI_U8 sirRSNOui[][ DOT11F_RSN_OUI_SIZE ] = {
64 { 0x00, 0x0F, 0xAC, 0x00 }, /* group cipher */
65 { 0x00, 0x0F, 0xAC, 0x01 }, /* WEP-40 or RSN */
66 { 0x00, 0x0F, 0xAC, 0x02 }, /* TKIP or RSN-PSK */
67 { 0x00, 0x0F, 0xAC, 0x03 }, /* Reserved */
68 { 0x00, 0x0F, 0xAC, 0x04 }, /* AES-CCMP */
69 { 0x00, 0x0F, 0xAC, 0x05 }, /* WEP-104 */
70 { 0x00, 0x40, 0x96, 0x00 }, /* CCKM */
71 /* BIP (encryption type) or RSN-PSK-SHA256 (authentication type) */
72 { 0x00, 0x0F, 0xAC, 0x06 },
73 /* RSN-8021X-SHA256 (authentication type) */
74 { 0x00, 0x0F, 0xAC, 0x05 }
75};
76
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
79////////////////////////////////////////////////////////////////////////
80void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
81{
82#ifdef WLAN_DEBUG
83 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
84 {
85 return;
86 }
87 else
88 {
89 va_list marker;
90
91 va_start( marker, pString ); /* Initialize variable arguments. */
92
93 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
94
95 va_end( marker ); /* Reset variable arguments. */
96 }
97#endif
98}
99
100void
101swapBitField16(tANI_U16 in, tANI_U16 *out)
102{
103# ifdef ANI_LITTLE_BIT_ENDIAN
104 *out = in;
105# else // Big-Endian...
106 *out = ( ( in & 0x8000 ) >> 15 ) |
107 ( ( in & 0x4000 ) >> 13 ) |
108 ( ( in & 0x2000 ) >> 11 ) |
109 ( ( in & 0x1000 ) >> 9 ) |
110 ( ( in & 0x0800 ) >> 7 ) |
111 ( ( in & 0x0400 ) >> 5 ) |
112 ( ( in & 0x0200 ) >> 3 ) |
113 ( ( in & 0x0100 ) >> 1 ) |
114 ( ( in & 0x0080 ) << 1 ) |
115 ( ( in & 0x0040 ) << 3 ) |
116 ( ( in & 0x0020 ) << 5 ) |
117 ( ( in & 0x0010 ) << 7 ) |
118 ( ( in & 0x0008 ) << 9 ) |
119 ( ( in & 0x0004 ) << 11 ) |
120 ( ( in & 0x0002 ) << 13 ) |
121 ( ( in & 0x0001 ) << 15 );
122# endif // ANI_LITTLE_BIT_ENDIAN
123}
124
125void
126swapBitField32(tANI_U32 in, tANI_U32 *out)
127{
128# ifdef ANI_LITTLE_BIT_ENDIAN
129 *out = in;
130# else // Big-Endian...
131 *out = ( ( in & 0x80000000 ) >> 31 ) |
132 ( ( in & 0x40000000 ) >> 29 ) |
133 ( ( in & 0x20000000 ) >> 27 ) |
134 ( ( in & 0x10000000 ) >> 25 ) |
135 ( ( in & 0x08000000 ) >> 23 ) |
136 ( ( in & 0x04000000 ) >> 21 ) |
137 ( ( in & 0x02000000 ) >> 19 ) |
138 ( ( in & 0x01000000 ) >> 17 ) |
139 ( ( in & 0x00800000 ) >> 15 ) |
140 ( ( in & 0x00400000 ) >> 13 ) |
141 ( ( in & 0x00200000 ) >> 11 ) |
142 ( ( in & 0x00100000 ) >> 9 ) |
143 ( ( in & 0x00080000 ) >> 7 ) |
144 ( ( in & 0x00040000 ) >> 5 ) |
145 ( ( in & 0x00020000 ) >> 3 ) |
146 ( ( in & 0x00010000 ) >> 1 ) |
147 ( ( in & 0x00008000 ) << 1 ) |
148 ( ( in & 0x00004000 ) << 3 ) |
149 ( ( in & 0x00002000 ) << 5 ) |
150 ( ( in & 0x00001000 ) << 7 ) |
151 ( ( in & 0x00000800 ) << 9 ) |
152 ( ( in & 0x00000400 ) << 11 ) |
153 ( ( in & 0x00000200 ) << 13 ) |
154 ( ( in & 0x00000100 ) << 15 ) |
155 ( ( in & 0x00000080 ) << 17 ) |
156 ( ( in & 0x00000040 ) << 19 ) |
157 ( ( in & 0x00000020 ) << 21 ) |
158 ( ( in & 0x00000010 ) << 23 ) |
159 ( ( in & 0x00000008 ) << 25 ) |
160 ( ( in & 0x00000004 ) << 27 ) |
161 ( ( in & 0x00000002 ) << 29 ) |
162 ( ( in & 0x00000001 ) << 31 );
163# endif // ANI_LITTLE_BIT_ENDIAN
164}
165
166inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
167{
Sushant Kaushik87787972015-09-11 16:05:00 +0530168 limLog(pMac, LOG1, FL("WMM Parameters Received: "));
169 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
171
Sushant Kaushik87787972015-09-11 16:05:00 +0530172 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
174
Sushant Kaushik87787972015-09-11 16:05:00 +0530175 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700176 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
177
Sushant Kaushik87787972015-09-11 16:05:00 +0530178 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
180
181 return;
182}
183
184////////////////////////////////////////////////////////////////////////
185// Functions for populating "dot11f" style IEs
186
187
188// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
189// < 0, cannot find
190int FindIELocation( tpAniSirGlobal pMac,
191 tpSirRSNie pRsnIe,
192 tANI_U8 EID)
193{
194 int idx, ieLen, bytesLeft;
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800195 int ret_val = -1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700196
197 // Here's what's going on: 'rsnIe' looks like this:
198
199 // typedef struct sSirRSNie
200 // {
201 // tANI_U16 length;
202 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
203 // } tSirRSNie, *tpSirRSNie;
204
205 // other code records both the WPA & RSN IEs (including their EIDs &
206 // lengths) into the array 'rsnIEdata'. We may have:
207
208 // With WAPI support, there may be 3 IEs here
209 // It can be only WPA IE, or only RSN IE or only WAPI IE
210 // Or two or all three of them with no particular ordering
211
212 // The if/then/else statements that follow are here to figure out
213 // whether we have the WPA IE, and where it is if we *do* have it.
214
215 //Save the first IE length
216 ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
217 idx = 0;
218 bytesLeft = pRsnIe->length;
219
220 while( 1 )
221 {
222 if ( EID == pRsnIe->rsnIEdata[ idx ] )
223 {
224 //Found it
225 return (idx);
226 }
227 else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
228 // & if no more IE,
229 bytesLeft <= (tANI_U16)( ieLen ) )
230 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530231 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation."), EID );
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800232 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 }
234 bytesLeft -= ieLen;
235 ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
236 idx += ieLen;
237 }
238
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800239 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700240}
241
242
243tSirRetStatus
244PopulateDot11fCapabilities(tpAniSirGlobal pMac,
245 tDot11fFfCapabilities *pDot11f,
246 tpPESession psessionEntry)
247{
248 tANI_U16 cfg;
249 tSirRetStatus nSirStatus;
250
251 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
252 if ( eSIR_SUCCESS != nSirStatus )
253 {
254 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
Sushant Kaushik87787972015-09-11 16:05:00 +0530255 "itfield from CFG (%d)."), nSirStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 return nSirStatus;
257 }
258
259#if 0
260 if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
261 {
262 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
263 }
264#endif
265 swapBitField16( cfg, ( tANI_U16* )pDot11f );
266
267 return eSIR_SUCCESS;
268} // End PopulateDot11fCapabilities.
269
270tSirRetStatus
271PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
272 tDot11fFfCapabilities *pDot11f,
273 tpDphHashNode pSta,
274 tpPESession psessionEntry)
275{
276 tANI_U16 cfg;
277 tSirRetStatus nSirStatus;
278 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
279 if ( eSIR_SUCCESS != nSirStatus )
280 {
281 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
Sushant Kaushik87787972015-09-11 16:05:00 +0530282 "itfield from CFG (%d)."), nSirStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return nSirStatus;
284 }
285
286 if ( ( NULL != pSta ) && pSta->aniPeer &&
287 PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
288 {
289 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
290 }
291
292 swapBitField16( cfg, ( tANI_U16* )pDot11f );
293
294 return eSIR_SUCCESS;
295
296} // End PopulateDot11fCapabilities2.
297
298void
299PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700300 tDot11fIEChanSwitchAnn *pDot11f,
301 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700302{
Jeff Johnsone7245742012-09-05 17:12:55 -0700303 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
304 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
305 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700306
307 pDot11f->present = 1;
308} // End PopulateDot11fChanSwitchAnn.
309
310void
311PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700312 tDot11fIEExtChanSwitchAnn *pDot11f,
313 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700314{
315 //Has to be updated on the cb state basis
316 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700317 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700318
319 pDot11f->present = 1;
320}
321
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700322#ifdef WLAN_FEATURE_11AC
323void
324PopulateDot11fWiderBWChanSwitchAnn(tpAniSirGlobal pMac,
325 tDot11fIEWiderBWChanSwitchAnn *pDot11f,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700326 tpPESession psessionEntry)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700327{
328 pDot11f->present = 1;
329 pDot11f->newChanWidth = psessionEntry->gLimWiderBWChannelSwitch.newChanWidth;
330 pDot11f->newCenterChanFreq0 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0;
331 pDot11f->newCenterChanFreq1 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1;
332}
333#endif
334
Jeff Johnson295189b2012-06-20 16:38:30 -0700335tSirRetStatus
336PopulateDot11fCountry(tpAniSirGlobal pMac,
337 tDot11fIECountry *pDot11f,
338 tpPESession psessionEntry)
339{
340 tANI_U32 len, maxlen, codelen;
341 tANI_U16 item;
342 tSirRetStatus nSirStatus;
343 tSirRFBand rfBand;
344 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
345
346 if (psessionEntry->lim11dEnabled )
347 {
348 limGetRfBand(pMac, &rfBand, psessionEntry);
349 if (rfBand == SIR_BAND_5_GHZ)
350 {
351 item = WNI_CFG_MAX_TX_POWER_5;
352 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
353 }
354 else
355 {
356 item = WNI_CFG_MAX_TX_POWER_2_4;
357 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
358 }
359
360 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
361
362 if ( 3 > len )
363 {
364 // no limit on tx power, cannot include the IE because at least
365 // one (channel,num,tx power) must be present
366 return eSIR_SUCCESS;
367 }
368
369 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
370 code, codelen, 3 );
371
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530372 vos_mem_copy( pDot11f->country, code, codelen );
Jeff Johnson295189b2012-06-20 16:38:30 -0700373
374 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
375 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530376 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting."), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
378 }
379
380 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530381 vos_mem_copy( ( tANI_U8* )pDot11f->triplets, temp, len );
Jeff Johnson295189b2012-06-20 16:38:30 -0700382
383 pDot11f->present = 1;
384 }
385
386 return eSIR_SUCCESS;
387} // End PopulateDot11fCountry.
388
389tSirRetStatus
390PopulateDot11fDSParams(tpAniSirGlobal pMac,
391 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
392 tpPESession psessionEntry)
393{
Abhishek Singh883b5a12015-10-08 12:22:25 +0530394 if (IS_24G_CH(channel))
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 {
396 // .11b/g mode PHY => Include the DS Parameter Set IE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 pDot11f->curr_channel = channel;
398 pDot11f->present = 1;
399 }
400
401 return eSIR_SUCCESS;
402} // End PopulateDot11fDSParams.
403
404#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
405
406
407void
408PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
409 tDot11fIEEDCAParamSet *pDot11f,
410 tpPESession psessionEntry)
411{
412
413 if ( psessionEntry->limQosEnabled )
414 {
415 //change to bitwise operation, after this is fixed in frames.
416 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
417
418 // Fill each EDCA parameter set in order: be, bk, vi, vo
419 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
420 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
421 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
422 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
423 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
424 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
425
426 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
427 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
428 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
429 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
430 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
431 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
432
433 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
434 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
435 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
436 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
437 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
438 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
439
440 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
441 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
442 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
443 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
444 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
445 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
446
447 pDot11f->present = 1;
448 }
449
450} // End PopluateDot11fEDCAParamSet.
451
452tSirRetStatus
453PopulateDot11fERPInfo(tpAniSirGlobal pMac,
454 tDot11fIEERPInfo *pDot11f,
455 tpPESession psessionEntry)
456{
457 tSirRetStatus nSirStatus;
458 tANI_U32 val;
459 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
460
461 limGetRfBand(pMac, &rfBand, psessionEntry);
462 if(SIR_BAND_2_4_GHZ == rfBand)
463 {
464 pDot11f->present = 1;
465
466 val = psessionEntry->cfgProtection.fromllb;
467 if(!val ){
Sravan Kumar Kairamcebb2182016-01-25 20:50:11 +0530468 dot11fLog( pMac, LOG1, FL("11B protection not enabled. Not populating ERP IE %d" ),val );
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 return eSIR_SUCCESS;
470 }
471
472 if (psessionEntry->gLim11bParams.protectionEnabled)
473 {
474 pDot11f->non_erp_present = 1;
475 pDot11f->use_prot = 1;
476 }
477
478 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
479 {
480 //FIXME_PROTECTION: we should be setting non_erp present also.
481 //check the test plan first.
482 pDot11f->use_prot = 1;
483 }
484
485
486 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
487 || !psessionEntry->beaconParams.fShortPreamble){
488 pDot11f->barker_preamble = 1;
489
490 }
491 // if protection always flag is set, advertise protection enabled
492 // regardless of legacy stations presence
493 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
494
495 if ( val )
496 {
497 pDot11f->use_prot = 1;
498 }
499 }
500
501 return eSIR_SUCCESS;
502} // End PopulateDot11fERPInfo.
503
504tSirRetStatus
505PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
506 tDot11fIEExtSuppRates *pDot11f,
507 tpPESession psessionEntry)
508{
509 tSirRetStatus nSirStatus;
510 tANI_U32 nRates = 0;
Sachin Ahujac772fd82015-09-08 17:12:19 +0530511 tANI_U8 rates[SIR_MAC_RATESET_EID_MAX];
Jeff Johnson295189b2012-06-20 16:38:30 -0700512
513 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
514 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
515 sending mgmt frames (lile probe req) which need to go out before any session is present.
516 */
517 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
518 {
519 if(psessionEntry != NULL)
520 {
521 nRates = psessionEntry->extRateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530522 vos_mem_copy( rates, psessionEntry->extRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 nRates);
524 }
525 else
526 {
527 dot11fLog( pMac, LOGE, FL("no session context exists while"
Sushant Kaushik87787972015-09-11 16:05:00 +0530528 " populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 }
530 }
531 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
532 {
533 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
534 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
535 }
536
537 if ( 0 != nRates )
538 {
539 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530540 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 pDot11f->present = 1;
542 }
543
544 return eSIR_SUCCESS;
545
546} // End PopulateDot11fExtSuppRates.
547
548tSirRetStatus
549PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
550 tANI_U8 nChannelNum,
551 tDot11fIEExtSuppRates *pDot11f)
552{
553 tANI_U32 nRates;
554 tSirRetStatus nSirStatus;
555 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
556
557 if ( 14 < nChannelNum )
558 {
559 pDot11f->present = 0;
560 return eSIR_SUCCESS;
561 }
562
563 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
564 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
565 // previously & I'm afraid to change it!
566 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
567 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
568
569 if ( 0 != nRates )
570 {
571 pDot11f->num_rates = ( tANI_U8 ) nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530572 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 pDot11f->present = 1;
574 }
575
576 return eSIR_SUCCESS;
577} // PopulateDot11fExtSuppRates1.
578
579tSirRetStatus
580PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700581 tpPESession psessionEntry,
582 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700583{
584 tANI_U32 nCfgValue, nCfgLen;
585 tANI_U8 nCfgValue8;
586 tSirRetStatus nSirStatus;
587 tSirMacHTParametersInfo *pHTParametersInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 union {
589 tANI_U16 nCfgValue16;
590 tSirMacHTCapabilityInfo htCapInfo;
591 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
592 } uHTCapabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700593
594 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
595 tSirMacASCapabilityInfo *pASCapabilityInfo;
596
597 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
598
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700600
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
603 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
604 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
605 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
606 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
607 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
608 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
609 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
610 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
611 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
612 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
613 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614
Jeff Johnsone7245742012-09-05 17:12:55 -0700615 // All sessionized entries will need the check below
616 if (psessionEntry == NULL) // Only in case of NO session
617 {
618 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
619 }
620 else
621 {
622 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
623 }
624
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
626 eHT_CHANNEL_WIDTH_20MHZ */
627 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
628 {
629 pDot11f->shortGI40MHz = 0;
630 }
631
Jeff Johnson295189b2012-06-20 16:38:30 -0700632
633
634 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
635
636 nCfgValue8 = ( tANI_U8 ) nCfgValue;
637 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
638
639 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
640 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
641 pDot11f->reserved1 = pHTParametersInfo->reserved;
642
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
644 pDot11f->supportedMCSSet, nCfgLen,
645 SIZE_OF_SUPPORTED_MCS_SET );
646
647
648 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
649
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
651
652 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
653 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
654 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
655
Jeff Johnson295189b2012-06-20 16:38:30 -0700656
657 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
658
659 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
660 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
661 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
662 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
663 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
664 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
665 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
666 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
667 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
668 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
669 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
670 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
671 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
672 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
673 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
674 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
675
676 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
677
678 nCfgValue8 = ( tANI_U8 ) nCfgValue;
679
680 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
681 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
682 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
683 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
684 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
685 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
686 pDot11f->rxAS = pASCapabilityInfo->rxAS;
687 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
688
689 pDot11f->present = 1;
690
691 return eSIR_SUCCESS;
692
693} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700694#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700695
Jeff Johnsone7245742012-09-05 17:12:55 -0700696void limLogVHTCap(tpAniSirGlobal pMac,
697 tDot11fIEVHTCaps *pDot11f)
698{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700699#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530700 limLog(pMac, LOG1, FL("maxMPDULen (2): %d"), pDot11f->maxMPDULen);
701 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d"), pDot11f->supportedChannelWidthSet);
702 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d"), pDot11f->ldpcCodingCap);
703 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d"), pDot11f->shortGI80MHz);
704 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d"), pDot11f->shortGI160and80plus80MHz);
705 limLog(pMac, LOG1, FL("txSTBC (1): %d"), pDot11f->txSTBC);
706 limLog(pMac, LOG1, FL("rxSTBC (3): %d"), pDot11f->rxSTBC);
707 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d"), pDot11f->suBeamFormerCap);
708 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d"), pDot11f->suBeamformeeCap);
709 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d"), pDot11f->csnofBeamformerAntSup);
710 limLog(pMac, LOG1, FL("numSoundingDim (3): %d"), pDot11f->numSoundingDim);
711 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d"), pDot11f->muBeamformerCap);
712 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d"), pDot11f->muBeamformeeCap);
713 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d"), pDot11f->vhtTXOPPS);
714 limLog(pMac, LOG1, FL("htcVHTCap (1): %d"), pDot11f->htcVHTCap);
715 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d"), pDot11f->maxAMPDULenExp);
716 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d"), pDot11f->vhtLinkAdaptCap);
717 limLog(pMac, LOG1, FL("rxAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
718 limLog(pMac, LOG1, FL("txAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
719 limLog(pMac, LOG1, FL("reserved1 (2): %d"), pDot11f->reserved1);
720 limLog(pMac, LOG1, FL("rxMCSMap (16): %d"), pDot11f->rxMCSMap);
721 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d"), pDot11f->rxHighSupDataRate);
722 limLog(pMac, LOG1, FL("reserve (3): %d"), pDot11f->reserved2);
723 limLog(pMac, LOG1, FL("txMCSMap (16): %d"), pDot11f->txMCSMap);
724 limLog(pMac, LOG1, FL("txSupDataRate (13): %d"), pDot11f->txSupDataRate);
725 limLog(pMac, LOG1, FL("reserv (3): %d"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700726#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700727}
728
729void limLogVHTOperation(tpAniSirGlobal pMac,
730 tDot11fIEVHTOperation *pDot11f)
731{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700732#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530733 limLog(pMac, LOG1, FL("chanWidth : %d"), pDot11f->chanWidth);
734 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d"), pDot11f->chanCenterFreqSeg1);
735 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d"), pDot11f->chanCenterFreqSeg2);
736 limLog(pMac, LOG1, FL("basicMCSSet: %d"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700737#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700738}
739
740void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
741 tDot11fIEVHTExtBssLoad *pDot11f)
742{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700743#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530744 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d"), pDot11f->muMIMOCapStaCount);
745 limLog(pMac, LOG1, FL("ssUnderUtil: %d"), pDot11f->ssUnderUtil);
746 limLog(pMac, LOG1, FL("FortyMHzUtil: %d"), pDot11f->FortyMHzUtil);
747 limLog(pMac, LOG1, FL("EightyMHzUtil: %d"), pDot11f->EightyMHzUtil);
748 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700749#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700750}
751
752
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700753void limLogOperatingMode( tpAniSirGlobal pMac,
754 tDot11fIEOperatingMode *pDot11f)
755{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700756#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530757 limLog(pMac, LOG1, FL("ChanWidth : %d"), pDot11f->chanWidth);
758 limLog(pMac, LOG1, FL("reserved: %d"), pDot11f->reserved);
759 limLog(pMac, LOG1, FL("rxNSS: %d"), pDot11f->rxNSS);
760 limLog(pMac, LOG1, FL("rxNSS Type: %d"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700761#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700762}
763
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700764void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
765{
766 tANI_U8 i;
Agrawal Ashishacba1872015-11-30 12:31:41 +0530767 if (pQosMapSet->num_dscp_exceptions > 21)
768 pQosMapSet->num_dscp_exceptions = 21;
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700769 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
770 pQosMapSet->num_dscp_exceptions);
771 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
772 {
773 limLog(pMac, LOG1, FL("dscp value: %d"),
774 pQosMapSet->dscp_exceptions[i][0]);
775 limLog(pMac, LOG1, FL("User priority value: %d"),
776 pQosMapSet->dscp_exceptions[i][1]);
777 }
778 for (i=0;i<8;i++)
779 {
780 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
781 pQosMapSet->dscp_range[i][0]);
782 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
783 pQosMapSet->dscp_range[i][1]);
784 }
785}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700786
Jeff Johnsone7245742012-09-05 17:12:55 -0700787tSirRetStatus
788PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530789 tDot11fIEVHTCaps *pDot11f,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530790 tANI_U8 nChannelNum,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530791 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700792{
793 tSirRetStatus nStatus;
794 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530795 tAniBool disableMcs9 = eSIR_FALSE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700796
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530797 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530798 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
799 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530800 else
801 disableMcs9 =
802 pMac->roam.configParam.channelBondingMode5GHz?
803 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700804 pDot11f->present = 1;
805
806 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
807 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
808
809 nCfgValue = 0;
810 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
811 nCfgValue );
812 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
813
814 nCfgValue = 0;
815 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
816 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
817
818 nCfgValue = 0;
819 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
820 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
821
822 nCfgValue = 0;
823 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
824 nCfgValue );
825 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
826
Deepthi Gowri0c1e1682015-06-19 12:57:53 +0530827 if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
828 {
829 pDot11f->shortGI80MHz = 0;
830 pDot11f->shortGI160and80plus80MHz = 0;
831 }
832
Jeff Johnsone7245742012-09-05 17:12:55 -0700833 nCfgValue = 0;
834 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
835 pDot11f->txSTBC = (nCfgValue & 0x0001);
836
837 nCfgValue = 0;
838 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
839 pDot11f->rxSTBC = (nCfgValue & 0x0007);
840
841 nCfgValue = 0;
842 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
843 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
844
845 nCfgValue = 0;
846 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
847 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
848
849 nCfgValue = 0;
850 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
851 nCfgValue );
852 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
853
854 nCfgValue = 0;
855 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
856 nCfgValue );
857 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
858
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530859 /* muBeamformerCap should be 0 for non AP and
860 * muBeamformeeCap should be 0 for AP
861 */
862 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
863 {
864 nCfgValue = 0;
865 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
866 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
867 pDot11f->muBeamformeeCap = 0;
868 }
869 else
870 {
871 pDot11f->muBeamformerCap = 0;
872 nCfgValue = 0;
873 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
874 /* Enable only if FW and host both support the MU_MIMO feature
875 */
876 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
877 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700878
879 nCfgValue = 0;
880 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
881 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
882
883 nCfgValue = 0;
884 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
885 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
886
887 nCfgValue = 0;
888 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
889 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
890
891 nCfgValue = 0;
892 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
893 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
894
895 nCfgValue = 0;
896 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
897 pDot11f->rxAntPattern = nCfgValue;
898
899 nCfgValue = 0;
900 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
901 pDot11f->txAntPattern = nCfgValue;
902
903 pDot11f->reserved1= 0;
904
905 nCfgValue = 0;
906 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530907
908 if (eSIR_TRUE == disableMcs9)
909 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700910 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
911
912 nCfgValue = 0;
913 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
914 nCfgValue );
915 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
916
917 pDot11f->reserved2= 0;
918
919 nCfgValue = 0;
920 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530921
922 if (eSIR_TRUE == disableMcs9)
923 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700924 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
925
926 nCfgValue = 0;
927 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
928 nCfgValue );
929 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
930
931 pDot11f->reserved3= 0;
932
933 limLogVHTCap(pMac, pDot11f);
934
935 return eSIR_SUCCESS;
936
937}
938
939tSirRetStatus
940PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530941 tDot11fIEVHTOperation *pDot11f,
942 tANI_U8 nChannelNum)
Jeff Johnsone7245742012-09-05 17:12:55 -0700943{
944 tSirRetStatus nStatus;
945 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530946 tAniBool disableMcs9 = eSIR_FALSE;
947
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530948 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530949 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
950 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530951 else
952 disableMcs9 =
953 pMac->roam.configParam.channelBondingMode5GHz?
954 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700955
956 pDot11f->present = 1;
957
958 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
959 pDot11f->chanWidth = (tANI_U8)nCfgValue;
960
961 nCfgValue = 0;
962 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
963 nCfgValue );
964 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
965
966 nCfgValue = 0;
967 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
968 nCfgValue );
969 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
970
971 nCfgValue = 0;
972 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530973
974 if (eSIR_TRUE == disableMcs9)
975 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700976 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
977
978 limLogVHTOperation(pMac,pDot11f);
979
980 return eSIR_SUCCESS;
981
982}
983
984tSirRetStatus
985PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
986 tDot11fIEVHTExtBssLoad *pDot11f)
987{
988 tSirRetStatus nStatus;
989 tANI_U32 nCfgValue=0;
990
991 pDot11f->present = 1;
992
993 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
994 nCfgValue );
995 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
996
997 nCfgValue = 0;
998 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
999 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
1000
1001 nCfgValue=0;
1002 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
1003 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
1004
1005 nCfgValue=0;
1006 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
1007 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
1008
1009 nCfgValue=0;
1010 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
1011 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
1012
1013 limLogVHTExtBssLoad(pMac,pDot11f);
1014
1015 return eSIR_SUCCESS;
1016}
1017
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301018#ifdef WLAN_FEATURE_AP_HT40_24G
1019tSirRetStatus
1020PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
1021 tDot11fIEOBSSScanParameters *pDot11f,
1022 tpPESession psessionEntry)
1023{
1024 pDot11f->present = 1;
1025
1026 pDot11f->obssScanPassiveDwell =
1027 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
1028
1029 pDot11f->obssScanActiveDwell =
1030 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
1031
1032 pDot11f->bssChannelWidthTriggerScanInterval =
1033 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
1034
1035 pDot11f->obssScanPassiveTotalPerChannel =
1036 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
1037
1038 pDot11f->obssScanActiveTotalPerChannel =
1039 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
1040
1041 pDot11f->bssWidthChannelTransitionDelayFactor =
1042 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
1043
1044 pDot11f->obssScanActivityThreshold =
1045 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
1046
1047 return eSIR_SUCCESS;
1048}
1049#endif
1050
Mohit Khanna4a70d262012-09-11 16:30:12 -07001051tSirRetStatus
1052PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +05301053 tDot11fIEExtCap *pDot11f,
1054 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -07001055{
Hu Wangc12631c2016-08-11 09:57:03 +08001056 struct s_ext_cap *p_ext_cap = (struct s_ext_cap *)pDot11f->bytes;
Sandeep Puligilla60342762014-01-30 21:05:37 +05301057
Sandeep Puligilla60342762014-01-30 21:05:37 +05301058#ifdef WLAN_FEATURE_11AC
Sushant Kaushikc25b4fc2015-09-16 16:42:34 +05301059 if (psessionEntry->vhtCapability &&
1060 psessionEntry->limSystemRole != eLIM_STA_IN_IBSS_ROLE )
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301061 {
Hu Wangc12631c2016-08-11 09:57:03 +08001062 p_ext_cap->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301063 pDot11f->present = 1;
1064 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301065#endif
1066 /* while operating in 2.4GHz only then STA need to advertize
1067 the bss co-ex capability*/
1068 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
1069 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301070#ifdef WLAN_FEATURE_AP_HT40_24G
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301071 if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1072 && pMac->roam.configParam.channelBondingMode24GHz)
1073 || pMac->roam.configParam.apHT40_24GEnabled)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301074#else
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301075 if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1076 && pMac->roam.configParam.channelBondingMode24GHz)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301077#endif
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301078 {
Hu Wangc12631c2016-08-11 09:57:03 +08001079 p_ext_cap->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301080 pDot11f->present = 1;
1081 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301082 }
Hu Wangc12631c2016-08-11 09:57:03 +08001083
1084 if (pDot11f->present)
1085 {
1086 /* Need to compute the num_bytes based on bits set */
1087 pDot11f->num_bytes = lim_compute_ext_cap_ie_length(pDot11f);
1088 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07001089 return eSIR_SUCCESS;
1090}
1091
1092tSirRetStatus
1093PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
1094 tDot11fIEOperatingMode *pDot11f,
1095 tpPESession psessionEntry)
1096{
1097 pDot11f->present = 1;
1098
1099 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1100 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1101 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1102
1103 return eSIR_SUCCESS;
1104}
Jeff Johnsone7245742012-09-05 17:12:55 -07001105
1106#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001107tSirRetStatus
1108PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1109 tDot11fIEHTInfo *pDot11f,
1110 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001111{
1112 tANI_U32 nCfgValue, nCfgLen;
1113 tANI_U8 htInfoField1;
1114 tANI_U16 htInfoField2;
1115 tSirRetStatus nSirStatus;
1116 tSirMacHTInfoField1 *pHTInfoField1;
1117 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 union {
1119 tANI_U16 nCfgValue16;
1120 tSirMacHTInfoField3 infoField3;
1121 }uHTInfoField;
1122 union {
1123 tANI_U16 nCfgValue16;
1124 tSirMacHTInfoField2 infoField2;
1125 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001126
Jeff Johnson295189b2012-06-20 16:38:30 -07001127
1128 #if 0
1129 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1130 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301131
1132 if (NULL == psessionEntry)
1133 {
1134 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301135 FL("Invalid session entry in PopulateDot11fHTInfo()"));)
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301136 return eSIR_FAILURE;
1137 }
1138
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1140
1141 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1142
1143 htInfoField1 = ( tANI_U8 ) nCfgValue;
1144
1145 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1147 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1148
Jeff Johnsone7245742012-09-05 17:12:55 -07001149 if (psessionEntry == NULL)
1150 {
1151 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301152 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001153 }
1154 else
1155 {
1156 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1157 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1158 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001159
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001160 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1162
1163 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1164
1165 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1166 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1167 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1168
1169 uHTInfoField2.infoField2.reserved = 0;
1170
1171 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1173
1174 htInfoField2 = ( tANI_U16 ) nCfgValue;
1175
1176 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1177 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1178 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1179 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1180
1181 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001183
1184 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1185
1186
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1188
1189
1190 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1191 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1192 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1193 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1194 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1195 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1196 uHTInfoField.infoField3.reserved = 0;
1197
Jeff Johnson295189b2012-06-20 16:38:30 -07001198
1199 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1200 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1201 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1202 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1203 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1204
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1206 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1207 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1208 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1209
Jeff Johnson295189b2012-06-20 16:38:30 -07001210
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1212 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1213 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1214 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1215 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1216 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1217 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001218 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1219 pDot11f->basicMCSSet, nCfgLen,
1220 SIZE_OF_BASIC_MCS_SET );
1221
1222 pDot11f->present = 1;
1223
1224 return eSIR_SUCCESS;
1225
1226} // End PopulateDot11fHTInfo.
1227
1228void
1229PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1230 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1231{
1232 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1233 {
1234 pDot11f->present = 1;
1235 // ATIM duration is always set to 0
1236 pDot11f->atim = 0;
1237 }
1238
1239} // End PopulateDot11fIBSSParams.
1240
1241
1242#ifdef ANI_SUPPORT_11H
1243tSirRetStatus
1244PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1245 tpSirMacMeasReqActionFrame pReq,
1246 tDot11fIEMeasurementReport *pDot11f)
1247{
1248 pDot11f->token = pReq->measReqIE.measToken;
1249 pDot11f->late = 0;
1250 pDot11f->incapable = 0;
1251 pDot11f->refused = 1;
1252 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1253
1254 pDot11f->present = 1;
1255
1256 return eSIR_SUCCESS;
1257
1258} // End PopulatedDot11fMeasurementReport0.
1259
1260tSirRetStatus
1261PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1262 tpSirMacMeasReqActionFrame pReq,
1263 tDot11fIEMeasurementReport *pDot11f)
1264{
1265 pDot11f->token = pReq->measReqIE.measToken;
1266 pDot11f->late = 0;
1267 pDot11f->incapable = 0;
1268 pDot11f->refused = 1;
1269 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1270
1271 pDot11f->present = 1;
1272
1273 return eSIR_SUCCESS;
1274
1275} // End PopulatedDot11fMeasurementReport1.
1276
1277tSirRetStatus
1278PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1279 tpSirMacMeasReqActionFrame pReq,
1280 tDot11fIEMeasurementReport *pDot11f)
1281{
1282 pDot11f->token = pReq->measReqIE.measToken;
1283 pDot11f->late = 0;
1284 pDot11f->incapable = 0;
1285 pDot11f->refused = 1;
1286 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1287
1288 pDot11f->present = 1;
1289
1290 return eSIR_SUCCESS;
1291
1292} // End PopulatedDot11fMeasurementReport2.
1293#endif
1294
1295void
1296PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1297 tDot11fIEPowerCaps *pCaps,
1298 tANI_U8 nAssocType,
1299 tpPESession psessionEntry)
1300{
1301 if (nAssocType == LIM_REASSOC)
1302 {
1303 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1304 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1305 }else
1306 {
1307 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1308 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1309
1310 }
1311
1312 pCaps->present = 1;
1313} // End PopulateDot11fPowerCaps.
1314
1315tSirRetStatus
1316PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1317 tDot11fIEPowerConstraints *pDot11f)
1318{
1319 tANI_U32 cfg;
1320 tSirRetStatus nSirStatus;
1321
1322 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1323
1324 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1325 pDot11f->present = 1;
1326
1327 return eSIR_SUCCESS;
1328} // End PopulateDot11fPowerConstraints.
1329
1330void
1331PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1332 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1333{
1334 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1335 pDot11f->reserved = 0;
1336 pDot11f->txopreq = 0;
1337 pDot11f->qreq = 0;
1338 pDot11f->qack = 0;
1339 pDot11f->present = 1;
1340} // End PopulatedDot11fQOSCaps.
1341
1342void
1343PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1344 tDot11fIEQOSCapsStation *pDot11f)
1345{
1346 tANI_U32 val = 0;
1347
1348 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301349 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001350
1351 pDot11f->more_data_ack = 0;
1352 pDot11f->max_sp_length = (tANI_U8)val;
1353 pDot11f->qack = 0;
1354
1355 if (pMac->lim.gUapsdEnable)
1356 {
1357 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1358 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1359 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1360 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1361 }
1362 pDot11f->present = 1;
1363} // End PopulatedDot11fQOSCaps.
1364
1365tSirRetStatus
1366PopulateDot11fRSN(tpAniSirGlobal pMac,
1367 tpSirRSNie pRsnIe,
1368 tDot11fIERSN *pDot11f)
1369{
1370 tANI_U32 status;
1371 int idx;
1372
1373 if ( pRsnIe->length )
1374 {
1375 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1376 {
1377 status = dot11fUnpackIeRSN( pMac,
1378 pRsnIe->rsnIEdata + idx + 2, //EID, length
1379 pRsnIe->rsnIEdata[ idx + 1 ],
1380 pDot11f );
1381 if ( DOT11F_FAILED( status ) )
1382 {
1383 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
Sushant Kaushik87787972015-09-11 16:05:00 +05301384 "N (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 status );
1386 return eSIR_FAILURE;
1387 }
1388 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301389 "PopulateDot11fRSN."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 }
1391
1392 }
1393
1394 return eSIR_SUCCESS;
1395} // End PopulateDot11fRSN.
1396
1397tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1398 tpSirRSNie pRsnIe,
1399 tDot11fIERSNOpaque *pDot11f )
1400{
1401 int idx;
1402
1403 if ( pRsnIe->length )
1404 {
1405 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1406 {
1407 pDot11f->present = 1;
1408 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301409 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 pRsnIe->rsnIEdata + idx + 2, // EID, len
1411 pRsnIe->rsnIEdata[ idx + 1 ] );
1412 }
1413 }
1414
1415 return eSIR_SUCCESS;
1416
1417} // End PopulateDot11fRSNOpaque.
1418
1419
1420
1421#if defined(FEATURE_WLAN_WAPI)
1422
1423tSirRetStatus
1424PopulateDot11fWAPI(tpAniSirGlobal pMac,
1425 tpSirRSNie pRsnIe,
1426 tDot11fIEWAPI *pDot11f)
1427 {
1428 tANI_U32 status;
1429 int idx;
1430
1431 if ( pRsnIe->length )
1432 {
1433 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1434 {
1435 status = dot11fUnpackIeWAPI( pMac,
1436 pRsnIe->rsnIEdata + idx + 2, //EID, length
1437 pRsnIe->rsnIEdata[ idx + 1 ],
1438 pDot11f );
1439 if ( DOT11F_FAILED( status ) )
1440 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301441 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001442 status );
1443 return eSIR_FAILURE;
1444 }
1445 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301446 "PopulateDot11fWAPI."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 }
1448 }
1449
1450 return eSIR_SUCCESS;
1451} // End PopulateDot11fWAPI.
1452
1453tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1454 tpSirRSNie pRsnIe,
1455 tDot11fIEWAPIOpaque *pDot11f )
1456{
1457 int idx;
1458
1459 if ( pRsnIe->length )
1460 {
1461 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1462 {
1463 pDot11f->present = 1;
1464 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301465 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 pRsnIe->rsnIEdata + idx + 2, // EID, len
1467 pRsnIe->rsnIEdata[ idx + 1 ] );
1468 }
1469 }
1470
1471 return eSIR_SUCCESS;
1472
1473} // End PopulateDot11fWAPIOpaque.
1474
1475
1476#endif //defined(FEATURE_WLAN_WAPI)
1477
1478void
1479PopulateDot11fSSID(tpAniSirGlobal pMac,
1480 tSirMacSSid *pInternal,
1481 tDot11fIESSID *pDot11f)
1482{
1483 pDot11f->present = 1;
1484 pDot11f->num_ssid = pInternal->length;
1485 if ( pInternal->length )
1486 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301487 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 pInternal->length );
1489 }
1490} // End PopulateDot11fSSID.
1491
1492tSirRetStatus
1493PopulateDot11fSSID2(tpAniSirGlobal pMac,
1494 tDot11fIESSID *pDot11f)
1495{
1496 tANI_U32 nCfg;
1497 tSirRetStatus nSirStatus;
1498
1499 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1500 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1501 pDot11f->present = 1;
1502 return eSIR_SUCCESS;
1503} // End PopulateDot11fSSID2.
1504
1505void
1506PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1507 tDot11fIESchedule *pDot11f)
1508{
1509 pDot11f->aggregation = pSchedule->info.aggregation;
1510 pDot11f->tsid = pSchedule->info.tsid;
1511 pDot11f->direction = pSchedule->info.direction;
1512 pDot11f->reserved = pSchedule->info.rsvd;
1513 pDot11f->service_start_time = pSchedule->svcStartTime;
1514 pDot11f->service_interval = pSchedule->svcInterval;
1515 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1516 pDot11f->spec_interval = pSchedule->specInterval;
1517
1518 pDot11f->present = 1;
1519} // End PopulateDot11fSchedule.
1520
1521void
1522PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1523 tDot11fIESuppChannels *pDot11f,
1524 tANI_U8 nAssocType,
1525 tpPESession psessionEntry)
1526{
1527 tANI_U8 i;
1528 tANI_U8 *p;
1529
1530 if (nAssocType == LIM_REASSOC)
1531 {
1532 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1533 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1534 }else
1535 {
1536 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1537 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1538 }
1539 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1540 {
1541 pDot11f->bands[i][0] = *p;
1542 pDot11f->bands[i][1] = 1;
1543 }
1544
1545 pDot11f->present = 1;
1546
1547} // End PopulateDot11fSuppChannels.
1548
1549tSirRetStatus
1550PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1551 tANI_U8 nChannelNum,
1552 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1553{
1554 tSirRetStatus nSirStatus;
1555 tANI_U32 nRates;
1556 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1557
1558 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1559 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1560 sending mgmt frames (lile probe req) which need to go out before any session is present.
1561 */
1562 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1563 {
1564 #if 0
1565 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1566 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1567 #endif //TO SUPPORT BT-AMP
1568 if(psessionEntry != NULL)
1569 {
1570 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301571 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 nRates);
1573 }
1574 else
1575 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301576 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 nRates = 0;
1578 }
1579 }
1580 else if ( 14 >= nChannelNum )
1581 {
1582 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1583 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1584 }
1585 else
1586 {
1587 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1588 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1589 }
1590
1591 if ( 0 != nRates )
1592 {
1593 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301594 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 pDot11f->present = 1;
1596 }
1597
1598 return eSIR_SUCCESS;
1599
1600} // End PopulateDot11fSuppRates.
1601
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301602/**
1603 * PopulateDot11fRatesTdls() - populate supported rates and
1604 * extended supported rates IE.
1605 * @p_mac gloabl - header.
1606 * @p_supp_rates - pointer to supported rates IE
1607 * @p_ext_supp_rates - pointer to extended supported rates IE
1608 *
1609 * This function populates the supported rates and extended supported
1610 * rates IE based in the STA capability. If the number of rates
1611 * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
1612 * IE is populated.
1613 *
1614 * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
1615 * on failure.
1616 */
1617
1618tSirRetStatus
1619PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
1620 tDot11fIESuppRates *p_supp_rates,
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301621 tDot11fIEExtSuppRates *p_ext_supp_rates,
1622 tANI_U8 curr_oper_channel)
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301623{
1624 tSirMacRateSet temp_rateset;
1625 tSirMacRateSet temp_rateset2;
1626 uint32_t val, i;
1627 uint32_t self_dot11mode = 0;
1628
1629 wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
1630
1631 /**
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301632 * Include 11b rates only when the device configured
1633 * in auto, 11a/b/g or 11b_only and also if current base
1634 * channel is 5 GHz then no need to advertise the 11b rates.
1635 * If devices to move 2.4GHz off-channel then they can communicate
1636 * in 11g rates i.e. (6, 9, 12, 18, 24, 36 and 54).
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301637 */
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301638 limLog(p_mac, LOG1, FL("Current operating channel %d self_dot11mode = %d"),
1639 curr_oper_channel, self_dot11mode);
1640
1641 if ((curr_oper_channel <= SIR_11B_CHANNEL_END) &&
1642 ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301643 (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1644 (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
1645 (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
1646 (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301647 (self_dot11mode == WNI_CFG_DOT11_MODE_11B)))
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301648 {
1649 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1650 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
1651 (tANI_U8 *)&temp_rateset.rate, &val);
1652 temp_rateset.numRates = (tANI_U8) val;
1653 }
1654 else
1655 {
1656 temp_rateset.numRates = 0;
1657 }
1658
1659 /* Include 11a rates when the device configured in non-11b mode */
1660 if (!IS_DOT11_MODE_11B(self_dot11mode))
1661 {
1662 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1663 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
1664 (tANI_U8 *)&temp_rateset2.rate, &val);
1665 temp_rateset2.numRates = (tANI_U8) val;
1666 }
1667 else
1668 {
1669 temp_rateset2.numRates = 0;
1670 }
1671
1672 if ((temp_rateset.numRates + temp_rateset2.numRates) >
1673 SIR_MAC_MAX_NUMBER_OF_RATES)
1674 {
1675 limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
1676 SIR_MAC_MAX_NUMBER_OF_RATES);
1677 return eSIR_FAILURE;
1678 }
1679
1680 /**
1681 * copy all rates in temp_rateset,
1682 * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
1683 */
1684 for (i = 0; i < temp_rateset2.numRates; i++)
1685 temp_rateset.rate[i + temp_rateset.numRates] =
1686 temp_rateset2.rate[i];
1687
1688 temp_rateset.numRates += temp_rateset2.numRates;
1689
1690 if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
1691 {
1692 p_supp_rates->num_rates = temp_rateset.numRates;
1693 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1694 p_supp_rates->num_rates);
1695 p_supp_rates->present = 1;
1696 }
1697 else /* Populate extended capability as well */
1698 {
1699 p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
1700 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1701 p_supp_rates->num_rates);
1702 p_supp_rates->present = 1;
1703 p_ext_supp_rates->num_rates = temp_rateset.numRates -
1704 MAX_NUM_SUPPORTED_RATES;
1705 vos_mem_copy(p_ext_supp_rates->rates,
1706 (tANI_U8 *)temp_rateset.rate +
1707 MAX_NUM_SUPPORTED_RATES,
1708 p_ext_supp_rates->num_rates);
1709 p_ext_supp_rates->present = 1;
1710 }
1711
1712 return eSIR_SUCCESS;
1713
1714} /* End PopulateDot11fRatesTdls */
1715
Jeff Johnson295189b2012-06-20 16:38:30 -07001716tSirRetStatus
1717PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1718 tDot11fIETPCReport *pDot11f,
1719 tpPESession psessionEntry)
1720{
1721 tANI_U16 staid, txPower;
1722 tSirRetStatus nSirStatus;
1723
1724 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1725 if ( eSIR_SUCCESS != nSirStatus )
1726 {
1727 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1728 "eDot11fTPCReport; limGetMgmtStaid "
Sushant Kaushik87787972015-09-11 16:05:00 +05301729 "returned status %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 nSirStatus );
1731 return eSIR_FAILURE;
1732 }
1733
1734 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1735 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1736 txPower = 0;
1737 pDot11f->tx_power = ( tANI_U8 )txPower;
1738 pDot11f->link_margin = 0;
1739 pDot11f->present = 1;
1740
1741 return eSIR_SUCCESS;
1742} // End PopulateDot11fTPCReport.
1743
1744
1745void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1746 tDot11fFfTSInfo *pDot11f)
1747{
1748 pDot11f->traffic_type = pInfo->traffic.trafficType;
1749 pDot11f->tsid = pInfo->traffic.tsid;
1750 pDot11f->direction = pInfo->traffic.direction;
1751 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1752 pDot11f->aggregation = pInfo->traffic.aggregation;
1753 pDot11f->psb = pInfo->traffic.psb;
1754 pDot11f->user_priority = pInfo->traffic.userPrio;
1755 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1756 pDot11f->schedule = pInfo->schedule.schedule;
1757} // End PopulatedDot11fTSInfo.
1758
1759void PopulateDot11fWMM(tpAniSirGlobal pMac,
1760 tDot11fIEWMMInfoAp *pInfo,
1761 tDot11fIEWMMParams *pParams,
1762 tDot11fIEWMMCaps *pCaps,
1763 tpPESession psessionEntry)
1764{
1765 if ( psessionEntry->limWmeEnabled )
1766 {
1767 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1768 {
1769 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1770 {
1771 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1772 }
1773 }
1774 else
1775 {
1776 {
1777 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1778 }
1779
1780 if ( psessionEntry->limWsmEnabled )
1781 {
1782 PopulateDot11fWMMCaps( pCaps );
1783 }
1784 }
1785 }
1786} // End PopulateDot11fWMM.
1787
1788void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1789{
1790 pCaps->version = SIR_MAC_OUI_VERSION_1;
1791 pCaps->qack = 0;
1792 pCaps->queue_request = 1;
1793 pCaps->txop_request = 0;
1794 pCaps->more_ack = 0;
1795 pCaps->present = 1;
1796} // End PopulateDot11fWmmCaps.
1797
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001798#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001799void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1800{
1801 tANI_U8 numTspecs = 0, idx;
1802 tTspecInfo *pTspec = NULL;
1803
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001804 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1805 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 pReassoc->num_WMMTSPEC = numTspecs;
1807 if (numTspecs) {
1808 for (idx=0; idx<numTspecs; idx++) {
1809 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301810 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 pTspec++;
1812 }
1813 }
1814}
1815#endif
1816
1817void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1818 tpPESession psessionEntry)
1819{
1820 pInfo->version = SIR_MAC_OUI_VERSION_1;
1821
1822 /* WMM Specification 3.1.3, 3.2.3
1823 * An IBSS staion shall always use its default WMM parameters.
1824 */
1825 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1826 {
1827 pInfo->param_set_count = 0;
1828 pInfo->uapsd = 0;
1829 }
1830 else
1831 {
1832 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1834 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1835 }
1836 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1838 }
1839 pInfo->present = 1;
1840}
1841
1842void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1843{
1844 tANI_U32 val = 0;
1845
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301846 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 pInfo->version = SIR_MAC_OUI_VERSION_1;
1848 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1849 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1850 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1851 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1852
1853 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301854 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 pInfo->max_sp_length = (tANI_U8)val;
1856 pInfo->present = 1;
1857}
1858
Jeff Johnson295189b2012-06-20 16:38:30 -07001859void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1860 tDot11fIEWMMParams *pParams,
1861 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001862{
1863 pParams->version = SIR_MAC_OUI_VERSION_1;
1864
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1866 pParams->qosInfo =
1867 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1868 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 pParams->qosInfo =
1870 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1871
1872 // Fill each EDCA parameter set in order: be, bk, vi, vo
1873 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1874 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1875 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1876 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1877 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1878 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1879
1880 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1881 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1882 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1883 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1884 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1885 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1886
Jeff Johnson295189b2012-06-20 16:38:30 -07001887 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1888 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1889 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1891
1892
1893
1894 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1895 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1896 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1897 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1898 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1899
Jeff Johnson295189b2012-06-20 16:38:30 -07001900 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1901 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1902 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1904
1905 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1906 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1907 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1908 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1909 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1910
1911 pParams->present = 1;
1912
1913} // End PopulateDot11fWMMParams.
1914
1915void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1916 tDot11fIEWMMSchedule *pDot11f)
1917{
1918 pDot11f->version = 1;
1919 pDot11f->aggregation = pSchedule->info.aggregation;
1920 pDot11f->tsid = pSchedule->info.tsid;
1921 pDot11f->direction = pSchedule->info.direction;
1922 pDot11f->reserved = pSchedule->info.rsvd;
1923 pDot11f->service_start_time = pSchedule->svcStartTime;
1924 pDot11f->service_interval = pSchedule->svcInterval;
1925 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1926 pDot11f->spec_interval = pSchedule->specInterval;
1927
1928 pDot11f->present = 1;
1929} // End PopulateDot11fWMMSchedule.
1930
1931tSirRetStatus
1932PopulateDot11fWPA(tpAniSirGlobal pMac,
1933 tpSirRSNie pRsnIe,
1934 tDot11fIEWPA *pDot11f)
1935{
1936 tANI_U32 status;
1937 int idx;
1938
1939 if ( pRsnIe->length )
1940 {
1941 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1942 {
1943 status = dot11fUnpackIeWPA( pMac,
1944 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1945 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1946 pDot11f );
1947 if ( DOT11F_FAILED( status ) )
1948 {
1949 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
Sushant Kaushik87787972015-09-11 16:05:00 +05301950 "A (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 status );
1952 return eSIR_FAILURE;
1953 }
1954 }
1955 }
1956
1957 return eSIR_SUCCESS;
1958} // End PopulateDot11fWPA.
1959
1960
1961
1962tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1963 tpSirRSNie pRsnIe,
1964 tDot11fIEWPAOpaque *pDot11f )
1965{
1966 int idx;
1967
1968 if ( pRsnIe->length )
1969 {
1970 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1971 {
1972 pDot11f->present = 1;
1973 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301974 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1976 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1977 }
1978 }
1979
1980 return eSIR_SUCCESS;
1981
1982} // End PopulateDot11fWPAOpaque.
1983
1984////////////////////////////////////////////////////////////////////////
1985
1986tSirRetStatus
1987sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1988{
1989#if 0
1990 tANI_U32 val;
1991
1992 *caps = 0;
1993 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1994 != eSIR_SUCCESS)
1995 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301996 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 return eSIR_FAILURE;
1998 }
1999 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
2000 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302001 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 return eSIR_FAILURE;
2003 }
2004
2005 *caps = (tANI_U16) val;
2006#endif
2007 return eSIR_SUCCESS;
2008}
2009
2010tSirRetStatus
2011sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
2012 tANI_U8 *pFrame,
2013 tANI_U32 nFrame,
2014 tpSirProbeReq pProbeReq)
2015{
2016 tANI_U32 status;
2017 tDot11fProbeRequest pr;
2018
2019 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302020 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002021
2022 // delegate to the framesc-generated code,
2023 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
2024 if ( DOT11F_FAILED( status ) )
2025 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302026 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 status, nFrame);
2028 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2029 return eSIR_FAILURE;
2030 }
2031 else if ( DOT11F_WARNED( status ) )
2032 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302033 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 status, nFrame );
2035 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2036 }
2037
2038 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
2039 if ( ! pr.SSID.present )
2040 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302041 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 }
2043 else
2044 {
2045 pProbeReq->ssidPresent = 1;
2046 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
2047 }
2048
2049 if ( ! pr.SuppRates.present )
2050 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302051 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 return eSIR_FAILURE;
2053 }
2054 else
2055 {
2056 pProbeReq->suppRatesPresent = 1;
2057 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
2058 }
2059
2060 if ( pr.ExtSuppRates.present )
2061 {
2062 pProbeReq->extendedRatesPresent = 1;
2063 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
2064 }
2065
2066 if ( pr.HTCaps.present )
2067 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302068 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 }
2070
2071 if ( pr.WscProbeReq.present )
2072 {
2073 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05302074 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002076#ifdef WLAN_FEATURE_11AC
2077 if ( pr.VHTCaps.present )
2078 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302079 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002080 }
2081#endif
2082
Jeff Johnson295189b2012-06-20 16:38:30 -07002083
2084 if ( pr.P2PProbeReq.present )
2085 {
2086 pProbeReq->p2pIePresent = 1;
2087 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002088
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 return eSIR_SUCCESS;
2090
2091} // End sirConvertProbeReqFrame2Struct.
2092
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302093/* function ValidateAndRectifyIEs checks for the malformed frame.
2094 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302095 * (Tagged elements).
2096 * Every Tagged IE has tag number, tag length and data. Tag length indicates
2097 * the size of data in bytes.
2098 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302099 * And also rectifies missing optional fields in IE.
2100 *
2101 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
2102 * extended to rectify other optional fields in other IEs.
2103 *
2104 */
2105tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
2106 tANI_U8 *pMgmtFrame,
2107 tANI_U32 nFrameBytes,
2108 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302109{
2110 tANI_U32 length = SIZE_OF_FIXED_PARAM;
2111 tANI_U8 *refFrame;
2112
2113 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302114 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302115 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302116 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302117 {
2118 /*refFrame points to next IE */
2119 refFrame = pMgmtFrame + length;
2120 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
2121 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
2122 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302123 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302124 {
2125 /* Workaround : Some APs may not include RSN Capability but
2126 * the length of which is included in RSN IE length.
2127 * this may cause in updating RSN Capability with junk value.
2128 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302129 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302130 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302131 if ((*refFrame == RSNIEID) &&
2132 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302133 {
2134 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302135 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302136 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302137 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302138 limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05302139 FL("Added RSN Capability to the RSNIE as 0x00 0x00"));
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302140
2141 return eHAL_STATUS_SUCCESS;
Hu Wangfcc5e132016-03-04 10:34:24 +08002142 } else {
2143 /* Workaround: Some APs may add extra 0x00 padding after IEs.
2144 * Return true to allow these probe response frames proceed.
2145 */
2146 if (nFrameBytes - length > 0) {
2147 tANI_U32 i;
2148 tANI_BOOLEAN zero_padding = VOS_TRUE;
2149
2150 for (i = length; i < nFrameBytes; i ++) {
2151 if (pMgmtFrame[i-1] != 0x0) {
2152 zero_padding = VOS_FALSE;
2153 break;
2154 }
2155 }
2156
2157 if (zero_padding) {
2158 return eHAL_STATUS_SUCCESS;
2159 }
2160 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302161 }
Hu Wangfcc5e132016-03-04 10:34:24 +08002162
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302163 return eSIR_FAILURE;
2164 }
2165 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302166 return eHAL_STATUS_SUCCESS;
2167}
2168
Jeff Johnson295189b2012-06-20 16:38:30 -07002169tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
2170 tANI_U8 *pFrame,
2171 tANI_U32 nFrame,
2172 tpSirProbeRespBeacon pProbeResp)
2173{
2174 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002175 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002176
2177 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302178 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002179
Abhishek Singhc75726d2015-04-13 14:44:14 +05302180 pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302181 if ( NULL == pr )
2182 status = eHAL_STATUS_FAILURE;
2183 else
2184 status = eHAL_STATUS_SUCCESS;
2185 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07002186 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302187 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002188 return eSIR_FAILURE;
2189 }
2190
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302191 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002192
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002194 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 if ( DOT11F_FAILED( status ) )
2196 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302197 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 status, nFrame);
2199 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05302200 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 return eSIR_FAILURE;
2202 }
2203 else if ( DOT11F_WARNED( status ) )
2204 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302205 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 status, nFrame );
2207 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2208 }
2209
2210 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
2211
2212 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302213 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
2214 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002215
2216 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07002217 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002218
2219 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07002220 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
2221 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
2222 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
2223 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
2224 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
2225 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
2226 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
2227 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
2228 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
2229 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
2230 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2231 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2232 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2233 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2234 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2235 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002236
Jeff Johnson32d95a32012-09-10 13:15:23 -07002237 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302239 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 }
2241 else
2242 {
2243 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002244 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 }
2246
Jeff Johnson32d95a32012-09-10 13:15:23 -07002247 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302249 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 }
2251 else
2252 {
2253 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002254 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 }
2256
Jeff Johnson32d95a32012-09-10 13:15:23 -07002257 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 {
2259 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002260 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 }
2262
2263
Jeff Johnson32d95a32012-09-10 13:15:23 -07002264 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 {
2266 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002267 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 }
2269
Jeff Johnson32d95a32012-09-10 13:15:23 -07002270 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 {
2272 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002273 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 }
2275
Jeff Johnson32d95a32012-09-10 13:15:23 -07002276 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 {
2278 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002279 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 }
2281
Jeff Johnson32d95a32012-09-10 13:15:23 -07002282 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 {
2284 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302285 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 sizeof(tDot11fIEExtChanSwitchAnn) );
2287 }
2288
Jeff Johnson32d95a32012-09-10 13:15:23 -07002289 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 {
2291 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302292 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 sizeof(tDot11fIEExtChanSwitchAnn) );
2294 }
2295
Jeff Johnson32d95a32012-09-10 13:15:23 -07002296 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 {
2298 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302299 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301
Jeff Johnson32d95a32012-09-10 13:15:23 -07002302 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 {
2304 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302305 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2306 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 }
2308
Jeff Johnson32d95a32012-09-10 13:15:23 -07002309 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 {
2311 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302312 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 }
2314
Jeff Johnson32d95a32012-09-10 13:15:23 -07002315 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302317 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 }
2319
Jeff Johnson32d95a32012-09-10 13:15:23 -07002320 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302322 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 }
2324
Jeff Johnson32d95a32012-09-10 13:15:23 -07002325 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002326 {
2327 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002328 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002330 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002332 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 }
2334
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002335 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 {
2337 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002338 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002339 }
2340
Jeff Johnson32d95a32012-09-10 13:15:23 -07002341 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 {
2343 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002344 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 }
2346
Jeff Johnson32d95a32012-09-10 13:15:23 -07002347 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 {
2349 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002350 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05302351 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002352 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 }
2354
Jeff Johnson32d95a32012-09-10 13:15:23 -07002355 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002356 {
2357 pProbeResp->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05302358 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 }
2360
Jeff Johnson32d95a32012-09-10 13:15:23 -07002361 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002362 {
2363 pProbeResp->wsmCapablePresent = 1;
2364 }
2365
2366
Jeff Johnson32d95a32012-09-10 13:15:23 -07002367 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 {
2369 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002370 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002371 }
2372
2373#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002374 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002375 {
2376 // MobilityDomain
2377 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302378 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2379 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002380 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002381#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Sushant Kaushik87787972015-09-11 16:05:00 +05302382 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2384#endif
2385 }
2386#endif
2387
Kapil Gupta04ab1992016-06-26 13:36:51 +05302388#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
Jeff Johnson32d95a32012-09-10 13:15:23 -07002389 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302391 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002392 }
2393#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002394 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302396 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 sizeof(tDot11fIEP2PProbeRes) );
2398 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002399#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002400 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002401 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302402 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002403 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002404 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002405 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302406 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002407 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002408 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002409 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302410 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002411 }
2412#endif
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302413
Abhishek Singhc75726d2015-04-13 14:44:14 +05302414 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 return eSIR_SUCCESS;
2416
2417} // End sirConvertProbeFrame2Struct.
2418
2419tSirRetStatus
2420sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2421 tANI_U8 *pFrame,
2422 tANI_U32 nFrame,
2423 tpSirAssocReq pAssocReq)
2424{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002425 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 tANI_U32 status;
2427
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302428 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2429 if ( NULL == ar )
2430 status = eHAL_STATUS_FAILURE;
2431 else
2432 status = eHAL_STATUS_SUCCESS;
2433 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002434 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302435 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002436 return eSIR_FAILURE;
2437 }
2438 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302439 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2440 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002441
2442 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002443 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002444 if ( DOT11F_FAILED( status ) )
2445 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302446 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 status, nFrame);
2448 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302449 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 return eSIR_FAILURE;
2451 }
2452 else if ( DOT11F_WARNED( status ) )
2453 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302454 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 status, nFrame );
2456 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2457 }
2458
2459 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2460
2461 // make sure this is seen as an assoc request
2462 pAssocReq->reassocRequest = 0;
2463
2464 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002465 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2466 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2467 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2468 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2469 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2470 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2471 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2472 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2473 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2474 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2475 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2476 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2477 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2478 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2479 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2480 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002481
2482 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002483 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002484
2485 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002486 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002487 {
2488 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002489 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 }
2491
2492 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002493 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 {
2495 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002496 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 }
2498
2499 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002500 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 {
2502 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002503 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 }
2505
2506 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002507 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 {
2509 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002510 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 }
2512
2513 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002514 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 {
2516 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002517 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 }
2519
2520 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002521 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002522 {
2523 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002524 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002525 }
2526
2527 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002528 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 {
2530 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002531 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002532 }
2533
2534
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002535 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 {
2537 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002538 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002540#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002541 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002542 {
2543 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002544 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002545 }
2546#endif
2547
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002549 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 {
2551 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002552 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 }
2554
2555 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002556 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002557 {
2558 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002559 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 }
2561
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002562 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302564 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 }
2566
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002567 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 {
2569 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302570 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2571 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002572
2573 }
2574
2575
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002576 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578 if ( ! pAssocReq->ssidPresent )
2579 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302580 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302581 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002582 return eSIR_FAILURE;
2583 }
2584
2585 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2586 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302587 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302588 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002589 return eSIR_FAILURE;
2590 }
2591
Jeff Johnsone7245742012-09-05 17:12:55 -07002592#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002593 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002594 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302595 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302596 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002597 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2598 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002599 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002600 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302601 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Sushant Kaushik87787972015-09-11 16:05:00 +05302602 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002603 limLogOperatingMode( pMac, &pAssocReq->operMode);
2604 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002605#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302606 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 return eSIR_SUCCESS;
2608
2609} // End sirConvertAssocReqFrame2Struct.
2610
2611tSirRetStatus
2612sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2613 tANI_U8 *pFrame,
2614 tANI_U32 nFrame,
2615 tpSirAssocRsp pAssocRsp)
2616{
2617 static tDot11fAssocResponse ar;
2618 tANI_U32 status;
2619 tANI_U8 cnt =0;
2620
2621 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302622 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002623
2624 // delegate to the framesc-generated code,
2625 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2626 if ( DOT11F_FAILED( status ) )
2627 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302628 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 status, nFrame);
2630 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2631 return eSIR_FAILURE;
2632 }
2633 else if ( DOT11F_WARNED( status ) )
2634 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302635 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002636 status, nFrame );
2637 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2638 }
2639
2640 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2641
2642 // Capabilities
2643 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2644 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2645 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2646 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2647 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2648 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2649 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2650 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2651 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2652 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2653 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2654 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2655 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2656 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2657 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2658 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2659
2660 pAssocRsp->statusCode = ar.Status.status;
2661 pAssocRsp->aid = ar.AID.associd;
2662
2663 if ( ! ar.SuppRates.present )
2664 {
2665 pAssocRsp->suppRatesPresent = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302666 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 }
2668 else
2669 {
2670 pAssocRsp->suppRatesPresent = 1;
2671 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2672 }
2673
2674 if ( ar.ExtSuppRates.present )
2675 {
2676 pAssocRsp->extendedRatesPresent = 1;
2677 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2678 }
2679
2680 if ( ar.EDCAParamSet.present )
2681 {
2682 pAssocRsp->edcaPresent = 1;
2683 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2684 }
Atul Mittalbceb4a12014-11-27 18:50:19 +05302685 if (ar.ExtCap.present)
2686 {
Hu Wangc12631c2016-08-11 09:57:03 +08002687 struct s_ext_cap *p_ext_cap;
Atul Mittalbceb4a12014-11-27 18:50:19 +05302688 vos_mem_copy(&pAssocRsp->ExtCap, &ar.ExtCap, sizeof(tDot11fIEExtCap));
Hu Wangc12631c2016-08-11 09:57:03 +08002689
2690 p_ext_cap = (struct s_ext_cap *)&pAssocRsp->ExtCap.bytes;
Atul Mittalbceb4a12014-11-27 18:50:19 +05302691 limLog(pMac, LOG1,
2692 FL("ExtCap is present, TDLSChanSwitProhibited: %d"),
Hu Wangc12631c2016-08-11 09:57:03 +08002693 p_ext_cap->TDLSChanSwitProhibited);
Atul Mittalbceb4a12014-11-27 18:50:19 +05302694 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 if ( ar.WMMParams.present )
2696 {
2697 pAssocRsp->wmeEdcaPresent = 1;
2698 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002699 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 __printWMMParams(pMac, &ar.WMMParams);
2701 }
2702
2703 if ( ar.HTCaps.present )
2704 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302705 limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302706 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002707 }
2708
2709 if ( ar.HTInfo.present )
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302710 { limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302711 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 }
2713
2714#ifdef WLAN_FEATURE_VOWIFI_11R
2715 if (ar.MobilityDomain.present)
2716 {
2717 // MobilityDomain
2718 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302719 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2720 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2722#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002723 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002724 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2725#endif
2726 }
2727
2728 if ( ar.FTInfo.present )
2729 {
2730#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002731 limLog(pMac, LOG1, FL("FT Info present %d %d %d"), ar.FTInfo.R0KH_ID.num_PMK_R0_ID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002732 ar.FTInfo.R0KH_ID.present,
2733 ar.FTInfo.R1KH_ID.present);
2734#endif
2735 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302736 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 }
2738#endif
2739
2740#ifdef WLAN_FEATURE_VOWIFI_11R
2741 if (ar.num_RICDataDesc) {
2742 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2743 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302744 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2745 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002746 }
2747 }
2748 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2749 pAssocRsp->ricPresent = TRUE;
2750 }
2751#endif
2752
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002753#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 if (ar.num_WMMTSPEC) {
2755 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2756 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302757 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2758 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002759 }
2760 pAssocRsp->tspecPresent = TRUE;
2761 }
2762
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002763 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 {
2765 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302766 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002767 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 }
2769#endif
2770
Jeff Johnsone7245742012-09-05 17:12:55 -07002771#ifdef WLAN_FEATURE_11AC
2772 if ( ar.VHTCaps.present )
2773 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302774 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002775 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002776 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2777 }
2778 if ( ar.VHTOperation.present )
2779 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302780 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002781 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002782 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2783 }
2784#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302785 if(ar.OBSSScanParameters.present)
2786 {
2787 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2788 sizeof( tDot11fIEOBSSScanParameters));
2789 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002790 if ( ar.QosMapSet.present )
2791 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002792 pAssocRsp->QosMapSet.present = 1;
2793 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002794 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002795 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002796 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002798} // End sirConvertAssocRespFrame2Struct.
2799
2800tSirRetStatus
2801sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2802 tANI_U8 *pFrame,
2803 tANI_U32 nFrame,
2804 tpSirAssocReq pAssocReq)
2805{
2806 static tDot11fReAssocRequest ar;
2807 tANI_U32 status;
2808
2809 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302810 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002811
2812 // delegate to the framesc-generated code,
2813 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2814 if ( DOT11F_FAILED( status ) )
2815 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302816 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 status, nFrame);
2818 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2819 return eSIR_FAILURE;
2820 }
2821 else if ( DOT11F_WARNED( status ) )
2822 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302823 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002824 status, nFrame );
2825 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2826 }
2827
2828 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2829
2830 // make sure this is seen as a re-assoc request
2831 pAssocReq->reassocRequest = 1;
2832
2833 // Capabilities
2834 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2835 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2836 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2837 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2838 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2839 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2840 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2841 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2842 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2843 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2844 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2845 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2846 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2847 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2848 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2849 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2850
2851 // Listen Interval
2852 pAssocReq->listenInterval = ar.ListenInterval.interval;
2853
2854 // SSID
2855 if ( ar.SSID.present )
2856 {
2857 pAssocReq->ssidPresent = 1;
2858 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2859 }
2860
2861 // Supported Rates
2862 if ( ar.SuppRates.present )
2863 {
2864 pAssocReq->suppRatesPresent = 1;
2865 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2866 }
2867
2868 // Extended Supported Rates
2869 if ( ar.ExtSuppRates.present )
2870 {
2871 pAssocReq->extendedRatesPresent = 1;
2872 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2873 &ar.ExtSuppRates );
2874 }
2875
2876 // QOS Capabilities:
2877 if ( ar.QOSCapsStation.present )
2878 {
2879 pAssocReq->qosCapabilityPresent = 1;
2880 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2881 }
2882
2883 // WPA
2884 if ( ar.WPAOpaque.present )
2885 {
2886 pAssocReq->wpaPresent = 1;
2887 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2888 }
2889
2890 // RSN
2891 if ( ar.RSNOpaque.present )
2892 {
2893 pAssocReq->rsnPresent = 1;
2894 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2895 }
2896
2897
2898 // Power Capabilities
2899 if ( ar.PowerCaps.present )
2900 {
2901 pAssocReq->powerCapabilityPresent = 1;
2902 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2903 }
2904
2905 // Supported Channels
2906 if ( ar.SuppChannels.present )
2907 {
2908 pAssocReq->supportedChannelsPresent = 1;
2909 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2910 }
2911
2912 if ( ar.HTCaps.present )
2913 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302914 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 }
2916
2917 if ( ar.WMMInfoStation.present )
2918 {
2919 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302920 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2921 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002922
2923 }
2924
2925 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2926
2927 if ( ! pAssocReq->ssidPresent )
2928 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302929 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 return eSIR_FAILURE;
2931 }
2932
2933 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2934 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302935 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002936 return eSIR_FAILURE;
2937 }
2938
2939 // Why no call to 'updateAssocReqFromPropCapability' here, like
2940 // there is in 'sirConvertAssocReqFrame2Struct'?
2941
2942 // WSC IE
2943 if (ar.WscIEOpaque.present)
2944 {
2945 pAssocReq->addIEPresent = 1;
2946 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2947 }
2948
Jeff Johnson295189b2012-06-20 16:38:30 -07002949 if(ar.P2PIEOpaque.present)
2950 {
2951 pAssocReq->addIEPresent = 1;
2952 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2953 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002954
Jeff Johnsone7245742012-09-05 17:12:55 -07002955#ifdef WLAN_FEATURE_WFD
2956 if(ar.WFDIEOpaque.present)
2957 {
2958 pAssocReq->addIEPresent = 1;
2959 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2960 }
2961#endif
2962
2963#ifdef WLAN_FEATURE_11AC
2964 if ( ar.VHTCaps.present )
2965 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302966 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002967 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002968 if ( ar.OperatingMode.present )
2969 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302970 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302971 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002972 limLogOperatingMode( pMac, &pAssocReq->operMode);
2973 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002974#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 return eSIR_SUCCESS;
2976
2977} // End sirConvertReassocReqFrame2Struct.
2978
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002979
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002980#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002981tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002982sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002983 tANI_U8 *pPayload,
2984 const tANI_U32 nPayload,
2985 tANI_U8 **outIeBuf,
2986 tANI_U32 *pOutIeLen)
2987{
2988 tDot11fBeaconIEs *pBies = NULL;
2989 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002990 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002991 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002992
2993 /* To store how many bytes are required to be allocated
2994 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002995 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002996 tANI_U8 *pos = NULL;
2997
2998 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002999 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003000 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3001 if ( NULL == pBies )
3002 status = eHAL_STATUS_FAILURE;
3003 else
3004 status = eHAL_STATUS_SUCCESS;
3005 if (!HAL_STATUS_SUCCESS(status))
3006 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303007 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003008 return eSIR_FAILURE;
3009 }
Hu Wangc12631c2016-08-11 09:57:03 +08003010 vos_mem_zero(pBies, sizeof(tDot11fBeaconIEs));
3011
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003012 // delegate to the framesc-generated code,
3013 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3014
3015 if ( DOT11F_FAILED( status ) )
3016 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303017 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003018 status, nPayload);
3019 vos_mem_free(pBies);
3020 return eSIR_FAILURE;
3021 }
3022 else if ( DOT11F_WARNED( status ) )
3023 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303024 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003025 status, nPayload );
3026 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3027 }
3028
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003029 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003030 if ( !pBies->SSID.present )
3031 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303032 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003033 }
3034 else
3035 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003036 eseBcnReportMandatoryIe.ssidPresent = 1;
3037 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003038 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003039 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003040 }
3041
3042 if ( !pBies->SuppRates.present )
3043 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303044 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003045 }
3046 else
3047 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003048 eseBcnReportMandatoryIe.suppRatesPresent = 1;
3049 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
3050 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003051 }
3052
3053 if ( pBies->FHParamSet.present)
3054 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003055 eseBcnReportMandatoryIe.fhParamPresent = 1;
3056 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003057 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
3058 }
3059
3060 if ( pBies->DSParams.present )
3061 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003062 eseBcnReportMandatoryIe.dsParamsPresent = 1;
3063 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003064 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
3065 }
3066
3067 if ( pBies->CFParams.present )
3068 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003069 eseBcnReportMandatoryIe.cfPresent = 1;
3070 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003071 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
3072 }
3073
3074 if ( pBies->IBSSParams.present )
3075 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003076 eseBcnReportMandatoryIe.ibssParamPresent = 1;
3077 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003078 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3079 }
3080
3081 if ( pBies->TIM.present )
3082 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003083 eseBcnReportMandatoryIe.timPresent = 1;
3084 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
3085 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
3086 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
3087 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003088 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
3089 }
3090
3091 if ( pBies->RRMEnabledCap.present )
3092 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003093 eseBcnReportMandatoryIe.rrmPresent = 1;
3094 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003095 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3096 }
3097
3098 *outIeBuf = vos_mem_malloc(numBytes);
3099 if (NULL == *outIeBuf)
3100 {
3101 limLog(pMac, LOGP, FL("Memory Allocation failure"));
3102 vos_mem_free(pBies);
3103 return eSIR_FAILURE;
3104 }
3105 pos = *outIeBuf;
3106 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003107 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003108
3109 /* Start filling the output Ie with Mandatory IE information */
3110 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003111 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003112 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003113 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003114 {
3115 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
3116 retStatus = eSIR_FAILURE;
3117 goto err_bcnrep;
3118 }
3119 *pos = SIR_MAC_SSID_EID;
3120 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003121 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003122 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003123 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
3124 eseBcnReportMandatoryIe.ssId.length);
3125 pos += eseBcnReportMandatoryIe.ssId.length;
3126 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003127 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003128
3129 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003130 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003131 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003132 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003133 {
3134 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
3135 retStatus = eSIR_FAILURE;
3136 goto err_bcnrep;
3137 }
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05303138 if (eseBcnReportMandatoryIe.supportedRates.numRates <=
3139 SIR_MAC_RATESET_EID_MAX) {
3140 *pos = SIR_MAC_RATESET_EID;
3141 pos++;
3142 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
3143 pos++;
3144 vos_mem_copy(pos,
3145 (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
3146 eseBcnReportMandatoryIe.supportedRates.numRates);
3147 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
3148 freeBytes -= (1 + 1 +
3149 eseBcnReportMandatoryIe.supportedRates.numRates);
3150 }
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003151 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003152
3153 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003154 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003155 {
3156 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
3157 {
3158 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
3159 retStatus = eSIR_FAILURE;
3160 goto err_bcnrep;
3161 }
3162 *pos = SIR_MAC_FH_PARAM_SET_EID;
3163 pos++;
3164 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
3165 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003166 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003167 SIR_MAC_FH_PARAM_SET_EID_MAX);
3168 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
3169 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
3170 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003171
3172 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003173 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003174 {
3175 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
3176 {
3177 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
3178 retStatus = eSIR_FAILURE;
3179 goto err_bcnrep;
3180 }
3181 *pos = SIR_MAC_DS_PARAM_SET_EID;
3182 pos++;
3183 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
3184 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003185 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003186 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
3187 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
3188 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003189
3190 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003191 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003192 {
3193 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
3194 {
3195 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
3196 retStatus = eSIR_FAILURE;
3197 goto err_bcnrep;
3198 }
3199 *pos = SIR_MAC_CF_PARAM_SET_EID;
3200 pos++;
3201 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
3202 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003203 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003204 SIR_MAC_CF_PARAM_SET_EID_MAX);
3205 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
3206 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
3207 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003208
3209 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003210 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003211 {
3212 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
3213 {
3214 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
3215 retStatus = eSIR_FAILURE;
3216 goto err_bcnrep;
3217 }
3218 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
3219 pos++;
3220 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3221 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003222 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003223 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3224 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3225 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3226 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003227
3228 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003229 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003230 {
3231 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
3232 {
3233 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
3234 retStatus = eSIR_FAILURE;
3235 goto err_bcnrep;
3236 }
3237 *pos = SIR_MAC_TIM_EID;
3238 pos++;
3239 *pos = SIR_MAC_TIM_EID_MIN;
3240 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003241 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003242 SIR_MAC_TIM_EID_MIN);
3243 pos += SIR_MAC_TIM_EID_MIN;
3244 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
3245 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003246
3247 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003248 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003249 {
3250 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3251 {
3252 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3253 retStatus = eSIR_FAILURE;
3254 goto err_bcnrep;
3255 }
3256 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3257 pos++;
3258 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3259 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003260 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003261 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3262 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3263 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003264
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003265 if (freeBytes != 0)
3266 {
3267 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3268 retStatus = eSIR_FAILURE;
3269 }
3270
3271err_bcnrep:
3272 /* The message counter would not be incremented in case of
3273 * returning failure and hence next time, this function gets
3274 * called, it would be using the same msg ctr for a different
3275 * BSS.So, it is good to clear the memory allocated for a BSS
3276 * that is returning failure.On success, the caller would take
3277 * care of freeing up the memory*/
3278 if (retStatus == eSIR_FAILURE)
3279 {
3280 vos_mem_free(*outIeBuf);
3281 *outIeBuf = NULL;
3282 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003283 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003284 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003285}
3286
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003287#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003288
Jeff Johnson295189b2012-06-20 16:38:30 -07003289tSirRetStatus
3290sirParseBeaconIE(tpAniSirGlobal pMac,
3291 tpSirProbeRespBeacon pBeaconStruct,
3292 tANI_U8 *pPayload,
3293 tANI_U32 nPayload)
3294{
3295 tDot11fBeaconIEs *pBies;
3296 tANI_U32 status;
3297
3298 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303299 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003300
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303301 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3302 if ( NULL == pBies )
3303 status = eHAL_STATUS_FAILURE;
3304 else
3305 status = eHAL_STATUS_SUCCESS;
3306 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303308 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003309 return eSIR_FAILURE;
3310 }
Hu Wangc12631c2016-08-11 09:57:03 +08003311 vos_mem_zero(pBies, sizeof(tDot11fBeaconIEs));
3312
Jeff Johnson295189b2012-06-20 16:38:30 -07003313 // delegate to the framesc-generated code,
3314 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3315
3316 if ( DOT11F_FAILED( status ) )
3317 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303318 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 status, nPayload);
3320 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303321 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 return eSIR_FAILURE;
3323 }
3324 else if ( DOT11F_WARNED( status ) )
3325 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303326 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003327 status, nPayload );
3328 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3329 }
3330
3331 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3332 if ( ! pBies->SSID.present )
3333 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303334 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003335 }
3336 else
3337 {
3338 pBeaconStruct->ssidPresent = 1;
3339 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3340 }
3341
3342 if ( ! pBies->SuppRates.present )
3343 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303344 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 }
3346 else
3347 {
3348 pBeaconStruct->suppRatesPresent = 1;
3349 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3350 }
3351
3352 if ( pBies->ExtSuppRates.present )
3353 {
3354 pBeaconStruct->extendedRatesPresent = 1;
3355 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3356 }
3357
3358 if ( pBies->CFParams.present )
3359 {
3360 pBeaconStruct->cfPresent = 1;
3361 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3362 }
3363
3364 if ( pBies->TIM.present )
3365 {
3366 pBeaconStruct->timPresent = 1;
3367 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3368 }
3369
3370 if ( pBies->Country.present )
3371 {
3372 pBeaconStruct->countryInfoPresent = 1;
3373 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3374 }
3375
3376 // 11h IEs
3377 if(pBies->TPCReport.present)
3378 {
3379 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303380 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 &pBies->TPCReport,
3382 sizeof( tDot11fIETPCReport));
3383 }
3384
3385 if(pBies->PowerConstraints.present)
3386 {
3387 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303388 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 &pBies->PowerConstraints,
3390 sizeof(tDot11fIEPowerConstraints));
3391 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003392#ifdef FEATURE_WLAN_ESE
3393 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003395 pBeaconStruct->eseTxPwr.present = 1;
3396 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 }
3398 if (pBies->QBSSLoad.present)
3399 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303400 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003401 }
3402#endif
3403
3404 if ( pBies->EDCAParamSet.present )
3405 {
3406 pBeaconStruct->edcaPresent = 1;
3407 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3408 }
3409
3410 // QOS Capabilities:
3411 if ( pBies->QOSCapsAp.present )
3412 {
3413 pBeaconStruct->qosCapabilityPresent = 1;
3414 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3415 }
3416
3417
3418
3419 if ( pBies->ChanSwitchAnn.present )
3420 {
3421 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303422 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 sizeof(tDot11fIEChanSwitchAnn));
3424 }
3425
3426 if ( pBies->ExtChanSwitchAnn.present)
3427 {
3428 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303429 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 sizeof(tDot11fIEExtChanSwitchAnn));
3431 }
3432
3433 if ( pBies->Quiet.present )
3434 {
3435 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303436 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 }
3438
3439 if ( pBies->HTCaps.present )
3440 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303441 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003442 }
3443
3444 if ( pBies->HTInfo.present )
3445 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303446 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 }
3448
3449 if ( pBies->DSParams.present )
3450 {
3451 pBeaconStruct->dsParamsPresent = 1;
3452 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3453 }
3454 else if(pBies->HTInfo.present)
3455 {
3456 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3457 }
3458
3459 if ( pBies->RSN.present )
3460 {
3461 pBeaconStruct->rsnPresent = 1;
3462 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3463 }
3464
3465 if ( pBies->WPA.present )
3466 {
3467 pBeaconStruct->wpaPresent = 1;
3468 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3469 }
3470
3471 if ( pBies->WMMParams.present )
3472 {
3473 pBeaconStruct->wmeEdcaPresent = 1;
3474 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3475 }
3476
3477 if ( pBies->WMMInfoAp.present )
3478 {
3479 pBeaconStruct->wmeInfoPresent = 1;
3480 }
3481
3482 if ( pBies->WMMCaps.present )
3483 {
3484 pBeaconStruct->wsmCapablePresent = 1;
3485 }
3486
3487
3488 if ( pBies->ERPInfo.present )
3489 {
3490 pBeaconStruct->erpPresent = 1;
3491 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3492 }
3493
Jeff Johnsone7245742012-09-05 17:12:55 -07003494#ifdef WLAN_FEATURE_11AC
3495 if ( pBies->VHTCaps.present )
3496 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303497 pBeaconStruct->VHTCaps.present = 1;
3498 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003499 }
3500 if ( pBies->VHTOperation.present )
3501 {
3502 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303503 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3504 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003505 }
3506 if ( pBies->VHTExtBssLoad.present )
3507 {
3508 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303509 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3510 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003511 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003512 if( pBies->OperatingMode.present)
3513 {
3514 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303515 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3516 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003517 }
3518
Jeff Johnsone7245742012-09-05 17:12:55 -07003519#endif
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303520 if (pBies->ExtCap.present )
3521 {
3522 pBeaconStruct->ExtCap.present = 1;
3523 vos_mem_copy( &pBeaconStruct->ExtCap, &pBies->ExtCap,
3524 sizeof(tDot11fIEExtCap));
3525 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303526 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003527
Jeff Johnsone7245742012-09-05 17:12:55 -07003528
Jeff Johnson295189b2012-06-20 16:38:30 -07003529 return eSIR_SUCCESS;
3530
3531} // End sirParseBeaconIE.
3532
3533tSirRetStatus
3534sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3535 tANI_U8 *pFrame,
3536 tpSirProbeRespBeacon pBeaconStruct)
3537{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003538 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003539 tANI_U32 status, nPayload;
3540 tANI_U8 *pPayload;
3541 tpSirMacMgmtHdr pHdr;
3542 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003543 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003544
3545 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3546 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3547 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3548 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003549 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003550
3551 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303552 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3553
Abhishek Singhc75726d2015-04-13 14:44:14 +05303554 pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303555 if ( NULL == pBeacon )
3556 status = eHAL_STATUS_FAILURE;
3557 else
3558 status = eHAL_STATUS_SUCCESS;
3559 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003560 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303561 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003562 return eSIR_FAILURE;
3563 }
3564
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303565 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003566
3567 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303568 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003569
3570 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003571 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 if ( DOT11F_FAILED( status ) )
3573 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303574 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003575 status, nPayload);
3576 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05303577 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003578 return eSIR_FAILURE;
3579 }
3580 else if ( DOT11F_WARNED( status ) )
3581 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303582 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003583 status, nPayload );
3584 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3585 }
3586
3587 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3588 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303589 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3590 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003591
3592 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003593 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003594
3595 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003596 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3597 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3598 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3599 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3600 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3601 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3602 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3603 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3604 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3605 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3606 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3607 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3608 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3609 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3610 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3611 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003612
Jeff Johnson32d95a32012-09-10 13:15:23 -07003613 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303615 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003616 }
3617 else
3618 {
3619 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003620 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 }
3622
Jeff Johnson32d95a32012-09-10 13:15:23 -07003623 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003624 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303625 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003626 }
3627 else
3628 {
3629 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003630 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003631 }
3632
Jeff Johnson32d95a32012-09-10 13:15:23 -07003633 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003634 {
3635 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003636 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 }
3638
3639
Jeff Johnson32d95a32012-09-10 13:15:23 -07003640 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 {
3642 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003643 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 }
3645
Jeff Johnson32d95a32012-09-10 13:15:23 -07003646 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003647 {
3648 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003649 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 }
3651
Jeff Johnson32d95a32012-09-10 13:15:23 -07003652 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003653 {
3654 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003655 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003656 }
3657
3658 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003659 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 {
3661 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003662 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003663 }
3664
Jeff Johnson32d95a32012-09-10 13:15:23 -07003665 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003666 {
3667 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003668 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 }
3670
Jeff Johnson32d95a32012-09-10 13:15:23 -07003671 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 {
3673 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303674 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003675 sizeof(tDot11fIEChanSwitchAnn) );
3676 }
3677
Jeff Johnson32d95a32012-09-10 13:15:23 -07003678 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003679 {
3680 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303681 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 sizeof(tDot11fIEExtChanSwitchAnn) );
3683 }
3684
Jeff Johnson32d95a32012-09-10 13:15:23 -07003685 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 {
3687 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303688 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003689 sizeof(tDot11fIETPCReport));
3690 }
3691
Jeff Johnson32d95a32012-09-10 13:15:23 -07003692 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003693 {
3694 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303695 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 sizeof(tDot11fIEPowerConstraints));
3697 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003698
3699 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003700 {
3701 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303702 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 }
3704
Jeff Johnson32d95a32012-09-10 13:15:23 -07003705 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003706 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303707 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003708 }
3709
Jeff Johnson32d95a32012-09-10 13:15:23 -07003710 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003711 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303712 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003713
3714 }
3715
Jeff Johnson32d95a32012-09-10 13:15:23 -07003716 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003717 {
3718 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003719 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003720 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003721 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003722 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003723 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003724 }
3725 else
3726 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003727 if ((!rfBand) || IS_5G_BAND(rfBand))
3728 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3729 else if (IS_24G_BAND(rfBand))
3730 pBeaconStruct->channelNumber = mappedRXCh;
3731 else
3732 {
3733 /*Only 0, 1, 2 are expected values for RF band from FW
3734 * if FW fixes are not present then rf band value will
3735 * be 0, else either 1 or 2 are expected from FW, 3 is
3736 * not expected from FW */
3737 PELOGE(limLog(pMac, LOGE,
3738 FL("Channel info is not present in Beacon and"
3739 " mapping is not done correctly"));)
3740 pBeaconStruct->channelNumber = mappedRXCh;
3741 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003742 }
3743
Jeff Johnson32d95a32012-09-10 13:15:23 -07003744 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 {
3746 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003747 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 }
3749
Jeff Johnson32d95a32012-09-10 13:15:23 -07003750 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003751 {
3752 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003753 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 }
3755
Jeff Johnson32d95a32012-09-10 13:15:23 -07003756 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003757 {
3758 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003759 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05303760 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003761 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003762 }
3763
Jeff Johnson32d95a32012-09-10 13:15:23 -07003764 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003765 {
3766 pBeaconStruct->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05303767 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003768 }
3769
Jeff Johnson32d95a32012-09-10 13:15:23 -07003770 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003771 {
3772 pBeaconStruct->wsmCapablePresent = 1;
3773 }
3774
Jeff Johnson32d95a32012-09-10 13:15:23 -07003775 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003776 {
3777 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003778 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 }
3780
3781#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003782 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003783 {
3784 // MobilityDomain
3785 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303786 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3787 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003788 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003789
3790 }
3791#endif
3792
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003793#ifdef FEATURE_WLAN_ESE
3794 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303795 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003796 //ESE Tx Power
3797 pBeaconStruct->eseTxPwr.present = 1;
3798 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3799 &pBeacon->ESETxmitPower,
3800 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303801 }
3802#endif
3803
Jeff Johnsone7245742012-09-05 17:12:55 -07003804#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003805 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003806 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303807 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003808 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003809 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003810 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303811 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3812 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003813 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003814 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003815 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303816 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3817 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003818 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003819 if(pBeacon->OperatingMode.present)
3820 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303821 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3822 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003823 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003824 if(pBeacon->WiderBWChanSwitchAnn.present)
3825 {
3826 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303827 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3828 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003829 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003830#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303831 if(pBeacon->OBSSScanParameters.present)
3832 {
3833 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3834 &pBeacon->OBSSScanParameters,
3835 sizeof( tDot11fIEOBSSScanParameters));
3836 }
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303837
Abhishek Singhc75726d2015-04-13 14:44:14 +05303838 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 return eSIR_SUCCESS;
3840
3841} // End sirConvertBeaconFrame2Struct.
3842
3843tSirRetStatus
3844sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3845 tANI_U8 *pFrame,
3846 tANI_U32 nFrame,
3847 tpSirMacAuthFrameBody pAuth)
3848{
3849 static tDot11fAuthentication auth;
3850 tANI_U32 status;
3851
3852 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303853 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003854
3855 // delegate to the framesc-generated code,
3856 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3857 if ( DOT11F_FAILED( status ) )
3858 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303859 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003860 status, nFrame);
3861 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3862 return eSIR_FAILURE;
3863 }
3864 else if ( DOT11F_WARNED( status ) )
3865 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303866 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 status, nFrame );
3868 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3869 }
3870
3871 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3872 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3873 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3874 pAuth->authStatusCode = auth.Status.status;
3875
3876 if ( auth.ChallengeText.present )
3877 {
3878 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3879 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303880 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 }
3882
3883 return eSIR_SUCCESS;
3884
3885} // End sirConvertAuthFrame2Struct.
3886
3887tSirRetStatus
3888sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3889 tANI_U8 *pFrame,
3890 tANI_U32 nFrame,
3891 tSirAddtsReqInfo *pAddTs)
3892{
3893 tDot11fAddTSRequest addts = {{0}};
3894 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3895 tANI_U8 j;
3896 tANI_U16 i;
3897 tANI_U32 status;
3898
3899 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3900 {
3901 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3902 "with an Action of %d; this is not "
3903 "supported & is probably an error."),
3904 *( pFrame + 1 ) );
3905 return eSIR_FAILURE;
3906 }
3907
3908 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303909 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003910
3911 // delegate to the framesc-generated code,
3912 switch ( *pFrame )
3913 {
3914 case SIR_MAC_ACTION_QOS_MGMT:
3915 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3916 break;
3917 case SIR_MAC_ACTION_WME:
3918 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3919 break;
3920 default:
3921 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3922 "with a Category of %d; this is not"
3923 " supported & is probably an error."),
3924 *pFrame );
3925 return eSIR_FAILURE;
3926 }
3927
3928 if ( DOT11F_FAILED( status ) )
3929 {
3930 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05303931 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 status, nFrame);
3933 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3934 return eSIR_FAILURE;
3935 }
3936 else if ( DOT11F_WARNED( status ) )
3937 {
3938 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3939 "g an Add TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05303940 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 status, nFrame );
3942 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3943 }
3944
3945 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3946 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3947 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3948 {
3949 pAddTs->dialogToken = addts.DialogToken.token;
3950
3951 if ( addts.TSPEC.present )
3952 {
3953 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3954 }
3955 else
3956 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303957 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003958 return eSIR_FAILURE;
3959 }
3960
3961 if ( addts.num_TCLAS )
3962 {
3963 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3964
3965 for ( i = 0U; i < addts.num_TCLAS; ++i )
3966 {
3967 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3968 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303969 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003970 return eSIR_FAILURE;
3971 }
3972 }
3973 }
3974
3975 if ( addts.TCLASSPROC.present )
3976 {
3977 pAddTs->tclasProcPresent = 1;
3978 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3979 }
3980
3981 if ( addts.WMMTSPEC.present )
3982 {
3983 pAddTs->wsmTspecPresent = 1;
3984 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3985 }
3986
3987 if ( addts.num_WMMTCLAS )
3988 {
3989 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3990 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3991
3992 for ( i = pAddTs->numTclas; i < j; ++i )
3993 {
3994 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3995 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303996 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 return eSIR_FAILURE;
3998 }
3999 }
4000 }
4001
4002 if ( addts.WMMTCLASPROC.present )
4003 {
4004 pAddTs->tclasProcPresent = 1;
4005 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4006 }
4007
4008 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4009 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304010 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 pAddTs->numTclas );
4012 return eSIR_FAILURE;
4013 }
4014 }
4015 else
4016 {
4017 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4018
4019 if ( wmmaddts.WMMTSPEC.present )
4020 {
4021 pAddTs->wmeTspecPresent = 1;
4022 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4023 }
4024 else
4025 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304026 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004027 return eSIR_FAILURE;
4028 }
4029 }
4030
4031 return eSIR_SUCCESS;
4032
4033} // End sirConvertAddtsReq2Struct.
4034
4035tSirRetStatus
4036sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
4037 tANI_U8 *pFrame,
4038 tANI_U32 nFrame,
4039 tSirAddtsRspInfo *pAddTs)
4040{
4041 tDot11fAddTSResponse addts = {{0}};
4042 tDot11fWMMAddTSResponse wmmaddts = {{0}};
4043 tANI_U8 j;
4044 tANI_U16 i;
4045 tANI_U32 status;
4046
4047 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
4048 {
4049 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4050 "with an Action of %d; this is not "
4051 "supported & is probably an error."),
4052 *( pFrame + 1 ) );
4053 return eSIR_FAILURE;
4054 }
4055
4056 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304057 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
4058 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
4059 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004060
4061
4062 // delegate to the framesc-generated code,
4063 switch ( *pFrame )
4064 {
4065 case SIR_MAC_ACTION_QOS_MGMT:
4066 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
4067 break;
4068 case SIR_MAC_ACTION_WME:
4069 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
4070 break;
4071 default:
4072 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4073 "with a Category of %d; this is not"
4074 " supported & is probably an error."),
4075 *pFrame );
4076 return eSIR_FAILURE;
4077 }
4078
4079 if ( DOT11F_FAILED( status ) )
4080 {
4081 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304082 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004083 status, nFrame);
4084 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4085 return eSIR_FAILURE;
4086 }
4087 else if ( DOT11F_WARNED( status ) )
4088 {
4089 limLog( pMac, LOGW, FL("There were warnings while unpackin"
4090 "g an Add TS Response frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304091 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004092 status, nFrame );
4093 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4094 }
4095
4096 // & "transliterate" from a 'tDot11fAddTSResponse' or a
4097 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
4098 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4099 {
4100 pAddTs->dialogToken = addts.DialogToken.token;
4101 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
4102
4103 if ( addts.TSDelay.present )
4104 {
4105 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
4106 }
4107
4108 // TS Delay is present iff status indicates its presence
4109 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
4110 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304111 limLog( pMac, LOGW, FL("Missing TSDelay IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 }
4113
4114 if ( addts.TSPEC.present )
4115 {
4116 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
4117 }
4118 else
4119 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304120 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004121 return eSIR_FAILURE;
4122 }
4123
4124 if ( addts.num_TCLAS )
4125 {
4126 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4127
4128 for ( i = 0U; i < addts.num_TCLAS; ++i )
4129 {
4130 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4131 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304132 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 return eSIR_FAILURE;
4134 }
4135 }
4136 }
4137
4138 if ( addts.TCLASSPROC.present )
4139 {
4140 pAddTs->tclasProcPresent = 1;
4141 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4142 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004143#ifdef FEATURE_WLAN_ESE
4144 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004145 {
4146 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304147 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004148 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004149 }
4150#endif
4151 if ( addts.Schedule.present )
4152 {
4153 pAddTs->schedulePresent = 1;
4154 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
4155 }
4156
4157 if ( addts.WMMSchedule.present )
4158 {
4159 pAddTs->schedulePresent = 1;
4160 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
4161 }
4162
4163 if ( addts.WMMTSPEC.present )
4164 {
4165 pAddTs->wsmTspecPresent = 1;
4166 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4167 }
4168
4169 if ( addts.num_WMMTCLAS )
4170 {
4171 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
4172 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
4173
4174 for ( i = pAddTs->numTclas; i < j; ++i )
4175 {
4176 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4177 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304178 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004179 return eSIR_FAILURE;
4180 }
4181 }
4182 }
4183
4184 if ( addts.WMMTCLASPROC.present )
4185 {
4186 pAddTs->tclasProcPresent = 1;
4187 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4188 }
4189
4190 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4191 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304192 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 pAddTs->numTclas );
4194 return eSIR_FAILURE;
4195 }
4196 }
4197 else
4198 {
4199 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4200 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
4201
4202 if ( wmmaddts.WMMTSPEC.present )
4203 {
4204 pAddTs->wmeTspecPresent = 1;
4205 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4206 }
4207 else
4208 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304209 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004210 return eSIR_FAILURE;
4211 }
4212
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004213#ifdef FEATURE_WLAN_ESE
4214 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004215 {
4216 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304217 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004218 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004219 }
4220#endif
4221
4222 }
4223
4224 return eSIR_SUCCESS;
4225
4226} // End sirConvertAddtsRsp2Struct.
4227
4228tSirRetStatus
4229sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
4230 tANI_U8 *pFrame,
4231 tANI_U32 nFrame,
4232 tSirDeltsReqInfo *pDelTs)
4233{
4234 tDot11fDelTS delts = {{0}};
4235 tDot11fWMMDelTS wmmdelts = {{0}};
4236 tANI_U32 status;
4237
4238 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
4239 {
4240 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4241 "with an Action of %d; this is not "
4242 "supported & is probably an error."),
4243 *( pFrame + 1 ) );
4244 return eSIR_FAILURE;
4245 }
4246
4247 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304248 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004249
4250 // delegate to the framesc-generated code,
4251 switch ( *pFrame )
4252 {
4253 case SIR_MAC_ACTION_QOS_MGMT:
4254 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
4255 break;
4256 case SIR_MAC_ACTION_WME:
4257 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4258 break;
4259 default:
4260 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4261 "with a Category of %d; this is not"
4262 " supported & is probably an error."),
4263 *pFrame );
4264 return eSIR_FAILURE;
4265 }
4266
4267 if ( DOT11F_FAILED( status ) )
4268 {
4269 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304270 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 status, nFrame);
4272 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4273 return eSIR_FAILURE;
4274 }
4275 else if ( DOT11F_WARNED( status ) )
4276 {
4277 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4278 "g an Del TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304279 "%d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 status, nFrame );
4281 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4282 }
4283
4284 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4285 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4286 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4287 {
4288 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4289 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4290 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4291 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4292 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4293 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4294 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4295 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4296
4297 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4298 }
4299 else
4300 {
4301 if ( wmmdelts.WMMTSPEC.present )
4302 {
4303 pDelTs->wmeTspecPresent = 1;
4304 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4305 }
4306 else
4307 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304308 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 return eSIR_FAILURE;
4310 }
4311 }
4312
4313 return eSIR_SUCCESS;
4314
4315} // End sirConvertDeltsReq2Struct.
4316
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004317tSirRetStatus
4318sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4319 tANI_U8 *pFrame,
4320 tANI_U32 nFrame,
4321 tSirQosMapSet *pQosMapSet)
4322{
4323 tDot11fQosMapConfigure mapConfigure;
4324 tANI_U32 status;
4325 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
Sreelakshmi Konamki8a251602016-02-19 16:12:23 +05304326 if ( DOT11F_FAILED( status ) || !mapConfigure.QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004327 {
Sreelakshmi Konamki8a251602016-02-19 16:12:23 +05304328 dot11fLog(pMac, LOGE, FL("Failed to parse or QosMapSet not present(0x%08x, %d bytes):"),
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004329 status, nFrame);
4330 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4331 return eSIR_FAILURE;
4332 }
4333 else if ( DOT11F_WARNED( status ) )
4334 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304335 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):"),
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004336 status, nFrame );
4337 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4338 }
4339 pQosMapSet->present = mapConfigure.QosMapSet.present;
4340 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004341 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004342 return eSIR_SUCCESS;
4343}
Jeff Johnson295189b2012-06-20 16:38:30 -07004344
4345#ifdef ANI_SUPPORT_11H
4346tSirRetStatus
4347sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4348 tANI_U8 *pFrame,
4349 tpSirMacTpcReqActionFrame pTpcReqFrame,
4350 tANI_U32 nFrame)
4351{
4352 tDot11fTPCRequest req;
4353 tANI_U32 status;
4354
4355 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304356 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004357
4358 // delegate to the framesc-generated code,
4359 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4360 if ( DOT11F_FAILED( status ) )
4361 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304362 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004363 status, nFrame);
4364 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4365 return eSIR_FAILURE;
4366 }
4367 else if ( DOT11F_WARNED( status ) )
4368 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304369 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004370 status, nFrame );
4371 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4372 }
4373
4374 // & "transliterate" from a 'tDot11fTPCRequest' to a
4375 // 'tSirMacTpcReqActionFrame'...
4376 pTpcReqFrame->actionHeader.category = req.Category.category;
4377 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4378 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4379 if ( req.TPCRequest.present )
4380 {
4381 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4382 pTpcReqFrame->length = 0;
4383 }
4384 else
4385 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304386 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 return eSIR_FAILURE;
4388 }
4389
4390 return eSIR_SUCCESS;
4391
4392} // End sirConvertTpcReqFrame2Struct.
4393
4394
4395tSirRetStatus
4396sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4397 tANI_U8 *pFrame,
4398 tpSirMacMeasReqActionFrame pMeasReqFrame,
4399 tANI_U32 nFrame)
4400{
4401 tDot11fMeasurementRequest mr;
4402 tANI_U32 status;
4403
4404 // Zero-init our [out] parameter,
Sunkad, Anand Ningappabf1650a2016-02-08 12:08:13 +05304405 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(*pMeasReqFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004406
4407 // delegate to the framesc-generated code,
4408 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4409 if ( DOT11F_FAILED( status ) )
4410 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304411 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004412 status, nFrame);
4413 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4414 return eSIR_FAILURE;
4415 }
4416 else if ( DOT11F_WARNED( status ) )
4417 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304418 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 status, nFrame );
4420 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4421 }
4422
4423 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4424 // 'tpSirMacMeasReqActionFrame'...
4425 pMeasReqFrame->actionHeader.category = mr.Category.category;
4426 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4427 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4428
4429 if ( 0 == mr.num_MeasurementRequest )
4430 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304431 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004432 return eSIR_FAILURE;
4433 }
4434 else if ( 1 < mr.num_MeasurementRequest )
4435 {
4436 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4437 }
4438
4439 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4440 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4441 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4442 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4443 ( mr.MeasurementRequest[0].enable << 2 ) |
4444 ( mr.MeasurementRequest[0].request << 1 ) |
4445 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4446 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4447
4448 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4449
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304450 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004451 mr.MeasurementRequest[0].meas_start_time, 8 );
4452
4453 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4454
4455 return eSIR_SUCCESS;
4456
4457} // End sirConvertMeasReqFrame2Struct.
4458#endif
4459
4460
4461void
4462PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4463 tDot11fIETSPEC *pDot11f)
4464{
4465 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4466 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4467 pDot11f->direction = pOld->tsinfo.traffic.direction;
4468 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4469 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4470 pDot11f->psb = pOld->tsinfo.traffic.psb;
4471 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4472 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4473 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4474 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4475 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4476 */
4477 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4478 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4479 pDot11f->max_msdu_size = pOld->maxMsduSz;
4480 pDot11f->min_service_int = pOld->minSvcInterval;
4481 pDot11f->max_service_int = pOld->maxSvcInterval;
4482 pDot11f->inactivity_int = pOld->inactInterval;
4483 pDot11f->suspension_int = pOld->suspendInterval;
4484 pDot11f->service_start_time = pOld->svcStartTime;
4485 pDot11f->min_data_rate = pOld->minDataRate;
4486 pDot11f->mean_data_rate = pOld->meanDataRate;
4487 pDot11f->peak_data_rate = pOld->peakDataRate;
4488 pDot11f->burst_size = pOld->maxBurstSz;
4489 pDot11f->delay_bound = pOld->delayBound;
4490 pDot11f->min_phy_rate = pOld->minPhyRate;
4491 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4492 pDot11f->medium_time = pOld->mediumTime;
4493
4494 pDot11f->present = 1;
4495
4496} // End PopulateDot11fTSPEC.
4497
4498void
4499PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4500 tDot11fIEWMMTSPEC *pDot11f)
4501{
4502 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4503 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4504 pDot11f->direction = pOld->tsinfo.traffic.direction;
4505 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4506 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4507 pDot11f->psb = pOld->tsinfo.traffic.psb;
4508 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4509 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4510 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4511 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4512 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4513 */
4514 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4515 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4516 pDot11f->max_msdu_size = pOld->maxMsduSz;
4517 pDot11f->min_service_int = pOld->minSvcInterval;
4518 pDot11f->max_service_int = pOld->maxSvcInterval;
4519 pDot11f->inactivity_int = pOld->inactInterval;
4520 pDot11f->suspension_int = pOld->suspendInterval;
4521 pDot11f->service_start_time = pOld->svcStartTime;
4522 pDot11f->min_data_rate = pOld->minDataRate;
4523 pDot11f->mean_data_rate = pOld->meanDataRate;
4524 pDot11f->peak_data_rate = pOld->peakDataRate;
4525 pDot11f->burst_size = pOld->maxBurstSz;
4526 pDot11f->delay_bound = pOld->delayBound;
4527 pDot11f->min_phy_rate = pOld->minPhyRate;
4528 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4529 pDot11f->medium_time = pOld->mediumTime;
4530
4531 pDot11f->version = 1;
4532 pDot11f->present = 1;
4533
4534} // End PopulateDot11fWMMTSPEC.
4535
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004536#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004537
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004538// Fill the ESE version currently supported
4539void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004540{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004541 pESEVersion->present = 1;
4542 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004543}
4544
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004545// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004546// The State is Normal (1)
4547// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004548void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004549{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004550 pESERadMgmtCap->present = 1;
4551 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4552 pESERadMgmtCap->mbssid_mask = 0;
4553 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004554}
4555
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004556tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004557 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004558 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004559{
4560 int idx;
4561
4562 if ( pCCKMie->length )
4563 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004564 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004565 {
4566 pDot11f->present = 1;
4567 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004568 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004569 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4570 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4571 }
4572 }
4573
4574 return eSIR_SUCCESS;
4575
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004576} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004577
Jeff Johnson295189b2012-06-20 16:38:30 -07004578void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004579 tSirMacESETSRSIE *pOld,
4580 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004581 tANI_U8 rate_length)
4582{
4583 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304584 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 pDot11f->num_tsrates = rate_length;
4586 pDot11f->present = 1;
4587}
4588#endif
4589
4590
4591tSirRetStatus
4592PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4593 tSirTclasInfo *pOld,
4594 tDot11fIETCLAS *pDot11f)
4595{
4596 pDot11f->user_priority = pOld->tclas.userPrio;
4597 pDot11f->classifier_type = pOld->tclas.classifierType;
4598 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4599
4600 switch ( pDot11f->classifier_type )
4601 {
4602 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304603 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4604 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4605 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4606 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4608 break;
4609 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4610 pDot11f->info.IpParams.version = pOld->version;
4611 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4612 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304613 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304614 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304615 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4616 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304617 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304618 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004619 pDot11f->info.IpParams.params.IpV4Params.src_port =
4620 pOld->tclasParams.ipv4.srcPort;
4621 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4622 pOld->tclasParams.ipv4.dstPort;
4623 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4624 pOld->tclasParams.ipv4.dscp;
4625 pDot11f->info.IpParams.params.IpV4Params.proto =
4626 pOld->tclasParams.ipv4.protocol;
4627 pDot11f->info.IpParams.params.IpV4Params.reserved =
4628 pOld->tclasParams.ipv4.rsvd;
4629 }
4630 else
4631 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304632 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 IpV6Params.source,
4634 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304635 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004636 IpV6Params.dest,
4637 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4638 pDot11f->info.IpParams.params.IpV6Params.src_port =
4639 pOld->tclasParams.ipv6.srcPort;
4640 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4641 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304642 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 IpV6Params.flow_label,
4644 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4645 }
4646 break;
4647 case SIR_MAC_TCLASTYPE_8021DQ:
4648 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4649 break;
4650 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304651 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 pDot11f->classifier_type );
4653 return eSIR_FAILURE;
4654 }
4655
4656 pDot11f->present = 1;
4657
4658 return eSIR_SUCCESS;
4659
4660} // End PopulateDot11fTCLAS.
4661
4662tSirRetStatus
4663PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4664 tSirTclasInfo *pOld,
4665 tDot11fIEWMMTCLAS *pDot11f)
4666{
4667 pDot11f->version = 1;
4668 pDot11f->user_priority = pOld->tclas.userPrio;
4669 pDot11f->classifier_type = pOld->tclas.classifierType;
4670 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4671
4672 switch ( pDot11f->classifier_type )
4673 {
4674 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304675 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004676 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304677 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004678 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4679 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4680 break;
4681 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4682 pDot11f->info.IpParams.version = pOld->version;
4683 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4684 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304685 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004686 IpV4Params.source,
4687 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304688 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004689 IpV4Params.dest,
4690 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4691 pDot11f->info.IpParams.params.IpV4Params.src_port =
4692 pOld->tclasParams.ipv4.srcPort;
4693 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4694 pOld->tclasParams.ipv4.dstPort;
4695 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4696 pOld->tclasParams.ipv4.dscp;
4697 pDot11f->info.IpParams.params.IpV4Params.proto =
4698 pOld->tclasParams.ipv4.protocol;
4699 pDot11f->info.IpParams.params.IpV4Params.reserved =
4700 pOld->tclasParams.ipv4.rsvd;
4701 }
4702 else
4703 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304704 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004705 IpV6Params.source,
4706 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304707 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004708 IpV6Params.dest,
4709 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4710 pDot11f->info.IpParams.params.IpV6Params.src_port =
4711 pOld->tclasParams.ipv6.srcPort;
4712 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4713 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304714 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004715 IpV6Params.flow_label,
4716 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4717 }
4718 break;
4719 case SIR_MAC_TCLASTYPE_8021DQ:
4720 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4721 break;
4722 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304723 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004724 pDot11f->classifier_type );
4725 return eSIR_FAILURE;
4726 }
4727
4728 pDot11f->present = 1;
4729
4730 return eSIR_SUCCESS;
4731
4732} // End PopulateDot11fWMMTCLAS.
4733
Jeff Johnson295189b2012-06-20 16:38:30 -07004734
4735tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4736 tDot11fIEWscBeacon *pDot11f)
4737{
4738
4739 tANI_U32 wpsState;
4740
4741 pDot11f->Version.present = 1;
4742 pDot11f->Version.major = 0x01;
4743 pDot11f->Version.minor = 0x00;
4744
4745 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304746 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004747
4748 pDot11f->WPSState.present = 1;
4749 pDot11f->WPSState.state = (tANI_U8) wpsState;
4750
4751 pDot11f->APSetupLocked.present = 0;
4752
4753 pDot11f->SelectedRegistrar.present = 0;
4754
4755 pDot11f->DevicePasswordID.present = 0;
4756
4757 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4758
4759 pDot11f->UUID_E.present = 0;
4760
4761 pDot11f->RFBands.present = 0;
4762
4763 pDot11f->present = 1;
4764 return eSIR_SUCCESS;
4765}
4766
4767tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4768 tDot11fIEWscBeacon *pDot11f)
4769{
4770 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4771 tANI_U32 devicepasswdId;
4772
4773
4774 pDot11f->APSetupLocked.present = 1;
4775 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4776
4777 pDot11f->SelectedRegistrar.present = 1;
4778 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4779
4780 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304781 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07004782
4783 pDot11f->DevicePasswordID.present = 1;
4784 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4785
4786 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4787 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4788
4789 // UUID_E and RF Bands are applicable only for dual band AP
4790
4791 return eSIR_SUCCESS;
4792}
4793
4794tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4795 tDot11fIEWscBeacon *pDot11f)
4796{
4797 pDot11f->APSetupLocked.present = 0;
4798 pDot11f->SelectedRegistrar.present = 0;
4799 pDot11f->DevicePasswordID.present = 0;
4800 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4801
4802 return eSIR_SUCCESS;
4803}
Jeff Johnson295189b2012-06-20 16:38:30 -07004804tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4805{
4806
4807 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4808
4809 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4810
4811
4812 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4813 {
4814 pDot11f->present = 1;
4815 pDot11f->Version.present = 1;
4816 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4817 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4818 }
4819 else
4820 {
4821 pDot11f->present = 0;
4822 pDot11f->Version.present = 0;
4823 }
4824
4825 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4826 {
4827
4828 pDot11f->WPSState.present = 1;
4829 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4830 }
4831 else
4832 pDot11f->WPSState.present = 0;
4833
4834 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4835 {
4836 pDot11f->APSetupLocked.present = 1;
4837 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4838 }
4839 else
4840 pDot11f->APSetupLocked.present = 0;
4841
4842 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4843 {
4844 pDot11f->SelectedRegistrar.present = 1;
4845 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4846 }
4847 else
4848 pDot11f->SelectedRegistrar.present = 0;
4849
4850 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4851 {
4852 pDot11f->DevicePasswordID.present = 1;
4853 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4854 }
4855 else
4856 pDot11f->DevicePasswordID.present = 0;
4857
4858 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4859 {
4860 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4861 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4862 }
4863 else
4864 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4865
4866 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4867 {
4868 pDot11f->ResponseType.present = 1;
4869 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4870 }
4871 else
4872 pDot11f->ResponseType.present = 0;
4873
4874 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4875 {
4876 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304877 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004878 }
4879 else
4880 pDot11f->UUID_E.present = 0;
4881
4882 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4883 {
4884 pDot11f->Manufacturer.present = 1;
4885 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304886 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4887 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 }
4889 else
4890 pDot11f->Manufacturer.present = 0;
4891
4892 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4893 {
4894 pDot11f->ModelName.present = 1;
4895 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304896 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4897 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 }
4899 else
4900 pDot11f->ModelName.present = 0;
4901
4902 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4903 {
4904 pDot11f->ModelNumber.present = 1;
4905 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304906 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4907 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004908 }
4909 else
4910 pDot11f->ModelNumber.present = 0;
4911
4912 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4913 {
4914 pDot11f->SerialNumber.present = 1;
4915 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304916 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4917 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 }
4919 else
4920 pDot11f->SerialNumber.present = 0;
4921
4922 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4923 {
4924 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304925 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4926 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4928 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4929 }
4930 else
4931 pDot11f->PrimaryDeviceType.present = 0;
4932
4933 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4934 {
4935 pDot11f->DeviceName.present = 1;
4936 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304937 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4938 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004939 }
4940 else
4941 pDot11f->DeviceName.present = 0;
4942
4943 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4944 {
4945 pDot11f->ConfigMethods.present = 1;
4946 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4947 }
4948 else
4949 pDot11f->ConfigMethods.present = 0;
4950
4951
4952 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4953 {
4954 pDot11f->RFBands.present = 1;
4955 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4956 }
4957 else
4958 pDot11f->RFBands.present = 0;
4959
4960 return eSIR_SUCCESS;
4961}
4962tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4963{
4964 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4965
4966 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4967
4968 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4969 {
4970 pDot11f->present = 1;
4971 pDot11f->Version.present = 1;
4972 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4973 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4974 }
4975 else
4976 {
4977 pDot11f->present = 0;
4978 pDot11f->Version.present = 0;
4979 }
4980
4981 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4982 {
4983 pDot11f->ResponseType.present = 1;
4984 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4985 }
4986 else
4987 pDot11f->ResponseType.present = 0;
4988
4989 return eSIR_SUCCESS;
4990}
4991
4992tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4993{
4994
4995 tSirWPSBeaconIE *pSirWPSBeaconIE;
4996
4997 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4998
4999
5000 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
5001 {
5002 pDot11f->present = 1;
5003 pDot11f->Version.present = 1;
5004 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
5005 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
5006 }
5007 else
5008 {
5009 pDot11f->present = 0;
5010 pDot11f->Version.present = 0;
5011 }
5012
5013 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
5014 {
5015
5016 pDot11f->WPSState.present = 1;
5017 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
5018 }
5019 else
5020 pDot11f->WPSState.present = 0;
5021
5022 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
5023 {
5024 pDot11f->APSetupLocked.present = 1;
5025 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
5026 }
5027 else
5028 pDot11f->APSetupLocked.present = 0;
5029
5030 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
5031 {
5032 pDot11f->SelectedRegistrar.present = 1;
5033 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
5034 }
5035 else
5036 pDot11f->SelectedRegistrar.present = 0;
5037
5038 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
5039 {
5040 pDot11f->DevicePasswordID.present = 1;
5041 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
5042 }
5043 else
5044 pDot11f->DevicePasswordID.present = 0;
5045
5046 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
5047 {
5048 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5049 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
5050 }
5051 else
5052 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5053
5054 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
5055 {
5056 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305057 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07005058 }
5059 else
5060 pDot11f->UUID_E.present = 0;
5061
5062
5063 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
5064 {
5065 pDot11f->RFBands.present = 1;
5066 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
5067 }
5068 else
5069 pDot11f->RFBands.present = 0;
5070
5071 return eSIR_SUCCESS;
5072}
Jeff Johnson295189b2012-06-20 16:38:30 -07005073tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
5074 tDot11fIEWscProbeRes *pDot11f)
5075{
5076 tANI_U32 cfgMethods;
5077 tANI_U32 cfgStrLen;
5078 tANI_U32 val;
5079 tANI_U32 wpsVersion, wpsState;
5080
5081
5082 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305083 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_VERSION );
Jeff Johnson295189b2012-06-20 16:38:30 -07005084
5085 pDot11f->Version.present = 1;
5086 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
5087 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
5088
5089 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305090 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07005091
5092 pDot11f->WPSState.present = 1;
5093 pDot11f->WPSState.state = (tANI_U8) wpsState;
5094
5095 pDot11f->APSetupLocked.present = 0;
5096
5097 pDot11f->SelectedRegistrar.present = 0;
5098
5099 pDot11f->DevicePasswordID.present = 0;
5100
5101 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5102
5103 pDot11f->ResponseType.present = 1;
5104 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
5105 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
5106 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5107 }
5108 else{
5109 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5110 }
5111
5112 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
5113 pDot11f->UUID_E.present = 1;
5114 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
5115 if (wlan_cfgGetStr(pMac,
5116 WNI_CFG_WPS_UUID,
5117 pDot11f->UUID_E.uuid,
5118 &cfgStrLen) != eSIR_SUCCESS)
5119 {
5120 *(pDot11f->UUID_E.uuid) = '\0';
5121 }
5122
5123 pDot11f->Manufacturer.present = 1;
5124 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
5125 if (wlan_cfgGetStr(pMac,
5126 WNI_CFG_MANUFACTURER_NAME,
5127 pDot11f->Manufacturer.name,
5128 &cfgStrLen) != eSIR_SUCCESS)
5129 {
5130 pDot11f->Manufacturer.num_name = 0;
5131 *(pDot11f->Manufacturer.name) = '\0';
5132 }
5133 else
5134 {
5135 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305136 pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005137 }
5138
5139 pDot11f->ModelName.present = 1;
5140 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
5141 if (wlan_cfgGetStr(pMac,
5142 WNI_CFG_MODEL_NAME,
5143 pDot11f->ModelName.text,
5144 &cfgStrLen) != eSIR_SUCCESS)
5145 {
5146 pDot11f->ModelName.num_text = 0;
5147 *(pDot11f->ModelName.text) = '\0';
5148 }
5149 else
5150 {
5151 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305152 pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005153 }
5154
5155 pDot11f->ModelNumber.present = 1;
5156 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
5157 if (wlan_cfgGetStr(pMac,
5158 WNI_CFG_MODEL_NUMBER,
5159 pDot11f->ModelNumber.text,
5160 &cfgStrLen) != eSIR_SUCCESS)
5161 {
5162 pDot11f->ModelNumber.num_text = 0;
5163 *(pDot11f->ModelNumber.text) = '\0';
5164 }
5165 else
5166 {
5167 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305168 pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005169 }
5170
5171 pDot11f->SerialNumber.present = 1;
5172 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
5173 if (wlan_cfgGetStr(pMac,
5174 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
5175 pDot11f->SerialNumber.text,
5176 &cfgStrLen) != eSIR_SUCCESS)
5177 {
5178 pDot11f->SerialNumber.num_text = 0;
5179 *(pDot11f->SerialNumber.text) = '\0';
5180 }
5181 else
5182 {
5183 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305184 pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005185 }
5186
5187 pDot11f->PrimaryDeviceType.present = 1;
5188
5189 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
5190 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305191 limLog(pMac, LOGP, FL("cfg get prim device category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005192 }
5193 else
5194 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
5195
5196 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
5197 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305198 limLog(pMac, LOGP, FL("cfg get prim device OUI failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005199 }
5200 else
5201 {
5202 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
5203 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
5204 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
5205 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
5206 }
5207
5208 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
5209 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305210 limLog(pMac, LOGP, FL("cfg get prim device sub category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005211 }
5212 else
5213 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
5214
5215 pDot11f->DeviceName.present = 1;
5216 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
5217 if (wlan_cfgGetStr(pMac,
5218 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
5219 pDot11f->DeviceName.text,
5220 &cfgStrLen) != eSIR_SUCCESS)
5221 {
5222 pDot11f->DeviceName.num_text = 0;
5223 *(pDot11f->DeviceName.text) = '\0';
5224 }
5225 else
5226 {
5227 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305228 pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005229 }
5230
5231 if (wlan_cfgGetInt(pMac,
5232 WNI_CFG_WPS_CFG_METHOD,
5233 &cfgMethods) != eSIR_SUCCESS)
5234 {
5235 pDot11f->ConfigMethods.present = 0;
5236 pDot11f->ConfigMethods.methods = 0;
5237 }
5238 else
5239 {
5240 pDot11f->ConfigMethods.present = 1;
5241 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
5242 }
5243
5244 pDot11f->RFBands.present = 0;
5245
5246 pDot11f->present = 1;
5247 return eSIR_SUCCESS;
5248}
5249
5250tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5251 tDot11fIEWscProbeRes *pDot11f)
5252{
5253 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
5254 tANI_U32 devicepasswdId;
5255
5256 pDot11f->APSetupLocked.present = 1;
5257 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5258
5259 pDot11f->SelectedRegistrar.present = 1;
5260 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5261
5262 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305263 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07005264
5265 pDot11f->DevicePasswordID.present = 1;
5266 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5267
5268 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5269 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5270
5271 // UUID_E and RF Bands are applicable only for dual band AP
5272
5273 return eSIR_SUCCESS;
5274}
5275
5276tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5277 tDot11fIEWscProbeRes *pDot11f)
5278{
5279 pDot11f->APSetupLocked.present = 0;
5280 pDot11f->SelectedRegistrar.present = 0;
5281 pDot11f->DevicePasswordID.present = 0;
5282 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5283
5284 return eSIR_SUCCESS;
5285}
5286
5287tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5288 tDot11fIEWscAssocRes *pDot11f,
5289 tpSirAssocReq pRcvdAssocReq)
5290{
5291 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5292 tANI_U8 *wscIe;
5293
5294
5295 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5296 if(wscIe != NULL)
5297 {
5298 // retreive WSC IE from given AssocReq
5299 dot11fUnpackIeWscAssocReq( pMac,
5300 wscIe + 2 + 4, // EID, length, OUI
5301 wscIe[ 1 ] - 4, // length without OUI
5302 &parsedWscAssocReq );
5303 pDot11f->present = 1;
5304 // version has to be 0x10
5305 pDot11f->Version.present = 1;
5306 pDot11f->Version.major = 0x1;
5307 pDot11f->Version.minor = 0x0;
5308
5309 pDot11f->ResponseType.present = 1;
5310
5311 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5312 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5313 {
5314 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5315 }
5316 else
5317 {
5318 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5319 }
5320 // Version infomration should be taken from our capability as well as peers
5321 // TODO: currently it takes from peers only
5322 if(parsedWscAssocReq.VendorExtension.present &&
5323 parsedWscAssocReq.VendorExtension.Version2.present)
5324 {
5325 pDot11f->VendorExtension.present = 1;
5326 pDot11f->VendorExtension.vendorId[0] = 0x00;
5327 pDot11f->VendorExtension.vendorId[1] = 0x37;
5328 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5329 pDot11f->VendorExtension.Version2.present = 1;
5330 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5331 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5332 }
5333 }
5334 return eSIR_SUCCESS;
5335}
5336
Jeff Johnson295189b2012-06-20 16:38:30 -07005337tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5338 tDot11fIEP2PAssocRes *pDot11f,
5339 tpSirAssocReq pRcvdAssocReq)
5340{
5341 tANI_U8 *p2pIe;
5342
5343 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5344 if(p2pIe != NULL)
5345 {
5346 pDot11f->present = 1;
5347 pDot11f->P2PStatus.present = 1;
5348 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5349 pDot11f->ExtendedListenTiming.present = 0;
5350 }
5351 return eSIR_SUCCESS;
5352}
Jeff Johnson295189b2012-06-20 16:38:30 -07005353
5354#if defined WLAN_FEATURE_VOWIFI
5355
5356tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5357 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5358{
5359 pDot11f->txPower = txPower;
5360 pDot11f->linkMargin = linkMargin;
5361 pDot11f->present = 1;
5362
5363 return eSIR_SUCCESS;
5364}
5365
5366tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5367{
5368
5369 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5370 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305371 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5372 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005373 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5374 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5375 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5376 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5377 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305378 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005379 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5380 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5381
5382 if( pBeaconReport->numIes )
5383 {
5384 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305385 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5386 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005387 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5388 }
5389
5390 return eSIR_SUCCESS;
5391
5392}
5393
5394tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5395{
5396 tpRRMCaps pRrmCaps;
5397
5398 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5399
5400 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5401 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5402 pDot11f->parallel = pRrmCaps->parallel ;
5403 pDot11f->repeated = pRrmCaps->repeated ;
5404 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5405 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5406 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5407 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5408 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5409 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5410 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5411 pDot11f->statistics = pRrmCaps->statistics ;
5412 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5413 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5414 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5415 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5416 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5417 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5418 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5419 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5420 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5421 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5422 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5423 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5424 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5425 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5426 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5427 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5428
5429 pDot11f->present = 1;
5430 return eSIR_SUCCESS;
5431}
5432#endif
5433
5434#if defined WLAN_FEATURE_VOWIFI_11R
5435void PopulateMDIE( tpAniSirGlobal pMac,
5436 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5437{
5438 pDot11f->present = 1;
5439 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5440
5441 // Plugfest fix
5442 pDot11f->overDSCap = (mdie[2] & 0x01);
5443 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5444
5445}
5446
5447void PopulateFTInfo( tpAniSirGlobal pMac,
5448 tDot11fIEFTInfo *pDot11f )
5449{
5450 pDot11f->present = 1;
5451 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5452 //All other info is zero.
5453
5454}
5455#endif
5456
5457void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5458 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5459{
5460 tANI_U8 num_supp = 0, num_ext = 0;
5461 tANI_U8 i,j;
5462
5463 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5464 {
5465 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5466 }
5467 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5468 {
5469 if( num_supp < 8 )
5470 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5471 else
5472 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5473 }
5474
5475 if( num_supp )
5476 {
5477 pSupp->num_rates = num_supp;
5478 pSupp->present = 1;
5479 }
5480 if( num_ext )
5481 {
5482 pExt->num_rates = num_ext;
5483 pExt->present = 1;
5484 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005485}
5486
5487void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5488 tDot11fIETimeoutInterval *pDot11f,
5489 tANI_U8 type, tANI_U32 value )
5490{
5491 pDot11f->present = 1;
5492 pDot11f->timeoutType = type;
5493 pDot11f->timeoutValue = value;
5494}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305495#ifdef SAP_AUTH_OFFLOAD
5496tSirRetStatus
5497sap_auth_offload_construct_rsn_opaque( tDot11fIERSN *pdot11f_rsn,
5498 tDot11fIERSNOpaque *pdot11f)
5499{
5500 tANI_U32 data_len=0;
5501 tANI_U8 *ptr;
5502 tANI_U32 element_len=0;
5503 tANI_U32 count=0;
5504 ptr = (tANI_U8 *)pdot11f->data;
5505 if (pdot11f_rsn->present)
5506 {
5507 pdot11f->present = pdot11f_rsn->present;
5508 element_len = sizeof(pdot11f_rsn->version);
5509 vos_mem_copy(ptr, &pdot11f_rsn->version, element_len);
5510 ptr += element_len;
5511 data_len += element_len;
5512 element_len = sizeof(pdot11f_rsn->gp_cipher_suite);
5513 vos_mem_copy(ptr, pdot11f_rsn->gp_cipher_suite, element_len);
5514 ptr += element_len;
5515 data_len += element_len;
5516
5517 if (pdot11f_rsn->pwise_cipher_suite_count)
5518 {
5519 element_len = sizeof(pdot11f_rsn->pwise_cipher_suite_count);
5520 vos_mem_copy(ptr,
5521 &pdot11f_rsn->pwise_cipher_suite_count,
5522 element_len);
5523 ptr += element_len;
5524 data_len += element_len;
5525 for (count = 0; count < pdot11f_rsn->pwise_cipher_suite_count;
5526 count++)
5527 {
5528 element_len = DOT11F_RSN_OUI_SIZE;
5529 vos_mem_copy(ptr,
5530 &pdot11f_rsn->pwise_cipher_suites[count][0],
5531 element_len);
5532 ptr += element_len;
5533 data_len += element_len;
5534 }
5535 }
5536
5537 if (pdot11f_rsn->akm_suite_count)
5538 {
5539 element_len = sizeof(pdot11f_rsn->akm_suite_count);
5540 vos_mem_copy(ptr, &pdot11f_rsn->akm_suite_count, element_len);
5541 ptr += element_len;
5542 data_len += element_len;
5543 for (count = 0; count < pdot11f_rsn->akm_suite_count; count++)
5544 {
5545 element_len = DOT11F_RSN_OUI_SIZE;
5546 vos_mem_copy(ptr,
5547 &pdot11f_rsn->akm_suites[count][0],
5548 element_len);
5549 ptr += element_len;
5550 data_len += element_len;
5551 }
5552 }
5553
5554 element_len = sizeof(pdot11f_rsn->RSN_Cap);
5555 vos_mem_copy(ptr, pdot11f_rsn->RSN_Cap, element_len);
5556 ptr += element_len;
5557 data_len += element_len;
5558 }
5559 pdot11f->num_data = data_len;
5560 return eSIR_SUCCESS;
5561}
5562
5563void
5564sap_auth_offload_update_rsn_ie( tpAniSirGlobal pmac,
5565 tDot11fIERSNOpaque *pdot11f)
5566{
5567 tDot11fIERSN *pdot11f_rsn;
5568 pdot11f_rsn = vos_mem_malloc(sizeof(tDot11fIERSN));
5569 vos_mem_set(pdot11f_rsn, sizeof(tDot11fIERSN), 0);
5570 /* Assign RSN IE for Software AP Authentication offload security */
5571 if (pmac->sap_auth_offload && pmac->sap_auth_offload_sec_type)
5572 {
5573 switch (pmac->sap_auth_offload_sec_type)
5574 {
5575 case eSIR_OFFLOAD_WPA2PSK_CCMP:
5576 /* Only Support one kind of Cipher Suit for
5577 * Software AP authentication offload
5578 */
5579 pdot11f_rsn->present = 1;
5580 pdot11f_rsn->version = 1;
5581 vos_mem_copy(pdot11f_rsn->gp_cipher_suite,
5582 &sirRSNOui[DOT11F_RSN_CSE_CCMP][0],
5583 DOT11F_RSN_OUI_SIZE);
5584 pdot11f_rsn->pwise_cipher_suite_count = 1;
5585 vos_mem_copy(&(pdot11f_rsn->pwise_cipher_suites[0][0]),
5586 &sirRSNOui[DOT11F_RSN_CSE_CCMP][0],
5587 DOT11F_RSN_OUI_SIZE);
5588 pdot11f_rsn->akm_suite_count = 1;
5589 vos_mem_copy(&(pdot11f_rsn->akm_suites[0][0]),
5590 &sirRSNOui[DOT11F_RSN_CSE_TKIP][0],
5591 DOT11F_RSN_OUI_SIZE);
5592 pdot11f_rsn->pmkid_count = 0;
5593 /* Construct RSN IE into RSNOpaque*/
5594 sap_auth_offload_construct_rsn_opaque(pdot11f_rsn, pdot11f);
5595 break;
5596 default:
5597 dot11fLog( pmac, LOGE,
5598 FL("The security type is not definied for "
5599 "Software AP authentication offload!\n"));
5600 break;
5601 }
5602 }
5603}
5604#endif /* SAP_AUTH_OFFLOAD */
5605
Jeff Johnson295189b2012-06-20 16:38:30 -07005606// parserApi.c ends here.