blob: f95e40c818c77446a00348b494f6b42d3d502f5a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002* Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
5*/
6
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08007/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08008 * Airgo Networks, Inc proprietary. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07009 * This file parserApi.cc contains the code for parsing
10 * 802.11 messages.
11 * Author: Pierre Vandwalle
12 * Date: 03/18/02
13 * History:-
14 * Date Modified by Modification Information
15 * --------------------------------------------------------------------
16 *
17 */
18
19#include "sirApi.h"
20#include "aniGlobal.h"
21#include "parserApi.h"
22#include "cfgApi.h"
23#include "limUtils.h"
24#include "utilsParser.h"
25#include "limSerDesUtils.h"
26#include "schApi.h"
27#include "palApi.h"
28#include "wmmApsd.h"
29#if defined WLAN_FEATURE_VOWIFI
30#include "rrmApi.h"
31#endif
32
33
34
35////////////////////////////////////////////////////////////////////////
36void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
37{
38#ifdef WLAN_DEBUG
39 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
40 {
41 return;
42 }
43 else
44 {
45 va_list marker;
46
47 va_start( marker, pString ); /* Initialize variable arguments. */
48
49 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
50
51 va_end( marker ); /* Reset variable arguments. */
52 }
53#endif
54}
55
56void
57swapBitField16(tANI_U16 in, tANI_U16 *out)
58{
59# ifdef ANI_LITTLE_BIT_ENDIAN
60 *out = in;
61# else // Big-Endian...
62 *out = ( ( in & 0x8000 ) >> 15 ) |
63 ( ( in & 0x4000 ) >> 13 ) |
64 ( ( in & 0x2000 ) >> 11 ) |
65 ( ( in & 0x1000 ) >> 9 ) |
66 ( ( in & 0x0800 ) >> 7 ) |
67 ( ( in & 0x0400 ) >> 5 ) |
68 ( ( in & 0x0200 ) >> 3 ) |
69 ( ( in & 0x0100 ) >> 1 ) |
70 ( ( in & 0x0080 ) << 1 ) |
71 ( ( in & 0x0040 ) << 3 ) |
72 ( ( in & 0x0020 ) << 5 ) |
73 ( ( in & 0x0010 ) << 7 ) |
74 ( ( in & 0x0008 ) << 9 ) |
75 ( ( in & 0x0004 ) << 11 ) |
76 ( ( in & 0x0002 ) << 13 ) |
77 ( ( in & 0x0001 ) << 15 );
78# endif // ANI_LITTLE_BIT_ENDIAN
79}
80
81void
82swapBitField32(tANI_U32 in, tANI_U32 *out)
83{
84# ifdef ANI_LITTLE_BIT_ENDIAN
85 *out = in;
86# else // Big-Endian...
87 *out = ( ( in & 0x80000000 ) >> 31 ) |
88 ( ( in & 0x40000000 ) >> 29 ) |
89 ( ( in & 0x20000000 ) >> 27 ) |
90 ( ( in & 0x10000000 ) >> 25 ) |
91 ( ( in & 0x08000000 ) >> 23 ) |
92 ( ( in & 0x04000000 ) >> 21 ) |
93 ( ( in & 0x02000000 ) >> 19 ) |
94 ( ( in & 0x01000000 ) >> 17 ) |
95 ( ( in & 0x00800000 ) >> 15 ) |
96 ( ( in & 0x00400000 ) >> 13 ) |
97 ( ( in & 0x00200000 ) >> 11 ) |
98 ( ( in & 0x00100000 ) >> 9 ) |
99 ( ( in & 0x00080000 ) >> 7 ) |
100 ( ( in & 0x00040000 ) >> 5 ) |
101 ( ( in & 0x00020000 ) >> 3 ) |
102 ( ( in & 0x00010000 ) >> 1 ) |
103 ( ( in & 0x00008000 ) << 1 ) |
104 ( ( in & 0x00004000 ) << 3 ) |
105 ( ( in & 0x00002000 ) << 5 ) |
106 ( ( in & 0x00001000 ) << 7 ) |
107 ( ( in & 0x00000800 ) << 9 ) |
108 ( ( in & 0x00000400 ) << 11 ) |
109 ( ( in & 0x00000200 ) << 13 ) |
110 ( ( in & 0x00000100 ) << 15 ) |
111 ( ( in & 0x00000080 ) << 17 ) |
112 ( ( in & 0x00000040 ) << 19 ) |
113 ( ( in & 0x00000020 ) << 21 ) |
114 ( ( in & 0x00000010 ) << 23 ) |
115 ( ( in & 0x00000008 ) << 25 ) |
116 ( ( in & 0x00000004 ) << 27 ) |
117 ( ( in & 0x00000002 ) << 29 ) |
118 ( ( in & 0x00000001 ) << 31 );
119# endif // ANI_LITTLE_BIT_ENDIAN
120}
121
122inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
123{
124 limLog(pMac, LOG1, FL("WMM Parameters Received: \n"));
125 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
126 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
127
128 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
129 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
130
131 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
132 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
133
134 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
135 pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
136
137 return;
138}
139
140////////////////////////////////////////////////////////////////////////
141// Functions for populating "dot11f" style IEs
142
143
144// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
145// < 0, cannot find
146int FindIELocation( tpAniSirGlobal pMac,
147 tpSirRSNie pRsnIe,
148 tANI_U8 EID)
149{
150 int idx, ieLen, bytesLeft;
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800151 int ret_val = -1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700152
153 // Here's what's going on: 'rsnIe' looks like this:
154
155 // typedef struct sSirRSNie
156 // {
157 // tANI_U16 length;
158 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
159 // } tSirRSNie, *tpSirRSNie;
160
161 // other code records both the WPA & RSN IEs (including their EIDs &
162 // lengths) into the array 'rsnIEdata'. We may have:
163
164 // With WAPI support, there may be 3 IEs here
165 // It can be only WPA IE, or only RSN IE or only WAPI IE
166 // Or two or all three of them with no particular ordering
167
168 // The if/then/else statements that follow are here to figure out
169 // whether we have the WPA IE, and where it is if we *do* have it.
170
171 //Save the first IE length
172 ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
173 idx = 0;
174 bytesLeft = pRsnIe->length;
175
176 while( 1 )
177 {
178 if ( EID == pRsnIe->rsnIEdata[ idx ] )
179 {
180 //Found it
181 return (idx);
182 }
183 else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
184 // & if no more IE,
185 bytesLeft <= (tANI_U16)( ieLen ) )
186 {
187 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800188 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 }
190 bytesLeft -= ieLen;
191 ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
192 idx += ieLen;
193 }
194
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800195 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700196}
197
198
199tSirRetStatus
200PopulateDot11fCapabilities(tpAniSirGlobal pMac,
201 tDot11fFfCapabilities *pDot11f,
202 tpPESession psessionEntry)
203{
204 tANI_U16 cfg;
205 tSirRetStatus nSirStatus;
206
207 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
208 if ( eSIR_SUCCESS != nSirStatus )
209 {
210 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
211 "itfield from CFG (%d).\n"), nSirStatus );
212 return nSirStatus;
213 }
214
215#if 0
216 if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
217 {
218 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
219 }
220#endif
221 swapBitField16( cfg, ( tANI_U16* )pDot11f );
222
223 return eSIR_SUCCESS;
224} // End PopulateDot11fCapabilities.
225
226tSirRetStatus
227PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
228 tDot11fFfCapabilities *pDot11f,
229 tpDphHashNode pSta,
230 tpPESession psessionEntry)
231{
232 tANI_U16 cfg;
233 tSirRetStatus nSirStatus;
234 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
235 if ( eSIR_SUCCESS != nSirStatus )
236 {
237 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
238 "itfield from CFG (%d).\n"), nSirStatus );
239 return nSirStatus;
240 }
241
242 if ( ( NULL != pSta ) && pSta->aniPeer &&
243 PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
244 {
245 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
246 }
247
248 swapBitField16( cfg, ( tANI_U16* )pDot11f );
249
250 return eSIR_SUCCESS;
251
252} // End PopulateDot11fCapabilities2.
253
254void
255PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700256 tDot11fIEChanSwitchAnn *pDot11f,
257 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700258{
Jeff Johnsone7245742012-09-05 17:12:55 -0700259 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
260 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
261 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700262
263 pDot11f->present = 1;
264} // End PopulateDot11fChanSwitchAnn.
265
266void
267PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700268 tDot11fIEExtChanSwitchAnn *pDot11f,
269 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700270{
271 //Has to be updated on the cb state basis
272 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700273 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700274
275 pDot11f->present = 1;
276}
277
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700278#ifdef WLAN_FEATURE_11AC
279void
280PopulateDot11fWiderBWChanSwitchAnn(tpAniSirGlobal pMac,
281 tDot11fIEWiderBWChanSwitchAnn *pDot11f,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700282 tpPESession psessionEntry)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700283{
284 pDot11f->present = 1;
285 pDot11f->newChanWidth = psessionEntry->gLimWiderBWChannelSwitch.newChanWidth;
286 pDot11f->newCenterChanFreq0 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0;
287 pDot11f->newCenterChanFreq1 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1;
288}
289#endif
290
Jeff Johnson295189b2012-06-20 16:38:30 -0700291tSirRetStatus
292PopulateDot11fCountry(tpAniSirGlobal pMac,
293 tDot11fIECountry *pDot11f,
294 tpPESession psessionEntry)
295{
296 tANI_U32 len, maxlen, codelen;
297 tANI_U16 item;
298 tSirRetStatus nSirStatus;
299 tSirRFBand rfBand;
300 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
301
302 if (psessionEntry->lim11dEnabled )
303 {
304 limGetRfBand(pMac, &rfBand, psessionEntry);
305 if (rfBand == SIR_BAND_5_GHZ)
306 {
307 item = WNI_CFG_MAX_TX_POWER_5;
308 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
309 }
310 else
311 {
312 item = WNI_CFG_MAX_TX_POWER_2_4;
313 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
314 }
315
316 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
317
318 if ( 3 > len )
319 {
320 // no limit on tx power, cannot include the IE because at least
321 // one (channel,num,tx power) must be present
322 return eSIR_SUCCESS;
323 }
324
325 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
326 code, codelen, 3 );
327
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530328 vos_mem_copy( pDot11f->country, code, codelen );
Jeff Johnson295189b2012-06-20 16:38:30 -0700329
330 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
331 {
332 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting.\n"), len);
333 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
334 }
335
336 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530337 vos_mem_copy( ( tANI_U8* )pDot11f->triplets, temp, len );
Jeff Johnson295189b2012-06-20 16:38:30 -0700338
339 pDot11f->present = 1;
340 }
341
342 return eSIR_SUCCESS;
343} // End PopulateDot11fCountry.
344
345tSirRetStatus
346PopulateDot11fDSParams(tpAniSirGlobal pMac,
347 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
348 tpPESession psessionEntry)
349{
Kiran Kumar Lokere27090372013-07-19 20:13:55 -0700350 if ((IS_24G_CH(channel)) || pMac->rrm.rrmPEContext.rrmEnable)
Jeff Johnson295189b2012-06-20 16:38:30 -0700351 {
352 // .11b/g mode PHY => Include the DS Parameter Set IE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 pDot11f->curr_channel = channel;
354 pDot11f->present = 1;
355 }
356
357 return eSIR_SUCCESS;
358} // End PopulateDot11fDSParams.
359
360#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
361
362
363void
364PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
365 tDot11fIEEDCAParamSet *pDot11f,
366 tpPESession psessionEntry)
367{
368
369 if ( psessionEntry->limQosEnabled )
370 {
371 //change to bitwise operation, after this is fixed in frames.
372 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
373
374 // Fill each EDCA parameter set in order: be, bk, vi, vo
375 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
376 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
377 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
378 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
379 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
380 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
381
382 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
383 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
384 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
385 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
386 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
387 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
388
389 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
390 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
391 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
392 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
393 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
394 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
395
396 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
397 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
398 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
399 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
400 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
401 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
402
403 pDot11f->present = 1;
404 }
405
406} // End PopluateDot11fEDCAParamSet.
407
408tSirRetStatus
409PopulateDot11fERPInfo(tpAniSirGlobal pMac,
410 tDot11fIEERPInfo *pDot11f,
411 tpPESession psessionEntry)
412{
413 tSirRetStatus nSirStatus;
414 tANI_U32 val;
415 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
416
417 limGetRfBand(pMac, &rfBand, psessionEntry);
418 if(SIR_BAND_2_4_GHZ == rfBand)
419 {
420 pDot11f->present = 1;
421
422 val = psessionEntry->cfgProtection.fromllb;
423 if(!val ){
424 dot11fLog( pMac, LOGE, FL("11B protection not enabled. Not populating ERP IE %d\n" ),val );
425 return eSIR_SUCCESS;
426 }
427
428 if (psessionEntry->gLim11bParams.protectionEnabled)
429 {
430 pDot11f->non_erp_present = 1;
431 pDot11f->use_prot = 1;
432 }
433
434 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
435 {
436 //FIXME_PROTECTION: we should be setting non_erp present also.
437 //check the test plan first.
438 pDot11f->use_prot = 1;
439 }
440
441
442 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
443 || !psessionEntry->beaconParams.fShortPreamble){
444 pDot11f->barker_preamble = 1;
445
446 }
447 // if protection always flag is set, advertise protection enabled
448 // regardless of legacy stations presence
449 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
450
451 if ( val )
452 {
453 pDot11f->use_prot = 1;
454 }
455 }
456
457 return eSIR_SUCCESS;
458} // End PopulateDot11fERPInfo.
459
460tSirRetStatus
461PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
462 tDot11fIEExtSuppRates *pDot11f,
463 tpPESession psessionEntry)
464{
465 tSirRetStatus nSirStatus;
466 tANI_U32 nRates = 0;
467 tANI_U8 rates[WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN];
468
469 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
470 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
471 sending mgmt frames (lile probe req) which need to go out before any session is present.
472 */
473 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
474 {
475 if(psessionEntry != NULL)
476 {
477 nRates = psessionEntry->extRateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530478 vos_mem_copy( rates, psessionEntry->extRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 nRates);
480 }
481 else
482 {
483 dot11fLog( pMac, LOGE, FL("no session context exists while"
484 " populating Operational Rate Set\n"));
485 }
486 }
487 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
488 {
489 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
490 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
491 }
492
493 if ( 0 != nRates )
494 {
495 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530496 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 pDot11f->present = 1;
498 }
499
500 return eSIR_SUCCESS;
501
502} // End PopulateDot11fExtSuppRates.
503
504tSirRetStatus
505PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
506 tANI_U8 nChannelNum,
507 tDot11fIEExtSuppRates *pDot11f)
508{
509 tANI_U32 nRates;
510 tSirRetStatus nSirStatus;
511 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
512
513 if ( 14 < nChannelNum )
514 {
515 pDot11f->present = 0;
516 return eSIR_SUCCESS;
517 }
518
519 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
520 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
521 // previously & I'm afraid to change it!
522 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
523 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
524
525 if ( 0 != nRates )
526 {
527 pDot11f->num_rates = ( tANI_U8 ) nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530528 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 pDot11f->present = 1;
530 }
531
532 return eSIR_SUCCESS;
533} // PopulateDot11fExtSuppRates1.
534
535tSirRetStatus
536PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700537 tpPESession psessionEntry,
538 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700539{
540 tANI_U32 nCfgValue, nCfgLen;
541 tANI_U8 nCfgValue8;
542 tSirRetStatus nSirStatus;
543 tSirMacHTParametersInfo *pHTParametersInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 union {
545 tANI_U16 nCfgValue16;
546 tSirMacHTCapabilityInfo htCapInfo;
547 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
548 } uHTCapabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700549
550 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
551 tSirMacASCapabilityInfo *pASCapabilityInfo;
552
553 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
554
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700556
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
559 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
560 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
561 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
562 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
563 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
564 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
565 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
566 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
567 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
568 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
569 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700570
Jeff Johnsone7245742012-09-05 17:12:55 -0700571 // All sessionized entries will need the check below
572 if (psessionEntry == NULL) // Only in case of NO session
573 {
574 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
575 }
576 else
577 {
578 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
579 }
580
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
582 eHT_CHANNEL_WIDTH_20MHZ */
583 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
584 {
585 pDot11f->shortGI40MHz = 0;
586 }
587
Mohit Khanna23863762012-09-11 17:40:09 -0700588 dot11fLog(pMac, LOG2, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave, pDot11f->greenField,
590 pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
591
592
593 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
594
595 nCfgValue8 = ( tANI_U8 ) nCfgValue;
596 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
597
598 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
599 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
600 pDot11f->reserved1 = pHTParametersInfo->reserved;
601
Mohit Khanna23863762012-09-11 17:40:09 -0700602 dot11fLog( pMac, LOG2, FL( "AMPDU Param: %x\n" ), nCfgValue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700603
604
605 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
606 pDot11f->supportedMCSSet, nCfgLen,
607 SIZE_OF_SUPPORTED_MCS_SET );
608
609
610 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
611
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
613
614 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
615 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
616 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
617
Jeff Johnson295189b2012-06-20 16:38:30 -0700618
619 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
620
621 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
622 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
623 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
624 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
625 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
626 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
627 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
628 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
629 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
630 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
631 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
632 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
633 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
634 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
635 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
636 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
637
638 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
639
640 nCfgValue8 = ( tANI_U8 ) nCfgValue;
641
642 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
643 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
644 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
645 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
646 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
647 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
648 pDot11f->rxAS = pASCapabilityInfo->rxAS;
649 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
650
651 pDot11f->present = 1;
652
653 return eSIR_SUCCESS;
654
655} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700656#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700657
Jeff Johnsone7245742012-09-05 17:12:55 -0700658void limLogVHTCap(tpAniSirGlobal pMac,
659 tDot11fIEVHTCaps *pDot11f)
660{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700661#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700662 limLog(pMac, LOG1, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
663 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
664 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
665 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
666 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
667 limLog(pMac, LOG1, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
668 limLog(pMac, LOG1, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
669 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
670 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
671 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
672 limLog(pMac, LOG1, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
673 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
674 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
675 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
676 limLog(pMac, LOG1, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
677 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
678 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
679 limLog(pMac, LOG1, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
680 limLog(pMac, LOG1, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
681 limLog(pMac, LOG1, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
682 limLog(pMac, LOG1, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
683 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
684 limLog(pMac, LOG1, FL("reserve (3): %d\n"), pDot11f->reserved2);
685 limLog(pMac, LOG1, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
686 limLog(pMac, LOG1, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
687 limLog(pMac, LOG1, FL("reserv (3): %d\n"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700688#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700689}
690
691void limLogVHTOperation(tpAniSirGlobal pMac,
692 tDot11fIEVHTOperation *pDot11f)
693{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700694#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700695 limLog(pMac, LOG1, FL("chanWidth : %d\n"), pDot11f->chanWidth);
696 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
697 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
698 limLog(pMac, LOG1, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700699#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700700}
701
702void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
703 tDot11fIEVHTExtBssLoad *pDot11f)
704{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700705#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700706 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
707 limLog(pMac, LOG1, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
708 limLog(pMac, LOG1, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
709 limLog(pMac, LOG1, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
710 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700711#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700712}
713
714
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700715void limLogOperatingMode( tpAniSirGlobal pMac,
716 tDot11fIEOperatingMode *pDot11f)
717{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700718#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700719 limLog(pMac, LOG1, FL("ChanWidth : %d\n"), pDot11f->chanWidth);
720 limLog(pMac, LOG1, FL("reserved: %d\n"), pDot11f->reserved);
721 limLog(pMac, LOG1, FL("rxNSS: %d\n"), pDot11f->rxNSS);
722 limLog(pMac, LOG1, FL("rxNSS Type: %d\n"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700723#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700724}
725
726
Jeff Johnsone7245742012-09-05 17:12:55 -0700727tSirRetStatus
728PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
729 tDot11fIEVHTCaps *pDot11f)
730{
731 tSirRetStatus nStatus;
732 tANI_U32 nCfgValue=0;
733
734 pDot11f->present = 1;
735
736 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
737 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
738
739 nCfgValue = 0;
740 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
741 nCfgValue );
742 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
743
744 nCfgValue = 0;
745 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
746 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
747
748 nCfgValue = 0;
749 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
750 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
751
752 nCfgValue = 0;
753 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
754 nCfgValue );
755 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
756
757 nCfgValue = 0;
758 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
759 pDot11f->txSTBC = (nCfgValue & 0x0001);
760
761 nCfgValue = 0;
762 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
763 pDot11f->rxSTBC = (nCfgValue & 0x0007);
764
765 nCfgValue = 0;
766 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
767 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
768
769 nCfgValue = 0;
770 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
771 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
772
773 nCfgValue = 0;
774 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
775 nCfgValue );
776 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
777
778 nCfgValue = 0;
779 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
780 nCfgValue );
781 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
782
783 nCfgValue = 0;
784 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
785 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
786
787 nCfgValue = 0;
788 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
789 pDot11f->muBeamformeeCap = (nCfgValue & 0x0001);
790
791 nCfgValue = 0;
792 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
793 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
794
795 nCfgValue = 0;
796 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
797 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
798
799 nCfgValue = 0;
800 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
801 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
802
803 nCfgValue = 0;
804 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
805 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
806
807 nCfgValue = 0;
808 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
809 pDot11f->rxAntPattern = nCfgValue;
810
811 nCfgValue = 0;
812 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
813 pDot11f->txAntPattern = nCfgValue;
814
815 pDot11f->reserved1= 0;
816
817 nCfgValue = 0;
818 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
819 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
820
821 nCfgValue = 0;
822 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
823 nCfgValue );
824 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
825
826 pDot11f->reserved2= 0;
827
828 nCfgValue = 0;
829 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
830 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
831
832 nCfgValue = 0;
833 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
834 nCfgValue );
835 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
836
837 pDot11f->reserved3= 0;
838
839 limLogVHTCap(pMac, pDot11f);
840
841 return eSIR_SUCCESS;
842
843}
844
845tSirRetStatus
846PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
847 tDot11fIEVHTOperation *pDot11f)
848{
849 tSirRetStatus nStatus;
850 tANI_U32 nCfgValue=0;
851
852 pDot11f->present = 1;
853
854 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
855 pDot11f->chanWidth = (tANI_U8)nCfgValue;
856
857 nCfgValue = 0;
858 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
859 nCfgValue );
860 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
861
862 nCfgValue = 0;
863 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
864 nCfgValue );
865 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
866
867 nCfgValue = 0;
868 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
869 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
870
871 limLogVHTOperation(pMac,pDot11f);
872
873 return eSIR_SUCCESS;
874
875}
876
877tSirRetStatus
878PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
879 tDot11fIEVHTExtBssLoad *pDot11f)
880{
881 tSirRetStatus nStatus;
882 tANI_U32 nCfgValue=0;
883
884 pDot11f->present = 1;
885
886 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
887 nCfgValue );
888 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
889
890 nCfgValue = 0;
891 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
892 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
893
894 nCfgValue=0;
895 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
896 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
897
898 nCfgValue=0;
899 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
900 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
901
902 nCfgValue=0;
903 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
904 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
905
906 limLogVHTExtBssLoad(pMac,pDot11f);
907
908 return eSIR_SUCCESS;
909}
910
Mohit Khanna4a70d262012-09-11 16:30:12 -0700911tSirRetStatus
912PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +0530913 tDot11fIEExtCap *pDot11f,
914 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700915{
Sandeep Puligilla60342762014-01-30 21:05:37 +0530916 tANI_U32 val;
917
Mohit Khanna4a70d262012-09-11 16:30:12 -0700918 pDot11f->present = 1;
Sandeep Puligilla60342762014-01-30 21:05:37 +0530919#ifdef WLAN_FEATURE_11AC
920 if (psessionEntry->vhtCapability)
921 pDot11f->operModeNotification = 1;
922#endif
923 /* while operating in 2.4GHz only then STA need to advertize
924 the bss co-ex capability*/
925 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
926 {
927 if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_24G, &val) !=
928 eSIR_SUCCESS)
929 PELOGE(limLog(pMac, LOGE, FL("could not retrieve "
930 "24G Chan bond Length \n"));)
931 if (TRUE == val)
932 pDot11f->bssCoexistMgmtSupport = 1;
933 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700934 return eSIR_SUCCESS;
935}
936
937tSirRetStatus
938PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
939 tDot11fIEOperatingMode *pDot11f,
940 tpPESession psessionEntry)
941{
942 pDot11f->present = 1;
943
944 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
945 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
946 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
947
948 return eSIR_SUCCESS;
949}
Jeff Johnsone7245742012-09-05 17:12:55 -0700950
951#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700952tSirRetStatus
953PopulateDot11fHTInfo(tpAniSirGlobal pMac,
954 tDot11fIEHTInfo *pDot11f,
955 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -0700956{
957 tANI_U32 nCfgValue, nCfgLen;
958 tANI_U8 htInfoField1;
959 tANI_U16 htInfoField2;
960 tSirRetStatus nSirStatus;
961 tSirMacHTInfoField1 *pHTInfoField1;
962 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -0700963 union {
964 tANI_U16 nCfgValue16;
965 tSirMacHTInfoField3 infoField3;
966 }uHTInfoField;
967 union {
968 tANI_U16 nCfgValue16;
969 tSirMacHTInfoField2 infoField2;
970 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -0700971
Jeff Johnson295189b2012-06-20 16:38:30 -0700972
973 #if 0
974 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
975 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +0530976
977 if (NULL == psessionEntry)
978 {
979 PELOGE(limLog(pMac, LOG1,
980 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
981 return eSIR_FAILURE;
982 }
983
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
985
986 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
987
988 htInfoField1 = ( tANI_U8 ) nCfgValue;
989
990 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
992 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
993
Jeff Johnsone7245742012-09-05 17:12:55 -0700994 if (psessionEntry == NULL)
995 {
996 PELOGE(limLog(pMac, LOG1,
997 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
998 }
999 else
1000 {
1001 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1002 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1003 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001004
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001005 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001006 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1007
1008 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1009
1010 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1011 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1012 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1013
1014 uHTInfoField2.infoField2.reserved = 0;
1015
1016 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001017 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1018
1019 htInfoField2 = ( tANI_U16 ) nCfgValue;
1020
1021 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1022 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1023 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1024 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1025
1026 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001028
1029 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1030
1031
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1033
1034
1035 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1036 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1037 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1038 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1039 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1040 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1041 uHTInfoField.infoField3.reserved = 0;
1042
Jeff Johnson295189b2012-06-20 16:38:30 -07001043
1044 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1045 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1046 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1047 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1048 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1049
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1051 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1052 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1053 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1054
Jeff Johnson295189b2012-06-20 16:38:30 -07001055
Jeff Johnson295189b2012-06-20 16:38:30 -07001056 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1057 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1058 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1059 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1060 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1061 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1062 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1064 pDot11f->basicMCSSet, nCfgLen,
1065 SIZE_OF_BASIC_MCS_SET );
1066
1067 pDot11f->present = 1;
1068
1069 return eSIR_SUCCESS;
1070
1071} // End PopulateDot11fHTInfo.
1072
1073void
1074PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1075 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1076{
1077 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1078 {
1079 pDot11f->present = 1;
1080 // ATIM duration is always set to 0
1081 pDot11f->atim = 0;
1082 }
1083
1084} // End PopulateDot11fIBSSParams.
1085
1086
1087#ifdef ANI_SUPPORT_11H
1088tSirRetStatus
1089PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1090 tpSirMacMeasReqActionFrame pReq,
1091 tDot11fIEMeasurementReport *pDot11f)
1092{
1093 pDot11f->token = pReq->measReqIE.measToken;
1094 pDot11f->late = 0;
1095 pDot11f->incapable = 0;
1096 pDot11f->refused = 1;
1097 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1098
1099 pDot11f->present = 1;
1100
1101 return eSIR_SUCCESS;
1102
1103} // End PopulatedDot11fMeasurementReport0.
1104
1105tSirRetStatus
1106PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1107 tpSirMacMeasReqActionFrame pReq,
1108 tDot11fIEMeasurementReport *pDot11f)
1109{
1110 pDot11f->token = pReq->measReqIE.measToken;
1111 pDot11f->late = 0;
1112 pDot11f->incapable = 0;
1113 pDot11f->refused = 1;
1114 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1115
1116 pDot11f->present = 1;
1117
1118 return eSIR_SUCCESS;
1119
1120} // End PopulatedDot11fMeasurementReport1.
1121
1122tSirRetStatus
1123PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1124 tpSirMacMeasReqActionFrame pReq,
1125 tDot11fIEMeasurementReport *pDot11f)
1126{
1127 pDot11f->token = pReq->measReqIE.measToken;
1128 pDot11f->late = 0;
1129 pDot11f->incapable = 0;
1130 pDot11f->refused = 1;
1131 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1132
1133 pDot11f->present = 1;
1134
1135 return eSIR_SUCCESS;
1136
1137} // End PopulatedDot11fMeasurementReport2.
1138#endif
1139
1140void
1141PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1142 tDot11fIEPowerCaps *pCaps,
1143 tANI_U8 nAssocType,
1144 tpPESession psessionEntry)
1145{
1146 if (nAssocType == LIM_REASSOC)
1147 {
1148 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1149 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1150 }else
1151 {
1152 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1153 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1154
1155 }
1156
1157 pCaps->present = 1;
1158} // End PopulateDot11fPowerCaps.
1159
1160tSirRetStatus
1161PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1162 tDot11fIEPowerConstraints *pDot11f)
1163{
1164 tANI_U32 cfg;
1165 tSirRetStatus nSirStatus;
1166
1167 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1168
1169 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1170 pDot11f->present = 1;
1171
1172 return eSIR_SUCCESS;
1173} // End PopulateDot11fPowerConstraints.
1174
1175void
1176PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1177 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1178{
1179 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1180 pDot11f->reserved = 0;
1181 pDot11f->txopreq = 0;
1182 pDot11f->qreq = 0;
1183 pDot11f->qack = 0;
1184 pDot11f->present = 1;
1185} // End PopulatedDot11fQOSCaps.
1186
1187void
1188PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1189 tDot11fIEQOSCapsStation *pDot11f)
1190{
1191 tANI_U32 val = 0;
1192
1193 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1194 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1195
1196 pDot11f->more_data_ack = 0;
1197 pDot11f->max_sp_length = (tANI_U8)val;
1198 pDot11f->qack = 0;
1199
1200 if (pMac->lim.gUapsdEnable)
1201 {
1202 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1203 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1204 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1205 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1206 }
1207 pDot11f->present = 1;
1208} // End PopulatedDot11fQOSCaps.
1209
1210tSirRetStatus
1211PopulateDot11fRSN(tpAniSirGlobal pMac,
1212 tpSirRSNie pRsnIe,
1213 tDot11fIERSN *pDot11f)
1214{
1215 tANI_U32 status;
1216 int idx;
1217
1218 if ( pRsnIe->length )
1219 {
1220 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1221 {
1222 status = dot11fUnpackIeRSN( pMac,
1223 pRsnIe->rsnIEdata + idx + 2, //EID, length
1224 pRsnIe->rsnIEdata[ idx + 1 ],
1225 pDot11f );
1226 if ( DOT11F_FAILED( status ) )
1227 {
1228 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1229 "N (0x%08x).\n"),
1230 status );
1231 return eSIR_FAILURE;
1232 }
1233 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1234 "PopulateDot11fRSN.\n"), status );
1235 }
1236
1237 }
1238
1239 return eSIR_SUCCESS;
1240} // End PopulateDot11fRSN.
1241
1242tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1243 tpSirRSNie pRsnIe,
1244 tDot11fIERSNOpaque *pDot11f )
1245{
1246 int idx;
1247
1248 if ( pRsnIe->length )
1249 {
1250 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1251 {
1252 pDot11f->present = 1;
1253 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301254 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 pRsnIe->rsnIEdata + idx + 2, // EID, len
1256 pRsnIe->rsnIEdata[ idx + 1 ] );
1257 }
1258 }
1259
1260 return eSIR_SUCCESS;
1261
1262} // End PopulateDot11fRSNOpaque.
1263
1264
1265
1266#if defined(FEATURE_WLAN_WAPI)
1267
1268tSirRetStatus
1269PopulateDot11fWAPI(tpAniSirGlobal pMac,
1270 tpSirRSNie pRsnIe,
1271 tDot11fIEWAPI *pDot11f)
1272 {
1273 tANI_U32 status;
1274 int idx;
1275
1276 if ( pRsnIe->length )
1277 {
1278 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1279 {
1280 status = dot11fUnpackIeWAPI( pMac,
1281 pRsnIe->rsnIEdata + idx + 2, //EID, length
1282 pRsnIe->rsnIEdata[ idx + 1 ],
1283 pDot11f );
1284 if ( DOT11F_FAILED( status ) )
1285 {
1286 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1287 status );
1288 return eSIR_FAILURE;
1289 }
1290 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1291 "PopulateDot11fWAPI.\n"), status );
1292 }
1293 }
1294
1295 return eSIR_SUCCESS;
1296} // End PopulateDot11fWAPI.
1297
1298tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1299 tpSirRSNie pRsnIe,
1300 tDot11fIEWAPIOpaque *pDot11f )
1301{
1302 int idx;
1303
1304 if ( pRsnIe->length )
1305 {
1306 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1307 {
1308 pDot11f->present = 1;
1309 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301310 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 pRsnIe->rsnIEdata + idx + 2, // EID, len
1312 pRsnIe->rsnIEdata[ idx + 1 ] );
1313 }
1314 }
1315
1316 return eSIR_SUCCESS;
1317
1318} // End PopulateDot11fWAPIOpaque.
1319
1320
1321#endif //defined(FEATURE_WLAN_WAPI)
1322
1323void
1324PopulateDot11fSSID(tpAniSirGlobal pMac,
1325 tSirMacSSid *pInternal,
1326 tDot11fIESSID *pDot11f)
1327{
1328 pDot11f->present = 1;
1329 pDot11f->num_ssid = pInternal->length;
1330 if ( pInternal->length )
1331 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301332 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 pInternal->length );
1334 }
1335} // End PopulateDot11fSSID.
1336
1337tSirRetStatus
1338PopulateDot11fSSID2(tpAniSirGlobal pMac,
1339 tDot11fIESSID *pDot11f)
1340{
1341 tANI_U32 nCfg;
1342 tSirRetStatus nSirStatus;
1343
1344 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1345 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1346 pDot11f->present = 1;
1347 return eSIR_SUCCESS;
1348} // End PopulateDot11fSSID2.
1349
1350void
1351PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1352 tDot11fIESchedule *pDot11f)
1353{
1354 pDot11f->aggregation = pSchedule->info.aggregation;
1355 pDot11f->tsid = pSchedule->info.tsid;
1356 pDot11f->direction = pSchedule->info.direction;
1357 pDot11f->reserved = pSchedule->info.rsvd;
1358 pDot11f->service_start_time = pSchedule->svcStartTime;
1359 pDot11f->service_interval = pSchedule->svcInterval;
1360 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1361 pDot11f->spec_interval = pSchedule->specInterval;
1362
1363 pDot11f->present = 1;
1364} // End PopulateDot11fSchedule.
1365
1366void
1367PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1368 tDot11fIESuppChannels *pDot11f,
1369 tANI_U8 nAssocType,
1370 tpPESession psessionEntry)
1371{
1372 tANI_U8 i;
1373 tANI_U8 *p;
1374
1375 if (nAssocType == LIM_REASSOC)
1376 {
1377 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1378 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1379 }else
1380 {
1381 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1382 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1383 }
1384 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1385 {
1386 pDot11f->bands[i][0] = *p;
1387 pDot11f->bands[i][1] = 1;
1388 }
1389
1390 pDot11f->present = 1;
1391
1392} // End PopulateDot11fSuppChannels.
1393
1394tSirRetStatus
1395PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1396 tANI_U8 nChannelNum,
1397 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1398{
1399 tSirRetStatus nSirStatus;
1400 tANI_U32 nRates;
1401 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1402
1403 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1404 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1405 sending mgmt frames (lile probe req) which need to go out before any session is present.
1406 */
1407 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1408 {
1409 #if 0
1410 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1411 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1412 #endif //TO SUPPORT BT-AMP
1413 if(psessionEntry != NULL)
1414 {
1415 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301416 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 nRates);
1418 }
1419 else
1420 {
1421 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1422 nRates = 0;
1423 }
1424 }
1425 else if ( 14 >= nChannelNum )
1426 {
1427 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1428 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1429 }
1430 else
1431 {
1432 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1433 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1434 }
1435
1436 if ( 0 != nRates )
1437 {
1438 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301439 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 pDot11f->present = 1;
1441 }
1442
1443 return eSIR_SUCCESS;
1444
1445} // End PopulateDot11fSuppRates.
1446
1447tSirRetStatus
1448PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1449 tDot11fIETPCReport *pDot11f,
1450 tpPESession psessionEntry)
1451{
1452 tANI_U16 staid, txPower;
1453 tSirRetStatus nSirStatus;
1454
1455 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1456 if ( eSIR_SUCCESS != nSirStatus )
1457 {
1458 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1459 "eDot11fTPCReport; limGetMgmtStaid "
1460 "returned status %d.\n"),
1461 nSirStatus );
1462 return eSIR_FAILURE;
1463 }
1464
1465 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1466 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1467 txPower = 0;
1468 pDot11f->tx_power = ( tANI_U8 )txPower;
1469 pDot11f->link_margin = 0;
1470 pDot11f->present = 1;
1471
1472 return eSIR_SUCCESS;
1473} // End PopulateDot11fTPCReport.
1474
1475
1476void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1477 tDot11fFfTSInfo *pDot11f)
1478{
1479 pDot11f->traffic_type = pInfo->traffic.trafficType;
1480 pDot11f->tsid = pInfo->traffic.tsid;
1481 pDot11f->direction = pInfo->traffic.direction;
1482 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1483 pDot11f->aggregation = pInfo->traffic.aggregation;
1484 pDot11f->psb = pInfo->traffic.psb;
1485 pDot11f->user_priority = pInfo->traffic.userPrio;
1486 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1487 pDot11f->schedule = pInfo->schedule.schedule;
1488} // End PopulatedDot11fTSInfo.
1489
1490void PopulateDot11fWMM(tpAniSirGlobal pMac,
1491 tDot11fIEWMMInfoAp *pInfo,
1492 tDot11fIEWMMParams *pParams,
1493 tDot11fIEWMMCaps *pCaps,
1494 tpPESession psessionEntry)
1495{
1496 if ( psessionEntry->limWmeEnabled )
1497 {
1498 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1499 {
1500 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1501 {
1502 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1503 }
1504 }
1505 else
1506 {
1507 {
1508 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1509 }
1510
1511 if ( psessionEntry->limWsmEnabled )
1512 {
1513 PopulateDot11fWMMCaps( pCaps );
1514 }
1515 }
1516 }
1517} // End PopulateDot11fWMM.
1518
1519void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1520{
1521 pCaps->version = SIR_MAC_OUI_VERSION_1;
1522 pCaps->qack = 0;
1523 pCaps->queue_request = 1;
1524 pCaps->txop_request = 0;
1525 pCaps->more_ack = 0;
1526 pCaps->present = 1;
1527} // End PopulateDot11fWmmCaps.
1528
1529#ifdef FEATURE_WLAN_CCX
1530void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1531{
1532 tANI_U8 numTspecs = 0, idx;
1533 tTspecInfo *pTspec = NULL;
1534
1535 numTspecs = psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs;
1536 pTspec = &psessionEntry->pLimReAssocReq->ccxTspecInfo.tspec[0];
1537 pReassoc->num_WMMTSPEC = numTspecs;
1538 if (numTspecs) {
1539 for (idx=0; idx<numTspecs; idx++) {
1540 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
1541 pTspec++;
1542 }
1543 }
1544}
1545#endif
1546
1547void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1548 tpPESession psessionEntry)
1549{
1550 pInfo->version = SIR_MAC_OUI_VERSION_1;
1551
1552 /* WMM Specification 3.1.3, 3.2.3
1553 * An IBSS staion shall always use its default WMM parameters.
1554 */
1555 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1556 {
1557 pInfo->param_set_count = 0;
1558 pInfo->uapsd = 0;
1559 }
1560 else
1561 {
1562 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1564 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1565 }
1566 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001567 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1568 }
1569 pInfo->present = 1;
1570}
1571
1572void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1573{
1574 tANI_U32 val = 0;
1575
1576 pInfo->version = SIR_MAC_OUI_VERSION_1;
1577 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1578 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1579 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1580 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1581
1582 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1583 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1584
1585 pInfo->max_sp_length = (tANI_U8)val;
1586 pInfo->present = 1;
1587}
1588
Jeff Johnson295189b2012-06-20 16:38:30 -07001589void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1590 tDot11fIEWMMParams *pParams,
1591 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001592{
1593 pParams->version = SIR_MAC_OUI_VERSION_1;
1594
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1596 pParams->qosInfo =
1597 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1598 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001599 pParams->qosInfo =
1600 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1601
1602 // Fill each EDCA parameter set in order: be, bk, vi, vo
1603 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1604 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1605 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1606 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1607 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1608 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1609
1610 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1611 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1612 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1613 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1614 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1615 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1616
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1618 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1619 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001620 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1621
1622
1623
1624 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1625 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1626 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1627 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1628 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1629
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1631 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1632 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1634
1635 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1636 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1637 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1638 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1639 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1640
1641 pParams->present = 1;
1642
1643} // End PopulateDot11fWMMParams.
1644
1645void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1646 tDot11fIEWMMSchedule *pDot11f)
1647{
1648 pDot11f->version = 1;
1649 pDot11f->aggregation = pSchedule->info.aggregation;
1650 pDot11f->tsid = pSchedule->info.tsid;
1651 pDot11f->direction = pSchedule->info.direction;
1652 pDot11f->reserved = pSchedule->info.rsvd;
1653 pDot11f->service_start_time = pSchedule->svcStartTime;
1654 pDot11f->service_interval = pSchedule->svcInterval;
1655 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1656 pDot11f->spec_interval = pSchedule->specInterval;
1657
1658 pDot11f->present = 1;
1659} // End PopulateDot11fWMMSchedule.
1660
1661tSirRetStatus
1662PopulateDot11fWPA(tpAniSirGlobal pMac,
1663 tpSirRSNie pRsnIe,
1664 tDot11fIEWPA *pDot11f)
1665{
1666 tANI_U32 status;
1667 int idx;
1668
1669 if ( pRsnIe->length )
1670 {
1671 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1672 {
1673 status = dot11fUnpackIeWPA( pMac,
1674 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1675 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1676 pDot11f );
1677 if ( DOT11F_FAILED( status ) )
1678 {
1679 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1680 "A (0x%08x).\n"),
1681 status );
1682 return eSIR_FAILURE;
1683 }
1684 }
1685 }
1686
1687 return eSIR_SUCCESS;
1688} // End PopulateDot11fWPA.
1689
1690
1691
1692tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1693 tpSirRSNie pRsnIe,
1694 tDot11fIEWPAOpaque *pDot11f )
1695{
1696 int idx;
1697
1698 if ( pRsnIe->length )
1699 {
1700 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1701 {
1702 pDot11f->present = 1;
1703 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301704 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1706 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1707 }
1708 }
1709
1710 return eSIR_SUCCESS;
1711
1712} // End PopulateDot11fWPAOpaque.
1713
1714////////////////////////////////////////////////////////////////////////
1715
1716tSirRetStatus
1717sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1718{
1719#if 0
1720 tANI_U32 val;
1721
1722 *caps = 0;
1723 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1724 != eSIR_SUCCESS)
1725 {
1726 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1727 return eSIR_FAILURE;
1728 }
1729 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1730 {
1731 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1732 return eSIR_FAILURE;
1733 }
1734
1735 *caps = (tANI_U16) val;
1736#endif
1737 return eSIR_SUCCESS;
1738}
1739
1740tSirRetStatus
1741sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1742 tANI_U8 *pFrame,
1743 tANI_U32 nFrame,
1744 tpSirProbeReq pProbeReq)
1745{
1746 tANI_U32 status;
1747 tDot11fProbeRequest pr;
1748
1749 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301750 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001751
1752 // delegate to the framesc-generated code,
1753 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1754 if ( DOT11F_FAILED( status ) )
1755 {
1756 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1757 status, nFrame);
1758 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1759 return eSIR_FAILURE;
1760 }
1761 else if ( DOT11F_WARNED( status ) )
1762 {
1763 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1764 status, nFrame );
1765 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1766 }
1767
1768 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1769 if ( ! pr.SSID.present )
1770 {
1771 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1772 }
1773 else
1774 {
1775 pProbeReq->ssidPresent = 1;
1776 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
1777 }
1778
1779 if ( ! pr.SuppRates.present )
1780 {
1781 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1782 return eSIR_FAILURE;
1783 }
1784 else
1785 {
1786 pProbeReq->suppRatesPresent = 1;
1787 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
1788 }
1789
1790 if ( pr.ExtSuppRates.present )
1791 {
1792 pProbeReq->extendedRatesPresent = 1;
1793 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
1794 }
1795
1796 if ( pr.HTCaps.present )
1797 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301798 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 }
1800
1801 if ( pr.WscProbeReq.present )
1802 {
1803 pProbeReq->wscIePresent = 1;
1804 memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
1805 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001806#ifdef WLAN_FEATURE_11AC
1807 if ( pr.VHTCaps.present )
1808 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301809 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07001810 }
1811#endif
1812
Jeff Johnson295189b2012-06-20 16:38:30 -07001813
1814 if ( pr.P2PProbeReq.present )
1815 {
1816 pProbeReq->p2pIePresent = 1;
1817 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001818
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 return eSIR_SUCCESS;
1820
1821} // End sirConvertProbeReqFrame2Struct.
1822
1823tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
1824 tANI_U8 *pFrame,
1825 tANI_U32 nFrame,
1826 tpSirProbeRespBeacon pProbeResp)
1827{
1828 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001829 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07001830
1831 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301832 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001833
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301834 pr = vos_mem_malloc(sizeof(tDot11fProbeResponse));
1835 if ( NULL == pr )
1836 status = eHAL_STATUS_FAILURE;
1837 else
1838 status = eHAL_STATUS_SUCCESS;
1839 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07001840 {
1841 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
1842 return eSIR_FAILURE;
1843 }
1844
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301845 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07001846
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07001848 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 if ( DOT11F_FAILED( status ) )
1850 {
1851 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
1852 status, nFrame);
1853 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301854 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 return eSIR_FAILURE;
1856 }
1857 else if ( DOT11F_WARNED( status ) )
1858 {
1859 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
1860 status, nFrame );
1861 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1862 }
1863
1864 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
1865
1866 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301867 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
1868 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001869
1870 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07001871 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07001872
1873 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07001874 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
1875 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
1876 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
1877 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
1878 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
1879 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
1880 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
1881 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
1882 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
1883 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
1884 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
1885 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
1886 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
1887 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
1888 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
1889 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07001890
Jeff Johnson32d95a32012-09-10 13:15:23 -07001891 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001892 {
1893 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1894 }
1895 else
1896 {
1897 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001898 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07001899 }
1900
Jeff Johnson32d95a32012-09-10 13:15:23 -07001901 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 {
1903 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1904 }
1905 else
1906 {
1907 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001908 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001909 }
1910
Jeff Johnson32d95a32012-09-10 13:15:23 -07001911 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 {
1913 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001914 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 }
1916
1917
Jeff Johnson32d95a32012-09-10 13:15:23 -07001918 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 {
1920 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001921 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07001922 }
1923
Jeff Johnson32d95a32012-09-10 13:15:23 -07001924 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 {
1926 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001927 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 }
1929
Jeff Johnson32d95a32012-09-10 13:15:23 -07001930 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001931 {
1932 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001933 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 }
1935
Jeff Johnson32d95a32012-09-10 13:15:23 -07001936 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 {
1938 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301939 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 sizeof(tDot11fIEExtChanSwitchAnn) );
1941 }
1942
Jeff Johnson32d95a32012-09-10 13:15:23 -07001943 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 {
1945 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301946 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 sizeof(tDot11fIEExtChanSwitchAnn) );
1948 }
1949
Jeff Johnson32d95a32012-09-10 13:15:23 -07001950 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 {
1952 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301953 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 }
1955
Jeff Johnson32d95a32012-09-10 13:15:23 -07001956 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 {
1958 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301959 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
1960 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 }
1962
Jeff Johnson32d95a32012-09-10 13:15:23 -07001963 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 {
1965 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301966 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001967 }
1968
Jeff Johnson32d95a32012-09-10 13:15:23 -07001969 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301971 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 }
1973
Jeff Johnson32d95a32012-09-10 13:15:23 -07001974 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301976 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 }
1978
Jeff Johnson32d95a32012-09-10 13:15:23 -07001979 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 {
1981 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001982 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07001984 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07001985 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07001986 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 }
1988
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001989 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 {
1991 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07001992 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 }
1994
Jeff Johnson32d95a32012-09-10 13:15:23 -07001995 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 {
1997 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001998 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 }
2000
Jeff Johnson32d95a32012-09-10 13:15:23 -07002001 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 {
2003 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002004 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002006 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 }
2008
Jeff Johnson32d95a32012-09-10 13:15:23 -07002009 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 {
2011 pProbeResp->wmeInfoPresent = 1;
2012 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2013 }
2014
Jeff Johnson32d95a32012-09-10 13:15:23 -07002015 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 {
2017 pProbeResp->wsmCapablePresent = 1;
2018 }
2019
2020
Jeff Johnson32d95a32012-09-10 13:15:23 -07002021 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 {
2023 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002024 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 }
2026
2027#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002028 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 {
2030 // MobilityDomain
2031 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302032 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2033 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002034 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002035#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002036 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2038#endif
2039 }
2040#endif
2041
2042#if defined FEATURE_WLAN_CCX
Jeff Johnson32d95a32012-09-10 13:15:23 -07002043 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302045 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 }
2047#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002048 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302050 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002051 sizeof(tDot11fIEP2PProbeRes) );
2052 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002053#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002054 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002055 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302056 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002057 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002058 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002059 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302060 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002061 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002062 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002063 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302064 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002065 }
2066#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302067 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 return eSIR_SUCCESS;
2069
2070} // End sirConvertProbeFrame2Struct.
2071
2072tSirRetStatus
2073sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2074 tANI_U8 *pFrame,
2075 tANI_U32 nFrame,
2076 tpSirAssocReq pAssocReq)
2077{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002078 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 tANI_U32 status;
2080
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302081 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2082 if ( NULL == ar )
2083 status = eHAL_STATUS_FAILURE;
2084 else
2085 status = eHAL_STATUS_SUCCESS;
2086 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002087 {
2088 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2089 return eSIR_FAILURE;
2090 }
2091 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302092 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2093 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002094
2095 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002096 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 if ( DOT11F_FAILED( status ) )
2098 {
2099 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2100 status, nFrame);
2101 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302102 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 return eSIR_FAILURE;
2104 }
2105 else if ( DOT11F_WARNED( status ) )
2106 {
2107 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2108 status, nFrame );
2109 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2110 }
2111
2112 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2113
2114 // make sure this is seen as an assoc request
2115 pAssocReq->reassocRequest = 0;
2116
2117 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002118 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2119 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2120 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2121 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2122 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2123 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2124 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2125 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2126 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2127 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2128 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2129 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2130 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2131 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2132 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2133 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002134
2135 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002136 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002137
2138 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002139 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 {
2141 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002142 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 }
2144
2145 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002146 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 {
2148 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002149 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 }
2151
2152 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002153 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 {
2155 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002156 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 }
2158
2159 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002160 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 {
2162 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002163 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 }
2165
2166 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002167 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002168 {
2169 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002170 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 }
2172
2173 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002174 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 {
2176 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002177 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 }
2179
2180 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002181 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 {
2183 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002184 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 }
2186
2187
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002188 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 {
2190 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002191 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002193#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002194 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002195 {
2196 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002197 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002198 }
2199#endif
2200
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002202 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 {
2204 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002205 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 }
2207
2208 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002209 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 {
2211 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002212 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 }
2214
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002215 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302217 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 }
2219
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002220 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 {
2222 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302223 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2224 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002225
2226 }
2227
2228
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002229 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002230
2231 if ( ! pAssocReq->ssidPresent )
2232 {
2233 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302234 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 return eSIR_FAILURE;
2236 }
2237
2238 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2239 {
2240 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302241 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 return eSIR_FAILURE;
2243 }
2244
Jeff Johnsone7245742012-09-05 17:12:55 -07002245#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002246 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002247 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302248 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002249 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2250 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2251 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002252 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002253 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302254 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002255 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2256 limLogOperatingMode( pMac, &pAssocReq->operMode);
2257 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002258#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302259 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 return eSIR_SUCCESS;
2261
2262} // End sirConvertAssocReqFrame2Struct.
2263
2264tSirRetStatus
2265sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2266 tANI_U8 *pFrame,
2267 tANI_U32 nFrame,
2268 tpSirAssocRsp pAssocRsp)
2269{
2270 static tDot11fAssocResponse ar;
2271 tANI_U32 status;
2272 tANI_U8 cnt =0;
2273
2274 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302275 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002276
2277 // delegate to the framesc-generated code,
2278 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2279 if ( DOT11F_FAILED( status ) )
2280 {
2281 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2282 status, nFrame);
2283 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2284 return eSIR_FAILURE;
2285 }
2286 else if ( DOT11F_WARNED( status ) )
2287 {
2288 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2289 status, nFrame );
2290 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2291 }
2292
2293 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2294
2295 // Capabilities
2296 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2297 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2298 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2299 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2300 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2301 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2302 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2303 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2304 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2305 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2306 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2307 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2308 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2309 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2310 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2311 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2312
2313 pAssocRsp->statusCode = ar.Status.status;
2314 pAssocRsp->aid = ar.AID.associd;
2315
2316 if ( ! ar.SuppRates.present )
2317 {
2318 pAssocRsp->suppRatesPresent = 0;
2319 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2320 }
2321 else
2322 {
2323 pAssocRsp->suppRatesPresent = 1;
2324 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2325 }
2326
2327 if ( ar.ExtSuppRates.present )
2328 {
2329 pAssocRsp->extendedRatesPresent = 1;
2330 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2331 }
2332
2333 if ( ar.EDCAParamSet.present )
2334 {
2335 pAssocRsp->edcaPresent = 1;
2336 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2337 }
2338
2339
2340 if ( ar.WMMParams.present )
2341 {
2342 pAssocRsp->wmeEdcaPresent = 1;
2343 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002344 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 __printWMMParams(pMac, &ar.WMMParams);
2346 }
2347
2348 if ( ar.HTCaps.present )
2349 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302350 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 }
2352
2353 if ( ar.HTInfo.present )
2354 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302355 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002356 }
2357
2358#ifdef WLAN_FEATURE_VOWIFI_11R
2359 if (ar.MobilityDomain.present)
2360 {
2361 // MobilityDomain
2362 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302363 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2364 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002365 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2366#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002367 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2369#endif
2370 }
2371
2372 if ( ar.FTInfo.present )
2373 {
2374#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002375 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 -07002376 ar.FTInfo.R0KH_ID.present,
2377 ar.FTInfo.R1KH_ID.present);
2378#endif
2379 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302380 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 }
2382#endif
2383
2384#ifdef WLAN_FEATURE_VOWIFI_11R
2385 if (ar.num_RICDataDesc) {
2386 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2387 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302388 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2389 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 }
2391 }
2392 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2393 pAssocRsp->ricPresent = TRUE;
2394 }
2395#endif
2396
2397#ifdef FEATURE_WLAN_CCX
2398 if (ar.num_WMMTSPEC) {
2399 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2400 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302401 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2402 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 }
2404 pAssocRsp->tspecPresent = TRUE;
2405 }
2406
2407 if(ar.CCXTrafStrmMet.present)
2408 {
2409 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302410 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Jeff Johnson295189b2012-06-20 16:38:30 -07002411 &ar.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
2412 }
2413#endif
2414
Jeff Johnsone7245742012-09-05 17:12:55 -07002415#ifdef WLAN_FEATURE_11AC
2416 if ( ar.VHTCaps.present )
2417 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302418 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002419 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002420 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2421 }
2422 if ( ar.VHTOperation.present )
2423 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302424 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002425 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002426 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2427 }
2428#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302429 if(ar.OBSSScanParameters.present)
2430 {
2431 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2432 sizeof( tDot11fIEOBSSScanParameters));
2433 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 return eSIR_SUCCESS;
2435
2436} // End sirConvertAssocRespFrame2Struct.
2437
2438tSirRetStatus
2439sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2440 tANI_U8 *pFrame,
2441 tANI_U32 nFrame,
2442 tpSirAssocReq pAssocReq)
2443{
2444 static tDot11fReAssocRequest ar;
2445 tANI_U32 status;
2446
2447 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302448 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002449
2450 // delegate to the framesc-generated code,
2451 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2452 if ( DOT11F_FAILED( status ) )
2453 {
2454 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2455 status, nFrame);
2456 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2457 return eSIR_FAILURE;
2458 }
2459 else if ( DOT11F_WARNED( status ) )
2460 {
2461 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2462 status, nFrame );
2463 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2464 }
2465
2466 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2467
2468 // make sure this is seen as a re-assoc request
2469 pAssocReq->reassocRequest = 1;
2470
2471 // Capabilities
2472 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2473 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2474 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2475 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2476 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2477 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2478 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2479 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2480 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2481 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2482 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2483 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2484 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2485 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2486 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2487 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2488
2489 // Listen Interval
2490 pAssocReq->listenInterval = ar.ListenInterval.interval;
2491
2492 // SSID
2493 if ( ar.SSID.present )
2494 {
2495 pAssocReq->ssidPresent = 1;
2496 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2497 }
2498
2499 // Supported Rates
2500 if ( ar.SuppRates.present )
2501 {
2502 pAssocReq->suppRatesPresent = 1;
2503 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2504 }
2505
2506 // Extended Supported Rates
2507 if ( ar.ExtSuppRates.present )
2508 {
2509 pAssocReq->extendedRatesPresent = 1;
2510 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2511 &ar.ExtSuppRates );
2512 }
2513
2514 // QOS Capabilities:
2515 if ( ar.QOSCapsStation.present )
2516 {
2517 pAssocReq->qosCapabilityPresent = 1;
2518 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2519 }
2520
2521 // WPA
2522 if ( ar.WPAOpaque.present )
2523 {
2524 pAssocReq->wpaPresent = 1;
2525 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2526 }
2527
2528 // RSN
2529 if ( ar.RSNOpaque.present )
2530 {
2531 pAssocReq->rsnPresent = 1;
2532 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2533 }
2534
2535
2536 // Power Capabilities
2537 if ( ar.PowerCaps.present )
2538 {
2539 pAssocReq->powerCapabilityPresent = 1;
2540 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2541 }
2542
2543 // Supported Channels
2544 if ( ar.SuppChannels.present )
2545 {
2546 pAssocReq->supportedChannelsPresent = 1;
2547 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2548 }
2549
2550 if ( ar.HTCaps.present )
2551 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302552 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 }
2554
2555 if ( ar.WMMInfoStation.present )
2556 {
2557 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302558 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2559 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002560
2561 }
2562
2563 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2564
2565 if ( ! pAssocReq->ssidPresent )
2566 {
2567 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2568 return eSIR_FAILURE;
2569 }
2570
2571 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2572 {
2573 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2574 return eSIR_FAILURE;
2575 }
2576
2577 // Why no call to 'updateAssocReqFromPropCapability' here, like
2578 // there is in 'sirConvertAssocReqFrame2Struct'?
2579
2580 // WSC IE
2581 if (ar.WscIEOpaque.present)
2582 {
2583 pAssocReq->addIEPresent = 1;
2584 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2585 }
2586
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 if(ar.P2PIEOpaque.present)
2588 {
2589 pAssocReq->addIEPresent = 1;
2590 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2591 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002592
Jeff Johnsone7245742012-09-05 17:12:55 -07002593#ifdef WLAN_FEATURE_WFD
2594 if(ar.WFDIEOpaque.present)
2595 {
2596 pAssocReq->addIEPresent = 1;
2597 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2598 }
2599#endif
2600
2601#ifdef WLAN_FEATURE_11AC
2602 if ( ar.VHTCaps.present )
2603 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302604 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002605 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002606 if ( ar.OperatingMode.present )
2607 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302608 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002609 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2610 limLogOperatingMode( pMac, &pAssocReq->operMode);
2611 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002612#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002613 return eSIR_SUCCESS;
2614
2615} // End sirConvertReassocReqFrame2Struct.
2616
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002617
2618#if defined(FEATURE_WLAN_CCX_UPLOAD)
2619tSirRetStatus
2620sirFillBeaconMandatoryIEforCcxBcnReport(tpAniSirGlobal pMac,
2621 tANI_U8 *pPayload,
2622 const tANI_U32 nPayload,
2623 tANI_U8 **outIeBuf,
2624 tANI_U32 *pOutIeLen)
2625{
2626 tDot11fBeaconIEs *pBies = NULL;
2627 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002628 tSirRetStatus retStatus = eSIR_SUCCESS;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002629 tSirCcxBcnReportMandatoryIe ccxBcnReportMandatoryIe;
2630
2631 /* To store how many bytes are required to be allocated
2632 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002633 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002634 tANI_U8 *pos = NULL;
2635
2636 // Zero-init our [out] parameter,
2637 vos_mem_set( (tANI_U8*)&ccxBcnReportMandatoryIe, sizeof(ccxBcnReportMandatoryIe), 0 );
2638 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2639 if ( NULL == pBies )
2640 status = eHAL_STATUS_FAILURE;
2641 else
2642 status = eHAL_STATUS_SUCCESS;
2643 if (!HAL_STATUS_SUCCESS(status))
2644 {
2645 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2646 return eSIR_FAILURE;
2647 }
2648 // delegate to the framesc-generated code,
2649 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2650
2651 if ( DOT11F_FAILED( status ) )
2652 {
2653 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2654 status, nPayload);
2655 vos_mem_free(pBies);
2656 return eSIR_FAILURE;
2657 }
2658 else if ( DOT11F_WARNED( status ) )
2659 {
2660 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2661 status, nPayload );
2662 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2663 }
2664
2665 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'ccxBcnReportMandatoryIe'...
2666 if ( !pBies->SSID.present )
2667 {
2668 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2669 }
2670 else
2671 {
2672 ccxBcnReportMandatoryIe.ssidPresent = 1;
2673 ConvertSSID( pMac, &ccxBcnReportMandatoryIe.ssId, &pBies->SSID );
2674 /* 1 for EID, 1 for length and length bytes */
2675 numBytes += 1 + 1 + ccxBcnReportMandatoryIe.ssId.length;
2676 }
2677
2678 if ( !pBies->SuppRates.present )
2679 {
2680 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2681 }
2682 else
2683 {
2684 ccxBcnReportMandatoryIe.suppRatesPresent = 1;
2685 ConvertSuppRates( pMac, &ccxBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2686 numBytes += 1 + 1 + ccxBcnReportMandatoryIe.supportedRates.numRates;
2687 }
2688
2689 if ( pBies->FHParamSet.present)
2690 {
2691 ccxBcnReportMandatoryIe.fhParamPresent = 1;
2692 ConvertFHParams( pMac, &ccxBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
2693 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2694 }
2695
2696 if ( pBies->DSParams.present )
2697 {
2698 ccxBcnReportMandatoryIe.dsParamsPresent = 1;
2699 ccxBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
2700 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2701 }
2702
2703 if ( pBies->CFParams.present )
2704 {
2705 ccxBcnReportMandatoryIe.cfPresent = 1;
2706 ConvertCFParams( pMac, &ccxBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
2707 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
2708 }
2709
2710 if ( pBies->IBSSParams.present )
2711 {
2712 ccxBcnReportMandatoryIe.ibssParamPresent = 1;
2713 ccxBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
2714 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2715 }
2716
2717 if ( pBies->TIM.present )
2718 {
2719 ccxBcnReportMandatoryIe.timPresent = 1;
2720 ccxBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
2721 ccxBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
2722 ccxBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
2723 /* As per the CCX spec, May truncate and report first 4 octets only */
2724 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
2725 }
2726
2727 if ( pBies->RRMEnabledCap.present )
2728 {
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002729 ccxBcnReportMandatoryIe.rrmPresent = 1;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002730 vos_mem_copy( &ccxBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
2731 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2732 }
2733
2734 *outIeBuf = vos_mem_malloc(numBytes);
2735 if (NULL == *outIeBuf)
2736 {
2737 limLog(pMac, LOGP, FL("Memory Allocation failure"));
2738 vos_mem_free(pBies);
2739 return eSIR_FAILURE;
2740 }
2741 pos = *outIeBuf;
2742 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002743 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002744
2745 /* Start filling the output Ie with Mandatory IE information */
2746 /* Fill SSID IE */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002747 if (ccxBcnReportMandatoryIe.ssidPresent)
2748 {
2749 if (freeBytes < (1 + 1 + ccxBcnReportMandatoryIe.ssId.length))
2750 {
2751 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
2752 retStatus = eSIR_FAILURE;
2753 goto err_bcnrep;
2754 }
2755 *pos = SIR_MAC_SSID_EID;
2756 pos++;
2757 *pos = ccxBcnReportMandatoryIe.ssId.length;
2758 pos++;
2759 vos_mem_copy(pos, (tANI_U8*)ccxBcnReportMandatoryIe.ssId.ssId,
2760 ccxBcnReportMandatoryIe.ssId.length);
2761 pos += ccxBcnReportMandatoryIe.ssId.length;
2762 freeBytes -= (1 + 1 + ccxBcnReportMandatoryIe.ssId.length);
2763 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002764
2765 /* Fill Supported Rates IE */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002766 if (ccxBcnReportMandatoryIe.suppRatesPresent)
2767 {
2768 if (freeBytes < (1 + 1 + ccxBcnReportMandatoryIe.supportedRates.numRates))
2769 {
2770 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
2771 retStatus = eSIR_FAILURE;
2772 goto err_bcnrep;
2773 }
2774 *pos = SIR_MAC_RATESET_EID;
2775 pos++;
2776 *pos = ccxBcnReportMandatoryIe.supportedRates.numRates;
2777 pos++;
2778 vos_mem_copy(pos, (tANI_U8*)ccxBcnReportMandatoryIe.supportedRates.rate,
2779 ccxBcnReportMandatoryIe.supportedRates.numRates);
2780 pos += ccxBcnReportMandatoryIe.supportedRates.numRates;
2781 freeBytes -= (1 + 1 + ccxBcnReportMandatoryIe.supportedRates.numRates);
2782 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002783
2784 /* Fill FH Parameter set IE */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002785 if (ccxBcnReportMandatoryIe.fhParamPresent)
2786 {
2787 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
2788 {
2789 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
2790 retStatus = eSIR_FAILURE;
2791 goto err_bcnrep;
2792 }
2793 *pos = SIR_MAC_FH_PARAM_SET_EID;
2794 pos++;
2795 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
2796 pos++;
2797 vos_mem_copy(pos, (tANI_U8*)&ccxBcnReportMandatoryIe.fhParamSet,
2798 SIR_MAC_FH_PARAM_SET_EID_MAX);
2799 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
2800 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
2801 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002802
2803 /* Fill DS Parameter set IE */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002804 if (ccxBcnReportMandatoryIe.dsParamsPresent)
2805 {
2806 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
2807 {
2808 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
2809 retStatus = eSIR_FAILURE;
2810 goto err_bcnrep;
2811 }
2812 *pos = SIR_MAC_DS_PARAM_SET_EID;
2813 pos++;
2814 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
2815 pos++;
2816 *pos = ccxBcnReportMandatoryIe.dsParamSet.channelNumber;
2817 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
2818 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
2819 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002820
2821 /* Fill CF Parameter set */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002822 if (ccxBcnReportMandatoryIe.cfPresent)
2823 {
2824 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
2825 {
2826 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
2827 retStatus = eSIR_FAILURE;
2828 goto err_bcnrep;
2829 }
2830 *pos = SIR_MAC_CF_PARAM_SET_EID;
2831 pos++;
2832 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
2833 pos++;
2834 vos_mem_copy(pos, (tANI_U8*)&ccxBcnReportMandatoryIe.cfParamSet,
2835 SIR_MAC_CF_PARAM_SET_EID_MAX);
2836 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
2837 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
2838 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002839
2840 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002841 if (ccxBcnReportMandatoryIe.ibssParamPresent)
2842 {
2843 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
2844 {
2845 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
2846 retStatus = eSIR_FAILURE;
2847 goto err_bcnrep;
2848 }
2849 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
2850 pos++;
2851 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2852 pos++;
2853 vos_mem_copy(pos, (tANI_U8*)&ccxBcnReportMandatoryIe.ibssParamSet.atim,
2854 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2855 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2856 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2857 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002858
2859 /* Fill TIM IE */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002860 if (ccxBcnReportMandatoryIe.timPresent)
2861 {
2862 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
2863 {
2864 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
2865 retStatus = eSIR_FAILURE;
2866 goto err_bcnrep;
2867 }
2868 *pos = SIR_MAC_TIM_EID;
2869 pos++;
2870 *pos = SIR_MAC_TIM_EID_MIN;
2871 pos++;
2872 vos_mem_copy(pos, (tANI_U8*)&ccxBcnReportMandatoryIe.tim,
2873 SIR_MAC_TIM_EID_MIN);
2874 pos += SIR_MAC_TIM_EID_MIN;
2875 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
2876 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002877
2878 /* Fill RM Capability IE */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002879 if (ccxBcnReportMandatoryIe.rrmPresent)
2880 {
2881 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
2882 {
2883 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
2884 retStatus = eSIR_FAILURE;
2885 goto err_bcnrep;
2886 }
2887 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
2888 pos++;
2889 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2890 pos++;
2891 vos_mem_copy(pos, (tANI_U8*)&ccxBcnReportMandatoryIe.rmEnabledCapabilities,
2892 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2893 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2894 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002895
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002896 if (freeBytes != 0)
2897 {
2898 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
2899 retStatus = eSIR_FAILURE;
2900 }
2901
2902err_bcnrep:
2903 /* The message counter would not be incremented in case of
2904 * returning failure and hence next time, this function gets
2905 * called, it would be using the same msg ctr for a different
2906 * BSS.So, it is good to clear the memory allocated for a BSS
2907 * that is returning failure.On success, the caller would take
2908 * care of freeing up the memory*/
2909 if (retStatus == eSIR_FAILURE)
2910 {
2911 vos_mem_free(*outIeBuf);
2912 *outIeBuf = NULL;
2913 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002914 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002915 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002916}
2917
2918#endif /* FEATURE_WLAN_CCX_UPLOAD */
2919
Jeff Johnson295189b2012-06-20 16:38:30 -07002920tSirRetStatus
2921sirParseBeaconIE(tpAniSirGlobal pMac,
2922 tpSirProbeRespBeacon pBeaconStruct,
2923 tANI_U8 *pPayload,
2924 tANI_U32 nPayload)
2925{
2926 tDot11fBeaconIEs *pBies;
2927 tANI_U32 status;
2928
2929 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302930 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002931
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302932 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2933 if ( NULL == pBies )
2934 status = eHAL_STATUS_FAILURE;
2935 else
2936 status = eHAL_STATUS_SUCCESS;
2937 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 {
2939 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2940 return eSIR_FAILURE;
2941 }
2942 // delegate to the framesc-generated code,
2943 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2944
2945 if ( DOT11F_FAILED( status ) )
2946 {
2947 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2948 status, nPayload);
2949 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302950 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07002951 return eSIR_FAILURE;
2952 }
2953 else if ( DOT11F_WARNED( status ) )
2954 {
2955 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2956 status, nPayload );
2957 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2958 }
2959
2960 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
2961 if ( ! pBies->SSID.present )
2962 {
2963 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2964 }
2965 else
2966 {
2967 pBeaconStruct->ssidPresent = 1;
2968 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
2969 }
2970
2971 if ( ! pBies->SuppRates.present )
2972 {
2973 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2974 }
2975 else
2976 {
2977 pBeaconStruct->suppRatesPresent = 1;
2978 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
2979 }
2980
2981 if ( pBies->ExtSuppRates.present )
2982 {
2983 pBeaconStruct->extendedRatesPresent = 1;
2984 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
2985 }
2986
2987 if ( pBies->CFParams.present )
2988 {
2989 pBeaconStruct->cfPresent = 1;
2990 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
2991 }
2992
2993 if ( pBies->TIM.present )
2994 {
2995 pBeaconStruct->timPresent = 1;
2996 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
2997 }
2998
2999 if ( pBies->Country.present )
3000 {
3001 pBeaconStruct->countryInfoPresent = 1;
3002 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3003 }
3004
3005 // 11h IEs
3006 if(pBies->TPCReport.present)
3007 {
3008 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303009 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 &pBies->TPCReport,
3011 sizeof( tDot11fIETPCReport));
3012 }
3013
3014 if(pBies->PowerConstraints.present)
3015 {
3016 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303017 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 &pBies->PowerConstraints,
3019 sizeof(tDot11fIEPowerConstraints));
3020 }
3021#ifdef FEATURE_WLAN_CCX
3022 if(pBies->CCXTxmitPower.present)
3023 {
3024 pBeaconStruct->ccxTxPwr.present = 1;
3025 pBeaconStruct->ccxTxPwr.power_limit = pBies->CCXTxmitPower.power_limit;
3026 }
3027 if (pBies->QBSSLoad.present)
3028 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303029 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 }
3031#endif
3032
3033 if ( pBies->EDCAParamSet.present )
3034 {
3035 pBeaconStruct->edcaPresent = 1;
3036 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3037 }
3038
3039 // QOS Capabilities:
3040 if ( pBies->QOSCapsAp.present )
3041 {
3042 pBeaconStruct->qosCapabilityPresent = 1;
3043 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3044 }
3045
3046
3047
3048 if ( pBies->ChanSwitchAnn.present )
3049 {
3050 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303051 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003052 sizeof(tDot11fIEChanSwitchAnn));
3053 }
3054
3055 if ( pBies->ExtChanSwitchAnn.present)
3056 {
3057 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303058 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 sizeof(tDot11fIEExtChanSwitchAnn));
3060 }
3061
3062 if ( pBies->Quiet.present )
3063 {
3064 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303065 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 }
3067
3068 if ( pBies->HTCaps.present )
3069 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303070 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 }
3072
3073 if ( pBies->HTInfo.present )
3074 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303075 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003076 }
3077
3078 if ( pBies->DSParams.present )
3079 {
3080 pBeaconStruct->dsParamsPresent = 1;
3081 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3082 }
3083 else if(pBies->HTInfo.present)
3084 {
3085 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3086 }
3087
3088 if ( pBies->RSN.present )
3089 {
3090 pBeaconStruct->rsnPresent = 1;
3091 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3092 }
3093
3094 if ( pBies->WPA.present )
3095 {
3096 pBeaconStruct->wpaPresent = 1;
3097 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3098 }
3099
3100 if ( pBies->WMMParams.present )
3101 {
3102 pBeaconStruct->wmeEdcaPresent = 1;
3103 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3104 }
3105
3106 if ( pBies->WMMInfoAp.present )
3107 {
3108 pBeaconStruct->wmeInfoPresent = 1;
3109 }
3110
3111 if ( pBies->WMMCaps.present )
3112 {
3113 pBeaconStruct->wsmCapablePresent = 1;
3114 }
3115
3116
3117 if ( pBies->ERPInfo.present )
3118 {
3119 pBeaconStruct->erpPresent = 1;
3120 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3121 }
3122
Jeff Johnsone7245742012-09-05 17:12:55 -07003123#ifdef WLAN_FEATURE_11AC
3124 if ( pBies->VHTCaps.present )
3125 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303126 pBeaconStruct->VHTCaps.present = 1;
3127 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003128 }
3129 if ( pBies->VHTOperation.present )
3130 {
3131 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303132 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3133 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003134 }
3135 if ( pBies->VHTExtBssLoad.present )
3136 {
3137 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303138 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3139 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003140 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003141 if( pBies->OperatingMode.present)
3142 {
3143 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303144 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3145 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003146 }
3147
Jeff Johnsone7245742012-09-05 17:12:55 -07003148#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303149 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003150
Jeff Johnsone7245742012-09-05 17:12:55 -07003151
Jeff Johnson295189b2012-06-20 16:38:30 -07003152 return eSIR_SUCCESS;
3153
3154} // End sirParseBeaconIE.
3155
3156tSirRetStatus
3157sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3158 tANI_U8 *pFrame,
3159 tpSirProbeRespBeacon pBeaconStruct)
3160{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003161 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003162 tANI_U32 status, nPayload;
3163 tANI_U8 *pPayload;
3164 tpSirMacMgmtHdr pHdr;
3165 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003166 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003167
3168 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3169 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3170 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3171 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003172 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003173
3174 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303175 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3176
3177 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
3178 if ( NULL == pBeacon )
3179 status = eHAL_STATUS_FAILURE;
3180 else
3181 status = eHAL_STATUS_SUCCESS;
3182 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003183 {
3184 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3185 return eSIR_FAILURE;
3186 }
3187
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303188 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003189
3190 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303191 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003192
3193 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003194 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003195 if ( DOT11F_FAILED( status ) )
3196 {
3197 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3198 status, nPayload);
3199 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303200 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 return eSIR_FAILURE;
3202 }
3203 else if ( DOT11F_WARNED( status ) )
3204 {
3205 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3206 status, nPayload );
3207 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3208 }
3209
3210 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3211 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303212 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3213 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003214
3215 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003216 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003217
3218 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003219 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3220 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3221 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3222 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3223 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3224 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3225 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3226 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3227 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3228 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3229 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3230 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3231 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3232 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3233 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3234 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003235
Jeff Johnson32d95a32012-09-10 13:15:23 -07003236 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 {
3238 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3239 }
3240 else
3241 {
3242 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003243 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003244 }
3245
Jeff Johnson32d95a32012-09-10 13:15:23 -07003246 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 {
3248 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3249 }
3250 else
3251 {
3252 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003253 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 }
3255
Jeff Johnson32d95a32012-09-10 13:15:23 -07003256 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 {
3258 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003259 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 }
3261
3262
Jeff Johnson32d95a32012-09-10 13:15:23 -07003263 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 {
3265 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003266 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 }
3268
Jeff Johnson32d95a32012-09-10 13:15:23 -07003269 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 {
3271 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003272 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 }
3274
Jeff Johnson32d95a32012-09-10 13:15:23 -07003275 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 {
3277 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003278 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003279 }
3280
3281 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003282 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 {
3284 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003285 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 }
3287
Jeff Johnson32d95a32012-09-10 13:15:23 -07003288 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 {
3290 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003291 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 }
3293
Jeff Johnson32d95a32012-09-10 13:15:23 -07003294 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 {
3296 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303297 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 sizeof(tDot11fIEChanSwitchAnn) );
3299 }
3300
Jeff Johnson32d95a32012-09-10 13:15:23 -07003301 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 {
3303 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303304 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003305 sizeof(tDot11fIEExtChanSwitchAnn) );
3306 }
3307
Jeff Johnson32d95a32012-09-10 13:15:23 -07003308 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003309 {
3310 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303311 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 sizeof(tDot11fIETPCReport));
3313 }
3314
Jeff Johnson32d95a32012-09-10 13:15:23 -07003315 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 {
3317 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303318 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 sizeof(tDot11fIEPowerConstraints));
3320 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003321
3322 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003323 {
3324 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303325 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 }
3327
Jeff Johnson32d95a32012-09-10 13:15:23 -07003328 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303330 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 }
3332
Jeff Johnson32d95a32012-09-10 13:15:23 -07003333 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003334 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303335 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003336
3337 }
3338
Jeff Johnson32d95a32012-09-10 13:15:23 -07003339 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 {
3341 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003342 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003344 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003346 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 }
3348 else
3349 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003350 if ((!rfBand) || IS_5G_BAND(rfBand))
3351 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3352 else if (IS_24G_BAND(rfBand))
3353 pBeaconStruct->channelNumber = mappedRXCh;
3354 else
3355 {
3356 /*Only 0, 1, 2 are expected values for RF band from FW
3357 * if FW fixes are not present then rf band value will
3358 * be 0, else either 1 or 2 are expected from FW, 3 is
3359 * not expected from FW */
3360 PELOGE(limLog(pMac, LOGE,
3361 FL("Channel info is not present in Beacon and"
3362 " mapping is not done correctly"));)
3363 pBeaconStruct->channelNumber = mappedRXCh;
3364 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 }
3366
Jeff Johnson32d95a32012-09-10 13:15:23 -07003367 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 {
3369 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003370 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003371 }
3372
Jeff Johnson32d95a32012-09-10 13:15:23 -07003373 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003374 {
3375 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003376 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 }
3378
Jeff Johnson32d95a32012-09-10 13:15:23 -07003379 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 {
3381 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003382 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003383 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003384 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 }
3386
Jeff Johnson32d95a32012-09-10 13:15:23 -07003387 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003388 {
3389 pBeaconStruct->wmeInfoPresent = 1;
3390 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3391 }
3392
Jeff Johnson32d95a32012-09-10 13:15:23 -07003393 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 {
3395 pBeaconStruct->wsmCapablePresent = 1;
3396 }
3397
Jeff Johnson32d95a32012-09-10 13:15:23 -07003398 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003399 {
3400 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003401 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003402 }
3403
3404#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003405 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003406 {
3407 // MobilityDomain
3408 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303409 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3410 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003411 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003412
3413 }
3414#endif
3415
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303416#ifdef FEATURE_WLAN_CCX
3417 if (pBeacon->CCXTxmitPower.present)
3418 {
3419 //CCX Tx Power
3420 pBeaconStruct->ccxTxPwr.present = 1;
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08003421 vos_mem_copy(&pBeaconStruct->ccxTxPwr,
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303422 &pBeacon->CCXTxmitPower,
3423 sizeof(tDot11fIECCXTxmitPower));
3424 }
3425#endif
3426
Jeff Johnsone7245742012-09-05 17:12:55 -07003427#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003428 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003429 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303430 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003431 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003432 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003433 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303434 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3435 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003436 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003437 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003438 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303439 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3440 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003441 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003442 if(pBeacon->OperatingMode.present)
3443 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303444 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3445 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003446 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003447 if(pBeacon->WiderBWChanSwitchAnn.present)
3448 {
3449 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303450 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3451 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003452 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003453#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303454 if(pBeacon->OBSSScanParameters.present)
3455 {
3456 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3457 &pBeacon->OBSSScanParameters,
3458 sizeof( tDot11fIEOBSSScanParameters));
3459 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303460 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003461 return eSIR_SUCCESS;
3462
3463} // End sirConvertBeaconFrame2Struct.
3464
3465tSirRetStatus
3466sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3467 tANI_U8 *pFrame,
3468 tANI_U32 nFrame,
3469 tpSirMacAuthFrameBody pAuth)
3470{
3471 static tDot11fAuthentication auth;
3472 tANI_U32 status;
3473
3474 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303475 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003476
3477 // delegate to the framesc-generated code,
3478 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3479 if ( DOT11F_FAILED( status ) )
3480 {
3481 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3482 status, nFrame);
3483 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3484 return eSIR_FAILURE;
3485 }
3486 else if ( DOT11F_WARNED( status ) )
3487 {
3488 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3489 status, nFrame );
3490 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3491 }
3492
3493 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3494 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3495 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3496 pAuth->authStatusCode = auth.Status.status;
3497
3498 if ( auth.ChallengeText.present )
3499 {
3500 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3501 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303502 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 }
3504
3505 return eSIR_SUCCESS;
3506
3507} // End sirConvertAuthFrame2Struct.
3508
3509tSirRetStatus
3510sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3511 tANI_U8 *pFrame,
3512 tANI_U32 nFrame,
3513 tSirAddtsReqInfo *pAddTs)
3514{
3515 tDot11fAddTSRequest addts = {{0}};
3516 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3517 tANI_U8 j;
3518 tANI_U16 i;
3519 tANI_U32 status;
3520
3521 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3522 {
3523 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3524 "with an Action of %d; this is not "
3525 "supported & is probably an error."),
3526 *( pFrame + 1 ) );
3527 return eSIR_FAILURE;
3528 }
3529
3530 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303531 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003532
3533 // delegate to the framesc-generated code,
3534 switch ( *pFrame )
3535 {
3536 case SIR_MAC_ACTION_QOS_MGMT:
3537 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3538 break;
3539 case SIR_MAC_ACTION_WME:
3540 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3541 break;
3542 default:
3543 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3544 "with a Category of %d; this is not"
3545 " supported & is probably an error."),
3546 *pFrame );
3547 return eSIR_FAILURE;
3548 }
3549
3550 if ( DOT11F_FAILED( status ) )
3551 {
3552 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3553 "rame (0x%08x, %d bytes):\n"),
3554 status, nFrame);
3555 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3556 return eSIR_FAILURE;
3557 }
3558 else if ( DOT11F_WARNED( status ) )
3559 {
3560 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3561 "g an Add TS Request frame (0x%08x,"
3562 "%d bytes):\n"),
3563 status, nFrame );
3564 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3565 }
3566
3567 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3568 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3569 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3570 {
3571 pAddTs->dialogToken = addts.DialogToken.token;
3572
3573 if ( addts.TSPEC.present )
3574 {
3575 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3576 }
3577 else
3578 {
3579 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3580 return eSIR_FAILURE;
3581 }
3582
3583 if ( addts.num_TCLAS )
3584 {
3585 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3586
3587 for ( i = 0U; i < addts.num_TCLAS; ++i )
3588 {
3589 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3590 {
3591 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3592 return eSIR_FAILURE;
3593 }
3594 }
3595 }
3596
3597 if ( addts.TCLASSPROC.present )
3598 {
3599 pAddTs->tclasProcPresent = 1;
3600 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3601 }
3602
3603 if ( addts.WMMTSPEC.present )
3604 {
3605 pAddTs->wsmTspecPresent = 1;
3606 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3607 }
3608
3609 if ( addts.num_WMMTCLAS )
3610 {
3611 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3612 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3613
3614 for ( i = pAddTs->numTclas; i < j; ++i )
3615 {
3616 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3617 {
3618 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3619 return eSIR_FAILURE;
3620 }
3621 }
3622 }
3623
3624 if ( addts.WMMTCLASPROC.present )
3625 {
3626 pAddTs->tclasProcPresent = 1;
3627 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3628 }
3629
3630 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3631 {
3632 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3633 pAddTs->numTclas );
3634 return eSIR_FAILURE;
3635 }
3636 }
3637 else
3638 {
3639 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3640
3641 if ( wmmaddts.WMMTSPEC.present )
3642 {
3643 pAddTs->wmeTspecPresent = 1;
3644 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3645 }
3646 else
3647 {
3648 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3649 return eSIR_FAILURE;
3650 }
3651 }
3652
3653 return eSIR_SUCCESS;
3654
3655} // End sirConvertAddtsReq2Struct.
3656
3657tSirRetStatus
3658sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3659 tANI_U8 *pFrame,
3660 tANI_U32 nFrame,
3661 tSirAddtsRspInfo *pAddTs)
3662{
3663 tDot11fAddTSResponse addts = {{0}};
3664 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3665 tANI_U8 j;
3666 tANI_U16 i;
3667 tANI_U32 status;
3668
3669 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3670 {
3671 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3672 "with an Action of %d; this is not "
3673 "supported & is probably an error."),
3674 *( pFrame + 1 ) );
3675 return eSIR_FAILURE;
3676 }
3677
3678 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303679 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3680 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3681 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003682
3683
3684 // delegate to the framesc-generated code,
3685 switch ( *pFrame )
3686 {
3687 case SIR_MAC_ACTION_QOS_MGMT:
3688 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3689 break;
3690 case SIR_MAC_ACTION_WME:
3691 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3692 break;
3693 default:
3694 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3695 "with a Category of %d; this is not"
3696 " supported & is probably an error."),
3697 *pFrame );
3698 return eSIR_FAILURE;
3699 }
3700
3701 if ( DOT11F_FAILED( status ) )
3702 {
3703 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
3704 "rame (0x%08x, %d bytes):\n"),
3705 status, nFrame);
3706 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3707 return eSIR_FAILURE;
3708 }
3709 else if ( DOT11F_WARNED( status ) )
3710 {
3711 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3712 "g an Add TS Response frame (0x%08x,"
3713 "%d bytes):\n"),
3714 status, nFrame );
3715 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3716 }
3717
3718 // & "transliterate" from a 'tDot11fAddTSResponse' or a
3719 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
3720 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3721 {
3722 pAddTs->dialogToken = addts.DialogToken.token;
3723 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
3724
3725 if ( addts.TSDelay.present )
3726 {
3727 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
3728 }
3729
3730 // TS Delay is present iff status indicates its presence
3731 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
3732 {
3733 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
3734 }
3735
3736 if ( addts.TSPEC.present )
3737 {
3738 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3739 }
3740 else
3741 {
3742 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
3743 return eSIR_FAILURE;
3744 }
3745
3746 if ( addts.num_TCLAS )
3747 {
3748 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3749
3750 for ( i = 0U; i < addts.num_TCLAS; ++i )
3751 {
3752 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3753 {
3754 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3755 return eSIR_FAILURE;
3756 }
3757 }
3758 }
3759
3760 if ( addts.TCLASSPROC.present )
3761 {
3762 pAddTs->tclasProcPresent = 1;
3763 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3764 }
3765#ifdef FEATURE_WLAN_CCX
3766 if(addts.CCXTrafStrmMet.present)
3767 {
3768 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303769 vos_mem_copy(&pAddTs->tsmIE.tsid,
Jeff Johnson295189b2012-06-20 16:38:30 -07003770 &addts.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
3771 }
3772#endif
3773 if ( addts.Schedule.present )
3774 {
3775 pAddTs->schedulePresent = 1;
3776 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
3777 }
3778
3779 if ( addts.WMMSchedule.present )
3780 {
3781 pAddTs->schedulePresent = 1;
3782 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
3783 }
3784
3785 if ( addts.WMMTSPEC.present )
3786 {
3787 pAddTs->wsmTspecPresent = 1;
3788 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3789 }
3790
3791 if ( addts.num_WMMTCLAS )
3792 {
3793 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3794 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3795
3796 for ( i = pAddTs->numTclas; i < j; ++i )
3797 {
3798 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3799 {
3800 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3801 return eSIR_FAILURE;
3802 }
3803 }
3804 }
3805
3806 if ( addts.WMMTCLASPROC.present )
3807 {
3808 pAddTs->tclasProcPresent = 1;
3809 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3810 }
3811
3812 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3813 {
3814 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3815 pAddTs->numTclas );
3816 return eSIR_FAILURE;
3817 }
3818 }
3819 else
3820 {
3821 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3822 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
3823
3824 if ( wmmaddts.WMMTSPEC.present )
3825 {
3826 pAddTs->wmeTspecPresent = 1;
3827 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3828 }
3829 else
3830 {
3831 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3832 return eSIR_FAILURE;
3833 }
3834
3835#ifdef FEATURE_WLAN_CCX
3836 if(wmmaddts.CCXTrafStrmMet.present)
3837 {
3838 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303839 vos_mem_copy(&pAddTs->tsmIE.tsid,
Jeff Johnson295189b2012-06-20 16:38:30 -07003840 &wmmaddts.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
3841 }
3842#endif
3843
3844 }
3845
3846 return eSIR_SUCCESS;
3847
3848} // End sirConvertAddtsRsp2Struct.
3849
3850tSirRetStatus
3851sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
3852 tANI_U8 *pFrame,
3853 tANI_U32 nFrame,
3854 tSirDeltsReqInfo *pDelTs)
3855{
3856 tDot11fDelTS delts = {{0}};
3857 tDot11fWMMDelTS wmmdelts = {{0}};
3858 tANI_U32 status;
3859
3860 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
3861 {
3862 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3863 "with an Action of %d; this is not "
3864 "supported & is probably an error."),
3865 *( pFrame + 1 ) );
3866 return eSIR_FAILURE;
3867 }
3868
3869 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303870 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003871
3872 // delegate to the framesc-generated code,
3873 switch ( *pFrame )
3874 {
3875 case SIR_MAC_ACTION_QOS_MGMT:
3876 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
3877 break;
3878 case SIR_MAC_ACTION_WME:
3879 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
3880 break;
3881 default:
3882 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3883 "with a Category of %d; this is not"
3884 " supported & is probably an error."),
3885 *pFrame );
3886 return eSIR_FAILURE;
3887 }
3888
3889 if ( DOT11F_FAILED( status ) )
3890 {
3891 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
3892 "rame (0x%08x, %d bytes):\n"),
3893 status, nFrame);
3894 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3895 return eSIR_FAILURE;
3896 }
3897 else if ( DOT11F_WARNED( status ) )
3898 {
3899 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
3900 "g an Del TS Request frame (0x%08x,"
3901 "%d bytes):\n"),
3902 status, nFrame );
3903 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3904 }
3905
3906 // & "transliterate" from a 'tDot11fDelTSResponse' or a
3907 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
3908 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3909 {
3910 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
3911 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
3912 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
3913 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
3914 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
3915 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
3916 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
3917 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
3918
3919 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
3920 }
3921 else
3922 {
3923 if ( wmmdelts.WMMTSPEC.present )
3924 {
3925 pDelTs->wmeTspecPresent = 1;
3926 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
3927 }
3928 else
3929 {
3930 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3931 return eSIR_FAILURE;
3932 }
3933 }
3934
3935 return eSIR_SUCCESS;
3936
3937} // End sirConvertDeltsReq2Struct.
3938
3939
3940#ifdef ANI_SUPPORT_11H
3941tSirRetStatus
3942sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
3943 tANI_U8 *pFrame,
3944 tpSirMacTpcReqActionFrame pTpcReqFrame,
3945 tANI_U32 nFrame)
3946{
3947 tDot11fTPCRequest req;
3948 tANI_U32 status;
3949
3950 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303951 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003952
3953 // delegate to the framesc-generated code,
3954 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
3955 if ( DOT11F_FAILED( status ) )
3956 {
3957 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
3958 status, nFrame);
3959 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3960 return eSIR_FAILURE;
3961 }
3962 else if ( DOT11F_WARNED( status ) )
3963 {
3964 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
3965 status, nFrame );
3966 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3967 }
3968
3969 // & "transliterate" from a 'tDot11fTPCRequest' to a
3970 // 'tSirMacTpcReqActionFrame'...
3971 pTpcReqFrame->actionHeader.category = req.Category.category;
3972 pTpcReqFrame->actionHeader.actionID = req.Action.action;
3973 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
3974 if ( req.TPCRequest.present )
3975 {
3976 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
3977 pTpcReqFrame->length = 0;
3978 }
3979 else
3980 {
3981 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
3982 return eSIR_FAILURE;
3983 }
3984
3985 return eSIR_SUCCESS;
3986
3987} // End sirConvertTpcReqFrame2Struct.
3988
3989
3990tSirRetStatus
3991sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
3992 tANI_U8 *pFrame,
3993 tpSirMacMeasReqActionFrame pMeasReqFrame,
3994 tANI_U32 nFrame)
3995{
3996 tDot11fMeasurementRequest mr;
3997 tANI_U32 status;
3998
3999 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304000 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004001
4002 // delegate to the framesc-generated code,
4003 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4004 if ( DOT11F_FAILED( status ) )
4005 {
4006 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4007 status, nFrame);
4008 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4009 return eSIR_FAILURE;
4010 }
4011 else if ( DOT11F_WARNED( status ) )
4012 {
4013 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4014 status, nFrame );
4015 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4016 }
4017
4018 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4019 // 'tpSirMacMeasReqActionFrame'...
4020 pMeasReqFrame->actionHeader.category = mr.Category.category;
4021 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4022 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4023
4024 if ( 0 == mr.num_MeasurementRequest )
4025 {
4026 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4027 return eSIR_FAILURE;
4028 }
4029 else if ( 1 < mr.num_MeasurementRequest )
4030 {
4031 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4032 }
4033
4034 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4035 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4036 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4037 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4038 ( mr.MeasurementRequest[0].enable << 2 ) |
4039 ( mr.MeasurementRequest[0].request << 1 ) |
4040 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4041 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4042
4043 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4044
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304045 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004046 mr.MeasurementRequest[0].meas_start_time, 8 );
4047
4048 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4049
4050 return eSIR_SUCCESS;
4051
4052} // End sirConvertMeasReqFrame2Struct.
4053#endif
4054
4055
4056void
4057PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4058 tDot11fIETSPEC *pDot11f)
4059{
4060 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4061 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4062 pDot11f->direction = pOld->tsinfo.traffic.direction;
4063 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4064 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4065 pDot11f->psb = pOld->tsinfo.traffic.psb;
4066 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4067 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4068 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4069 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4070 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4071 */
4072 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4073 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4074 pDot11f->max_msdu_size = pOld->maxMsduSz;
4075 pDot11f->min_service_int = pOld->minSvcInterval;
4076 pDot11f->max_service_int = pOld->maxSvcInterval;
4077 pDot11f->inactivity_int = pOld->inactInterval;
4078 pDot11f->suspension_int = pOld->suspendInterval;
4079 pDot11f->service_start_time = pOld->svcStartTime;
4080 pDot11f->min_data_rate = pOld->minDataRate;
4081 pDot11f->mean_data_rate = pOld->meanDataRate;
4082 pDot11f->peak_data_rate = pOld->peakDataRate;
4083 pDot11f->burst_size = pOld->maxBurstSz;
4084 pDot11f->delay_bound = pOld->delayBound;
4085 pDot11f->min_phy_rate = pOld->minPhyRate;
4086 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4087 pDot11f->medium_time = pOld->mediumTime;
4088
4089 pDot11f->present = 1;
4090
4091} // End PopulateDot11fTSPEC.
4092
4093void
4094PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4095 tDot11fIEWMMTSPEC *pDot11f)
4096{
4097 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4098 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4099 pDot11f->direction = pOld->tsinfo.traffic.direction;
4100 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4101 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4102 pDot11f->psb = pOld->tsinfo.traffic.psb;
4103 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4104 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4105 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4106 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4107 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4108 */
4109 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4110 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4111 pDot11f->max_msdu_size = pOld->maxMsduSz;
4112 pDot11f->min_service_int = pOld->minSvcInterval;
4113 pDot11f->max_service_int = pOld->maxSvcInterval;
4114 pDot11f->inactivity_int = pOld->inactInterval;
4115 pDot11f->suspension_int = pOld->suspendInterval;
4116 pDot11f->service_start_time = pOld->svcStartTime;
4117 pDot11f->min_data_rate = pOld->minDataRate;
4118 pDot11f->mean_data_rate = pOld->meanDataRate;
4119 pDot11f->peak_data_rate = pOld->peakDataRate;
4120 pDot11f->burst_size = pOld->maxBurstSz;
4121 pDot11f->delay_bound = pOld->delayBound;
4122 pDot11f->min_phy_rate = pOld->minPhyRate;
4123 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4124 pDot11f->medium_time = pOld->mediumTime;
4125
4126 pDot11f->version = 1;
4127 pDot11f->present = 1;
4128
4129} // End PopulateDot11fWMMTSPEC.
4130
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004131#if defined(FEATURE_WLAN_CCX)
4132
4133// Fill the CCX version currently supported
4134void PopulateDot11fCCXVersion(tDot11fIECCXVersion *pCCXVersion)
4135{
4136 pCCXVersion->present = 1;
4137 pCCXVersion->version = CCX_VERSION_SUPPORTED;
4138}
4139
4140// Fill the CCX ie for the station.
4141// The State is Normal (1)
4142// The MBSSID for station is set to 0.
4143void PopulateDot11fCCXRadMgmtCap(tDot11fIECCXRadMgmtCap *pCCXRadMgmtCap)
4144{
4145 pCCXRadMgmtCap->present = 1;
4146 pCCXRadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4147 pCCXRadMgmtCap->mbssid_mask = 0;
4148 pCCXRadMgmtCap->reserved = 0;
4149}
4150
4151tSirRetStatus PopulateDot11fCCXCckmOpaque( tpAniSirGlobal pMac,
4152 tpSirCCKMie pCCKMie,
4153 tDot11fIECCXCckmOpaque *pDot11f )
4154{
4155 int idx;
4156
4157 if ( pCCKMie->length )
4158 {
4159 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_CCXCCKMOPAQUE ) ) )
4160 {
4161 pDot11f->present = 1;
4162 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004163 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004164 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4165 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4166 }
4167 }
4168
4169 return eSIR_SUCCESS;
4170
4171} // End PopulateDot11fCCXCckmOpaque.
4172
Jeff Johnson295189b2012-06-20 16:38:30 -07004173void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
4174 tSirMacCCXTSRSIE *pOld,
4175 tDot11fIECCXTrafStrmRateSet *pDot11f,
4176 tANI_U8 rate_length)
4177{
4178 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304179 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 pDot11f->num_tsrates = rate_length;
4181 pDot11f->present = 1;
4182}
4183#endif
4184
4185
4186tSirRetStatus
4187PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4188 tSirTclasInfo *pOld,
4189 tDot11fIETCLAS *pDot11f)
4190{
4191 pDot11f->user_priority = pOld->tclas.userPrio;
4192 pDot11f->classifier_type = pOld->tclas.classifierType;
4193 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4194
4195 switch ( pDot11f->classifier_type )
4196 {
4197 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304198 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4199 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4200 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4201 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004202 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4203 break;
4204 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4205 pDot11f->info.IpParams.version = pOld->version;
4206 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4207 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304208 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
4209 IpV4Params.source,
4210 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
4211 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
4212 IpV4Params.dest,
4213 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 pDot11f->info.IpParams.params.IpV4Params.src_port =
4215 pOld->tclasParams.ipv4.srcPort;
4216 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4217 pOld->tclasParams.ipv4.dstPort;
4218 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4219 pOld->tclasParams.ipv4.dscp;
4220 pDot11f->info.IpParams.params.IpV4Params.proto =
4221 pOld->tclasParams.ipv4.protocol;
4222 pDot11f->info.IpParams.params.IpV4Params.reserved =
4223 pOld->tclasParams.ipv4.rsvd;
4224 }
4225 else
4226 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304227 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 IpV6Params.source,
4229 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304230 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 IpV6Params.dest,
4232 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4233 pDot11f->info.IpParams.params.IpV6Params.src_port =
4234 pOld->tclasParams.ipv6.srcPort;
4235 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4236 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304237 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004238 IpV6Params.flow_label,
4239 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4240 }
4241 break;
4242 case SIR_MAC_TCLASTYPE_8021DQ:
4243 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4244 break;
4245 default:
4246 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4247 pDot11f->classifier_type );
4248 return eSIR_FAILURE;
4249 }
4250
4251 pDot11f->present = 1;
4252
4253 return eSIR_SUCCESS;
4254
4255} // End PopulateDot11fTCLAS.
4256
4257tSirRetStatus
4258PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4259 tSirTclasInfo *pOld,
4260 tDot11fIEWMMTCLAS *pDot11f)
4261{
4262 pDot11f->version = 1;
4263 pDot11f->user_priority = pOld->tclas.userPrio;
4264 pDot11f->classifier_type = pOld->tclas.classifierType;
4265 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4266
4267 switch ( pDot11f->classifier_type )
4268 {
4269 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304270 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304272 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004273 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4274 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4275 break;
4276 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4277 pDot11f->info.IpParams.version = pOld->version;
4278 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4279 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304280 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 IpV4Params.source,
4282 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304283 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 IpV4Params.dest,
4285 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4286 pDot11f->info.IpParams.params.IpV4Params.src_port =
4287 pOld->tclasParams.ipv4.srcPort;
4288 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4289 pOld->tclasParams.ipv4.dstPort;
4290 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4291 pOld->tclasParams.ipv4.dscp;
4292 pDot11f->info.IpParams.params.IpV4Params.proto =
4293 pOld->tclasParams.ipv4.protocol;
4294 pDot11f->info.IpParams.params.IpV4Params.reserved =
4295 pOld->tclasParams.ipv4.rsvd;
4296 }
4297 else
4298 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304299 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 IpV6Params.source,
4301 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304302 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004303 IpV6Params.dest,
4304 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4305 pDot11f->info.IpParams.params.IpV6Params.src_port =
4306 pOld->tclasParams.ipv6.srcPort;
4307 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4308 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304309 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 IpV6Params.flow_label,
4311 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4312 }
4313 break;
4314 case SIR_MAC_TCLASTYPE_8021DQ:
4315 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4316 break;
4317 default:
4318 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4319 pDot11f->classifier_type );
4320 return eSIR_FAILURE;
4321 }
4322
4323 pDot11f->present = 1;
4324
4325 return eSIR_SUCCESS;
4326
4327} // End PopulateDot11fWMMTCLAS.
4328
Jeff Johnson295189b2012-06-20 16:38:30 -07004329
4330tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4331 tDot11fIEWscBeacon *pDot11f)
4332{
4333
4334 tANI_U32 wpsState;
4335
4336 pDot11f->Version.present = 1;
4337 pDot11f->Version.major = 0x01;
4338 pDot11f->Version.minor = 0x00;
4339
4340 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4341 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4342
4343 pDot11f->WPSState.present = 1;
4344 pDot11f->WPSState.state = (tANI_U8) wpsState;
4345
4346 pDot11f->APSetupLocked.present = 0;
4347
4348 pDot11f->SelectedRegistrar.present = 0;
4349
4350 pDot11f->DevicePasswordID.present = 0;
4351
4352 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4353
4354 pDot11f->UUID_E.present = 0;
4355
4356 pDot11f->RFBands.present = 0;
4357
4358 pDot11f->present = 1;
4359 return eSIR_SUCCESS;
4360}
4361
4362tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4363 tDot11fIEWscBeacon *pDot11f)
4364{
4365 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4366 tANI_U32 devicepasswdId;
4367
4368
4369 pDot11f->APSetupLocked.present = 1;
4370 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4371
4372 pDot11f->SelectedRegistrar.present = 1;
4373 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4374
4375 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4376 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4377
4378 pDot11f->DevicePasswordID.present = 1;
4379 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4380
4381 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4382 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4383
4384 // UUID_E and RF Bands are applicable only for dual band AP
4385
4386 return eSIR_SUCCESS;
4387}
4388
4389tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4390 tDot11fIEWscBeacon *pDot11f)
4391{
4392 pDot11f->APSetupLocked.present = 0;
4393 pDot11f->SelectedRegistrar.present = 0;
4394 pDot11f->DevicePasswordID.present = 0;
4395 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4396
4397 return eSIR_SUCCESS;
4398}
Jeff Johnson295189b2012-06-20 16:38:30 -07004399tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4400{
4401
4402 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4403
4404 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4405
4406
4407 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4408 {
4409 pDot11f->present = 1;
4410 pDot11f->Version.present = 1;
4411 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4412 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4413 }
4414 else
4415 {
4416 pDot11f->present = 0;
4417 pDot11f->Version.present = 0;
4418 }
4419
4420 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4421 {
4422
4423 pDot11f->WPSState.present = 1;
4424 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4425 }
4426 else
4427 pDot11f->WPSState.present = 0;
4428
4429 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4430 {
4431 pDot11f->APSetupLocked.present = 1;
4432 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4433 }
4434 else
4435 pDot11f->APSetupLocked.present = 0;
4436
4437 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4438 {
4439 pDot11f->SelectedRegistrar.present = 1;
4440 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4441 }
4442 else
4443 pDot11f->SelectedRegistrar.present = 0;
4444
4445 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4446 {
4447 pDot11f->DevicePasswordID.present = 1;
4448 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4449 }
4450 else
4451 pDot11f->DevicePasswordID.present = 0;
4452
4453 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4454 {
4455 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4456 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4457 }
4458 else
4459 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4460
4461 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4462 {
4463 pDot11f->ResponseType.present = 1;
4464 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4465 }
4466 else
4467 pDot11f->ResponseType.present = 0;
4468
4469 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4470 {
4471 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304472 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004473 }
4474 else
4475 pDot11f->UUID_E.present = 0;
4476
4477 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4478 {
4479 pDot11f->Manufacturer.present = 1;
4480 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304481 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4482 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004483 }
4484 else
4485 pDot11f->Manufacturer.present = 0;
4486
4487 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4488 {
4489 pDot11f->ModelName.present = 1;
4490 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304491 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4492 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 }
4494 else
4495 pDot11f->ModelName.present = 0;
4496
4497 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4498 {
4499 pDot11f->ModelNumber.present = 1;
4500 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304501 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4502 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 }
4504 else
4505 pDot11f->ModelNumber.present = 0;
4506
4507 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4508 {
4509 pDot11f->SerialNumber.present = 1;
4510 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304511 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4512 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004513 }
4514 else
4515 pDot11f->SerialNumber.present = 0;
4516
4517 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4518 {
4519 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304520 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4521 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4523 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4524 }
4525 else
4526 pDot11f->PrimaryDeviceType.present = 0;
4527
4528 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4529 {
4530 pDot11f->DeviceName.present = 1;
4531 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304532 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4533 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004534 }
4535 else
4536 pDot11f->DeviceName.present = 0;
4537
4538 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4539 {
4540 pDot11f->ConfigMethods.present = 1;
4541 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4542 }
4543 else
4544 pDot11f->ConfigMethods.present = 0;
4545
4546
4547 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4548 {
4549 pDot11f->RFBands.present = 1;
4550 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4551 }
4552 else
4553 pDot11f->RFBands.present = 0;
4554
4555 return eSIR_SUCCESS;
4556}
4557tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4558{
4559 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4560
4561 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4562
4563 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4564 {
4565 pDot11f->present = 1;
4566 pDot11f->Version.present = 1;
4567 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4568 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4569 }
4570 else
4571 {
4572 pDot11f->present = 0;
4573 pDot11f->Version.present = 0;
4574 }
4575
4576 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4577 {
4578 pDot11f->ResponseType.present = 1;
4579 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4580 }
4581 else
4582 pDot11f->ResponseType.present = 0;
4583
4584 return eSIR_SUCCESS;
4585}
4586
4587tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4588{
4589
4590 tSirWPSBeaconIE *pSirWPSBeaconIE;
4591
4592 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4593
4594
4595 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4596 {
4597 pDot11f->present = 1;
4598 pDot11f->Version.present = 1;
4599 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4600 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4601 }
4602 else
4603 {
4604 pDot11f->present = 0;
4605 pDot11f->Version.present = 0;
4606 }
4607
4608 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4609 {
4610
4611 pDot11f->WPSState.present = 1;
4612 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4613 }
4614 else
4615 pDot11f->WPSState.present = 0;
4616
4617 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4618 {
4619 pDot11f->APSetupLocked.present = 1;
4620 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4621 }
4622 else
4623 pDot11f->APSetupLocked.present = 0;
4624
4625 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4626 {
4627 pDot11f->SelectedRegistrar.present = 1;
4628 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4629 }
4630 else
4631 pDot11f->SelectedRegistrar.present = 0;
4632
4633 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4634 {
4635 pDot11f->DevicePasswordID.present = 1;
4636 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4637 }
4638 else
4639 pDot11f->DevicePasswordID.present = 0;
4640
4641 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4642 {
4643 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4644 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4645 }
4646 else
4647 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4648
4649 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4650 {
4651 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304652 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 }
4654 else
4655 pDot11f->UUID_E.present = 0;
4656
4657
4658 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4659 {
4660 pDot11f->RFBands.present = 1;
4661 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4662 }
4663 else
4664 pDot11f->RFBands.present = 0;
4665
4666 return eSIR_SUCCESS;
4667}
Jeff Johnson295189b2012-06-20 16:38:30 -07004668tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4669 tDot11fIEWscProbeRes *pDot11f)
4670{
4671 tANI_U32 cfgMethods;
4672 tANI_U32 cfgStrLen;
4673 tANI_U32 val;
4674 tANI_U32 wpsVersion, wpsState;
4675
4676
4677 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
4678 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
4679
4680 pDot11f->Version.present = 1;
4681 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
4682 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
4683
4684 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4685 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4686
4687 pDot11f->WPSState.present = 1;
4688 pDot11f->WPSState.state = (tANI_U8) wpsState;
4689
4690 pDot11f->APSetupLocked.present = 0;
4691
4692 pDot11f->SelectedRegistrar.present = 0;
4693
4694 pDot11f->DevicePasswordID.present = 0;
4695
4696 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4697
4698 pDot11f->ResponseType.present = 1;
4699 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
4700 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
4701 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4702 }
4703 else{
4704 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4705 }
4706
4707 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
4708 pDot11f->UUID_E.present = 1;
4709 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
4710 if (wlan_cfgGetStr(pMac,
4711 WNI_CFG_WPS_UUID,
4712 pDot11f->UUID_E.uuid,
4713 &cfgStrLen) != eSIR_SUCCESS)
4714 {
4715 *(pDot11f->UUID_E.uuid) = '\0';
4716 }
4717
4718 pDot11f->Manufacturer.present = 1;
4719 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
4720 if (wlan_cfgGetStr(pMac,
4721 WNI_CFG_MANUFACTURER_NAME,
4722 pDot11f->Manufacturer.name,
4723 &cfgStrLen) != eSIR_SUCCESS)
4724 {
4725 pDot11f->Manufacturer.num_name = 0;
4726 *(pDot11f->Manufacturer.name) = '\0';
4727 }
4728 else
4729 {
4730 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
4731 pDot11f->Manufacturer.name[cfgStrLen] = '\0';
4732 }
4733
4734 pDot11f->ModelName.present = 1;
4735 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
4736 if (wlan_cfgGetStr(pMac,
4737 WNI_CFG_MODEL_NAME,
4738 pDot11f->ModelName.text,
4739 &cfgStrLen) != eSIR_SUCCESS)
4740 {
4741 pDot11f->ModelName.num_text = 0;
4742 *(pDot11f->ModelName.text) = '\0';
4743 }
4744 else
4745 {
4746 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4747 pDot11f->ModelName.text[cfgStrLen] = '\0';
4748 }
4749
4750 pDot11f->ModelNumber.present = 1;
4751 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
4752 if (wlan_cfgGetStr(pMac,
4753 WNI_CFG_MODEL_NUMBER,
4754 pDot11f->ModelNumber.text,
4755 &cfgStrLen) != eSIR_SUCCESS)
4756 {
4757 pDot11f->ModelNumber.num_text = 0;
4758 *(pDot11f->ModelNumber.text) = '\0';
4759 }
4760 else
4761 {
4762 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4763 pDot11f->ModelNumber.text[cfgStrLen] = '\0';
4764 }
4765
4766 pDot11f->SerialNumber.present = 1;
4767 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
4768 if (wlan_cfgGetStr(pMac,
4769 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
4770 pDot11f->SerialNumber.text,
4771 &cfgStrLen) != eSIR_SUCCESS)
4772 {
4773 pDot11f->SerialNumber.num_text = 0;
4774 *(pDot11f->SerialNumber.text) = '\0';
4775 }
4776 else
4777 {
4778 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4779 pDot11f->SerialNumber.text[cfgStrLen] = '\0';
4780 }
4781
4782 pDot11f->PrimaryDeviceType.present = 1;
4783
4784 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
4785 {
4786 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
4787 }
4788 else
4789 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
4790
4791 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
4792 {
4793 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
4794 }
4795 else
4796 {
4797 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
4798 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
4799 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
4800 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
4801 }
4802
4803 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
4804 {
4805 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
4806 }
4807 else
4808 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
4809
4810 pDot11f->DeviceName.present = 1;
4811 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
4812 if (wlan_cfgGetStr(pMac,
4813 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
4814 pDot11f->DeviceName.text,
4815 &cfgStrLen) != eSIR_SUCCESS)
4816 {
4817 pDot11f->DeviceName.num_text = 0;
4818 *(pDot11f->DeviceName.text) = '\0';
4819 }
4820 else
4821 {
4822 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4823 pDot11f->DeviceName.text[cfgStrLen] = '\0';
4824 }
4825
4826 if (wlan_cfgGetInt(pMac,
4827 WNI_CFG_WPS_CFG_METHOD,
4828 &cfgMethods) != eSIR_SUCCESS)
4829 {
4830 pDot11f->ConfigMethods.present = 0;
4831 pDot11f->ConfigMethods.methods = 0;
4832 }
4833 else
4834 {
4835 pDot11f->ConfigMethods.present = 1;
4836 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
4837 }
4838
4839 pDot11f->RFBands.present = 0;
4840
4841 pDot11f->present = 1;
4842 return eSIR_SUCCESS;
4843}
4844
4845tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4846 tDot11fIEWscProbeRes *pDot11f)
4847{
4848 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4849 tANI_U32 devicepasswdId;
4850
4851 pDot11f->APSetupLocked.present = 1;
4852 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4853
4854 pDot11f->SelectedRegistrar.present = 1;
4855 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4856
4857 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4858 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4859
4860 pDot11f->DevicePasswordID.present = 1;
4861 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4862
4863 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4864 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4865
4866 // UUID_E and RF Bands are applicable only for dual band AP
4867
4868 return eSIR_SUCCESS;
4869}
4870
4871tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4872 tDot11fIEWscProbeRes *pDot11f)
4873{
4874 pDot11f->APSetupLocked.present = 0;
4875 pDot11f->SelectedRegistrar.present = 0;
4876 pDot11f->DevicePasswordID.present = 0;
4877 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4878
4879 return eSIR_SUCCESS;
4880}
4881
4882tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
4883 tDot11fIEWscAssocRes *pDot11f,
4884 tpSirAssocReq pRcvdAssocReq)
4885{
4886 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
4887 tANI_U8 *wscIe;
4888
4889
4890 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
4891 if(wscIe != NULL)
4892 {
4893 // retreive WSC IE from given AssocReq
4894 dot11fUnpackIeWscAssocReq( pMac,
4895 wscIe + 2 + 4, // EID, length, OUI
4896 wscIe[ 1 ] - 4, // length without OUI
4897 &parsedWscAssocReq );
4898 pDot11f->present = 1;
4899 // version has to be 0x10
4900 pDot11f->Version.present = 1;
4901 pDot11f->Version.major = 0x1;
4902 pDot11f->Version.minor = 0x0;
4903
4904 pDot11f->ResponseType.present = 1;
4905
4906 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
4907 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
4908 {
4909 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4910 }
4911 else
4912 {
4913 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4914 }
4915 // Version infomration should be taken from our capability as well as peers
4916 // TODO: currently it takes from peers only
4917 if(parsedWscAssocReq.VendorExtension.present &&
4918 parsedWscAssocReq.VendorExtension.Version2.present)
4919 {
4920 pDot11f->VendorExtension.present = 1;
4921 pDot11f->VendorExtension.vendorId[0] = 0x00;
4922 pDot11f->VendorExtension.vendorId[1] = 0x37;
4923 pDot11f->VendorExtension.vendorId[2] = 0x2A;
4924 pDot11f->VendorExtension.Version2.present = 1;
4925 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
4926 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
4927 }
4928 }
4929 return eSIR_SUCCESS;
4930}
4931
Jeff Johnson295189b2012-06-20 16:38:30 -07004932tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
4933 tDot11fIEP2PAssocRes *pDot11f,
4934 tpSirAssocReq pRcvdAssocReq)
4935{
4936 tANI_U8 *p2pIe;
4937
4938 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
4939 if(p2pIe != NULL)
4940 {
4941 pDot11f->present = 1;
4942 pDot11f->P2PStatus.present = 1;
4943 pDot11f->P2PStatus.status = eSIR_SUCCESS;
4944 pDot11f->ExtendedListenTiming.present = 0;
4945 }
4946 return eSIR_SUCCESS;
4947}
Jeff Johnson295189b2012-06-20 16:38:30 -07004948
4949#if defined WLAN_FEATURE_VOWIFI
4950
4951tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
4952 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
4953{
4954 pDot11f->txPower = txPower;
4955 pDot11f->linkMargin = linkMargin;
4956 pDot11f->present = 1;
4957
4958 return eSIR_SUCCESS;
4959}
4960
4961tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
4962{
4963
4964 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
4965 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304966 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
4967 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004968 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
4969 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
4970 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
4971 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
4972 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304973 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
4975 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
4976
4977 if( pBeaconReport->numIes )
4978 {
4979 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304980 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
4981 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07004982 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
4983 }
4984
4985 return eSIR_SUCCESS;
4986
4987}
4988
4989tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
4990{
4991 tpRRMCaps pRrmCaps;
4992
4993 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
4994
4995 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
4996 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
4997 pDot11f->parallel = pRrmCaps->parallel ;
4998 pDot11f->repeated = pRrmCaps->repeated ;
4999 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5000 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5001 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5002 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5003 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5004 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5005 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5006 pDot11f->statistics = pRrmCaps->statistics ;
5007 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5008 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5009 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5010 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5011 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5012 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5013 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5014 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5015 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5016 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5017 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5018 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5019 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5020 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5021 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5022 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5023
5024 pDot11f->present = 1;
5025 return eSIR_SUCCESS;
5026}
5027#endif
5028
5029#if defined WLAN_FEATURE_VOWIFI_11R
5030void PopulateMDIE( tpAniSirGlobal pMac,
5031 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5032{
5033 pDot11f->present = 1;
5034 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5035
5036 // Plugfest fix
5037 pDot11f->overDSCap = (mdie[2] & 0x01);
5038 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5039
5040}
5041
5042void PopulateFTInfo( tpAniSirGlobal pMac,
5043 tDot11fIEFTInfo *pDot11f )
5044{
5045 pDot11f->present = 1;
5046 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5047 //All other info is zero.
5048
5049}
5050#endif
5051
5052void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5053 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5054{
5055 tANI_U8 num_supp = 0, num_ext = 0;
5056 tANI_U8 i,j;
5057
5058 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5059 {
5060 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5061 }
5062 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5063 {
5064 if( num_supp < 8 )
5065 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5066 else
5067 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5068 }
5069
5070 if( num_supp )
5071 {
5072 pSupp->num_rates = num_supp;
5073 pSupp->present = 1;
5074 }
5075 if( num_ext )
5076 {
5077 pExt->num_rates = num_ext;
5078 pExt->present = 1;
5079 }
5080}
5081// parserApi.c ends here.