blob: ed5a7268884411ba0cacb1092eb139317d702331 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
Kiet Lamaa8e15a2014-02-11 23:30:06 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file parserApi.cc contains the code for parsing
30 * 802.11 messages.
31 * Author: Pierre Vandwalle
32 * Date: 03/18/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38
39#include "sirApi.h"
40#include "aniGlobal.h"
41#include "parserApi.h"
42#include "cfgApi.h"
43#include "limUtils.h"
44#include "utilsParser.h"
45#include "limSerDesUtils.h"
46#include "schApi.h"
47#include "palApi.h"
48#include "wmmApsd.h"
49#if defined WLAN_FEATURE_VOWIFI
50#include "rrmApi.h"
51#endif
52
53
54
55////////////////////////////////////////////////////////////////////////
56void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
57{
58#ifdef WLAN_DEBUG
59 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
60 {
61 return;
62 }
63 else
64 {
65 va_list marker;
66
67 va_start( marker, pString ); /* Initialize variable arguments. */
68
69 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
70
71 va_end( marker ); /* Reset variable arguments. */
72 }
73#endif
74}
75
76void
77swapBitField16(tANI_U16 in, tANI_U16 *out)
78{
79# ifdef ANI_LITTLE_BIT_ENDIAN
80 *out = in;
81# else // Big-Endian...
82 *out = ( ( in & 0x8000 ) >> 15 ) |
83 ( ( in & 0x4000 ) >> 13 ) |
84 ( ( in & 0x2000 ) >> 11 ) |
85 ( ( in & 0x1000 ) >> 9 ) |
86 ( ( in & 0x0800 ) >> 7 ) |
87 ( ( in & 0x0400 ) >> 5 ) |
88 ( ( in & 0x0200 ) >> 3 ) |
89 ( ( in & 0x0100 ) >> 1 ) |
90 ( ( in & 0x0080 ) << 1 ) |
91 ( ( in & 0x0040 ) << 3 ) |
92 ( ( in & 0x0020 ) << 5 ) |
93 ( ( in & 0x0010 ) << 7 ) |
94 ( ( in & 0x0008 ) << 9 ) |
95 ( ( in & 0x0004 ) << 11 ) |
96 ( ( in & 0x0002 ) << 13 ) |
97 ( ( in & 0x0001 ) << 15 );
98# endif // ANI_LITTLE_BIT_ENDIAN
99}
100
101void
102swapBitField32(tANI_U32 in, tANI_U32 *out)
103{
104# ifdef ANI_LITTLE_BIT_ENDIAN
105 *out = in;
106# else // Big-Endian...
107 *out = ( ( in & 0x80000000 ) >> 31 ) |
108 ( ( in & 0x40000000 ) >> 29 ) |
109 ( ( in & 0x20000000 ) >> 27 ) |
110 ( ( in & 0x10000000 ) >> 25 ) |
111 ( ( in & 0x08000000 ) >> 23 ) |
112 ( ( in & 0x04000000 ) >> 21 ) |
113 ( ( in & 0x02000000 ) >> 19 ) |
114 ( ( in & 0x01000000 ) >> 17 ) |
115 ( ( in & 0x00800000 ) >> 15 ) |
116 ( ( in & 0x00400000 ) >> 13 ) |
117 ( ( in & 0x00200000 ) >> 11 ) |
118 ( ( in & 0x00100000 ) >> 9 ) |
119 ( ( in & 0x00080000 ) >> 7 ) |
120 ( ( in & 0x00040000 ) >> 5 ) |
121 ( ( in & 0x00020000 ) >> 3 ) |
122 ( ( in & 0x00010000 ) >> 1 ) |
123 ( ( in & 0x00008000 ) << 1 ) |
124 ( ( in & 0x00004000 ) << 3 ) |
125 ( ( in & 0x00002000 ) << 5 ) |
126 ( ( in & 0x00001000 ) << 7 ) |
127 ( ( in & 0x00000800 ) << 9 ) |
128 ( ( in & 0x00000400 ) << 11 ) |
129 ( ( in & 0x00000200 ) << 13 ) |
130 ( ( in & 0x00000100 ) << 15 ) |
131 ( ( in & 0x00000080 ) << 17 ) |
132 ( ( in & 0x00000040 ) << 19 ) |
133 ( ( in & 0x00000020 ) << 21 ) |
134 ( ( in & 0x00000010 ) << 23 ) |
135 ( ( in & 0x00000008 ) << 25 ) |
136 ( ( in & 0x00000004 ) << 27 ) |
137 ( ( in & 0x00000002 ) << 29 ) |
138 ( ( in & 0x00000001 ) << 31 );
139# endif // ANI_LITTLE_BIT_ENDIAN
140}
141
142inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
143{
144 limLog(pMac, LOG1, FL("WMM Parameters Received: \n"));
145 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
146 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
147
148 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
149 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
150
151 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
152 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
153
154 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
155 pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
156
157 return;
158}
159
160////////////////////////////////////////////////////////////////////////
161// Functions for populating "dot11f" style IEs
162
163
164// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
165// < 0, cannot find
166int FindIELocation( tpAniSirGlobal pMac,
167 tpSirRSNie pRsnIe,
168 tANI_U8 EID)
169{
170 int idx, ieLen, bytesLeft;
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800171 int ret_val = -1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700172
173 // Here's what's going on: 'rsnIe' looks like this:
174
175 // typedef struct sSirRSNie
176 // {
177 // tANI_U16 length;
178 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
179 // } tSirRSNie, *tpSirRSNie;
180
181 // other code records both the WPA & RSN IEs (including their EIDs &
182 // lengths) into the array 'rsnIEdata'. We may have:
183
184 // With WAPI support, there may be 3 IEs here
185 // It can be only WPA IE, or only RSN IE or only WAPI IE
186 // Or two or all three of them with no particular ordering
187
188 // The if/then/else statements that follow are here to figure out
189 // whether we have the WPA IE, and where it is if we *do* have it.
190
191 //Save the first IE length
192 ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
193 idx = 0;
194 bytesLeft = pRsnIe->length;
195
196 while( 1 )
197 {
198 if ( EID == pRsnIe->rsnIEdata[ idx ] )
199 {
200 //Found it
201 return (idx);
202 }
203 else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
204 // & if no more IE,
205 bytesLeft <= (tANI_U16)( ieLen ) )
206 {
207 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800208 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 }
210 bytesLeft -= ieLen;
211 ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
212 idx += ieLen;
213 }
214
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800215 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700216}
217
218
219tSirRetStatus
220PopulateDot11fCapabilities(tpAniSirGlobal pMac,
221 tDot11fFfCapabilities *pDot11f,
222 tpPESession psessionEntry)
223{
224 tANI_U16 cfg;
225 tSirRetStatus nSirStatus;
226
227 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
228 if ( eSIR_SUCCESS != nSirStatus )
229 {
230 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
231 "itfield from CFG (%d).\n"), nSirStatus );
232 return nSirStatus;
233 }
234
235#if 0
236 if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
237 {
238 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
239 }
240#endif
241 swapBitField16( cfg, ( tANI_U16* )pDot11f );
242
243 return eSIR_SUCCESS;
244} // End PopulateDot11fCapabilities.
245
246tSirRetStatus
247PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
248 tDot11fFfCapabilities *pDot11f,
249 tpDphHashNode pSta,
250 tpPESession psessionEntry)
251{
252 tANI_U16 cfg;
253 tSirRetStatus nSirStatus;
254 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
255 if ( eSIR_SUCCESS != nSirStatus )
256 {
257 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
258 "itfield from CFG (%d).\n"), nSirStatus );
259 return nSirStatus;
260 }
261
262 if ( ( NULL != pSta ) && pSta->aniPeer &&
263 PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
264 {
265 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
266 }
267
268 swapBitField16( cfg, ( tANI_U16* )pDot11f );
269
270 return eSIR_SUCCESS;
271
272} // End PopulateDot11fCapabilities2.
273
274void
275PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700276 tDot11fIEChanSwitchAnn *pDot11f,
277 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700278{
Jeff Johnsone7245742012-09-05 17:12:55 -0700279 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
280 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
281 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700282
283 pDot11f->present = 1;
284} // End PopulateDot11fChanSwitchAnn.
285
286void
287PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700288 tDot11fIEExtChanSwitchAnn *pDot11f,
289 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700290{
291 //Has to be updated on the cb state basis
292 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700293 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700294
295 pDot11f->present = 1;
296}
297
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700298#ifdef WLAN_FEATURE_11AC
299void
300PopulateDot11fWiderBWChanSwitchAnn(tpAniSirGlobal pMac,
301 tDot11fIEWiderBWChanSwitchAnn *pDot11f,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700302 tpPESession psessionEntry)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700303{
304 pDot11f->present = 1;
305 pDot11f->newChanWidth = psessionEntry->gLimWiderBWChannelSwitch.newChanWidth;
306 pDot11f->newCenterChanFreq0 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0;
307 pDot11f->newCenterChanFreq1 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1;
308}
309#endif
310
Jeff Johnson295189b2012-06-20 16:38:30 -0700311tSirRetStatus
312PopulateDot11fCountry(tpAniSirGlobal pMac,
313 tDot11fIECountry *pDot11f,
314 tpPESession psessionEntry)
315{
316 tANI_U32 len, maxlen, codelen;
317 tANI_U16 item;
318 tSirRetStatus nSirStatus;
319 tSirRFBand rfBand;
320 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
321
322 if (psessionEntry->lim11dEnabled )
323 {
324 limGetRfBand(pMac, &rfBand, psessionEntry);
325 if (rfBand == SIR_BAND_5_GHZ)
326 {
327 item = WNI_CFG_MAX_TX_POWER_5;
328 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
329 }
330 else
331 {
332 item = WNI_CFG_MAX_TX_POWER_2_4;
333 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
334 }
335
336 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
337
338 if ( 3 > len )
339 {
340 // no limit on tx power, cannot include the IE because at least
341 // one (channel,num,tx power) must be present
342 return eSIR_SUCCESS;
343 }
344
345 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
346 code, codelen, 3 );
347
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530348 vos_mem_copy( pDot11f->country, code, codelen );
Jeff Johnson295189b2012-06-20 16:38:30 -0700349
350 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
351 {
352 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting.\n"), len);
353 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
354 }
355
356 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530357 vos_mem_copy( ( tANI_U8* )pDot11f->triplets, temp, len );
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
359 pDot11f->present = 1;
360 }
361
362 return eSIR_SUCCESS;
363} // End PopulateDot11fCountry.
364
365tSirRetStatus
366PopulateDot11fDSParams(tpAniSirGlobal pMac,
367 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
368 tpPESession psessionEntry)
369{
Kiran Kumar Lokere27090372013-07-19 20:13:55 -0700370 if ((IS_24G_CH(channel)) || pMac->rrm.rrmPEContext.rrmEnable)
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 {
372 // .11b/g mode PHY => Include the DS Parameter Set IE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pDot11f->curr_channel = channel;
374 pDot11f->present = 1;
375 }
376
377 return eSIR_SUCCESS;
378} // End PopulateDot11fDSParams.
379
380#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
381
382
383void
384PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
385 tDot11fIEEDCAParamSet *pDot11f,
386 tpPESession psessionEntry)
387{
388
389 if ( psessionEntry->limQosEnabled )
390 {
391 //change to bitwise operation, after this is fixed in frames.
392 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
393
394 // Fill each EDCA parameter set in order: be, bk, vi, vo
395 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
396 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
397 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
398 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
399 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
400 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
401
402 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
403 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
404 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
405 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
406 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
407 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
408
409 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
410 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
411 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
412 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
413 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
414 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
415
416 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
417 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
418 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
419 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
420 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
421 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
422
423 pDot11f->present = 1;
424 }
425
426} // End PopluateDot11fEDCAParamSet.
427
428tSirRetStatus
429PopulateDot11fERPInfo(tpAniSirGlobal pMac,
430 tDot11fIEERPInfo *pDot11f,
431 tpPESession psessionEntry)
432{
433 tSirRetStatus nSirStatus;
434 tANI_U32 val;
435 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
436
437 limGetRfBand(pMac, &rfBand, psessionEntry);
438 if(SIR_BAND_2_4_GHZ == rfBand)
439 {
440 pDot11f->present = 1;
441
442 val = psessionEntry->cfgProtection.fromllb;
443 if(!val ){
444 dot11fLog( pMac, LOGE, FL("11B protection not enabled. Not populating ERP IE %d\n" ),val );
445 return eSIR_SUCCESS;
446 }
447
448 if (psessionEntry->gLim11bParams.protectionEnabled)
449 {
450 pDot11f->non_erp_present = 1;
451 pDot11f->use_prot = 1;
452 }
453
454 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
455 {
456 //FIXME_PROTECTION: we should be setting non_erp present also.
457 //check the test plan first.
458 pDot11f->use_prot = 1;
459 }
460
461
462 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
463 || !psessionEntry->beaconParams.fShortPreamble){
464 pDot11f->barker_preamble = 1;
465
466 }
467 // if protection always flag is set, advertise protection enabled
468 // regardless of legacy stations presence
469 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
470
471 if ( val )
472 {
473 pDot11f->use_prot = 1;
474 }
475 }
476
477 return eSIR_SUCCESS;
478} // End PopulateDot11fERPInfo.
479
480tSirRetStatus
481PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
482 tDot11fIEExtSuppRates *pDot11f,
483 tpPESession psessionEntry)
484{
485 tSirRetStatus nSirStatus;
486 tANI_U32 nRates = 0;
487 tANI_U8 rates[WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN];
488
489 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
490 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
491 sending mgmt frames (lile probe req) which need to go out before any session is present.
492 */
493 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
494 {
495 if(psessionEntry != NULL)
496 {
497 nRates = psessionEntry->extRateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530498 vos_mem_copy( rates, psessionEntry->extRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 nRates);
500 }
501 else
502 {
503 dot11fLog( pMac, LOGE, FL("no session context exists while"
504 " populating Operational Rate Set\n"));
505 }
506 }
507 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
508 {
509 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
510 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
511 }
512
513 if ( 0 != nRates )
514 {
515 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530516 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 pDot11f->present = 1;
518 }
519
520 return eSIR_SUCCESS;
521
522} // End PopulateDot11fExtSuppRates.
523
524tSirRetStatus
525PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
526 tANI_U8 nChannelNum,
527 tDot11fIEExtSuppRates *pDot11f)
528{
529 tANI_U32 nRates;
530 tSirRetStatus nSirStatus;
531 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
532
533 if ( 14 < nChannelNum )
534 {
535 pDot11f->present = 0;
536 return eSIR_SUCCESS;
537 }
538
539 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
540 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
541 // previously & I'm afraid to change it!
542 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
543 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
544
545 if ( 0 != nRates )
546 {
547 pDot11f->num_rates = ( tANI_U8 ) nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530548 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 pDot11f->present = 1;
550 }
551
552 return eSIR_SUCCESS;
553} // PopulateDot11fExtSuppRates1.
554
555tSirRetStatus
556PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700557 tpPESession psessionEntry,
558 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559{
560 tANI_U32 nCfgValue, nCfgLen;
561 tANI_U8 nCfgValue8;
562 tSirRetStatus nSirStatus;
563 tSirMacHTParametersInfo *pHTParametersInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 union {
565 tANI_U16 nCfgValue16;
566 tSirMacHTCapabilityInfo htCapInfo;
567 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
568 } uHTCapabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700569
570 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
571 tSirMacASCapabilityInfo *pASCapabilityInfo;
572
573 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
574
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700576
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
579 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
580 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
581 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
582 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
583 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
584 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
585 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
586 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
587 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
588 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
589 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700590
Jeff Johnsone7245742012-09-05 17:12:55 -0700591 // All sessionized entries will need the check below
592 if (psessionEntry == NULL) // Only in case of NO session
593 {
594 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
595 }
596 else
597 {
598 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
599 }
600
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
602 eHT_CHANNEL_WIDTH_20MHZ */
603 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
604 {
605 pDot11f->shortGI40MHz = 0;
606 }
607
Mohit Khanna23863762012-09-11 17:40:09 -0700608 dot11fLog(pMac, LOG2, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave, pDot11f->greenField,
610 pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
611
612
613 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
614
615 nCfgValue8 = ( tANI_U8 ) nCfgValue;
616 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
617
618 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
619 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
620 pDot11f->reserved1 = pHTParametersInfo->reserved;
621
Mohit Khanna23863762012-09-11 17:40:09 -0700622 dot11fLog( pMac, LOG2, FL( "AMPDU Param: %x\n" ), nCfgValue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700623
624
625 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
626 pDot11f->supportedMCSSet, nCfgLen,
627 SIZE_OF_SUPPORTED_MCS_SET );
628
629
630 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
631
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
633
634 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
635 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
636 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
637
Jeff Johnson295189b2012-06-20 16:38:30 -0700638
639 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
640
641 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
642 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
643 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
644 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
645 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
646 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
647 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
648 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
649 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
650 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
651 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
652 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
653 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
654 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
655 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
656 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
657
658 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
659
660 nCfgValue8 = ( tANI_U8 ) nCfgValue;
661
662 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
663 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
664 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
665 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
666 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
667 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
668 pDot11f->rxAS = pASCapabilityInfo->rxAS;
669 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
670
671 pDot11f->present = 1;
672
673 return eSIR_SUCCESS;
674
675} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700676#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700677
Jeff Johnsone7245742012-09-05 17:12:55 -0700678void limLogVHTCap(tpAniSirGlobal pMac,
679 tDot11fIEVHTCaps *pDot11f)
680{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700681#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700682 limLog(pMac, LOG1, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
683 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
684 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
685 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
686 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
687 limLog(pMac, LOG1, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
688 limLog(pMac, LOG1, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
689 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
690 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
691 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
692 limLog(pMac, LOG1, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
693 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
694 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
695 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
696 limLog(pMac, LOG1, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
697 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
698 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
699 limLog(pMac, LOG1, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
700 limLog(pMac, LOG1, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
701 limLog(pMac, LOG1, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
702 limLog(pMac, LOG1, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
703 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
704 limLog(pMac, LOG1, FL("reserve (3): %d\n"), pDot11f->reserved2);
705 limLog(pMac, LOG1, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
706 limLog(pMac, LOG1, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
707 limLog(pMac, LOG1, FL("reserv (3): %d\n"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700708#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700709}
710
711void limLogVHTOperation(tpAniSirGlobal pMac,
712 tDot11fIEVHTOperation *pDot11f)
713{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700714#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700715 limLog(pMac, LOG1, FL("chanWidth : %d\n"), pDot11f->chanWidth);
716 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
717 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
718 limLog(pMac, LOG1, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700719#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700720}
721
722void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
723 tDot11fIEVHTExtBssLoad *pDot11f)
724{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700725#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700726 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
727 limLog(pMac, LOG1, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
728 limLog(pMac, LOG1, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
729 limLog(pMac, LOG1, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
730 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700731#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700732}
733
734
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700735void limLogOperatingMode( tpAniSirGlobal pMac,
736 tDot11fIEOperatingMode *pDot11f)
737{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700738#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700739 limLog(pMac, LOG1, FL("ChanWidth : %d\n"), pDot11f->chanWidth);
740 limLog(pMac, LOG1, FL("reserved: %d\n"), pDot11f->reserved);
741 limLog(pMac, LOG1, FL("rxNSS: %d\n"), pDot11f->rxNSS);
742 limLog(pMac, LOG1, FL("rxNSS Type: %d\n"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700743#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700744}
745
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700746void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
747{
748 tANI_U8 i;
749 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
750 pQosMapSet->num_dscp_exceptions);
751 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
752 {
753 limLog(pMac, LOG1, FL("dscp value: %d"),
754 pQosMapSet->dscp_exceptions[i][0]);
755 limLog(pMac, LOG1, FL("User priority value: %d"),
756 pQosMapSet->dscp_exceptions[i][1]);
757 }
758 for (i=0;i<8;i++)
759 {
760 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
761 pQosMapSet->dscp_range[i][0]);
762 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
763 pQosMapSet->dscp_range[i][1]);
764 }
765}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700766
Jeff Johnsone7245742012-09-05 17:12:55 -0700767tSirRetStatus
768PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530769 tDot11fIEVHTCaps *pDot11f,
770 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700771{
772 tSirRetStatus nStatus;
773 tANI_U32 nCfgValue=0;
774
775 pDot11f->present = 1;
776
777 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
778 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
779
780 nCfgValue = 0;
781 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
782 nCfgValue );
783 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
784
785 nCfgValue = 0;
786 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
787 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
788
789 nCfgValue = 0;
790 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
791 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
792
793 nCfgValue = 0;
794 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
795 nCfgValue );
796 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
797
798 nCfgValue = 0;
799 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
800 pDot11f->txSTBC = (nCfgValue & 0x0001);
801
802 nCfgValue = 0;
803 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
804 pDot11f->rxSTBC = (nCfgValue & 0x0007);
805
806 nCfgValue = 0;
807 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
808 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
809
810 nCfgValue = 0;
811 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
812 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
813
814 nCfgValue = 0;
815 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
816 nCfgValue );
817 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
818
819 nCfgValue = 0;
820 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
821 nCfgValue );
822 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
823
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530824 /* muBeamformerCap should be 0 for non AP and
825 * muBeamformeeCap should be 0 for AP
826 */
827 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
828 {
829 nCfgValue = 0;
830 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
831 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
832 pDot11f->muBeamformeeCap = 0;
833 }
834 else
835 {
836 pDot11f->muBeamformerCap = 0;
837 nCfgValue = 0;
838 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
839 /* Enable only if FW and host both support the MU_MIMO feature
840 */
841 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
842 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700843
844 nCfgValue = 0;
845 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
846 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
847
848 nCfgValue = 0;
849 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
850 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
851
852 nCfgValue = 0;
853 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
854 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
855
856 nCfgValue = 0;
857 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
858 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
859
860 nCfgValue = 0;
861 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
862 pDot11f->rxAntPattern = nCfgValue;
863
864 nCfgValue = 0;
865 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
866 pDot11f->txAntPattern = nCfgValue;
867
868 pDot11f->reserved1= 0;
869
870 nCfgValue = 0;
871 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
872 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
873
874 nCfgValue = 0;
875 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
876 nCfgValue );
877 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
878
879 pDot11f->reserved2= 0;
880
881 nCfgValue = 0;
882 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
883 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
884
885 nCfgValue = 0;
886 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
887 nCfgValue );
888 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
889
890 pDot11f->reserved3= 0;
891
892 limLogVHTCap(pMac, pDot11f);
893
894 return eSIR_SUCCESS;
895
896}
897
898tSirRetStatus
899PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
900 tDot11fIEVHTOperation *pDot11f)
901{
902 tSirRetStatus nStatus;
903 tANI_U32 nCfgValue=0;
904
905 pDot11f->present = 1;
906
907 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
908 pDot11f->chanWidth = (tANI_U8)nCfgValue;
909
910 nCfgValue = 0;
911 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
912 nCfgValue );
913 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
914
915 nCfgValue = 0;
916 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
917 nCfgValue );
918 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
919
920 nCfgValue = 0;
921 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
922 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
923
924 limLogVHTOperation(pMac,pDot11f);
925
926 return eSIR_SUCCESS;
927
928}
929
930tSirRetStatus
931PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
932 tDot11fIEVHTExtBssLoad *pDot11f)
933{
934 tSirRetStatus nStatus;
935 tANI_U32 nCfgValue=0;
936
937 pDot11f->present = 1;
938
939 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
940 nCfgValue );
941 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
942
943 nCfgValue = 0;
944 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
945 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
946
947 nCfgValue=0;
948 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
949 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
950
951 nCfgValue=0;
952 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
953 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
954
955 nCfgValue=0;
956 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
957 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
958
959 limLogVHTExtBssLoad(pMac,pDot11f);
960
961 return eSIR_SUCCESS;
962}
963
Mohit Khanna4a70d262012-09-11 16:30:12 -0700964tSirRetStatus
965PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +0530966 tDot11fIEExtCap *pDot11f,
967 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700968{
Sandeep Puligilla60342762014-01-30 21:05:37 +0530969 tANI_U32 val;
970
Sandeep Puligilla60342762014-01-30 21:05:37 +0530971#ifdef WLAN_FEATURE_11AC
972 if (psessionEntry->vhtCapability)
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530973 {
Sandeep Puligilla60342762014-01-30 21:05:37 +0530974 pDot11f->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530975 pDot11f->present = 1;
976 }
Sandeep Puligilla60342762014-01-30 21:05:37 +0530977#endif
978 /* while operating in 2.4GHz only then STA need to advertize
979 the bss co-ex capability*/
980 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
981 {
982 if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_24G, &val) !=
983 eSIR_SUCCESS)
984 PELOGE(limLog(pMac, LOGE, FL("could not retrieve "
985 "24G Chan bond Length \n"));)
986 if (TRUE == val)
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530987 {
Sandeep Puligilla60342762014-01-30 21:05:37 +0530988 pDot11f->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530989 pDot11f->present = 1;
990 }
Sandeep Puligilla60342762014-01-30 21:05:37 +0530991 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700992 return eSIR_SUCCESS;
993}
994
995tSirRetStatus
996PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
997 tDot11fIEOperatingMode *pDot11f,
998 tpPESession psessionEntry)
999{
1000 pDot11f->present = 1;
1001
1002 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1003 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1004 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1005
1006 return eSIR_SUCCESS;
1007}
Jeff Johnsone7245742012-09-05 17:12:55 -07001008
1009#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001010tSirRetStatus
1011PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1012 tDot11fIEHTInfo *pDot11f,
1013 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001014{
1015 tANI_U32 nCfgValue, nCfgLen;
1016 tANI_U8 htInfoField1;
1017 tANI_U16 htInfoField2;
1018 tSirRetStatus nSirStatus;
1019 tSirMacHTInfoField1 *pHTInfoField1;
1020 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 union {
1022 tANI_U16 nCfgValue16;
1023 tSirMacHTInfoField3 infoField3;
1024 }uHTInfoField;
1025 union {
1026 tANI_U16 nCfgValue16;
1027 tSirMacHTInfoField2 infoField2;
1028 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001029
Jeff Johnson295189b2012-06-20 16:38:30 -07001030
1031 #if 0
1032 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1033 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301034
1035 if (NULL == psessionEntry)
1036 {
1037 PELOGE(limLog(pMac, LOG1,
1038 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
1039 return eSIR_FAILURE;
1040 }
1041
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1043
1044 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1045
1046 htInfoField1 = ( tANI_U8 ) nCfgValue;
1047
1048 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1050 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1051
Jeff Johnsone7245742012-09-05 17:12:55 -07001052 if (psessionEntry == NULL)
1053 {
1054 PELOGE(limLog(pMac, LOG1,
1055 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
1056 }
1057 else
1058 {
1059 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1060 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1061 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001062
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001063 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001064 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1065
1066 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1067
1068 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1069 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1070 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1071
1072 uHTInfoField2.infoField2.reserved = 0;
1073
1074 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1076
1077 htInfoField2 = ( tANI_U16 ) nCfgValue;
1078
1079 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1080 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1081 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1082 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1083
1084 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001086
1087 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1088
1089
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1091
1092
1093 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1094 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1095 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1096 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1097 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1098 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1099 uHTInfoField.infoField3.reserved = 0;
1100
Jeff Johnson295189b2012-06-20 16:38:30 -07001101
1102 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1103 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1104 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1105 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1106 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1107
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1109 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1110 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1111 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1112
Jeff Johnson295189b2012-06-20 16:38:30 -07001113
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1115 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1116 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1117 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1118 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1119 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1120 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001121 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1122 pDot11f->basicMCSSet, nCfgLen,
1123 SIZE_OF_BASIC_MCS_SET );
1124
1125 pDot11f->present = 1;
1126
1127 return eSIR_SUCCESS;
1128
1129} // End PopulateDot11fHTInfo.
1130
1131void
1132PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1133 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1134{
1135 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1136 {
1137 pDot11f->present = 1;
1138 // ATIM duration is always set to 0
1139 pDot11f->atim = 0;
1140 }
1141
1142} // End PopulateDot11fIBSSParams.
1143
1144
1145#ifdef ANI_SUPPORT_11H
1146tSirRetStatus
1147PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1148 tpSirMacMeasReqActionFrame pReq,
1149 tDot11fIEMeasurementReport *pDot11f)
1150{
1151 pDot11f->token = pReq->measReqIE.measToken;
1152 pDot11f->late = 0;
1153 pDot11f->incapable = 0;
1154 pDot11f->refused = 1;
1155 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1156
1157 pDot11f->present = 1;
1158
1159 return eSIR_SUCCESS;
1160
1161} // End PopulatedDot11fMeasurementReport0.
1162
1163tSirRetStatus
1164PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1165 tpSirMacMeasReqActionFrame pReq,
1166 tDot11fIEMeasurementReport *pDot11f)
1167{
1168 pDot11f->token = pReq->measReqIE.measToken;
1169 pDot11f->late = 0;
1170 pDot11f->incapable = 0;
1171 pDot11f->refused = 1;
1172 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1173
1174 pDot11f->present = 1;
1175
1176 return eSIR_SUCCESS;
1177
1178} // End PopulatedDot11fMeasurementReport1.
1179
1180tSirRetStatus
1181PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1182 tpSirMacMeasReqActionFrame pReq,
1183 tDot11fIEMeasurementReport *pDot11f)
1184{
1185 pDot11f->token = pReq->measReqIE.measToken;
1186 pDot11f->late = 0;
1187 pDot11f->incapable = 0;
1188 pDot11f->refused = 1;
1189 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1190
1191 pDot11f->present = 1;
1192
1193 return eSIR_SUCCESS;
1194
1195} // End PopulatedDot11fMeasurementReport2.
1196#endif
1197
1198void
1199PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1200 tDot11fIEPowerCaps *pCaps,
1201 tANI_U8 nAssocType,
1202 tpPESession psessionEntry)
1203{
1204 if (nAssocType == LIM_REASSOC)
1205 {
1206 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1207 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1208 }else
1209 {
1210 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1211 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1212
1213 }
1214
1215 pCaps->present = 1;
1216} // End PopulateDot11fPowerCaps.
1217
1218tSirRetStatus
1219PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1220 tDot11fIEPowerConstraints *pDot11f)
1221{
1222 tANI_U32 cfg;
1223 tSirRetStatus nSirStatus;
1224
1225 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1226
1227 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1228 pDot11f->present = 1;
1229
1230 return eSIR_SUCCESS;
1231} // End PopulateDot11fPowerConstraints.
1232
1233void
1234PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1235 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1236{
1237 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1238 pDot11f->reserved = 0;
1239 pDot11f->txopreq = 0;
1240 pDot11f->qreq = 0;
1241 pDot11f->qack = 0;
1242 pDot11f->present = 1;
1243} // End PopulatedDot11fQOSCaps.
1244
1245void
1246PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1247 tDot11fIEQOSCapsStation *pDot11f)
1248{
1249 tANI_U32 val = 0;
1250
1251 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1252 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1253
1254 pDot11f->more_data_ack = 0;
1255 pDot11f->max_sp_length = (tANI_U8)val;
1256 pDot11f->qack = 0;
1257
1258 if (pMac->lim.gUapsdEnable)
1259 {
1260 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1261 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1262 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1263 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1264 }
1265 pDot11f->present = 1;
1266} // End PopulatedDot11fQOSCaps.
1267
1268tSirRetStatus
1269PopulateDot11fRSN(tpAniSirGlobal pMac,
1270 tpSirRSNie pRsnIe,
1271 tDot11fIERSN *pDot11f)
1272{
1273 tANI_U32 status;
1274 int idx;
1275
1276 if ( pRsnIe->length )
1277 {
1278 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1279 {
1280 status = dot11fUnpackIeRSN( 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 PopulateDot11fRS"
1287 "N (0x%08x).\n"),
1288 status );
1289 return eSIR_FAILURE;
1290 }
1291 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1292 "PopulateDot11fRSN.\n"), status );
1293 }
1294
1295 }
1296
1297 return eSIR_SUCCESS;
1298} // End PopulateDot11fRSN.
1299
1300tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1301 tpSirRSNie pRsnIe,
1302 tDot11fIERSNOpaque *pDot11f )
1303{
1304 int idx;
1305
1306 if ( pRsnIe->length )
1307 {
1308 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1309 {
1310 pDot11f->present = 1;
1311 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301312 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 pRsnIe->rsnIEdata + idx + 2, // EID, len
1314 pRsnIe->rsnIEdata[ idx + 1 ] );
1315 }
1316 }
1317
1318 return eSIR_SUCCESS;
1319
1320} // End PopulateDot11fRSNOpaque.
1321
1322
1323
1324#if defined(FEATURE_WLAN_WAPI)
1325
1326tSirRetStatus
1327PopulateDot11fWAPI(tpAniSirGlobal pMac,
1328 tpSirRSNie pRsnIe,
1329 tDot11fIEWAPI *pDot11f)
1330 {
1331 tANI_U32 status;
1332 int idx;
1333
1334 if ( pRsnIe->length )
1335 {
1336 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1337 {
1338 status = dot11fUnpackIeWAPI( pMac,
1339 pRsnIe->rsnIEdata + idx + 2, //EID, length
1340 pRsnIe->rsnIEdata[ idx + 1 ],
1341 pDot11f );
1342 if ( DOT11F_FAILED( status ) )
1343 {
1344 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1345 status );
1346 return eSIR_FAILURE;
1347 }
1348 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1349 "PopulateDot11fWAPI.\n"), status );
1350 }
1351 }
1352
1353 return eSIR_SUCCESS;
1354} // End PopulateDot11fWAPI.
1355
1356tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1357 tpSirRSNie pRsnIe,
1358 tDot11fIEWAPIOpaque *pDot11f )
1359{
1360 int idx;
1361
1362 if ( pRsnIe->length )
1363 {
1364 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1365 {
1366 pDot11f->present = 1;
1367 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301368 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001369 pRsnIe->rsnIEdata + idx + 2, // EID, len
1370 pRsnIe->rsnIEdata[ idx + 1 ] );
1371 }
1372 }
1373
1374 return eSIR_SUCCESS;
1375
1376} // End PopulateDot11fWAPIOpaque.
1377
1378
1379#endif //defined(FEATURE_WLAN_WAPI)
1380
1381void
1382PopulateDot11fSSID(tpAniSirGlobal pMac,
1383 tSirMacSSid *pInternal,
1384 tDot11fIESSID *pDot11f)
1385{
1386 pDot11f->present = 1;
1387 pDot11f->num_ssid = pInternal->length;
1388 if ( pInternal->length )
1389 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301390 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 pInternal->length );
1392 }
1393} // End PopulateDot11fSSID.
1394
1395tSirRetStatus
1396PopulateDot11fSSID2(tpAniSirGlobal pMac,
1397 tDot11fIESSID *pDot11f)
1398{
1399 tANI_U32 nCfg;
1400 tSirRetStatus nSirStatus;
1401
1402 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1403 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1404 pDot11f->present = 1;
1405 return eSIR_SUCCESS;
1406} // End PopulateDot11fSSID2.
1407
1408void
1409PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1410 tDot11fIESchedule *pDot11f)
1411{
1412 pDot11f->aggregation = pSchedule->info.aggregation;
1413 pDot11f->tsid = pSchedule->info.tsid;
1414 pDot11f->direction = pSchedule->info.direction;
1415 pDot11f->reserved = pSchedule->info.rsvd;
1416 pDot11f->service_start_time = pSchedule->svcStartTime;
1417 pDot11f->service_interval = pSchedule->svcInterval;
1418 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1419 pDot11f->spec_interval = pSchedule->specInterval;
1420
1421 pDot11f->present = 1;
1422} // End PopulateDot11fSchedule.
1423
1424void
1425PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1426 tDot11fIESuppChannels *pDot11f,
1427 tANI_U8 nAssocType,
1428 tpPESession psessionEntry)
1429{
1430 tANI_U8 i;
1431 tANI_U8 *p;
1432
1433 if (nAssocType == LIM_REASSOC)
1434 {
1435 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1436 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1437 }else
1438 {
1439 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1440 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1441 }
1442 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1443 {
1444 pDot11f->bands[i][0] = *p;
1445 pDot11f->bands[i][1] = 1;
1446 }
1447
1448 pDot11f->present = 1;
1449
1450} // End PopulateDot11fSuppChannels.
1451
1452tSirRetStatus
1453PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1454 tANI_U8 nChannelNum,
1455 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1456{
1457 tSirRetStatus nSirStatus;
1458 tANI_U32 nRates;
1459 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1460
1461 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1462 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1463 sending mgmt frames (lile probe req) which need to go out before any session is present.
1464 */
1465 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1466 {
1467 #if 0
1468 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1469 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1470 #endif //TO SUPPORT BT-AMP
1471 if(psessionEntry != NULL)
1472 {
1473 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301474 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 nRates);
1476 }
1477 else
1478 {
1479 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1480 nRates = 0;
1481 }
1482 }
1483 else if ( 14 >= nChannelNum )
1484 {
1485 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1486 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1487 }
1488 else
1489 {
1490 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1491 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1492 }
1493
1494 if ( 0 != nRates )
1495 {
1496 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301497 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 pDot11f->present = 1;
1499 }
1500
1501 return eSIR_SUCCESS;
1502
1503} // End PopulateDot11fSuppRates.
1504
1505tSirRetStatus
1506PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1507 tDot11fIETPCReport *pDot11f,
1508 tpPESession psessionEntry)
1509{
1510 tANI_U16 staid, txPower;
1511 tSirRetStatus nSirStatus;
1512
1513 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1514 if ( eSIR_SUCCESS != nSirStatus )
1515 {
1516 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1517 "eDot11fTPCReport; limGetMgmtStaid "
1518 "returned status %d.\n"),
1519 nSirStatus );
1520 return eSIR_FAILURE;
1521 }
1522
1523 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1524 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1525 txPower = 0;
1526 pDot11f->tx_power = ( tANI_U8 )txPower;
1527 pDot11f->link_margin = 0;
1528 pDot11f->present = 1;
1529
1530 return eSIR_SUCCESS;
1531} // End PopulateDot11fTPCReport.
1532
1533
1534void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1535 tDot11fFfTSInfo *pDot11f)
1536{
1537 pDot11f->traffic_type = pInfo->traffic.trafficType;
1538 pDot11f->tsid = pInfo->traffic.tsid;
1539 pDot11f->direction = pInfo->traffic.direction;
1540 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1541 pDot11f->aggregation = pInfo->traffic.aggregation;
1542 pDot11f->psb = pInfo->traffic.psb;
1543 pDot11f->user_priority = pInfo->traffic.userPrio;
1544 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1545 pDot11f->schedule = pInfo->schedule.schedule;
1546} // End PopulatedDot11fTSInfo.
1547
1548void PopulateDot11fWMM(tpAniSirGlobal pMac,
1549 tDot11fIEWMMInfoAp *pInfo,
1550 tDot11fIEWMMParams *pParams,
1551 tDot11fIEWMMCaps *pCaps,
1552 tpPESession psessionEntry)
1553{
1554 if ( psessionEntry->limWmeEnabled )
1555 {
1556 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1557 {
1558 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1559 {
1560 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1561 }
1562 }
1563 else
1564 {
1565 {
1566 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1567 }
1568
1569 if ( psessionEntry->limWsmEnabled )
1570 {
1571 PopulateDot11fWMMCaps( pCaps );
1572 }
1573 }
1574 }
1575} // End PopulateDot11fWMM.
1576
1577void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1578{
1579 pCaps->version = SIR_MAC_OUI_VERSION_1;
1580 pCaps->qack = 0;
1581 pCaps->queue_request = 1;
1582 pCaps->txop_request = 0;
1583 pCaps->more_ack = 0;
1584 pCaps->present = 1;
1585} // End PopulateDot11fWmmCaps.
1586
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001587#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001588void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1589{
1590 tANI_U8 numTspecs = 0, idx;
1591 tTspecInfo *pTspec = NULL;
1592
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001593 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1594 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 pReassoc->num_WMMTSPEC = numTspecs;
1596 if (numTspecs) {
1597 for (idx=0; idx<numTspecs; idx++) {
1598 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301599 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 pTspec++;
1601 }
1602 }
1603}
1604#endif
1605
1606void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1607 tpPESession psessionEntry)
1608{
1609 pInfo->version = SIR_MAC_OUI_VERSION_1;
1610
1611 /* WMM Specification 3.1.3, 3.2.3
1612 * An IBSS staion shall always use its default WMM parameters.
1613 */
1614 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1615 {
1616 pInfo->param_set_count = 0;
1617 pInfo->uapsd = 0;
1618 }
1619 else
1620 {
1621 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001622 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1623 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1624 }
1625 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1627 }
1628 pInfo->present = 1;
1629}
1630
1631void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1632{
1633 tANI_U32 val = 0;
1634
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301635 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 pInfo->version = SIR_MAC_OUI_VERSION_1;
1637 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1638 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1639 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1640 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1641
1642 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1643 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 pInfo->max_sp_length = (tANI_U8)val;
1645 pInfo->present = 1;
1646}
1647
Jeff Johnson295189b2012-06-20 16:38:30 -07001648void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1649 tDot11fIEWMMParams *pParams,
1650 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001651{
1652 pParams->version = SIR_MAC_OUI_VERSION_1;
1653
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1655 pParams->qosInfo =
1656 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1657 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 pParams->qosInfo =
1659 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1660
1661 // Fill each EDCA parameter set in order: be, bk, vi, vo
1662 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1663 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1664 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1665 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1666 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1667 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1668
1669 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1670 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1671 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1672 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1673 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1674 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1675
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1677 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1678 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1680
1681
1682
1683 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1684 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1685 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1686 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1687 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1688
Jeff Johnson295189b2012-06-20 16:38:30 -07001689 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1690 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1691 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1693
1694 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1695 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1696 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1697 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1698 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1699
1700 pParams->present = 1;
1701
1702} // End PopulateDot11fWMMParams.
1703
1704void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1705 tDot11fIEWMMSchedule *pDot11f)
1706{
1707 pDot11f->version = 1;
1708 pDot11f->aggregation = pSchedule->info.aggregation;
1709 pDot11f->tsid = pSchedule->info.tsid;
1710 pDot11f->direction = pSchedule->info.direction;
1711 pDot11f->reserved = pSchedule->info.rsvd;
1712 pDot11f->service_start_time = pSchedule->svcStartTime;
1713 pDot11f->service_interval = pSchedule->svcInterval;
1714 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1715 pDot11f->spec_interval = pSchedule->specInterval;
1716
1717 pDot11f->present = 1;
1718} // End PopulateDot11fWMMSchedule.
1719
1720tSirRetStatus
1721PopulateDot11fWPA(tpAniSirGlobal pMac,
1722 tpSirRSNie pRsnIe,
1723 tDot11fIEWPA *pDot11f)
1724{
1725 tANI_U32 status;
1726 int idx;
1727
1728 if ( pRsnIe->length )
1729 {
1730 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1731 {
1732 status = dot11fUnpackIeWPA( pMac,
1733 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1734 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1735 pDot11f );
1736 if ( DOT11F_FAILED( status ) )
1737 {
1738 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1739 "A (0x%08x).\n"),
1740 status );
1741 return eSIR_FAILURE;
1742 }
1743 }
1744 }
1745
1746 return eSIR_SUCCESS;
1747} // End PopulateDot11fWPA.
1748
1749
1750
1751tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1752 tpSirRSNie pRsnIe,
1753 tDot11fIEWPAOpaque *pDot11f )
1754{
1755 int idx;
1756
1757 if ( pRsnIe->length )
1758 {
1759 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1760 {
1761 pDot11f->present = 1;
1762 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301763 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1765 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1766 }
1767 }
1768
1769 return eSIR_SUCCESS;
1770
1771} // End PopulateDot11fWPAOpaque.
1772
1773////////////////////////////////////////////////////////////////////////
1774
1775tSirRetStatus
1776sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1777{
1778#if 0
1779 tANI_U32 val;
1780
1781 *caps = 0;
1782 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1783 != eSIR_SUCCESS)
1784 {
1785 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1786 return eSIR_FAILURE;
1787 }
1788 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1789 {
1790 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1791 return eSIR_FAILURE;
1792 }
1793
1794 *caps = (tANI_U16) val;
1795#endif
1796 return eSIR_SUCCESS;
1797}
1798
1799tSirRetStatus
1800sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1801 tANI_U8 *pFrame,
1802 tANI_U32 nFrame,
1803 tpSirProbeReq pProbeReq)
1804{
1805 tANI_U32 status;
1806 tDot11fProbeRequest pr;
1807
1808 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301809 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001810
1811 // delegate to the framesc-generated code,
1812 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1813 if ( DOT11F_FAILED( status ) )
1814 {
1815 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1816 status, nFrame);
1817 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1818 return eSIR_FAILURE;
1819 }
1820 else if ( DOT11F_WARNED( status ) )
1821 {
1822 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1823 status, nFrame );
1824 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1825 }
1826
1827 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1828 if ( ! pr.SSID.present )
1829 {
1830 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1831 }
1832 else
1833 {
1834 pProbeReq->ssidPresent = 1;
1835 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
1836 }
1837
1838 if ( ! pr.SuppRates.present )
1839 {
1840 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1841 return eSIR_FAILURE;
1842 }
1843 else
1844 {
1845 pProbeReq->suppRatesPresent = 1;
1846 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
1847 }
1848
1849 if ( pr.ExtSuppRates.present )
1850 {
1851 pProbeReq->extendedRatesPresent = 1;
1852 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
1853 }
1854
1855 if ( pr.HTCaps.present )
1856 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301857 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 }
1859
1860 if ( pr.WscProbeReq.present )
1861 {
1862 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05301863 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07001864 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001865#ifdef WLAN_FEATURE_11AC
1866 if ( pr.VHTCaps.present )
1867 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301868 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07001869 }
1870#endif
1871
Jeff Johnson295189b2012-06-20 16:38:30 -07001872
1873 if ( pr.P2PProbeReq.present )
1874 {
1875 pProbeReq->p2pIePresent = 1;
1876 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001877
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 return eSIR_SUCCESS;
1879
1880} // End sirConvertProbeReqFrame2Struct.
1881
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301882/* function ValidateAndRectifyIEs checks for the malformed frame.
1883 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301884 * (Tagged elements).
1885 * Every Tagged IE has tag number, tag length and data. Tag length indicates
1886 * the size of data in bytes.
1887 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301888 * And also rectifies missing optional fields in IE.
1889 *
1890 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
1891 * extended to rectify other optional fields in other IEs.
1892 *
1893 */
1894tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
1895 tANI_U8 *pMgmtFrame,
1896 tANI_U32 nFrameBytes,
1897 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301898{
1899 tANI_U32 length = SIZE_OF_FIXED_PARAM;
1900 tANI_U8 *refFrame;
1901
1902 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301903 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301904 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301905 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301906 {
1907 /*refFrame points to next IE */
1908 refFrame = pMgmtFrame + length;
1909 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
1910 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
1911 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301912 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301913 {
1914 /* Workaround : Some APs may not include RSN Capability but
1915 * the length of which is included in RSN IE length.
1916 * this may cause in updating RSN Capability with junk value.
1917 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301918 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301919 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301920 if ((*refFrame == RSNIEID) &&
1921 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301922 {
1923 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301924 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301925 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301926 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301927 limLog(pMac, LOG1,
1928 FL("Added RSN Capability to the RSNIE as 0x00 0x00\n"));
1929
1930 return eHAL_STATUS_SUCCESS;
1931 }
1932 return eSIR_FAILURE;
1933 }
1934 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301935 return eHAL_STATUS_SUCCESS;
1936}
1937
Jeff Johnson295189b2012-06-20 16:38:30 -07001938tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
1939 tANI_U8 *pFrame,
1940 tANI_U32 nFrame,
1941 tpSirProbeRespBeacon pProbeResp)
1942{
1943 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001944 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07001945
1946 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301947 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001948
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301949 pr = vos_mem_malloc(sizeof(tDot11fProbeResponse));
1950 if ( NULL == pr )
1951 status = eHAL_STATUS_FAILURE;
1952 else
1953 status = eHAL_STATUS_SUCCESS;
1954 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07001955 {
1956 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
1957 return eSIR_FAILURE;
1958 }
1959
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301960 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07001961
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07001963 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 if ( DOT11F_FAILED( status ) )
1965 {
1966 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
1967 status, nFrame);
1968 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301969 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 return eSIR_FAILURE;
1971 }
1972 else if ( DOT11F_WARNED( status ) )
1973 {
1974 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
1975 status, nFrame );
1976 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1977 }
1978
1979 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
1980
1981 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301982 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
1983 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001984
1985 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07001986 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07001987
1988 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07001989 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
1990 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
1991 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
1992 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
1993 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
1994 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
1995 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
1996 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
1997 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
1998 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
1999 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2000 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2001 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2002 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2003 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2004 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002005
Jeff Johnson32d95a32012-09-10 13:15:23 -07002006 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 {
2008 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2009 }
2010 else
2011 {
2012 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002013 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 }
2015
Jeff Johnson32d95a32012-09-10 13:15:23 -07002016 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 {
2018 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2019 }
2020 else
2021 {
2022 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002023 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 }
2025
Jeff Johnson32d95a32012-09-10 13:15:23 -07002026 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 {
2028 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002029 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 }
2031
2032
Jeff Johnson32d95a32012-09-10 13:15:23 -07002033 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 {
2035 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002036 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 }
2038
Jeff Johnson32d95a32012-09-10 13:15:23 -07002039 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 {
2041 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002042 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 }
2044
Jeff Johnson32d95a32012-09-10 13:15:23 -07002045 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 {
2047 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002048 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 }
2050
Jeff Johnson32d95a32012-09-10 13:15:23 -07002051 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 {
2053 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302054 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 sizeof(tDot11fIEExtChanSwitchAnn) );
2056 }
2057
Jeff Johnson32d95a32012-09-10 13:15:23 -07002058 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 {
2060 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302061 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 sizeof(tDot11fIEExtChanSwitchAnn) );
2063 }
2064
Jeff Johnson32d95a32012-09-10 13:15:23 -07002065 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 {
2067 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302068 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 }
2070
Jeff Johnson32d95a32012-09-10 13:15:23 -07002071 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 {
2073 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302074 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2075 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 }
2077
Jeff Johnson32d95a32012-09-10 13:15:23 -07002078 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 {
2080 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302081 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 }
2083
Jeff Johnson32d95a32012-09-10 13:15:23 -07002084 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302086 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 }
2088
Jeff Johnson32d95a32012-09-10 13:15:23 -07002089 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302091 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002092 }
2093
Jeff Johnson32d95a32012-09-10 13:15:23 -07002094 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 {
2096 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002097 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002099 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002101 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 }
2103
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002104 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002105 {
2106 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002107 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 }
2109
Jeff Johnson32d95a32012-09-10 13:15:23 -07002110 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 {
2112 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002113 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 }
2115
Jeff Johnson32d95a32012-09-10 13:15:23 -07002116 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 {
2118 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002119 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002121 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 }
2123
Jeff Johnson32d95a32012-09-10 13:15:23 -07002124 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 {
2126 pProbeResp->wmeInfoPresent = 1;
2127 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2128 }
2129
Jeff Johnson32d95a32012-09-10 13:15:23 -07002130 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 {
2132 pProbeResp->wsmCapablePresent = 1;
2133 }
2134
2135
Jeff Johnson32d95a32012-09-10 13:15:23 -07002136 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 {
2138 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002139 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 }
2141
2142#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002143 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 {
2145 // MobilityDomain
2146 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302147 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2148 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002149 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002150#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002151 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2153#endif
2154 }
2155#endif
2156
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002157#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002158 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302160 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 }
2162#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002163 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302165 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 sizeof(tDot11fIEP2PProbeRes) );
2167 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002168#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002169 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002170 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302171 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002172 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002173 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002174 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302175 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002176 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002177 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002178 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302179 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002180 }
2181#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302182 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 return eSIR_SUCCESS;
2184
2185} // End sirConvertProbeFrame2Struct.
2186
2187tSirRetStatus
2188sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2189 tANI_U8 *pFrame,
2190 tANI_U32 nFrame,
2191 tpSirAssocReq pAssocReq)
2192{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002193 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 tANI_U32 status;
2195
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302196 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2197 if ( NULL == ar )
2198 status = eHAL_STATUS_FAILURE;
2199 else
2200 status = eHAL_STATUS_SUCCESS;
2201 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002202 {
2203 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2204 return eSIR_FAILURE;
2205 }
2206 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302207 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2208 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002209
2210 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002211 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 if ( DOT11F_FAILED( status ) )
2213 {
2214 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2215 status, nFrame);
2216 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302217 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 return eSIR_FAILURE;
2219 }
2220 else if ( DOT11F_WARNED( status ) )
2221 {
2222 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2223 status, nFrame );
2224 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2225 }
2226
2227 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2228
2229 // make sure this is seen as an assoc request
2230 pAssocReq->reassocRequest = 0;
2231
2232 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002233 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2234 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2235 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2236 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2237 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2238 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2239 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2240 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2241 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2242 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2243 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2244 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2245 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2246 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2247 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2248 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002249
2250 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002251 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002252
2253 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002254 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 {
2256 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002257 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 }
2259
2260 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002261 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 {
2263 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002264 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 }
2266
2267 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002268 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 {
2270 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002271 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 }
2273
2274 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002275 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 {
2277 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002278 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 }
2280
2281 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002282 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 {
2284 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002285 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 }
2287
2288 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002289 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 {
2291 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002292 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 }
2294
2295 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002296 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 {
2298 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002299 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301
2302
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002303 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 {
2305 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002306 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002308#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002309 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002310 {
2311 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002312 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002313 }
2314#endif
2315
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002317 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 {
2319 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002320 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 }
2322
2323 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002324 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 {
2326 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002327 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 }
2329
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002330 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302332 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 }
2334
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002335 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 {
2337 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302338 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2339 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002340
2341 }
2342
2343
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002344 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002345
2346 if ( ! pAssocReq->ssidPresent )
2347 {
2348 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302349 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 return eSIR_FAILURE;
2351 }
2352
2353 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2354 {
2355 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302356 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002357 return eSIR_FAILURE;
2358 }
2359
Jeff Johnsone7245742012-09-05 17:12:55 -07002360#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002361 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002362 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302363 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002364 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2365 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2366 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002367 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002368 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302369 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002370 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2371 limLogOperatingMode( pMac, &pAssocReq->operMode);
2372 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002373#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302374 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002375 return eSIR_SUCCESS;
2376
2377} // End sirConvertAssocReqFrame2Struct.
2378
2379tSirRetStatus
2380sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2381 tANI_U8 *pFrame,
2382 tANI_U32 nFrame,
2383 tpSirAssocRsp pAssocRsp)
2384{
2385 static tDot11fAssocResponse ar;
2386 tANI_U32 status;
2387 tANI_U8 cnt =0;
2388
2389 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302390 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002391
2392 // delegate to the framesc-generated code,
2393 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2394 if ( DOT11F_FAILED( status ) )
2395 {
2396 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2397 status, nFrame);
2398 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2399 return eSIR_FAILURE;
2400 }
2401 else if ( DOT11F_WARNED( status ) )
2402 {
2403 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2404 status, nFrame );
2405 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2406 }
2407
2408 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2409
2410 // Capabilities
2411 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2412 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2413 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2414 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2415 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2416 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2417 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2418 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2419 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2420 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2421 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2422 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2423 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2424 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2425 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2426 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2427
2428 pAssocRsp->statusCode = ar.Status.status;
2429 pAssocRsp->aid = ar.AID.associd;
2430
2431 if ( ! ar.SuppRates.present )
2432 {
2433 pAssocRsp->suppRatesPresent = 0;
2434 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2435 }
2436 else
2437 {
2438 pAssocRsp->suppRatesPresent = 1;
2439 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2440 }
2441
2442 if ( ar.ExtSuppRates.present )
2443 {
2444 pAssocRsp->extendedRatesPresent = 1;
2445 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2446 }
2447
2448 if ( ar.EDCAParamSet.present )
2449 {
2450 pAssocRsp->edcaPresent = 1;
2451 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2452 }
2453
2454
2455 if ( ar.WMMParams.present )
2456 {
2457 pAssocRsp->wmeEdcaPresent = 1;
2458 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002459 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 __printWMMParams(pMac, &ar.WMMParams);
2461 }
2462
2463 if ( ar.HTCaps.present )
2464 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302465 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 }
2467
2468 if ( ar.HTInfo.present )
2469 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302470 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 }
2472
2473#ifdef WLAN_FEATURE_VOWIFI_11R
2474 if (ar.MobilityDomain.present)
2475 {
2476 // MobilityDomain
2477 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302478 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2479 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2481#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002482 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2484#endif
2485 }
2486
2487 if ( ar.FTInfo.present )
2488 {
2489#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002490 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 -07002491 ar.FTInfo.R0KH_ID.present,
2492 ar.FTInfo.R1KH_ID.present);
2493#endif
2494 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302495 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002496 }
2497#endif
2498
2499#ifdef WLAN_FEATURE_VOWIFI_11R
2500 if (ar.num_RICDataDesc) {
2501 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2502 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302503 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2504 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 }
2506 }
2507 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2508 pAssocRsp->ricPresent = TRUE;
2509 }
2510#endif
2511
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002512#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002513 if (ar.num_WMMTSPEC) {
2514 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2515 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302516 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2517 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 }
2519 pAssocRsp->tspecPresent = TRUE;
2520 }
2521
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002522 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 {
2524 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302525 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002526 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 }
2528#endif
2529
Jeff Johnsone7245742012-09-05 17:12:55 -07002530#ifdef WLAN_FEATURE_11AC
2531 if ( ar.VHTCaps.present )
2532 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302533 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002534 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002535 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2536 }
2537 if ( ar.VHTOperation.present )
2538 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302539 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002540 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002541 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2542 }
2543#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302544 if(ar.OBSSScanParameters.present)
2545 {
2546 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2547 sizeof( tDot11fIEOBSSScanParameters));
2548 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002549 if ( ar.QosMapSet.present )
2550 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002551 pAssocRsp->QosMapSet.present = 1;
2552 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002553 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002554 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002555 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002556 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002557} // End sirConvertAssocRespFrame2Struct.
2558
2559tSirRetStatus
2560sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2561 tANI_U8 *pFrame,
2562 tANI_U32 nFrame,
2563 tpSirAssocReq pAssocReq)
2564{
2565 static tDot11fReAssocRequest ar;
2566 tANI_U32 status;
2567
2568 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302569 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002570
2571 // delegate to the framesc-generated code,
2572 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2573 if ( DOT11F_FAILED( status ) )
2574 {
2575 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2576 status, nFrame);
2577 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2578 return eSIR_FAILURE;
2579 }
2580 else if ( DOT11F_WARNED( status ) )
2581 {
2582 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2583 status, nFrame );
2584 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2585 }
2586
2587 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2588
2589 // make sure this is seen as a re-assoc request
2590 pAssocReq->reassocRequest = 1;
2591
2592 // Capabilities
2593 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2594 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2595 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2596 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2597 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2598 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2599 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2600 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2601 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2602 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2603 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2604 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2605 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2606 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2607 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2608 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2609
2610 // Listen Interval
2611 pAssocReq->listenInterval = ar.ListenInterval.interval;
2612
2613 // SSID
2614 if ( ar.SSID.present )
2615 {
2616 pAssocReq->ssidPresent = 1;
2617 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2618 }
2619
2620 // Supported Rates
2621 if ( ar.SuppRates.present )
2622 {
2623 pAssocReq->suppRatesPresent = 1;
2624 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2625 }
2626
2627 // Extended Supported Rates
2628 if ( ar.ExtSuppRates.present )
2629 {
2630 pAssocReq->extendedRatesPresent = 1;
2631 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2632 &ar.ExtSuppRates );
2633 }
2634
2635 // QOS Capabilities:
2636 if ( ar.QOSCapsStation.present )
2637 {
2638 pAssocReq->qosCapabilityPresent = 1;
2639 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2640 }
2641
2642 // WPA
2643 if ( ar.WPAOpaque.present )
2644 {
2645 pAssocReq->wpaPresent = 1;
2646 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2647 }
2648
2649 // RSN
2650 if ( ar.RSNOpaque.present )
2651 {
2652 pAssocReq->rsnPresent = 1;
2653 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2654 }
2655
2656
2657 // Power Capabilities
2658 if ( ar.PowerCaps.present )
2659 {
2660 pAssocReq->powerCapabilityPresent = 1;
2661 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2662 }
2663
2664 // Supported Channels
2665 if ( ar.SuppChannels.present )
2666 {
2667 pAssocReq->supportedChannelsPresent = 1;
2668 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2669 }
2670
2671 if ( ar.HTCaps.present )
2672 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302673 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 }
2675
2676 if ( ar.WMMInfoStation.present )
2677 {
2678 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302679 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2680 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002681
2682 }
2683
2684 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2685
2686 if ( ! pAssocReq->ssidPresent )
2687 {
2688 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2689 return eSIR_FAILURE;
2690 }
2691
2692 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2693 {
2694 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2695 return eSIR_FAILURE;
2696 }
2697
2698 // Why no call to 'updateAssocReqFromPropCapability' here, like
2699 // there is in 'sirConvertAssocReqFrame2Struct'?
2700
2701 // WSC IE
2702 if (ar.WscIEOpaque.present)
2703 {
2704 pAssocReq->addIEPresent = 1;
2705 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2706 }
2707
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 if(ar.P2PIEOpaque.present)
2709 {
2710 pAssocReq->addIEPresent = 1;
2711 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2712 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002713
Jeff Johnsone7245742012-09-05 17:12:55 -07002714#ifdef WLAN_FEATURE_WFD
2715 if(ar.WFDIEOpaque.present)
2716 {
2717 pAssocReq->addIEPresent = 1;
2718 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2719 }
2720#endif
2721
2722#ifdef WLAN_FEATURE_11AC
2723 if ( ar.VHTCaps.present )
2724 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302725 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002726 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002727 if ( ar.OperatingMode.present )
2728 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302729 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002730 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2731 limLogOperatingMode( pMac, &pAssocReq->operMode);
2732 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002733#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 return eSIR_SUCCESS;
2735
2736} // End sirConvertReassocReqFrame2Struct.
2737
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002738
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002739#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002740tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002741sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002742 tANI_U8 *pPayload,
2743 const tANI_U32 nPayload,
2744 tANI_U8 **outIeBuf,
2745 tANI_U32 *pOutIeLen)
2746{
2747 tDot11fBeaconIEs *pBies = NULL;
2748 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002749 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002750 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002751
2752 /* To store how many bytes are required to be allocated
2753 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002754 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002755 tANI_U8 *pos = NULL;
2756
2757 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002758 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002759 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2760 if ( NULL == pBies )
2761 status = eHAL_STATUS_FAILURE;
2762 else
2763 status = eHAL_STATUS_SUCCESS;
2764 if (!HAL_STATUS_SUCCESS(status))
2765 {
2766 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2767 return eSIR_FAILURE;
2768 }
2769 // delegate to the framesc-generated code,
2770 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2771
2772 if ( DOT11F_FAILED( status ) )
2773 {
2774 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2775 status, nPayload);
2776 vos_mem_free(pBies);
2777 return eSIR_FAILURE;
2778 }
2779 else if ( DOT11F_WARNED( status ) )
2780 {
2781 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2782 status, nPayload );
2783 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2784 }
2785
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002786 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002787 if ( !pBies->SSID.present )
2788 {
2789 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2790 }
2791 else
2792 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002793 eseBcnReportMandatoryIe.ssidPresent = 1;
2794 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002795 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002796 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002797 }
2798
2799 if ( !pBies->SuppRates.present )
2800 {
2801 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2802 }
2803 else
2804 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002805 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2806 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2807 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002808 }
2809
2810 if ( pBies->FHParamSet.present)
2811 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002812 eseBcnReportMandatoryIe.fhParamPresent = 1;
2813 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002814 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2815 }
2816
2817 if ( pBies->DSParams.present )
2818 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002819 eseBcnReportMandatoryIe.dsParamsPresent = 1;
2820 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002821 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2822 }
2823
2824 if ( pBies->CFParams.present )
2825 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002826 eseBcnReportMandatoryIe.cfPresent = 1;
2827 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002828 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
2829 }
2830
2831 if ( pBies->IBSSParams.present )
2832 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002833 eseBcnReportMandatoryIe.ibssParamPresent = 1;
2834 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002835 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2836 }
2837
2838 if ( pBies->TIM.present )
2839 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002840 eseBcnReportMandatoryIe.timPresent = 1;
2841 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
2842 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
2843 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
2844 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002845 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
2846 }
2847
2848 if ( pBies->RRMEnabledCap.present )
2849 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002850 eseBcnReportMandatoryIe.rrmPresent = 1;
2851 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002852 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2853 }
2854
2855 *outIeBuf = vos_mem_malloc(numBytes);
2856 if (NULL == *outIeBuf)
2857 {
2858 limLog(pMac, LOGP, FL("Memory Allocation failure"));
2859 vos_mem_free(pBies);
2860 return eSIR_FAILURE;
2861 }
2862 pos = *outIeBuf;
2863 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002864 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002865
2866 /* Start filling the output Ie with Mandatory IE information */
2867 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002868 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002869 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002870 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002871 {
2872 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
2873 retStatus = eSIR_FAILURE;
2874 goto err_bcnrep;
2875 }
2876 *pos = SIR_MAC_SSID_EID;
2877 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002878 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002879 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002880 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
2881 eseBcnReportMandatoryIe.ssId.length);
2882 pos += eseBcnReportMandatoryIe.ssId.length;
2883 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002884 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002885
2886 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002887 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002888 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002889 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002890 {
2891 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
2892 retStatus = eSIR_FAILURE;
2893 goto err_bcnrep;
2894 }
2895 *pos = SIR_MAC_RATESET_EID;
2896 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002897 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002898 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002899 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
2900 eseBcnReportMandatoryIe.supportedRates.numRates);
2901 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
2902 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002903 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002904
2905 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002906 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002907 {
2908 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
2909 {
2910 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
2911 retStatus = eSIR_FAILURE;
2912 goto err_bcnrep;
2913 }
2914 *pos = SIR_MAC_FH_PARAM_SET_EID;
2915 pos++;
2916 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
2917 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002918 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002919 SIR_MAC_FH_PARAM_SET_EID_MAX);
2920 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
2921 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
2922 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002923
2924 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002925 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002926 {
2927 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
2928 {
2929 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
2930 retStatus = eSIR_FAILURE;
2931 goto err_bcnrep;
2932 }
2933 *pos = SIR_MAC_DS_PARAM_SET_EID;
2934 pos++;
2935 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
2936 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002937 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002938 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
2939 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
2940 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002941
2942 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002943 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002944 {
2945 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
2946 {
2947 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
2948 retStatus = eSIR_FAILURE;
2949 goto err_bcnrep;
2950 }
2951 *pos = SIR_MAC_CF_PARAM_SET_EID;
2952 pos++;
2953 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
2954 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002955 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002956 SIR_MAC_CF_PARAM_SET_EID_MAX);
2957 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
2958 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
2959 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002960
2961 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002962 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002963 {
2964 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
2965 {
2966 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
2967 retStatus = eSIR_FAILURE;
2968 goto err_bcnrep;
2969 }
2970 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
2971 pos++;
2972 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2973 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002974 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002975 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2976 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2977 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2978 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002979
2980 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002981 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002982 {
2983 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
2984 {
2985 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
2986 retStatus = eSIR_FAILURE;
2987 goto err_bcnrep;
2988 }
2989 *pos = SIR_MAC_TIM_EID;
2990 pos++;
2991 *pos = SIR_MAC_TIM_EID_MIN;
2992 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002993 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002994 SIR_MAC_TIM_EID_MIN);
2995 pos += SIR_MAC_TIM_EID_MIN;
2996 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
2997 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002998
2999 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003000 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003001 {
3002 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3003 {
3004 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3005 retStatus = eSIR_FAILURE;
3006 goto err_bcnrep;
3007 }
3008 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3009 pos++;
3010 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3011 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003012 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003013 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3014 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3015 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003016
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003017 if (freeBytes != 0)
3018 {
3019 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3020 retStatus = eSIR_FAILURE;
3021 }
3022
3023err_bcnrep:
3024 /* The message counter would not be incremented in case of
3025 * returning failure and hence next time, this function gets
3026 * called, it would be using the same msg ctr for a different
3027 * BSS.So, it is good to clear the memory allocated for a BSS
3028 * that is returning failure.On success, the caller would take
3029 * care of freeing up the memory*/
3030 if (retStatus == eSIR_FAILURE)
3031 {
3032 vos_mem_free(*outIeBuf);
3033 *outIeBuf = NULL;
3034 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003035 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003036 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003037}
3038
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003039#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003040
Jeff Johnson295189b2012-06-20 16:38:30 -07003041tSirRetStatus
3042sirParseBeaconIE(tpAniSirGlobal pMac,
3043 tpSirProbeRespBeacon pBeaconStruct,
3044 tANI_U8 *pPayload,
3045 tANI_U32 nPayload)
3046{
3047 tDot11fBeaconIEs *pBies;
3048 tANI_U32 status;
3049
3050 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303051 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003052
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303053 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3054 if ( NULL == pBies )
3055 status = eHAL_STATUS_FAILURE;
3056 else
3057 status = eHAL_STATUS_SUCCESS;
3058 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 {
3060 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3061 return eSIR_FAILURE;
3062 }
3063 // delegate to the framesc-generated code,
3064 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3065
3066 if ( DOT11F_FAILED( status ) )
3067 {
3068 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3069 status, nPayload);
3070 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303071 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 return eSIR_FAILURE;
3073 }
3074 else if ( DOT11F_WARNED( status ) )
3075 {
3076 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3077 status, nPayload );
3078 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3079 }
3080
3081 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3082 if ( ! pBies->SSID.present )
3083 {
3084 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3085 }
3086 else
3087 {
3088 pBeaconStruct->ssidPresent = 1;
3089 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3090 }
3091
3092 if ( ! pBies->SuppRates.present )
3093 {
3094 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3095 }
3096 else
3097 {
3098 pBeaconStruct->suppRatesPresent = 1;
3099 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3100 }
3101
3102 if ( pBies->ExtSuppRates.present )
3103 {
3104 pBeaconStruct->extendedRatesPresent = 1;
3105 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3106 }
3107
3108 if ( pBies->CFParams.present )
3109 {
3110 pBeaconStruct->cfPresent = 1;
3111 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3112 }
3113
3114 if ( pBies->TIM.present )
3115 {
3116 pBeaconStruct->timPresent = 1;
3117 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3118 }
3119
3120 if ( pBies->Country.present )
3121 {
3122 pBeaconStruct->countryInfoPresent = 1;
3123 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3124 }
3125
3126 // 11h IEs
3127 if(pBies->TPCReport.present)
3128 {
3129 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303130 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 &pBies->TPCReport,
3132 sizeof( tDot11fIETPCReport));
3133 }
3134
3135 if(pBies->PowerConstraints.present)
3136 {
3137 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303138 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 &pBies->PowerConstraints,
3140 sizeof(tDot11fIEPowerConstraints));
3141 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003142#ifdef FEATURE_WLAN_ESE
3143 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003144 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003145 pBeaconStruct->eseTxPwr.present = 1;
3146 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 }
3148 if (pBies->QBSSLoad.present)
3149 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303150 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003151 }
3152#endif
3153
3154 if ( pBies->EDCAParamSet.present )
3155 {
3156 pBeaconStruct->edcaPresent = 1;
3157 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3158 }
3159
3160 // QOS Capabilities:
3161 if ( pBies->QOSCapsAp.present )
3162 {
3163 pBeaconStruct->qosCapabilityPresent = 1;
3164 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3165 }
3166
3167
3168
3169 if ( pBies->ChanSwitchAnn.present )
3170 {
3171 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303172 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 sizeof(tDot11fIEChanSwitchAnn));
3174 }
3175
3176 if ( pBies->ExtChanSwitchAnn.present)
3177 {
3178 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303179 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003180 sizeof(tDot11fIEExtChanSwitchAnn));
3181 }
3182
3183 if ( pBies->Quiet.present )
3184 {
3185 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303186 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003187 }
3188
3189 if ( pBies->HTCaps.present )
3190 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303191 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 }
3193
3194 if ( pBies->HTInfo.present )
3195 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303196 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003197 }
3198
3199 if ( pBies->DSParams.present )
3200 {
3201 pBeaconStruct->dsParamsPresent = 1;
3202 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3203 }
3204 else if(pBies->HTInfo.present)
3205 {
3206 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3207 }
3208
3209 if ( pBies->RSN.present )
3210 {
3211 pBeaconStruct->rsnPresent = 1;
3212 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3213 }
3214
3215 if ( pBies->WPA.present )
3216 {
3217 pBeaconStruct->wpaPresent = 1;
3218 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3219 }
3220
3221 if ( pBies->WMMParams.present )
3222 {
3223 pBeaconStruct->wmeEdcaPresent = 1;
3224 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3225 }
3226
3227 if ( pBies->WMMInfoAp.present )
3228 {
3229 pBeaconStruct->wmeInfoPresent = 1;
3230 }
3231
3232 if ( pBies->WMMCaps.present )
3233 {
3234 pBeaconStruct->wsmCapablePresent = 1;
3235 }
3236
3237
3238 if ( pBies->ERPInfo.present )
3239 {
3240 pBeaconStruct->erpPresent = 1;
3241 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3242 }
3243
Jeff Johnsone7245742012-09-05 17:12:55 -07003244#ifdef WLAN_FEATURE_11AC
3245 if ( pBies->VHTCaps.present )
3246 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303247 pBeaconStruct->VHTCaps.present = 1;
3248 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003249 }
3250 if ( pBies->VHTOperation.present )
3251 {
3252 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303253 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3254 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003255 }
3256 if ( pBies->VHTExtBssLoad.present )
3257 {
3258 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303259 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3260 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003261 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003262 if( pBies->OperatingMode.present)
3263 {
3264 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303265 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3266 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003267 }
3268
Jeff Johnsone7245742012-09-05 17:12:55 -07003269#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303270 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003271
Jeff Johnsone7245742012-09-05 17:12:55 -07003272
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 return eSIR_SUCCESS;
3274
3275} // End sirParseBeaconIE.
3276
3277tSirRetStatus
3278sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3279 tANI_U8 *pFrame,
3280 tpSirProbeRespBeacon pBeaconStruct)
3281{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003282 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 tANI_U32 status, nPayload;
3284 tANI_U8 *pPayload;
3285 tpSirMacMgmtHdr pHdr;
3286 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003287 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003288
3289 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3290 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3291 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3292 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003293 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003294
3295 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303296 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3297
3298 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
3299 if ( NULL == pBeacon )
3300 status = eHAL_STATUS_FAILURE;
3301 else
3302 status = eHAL_STATUS_SUCCESS;
3303 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003304 {
3305 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3306 return eSIR_FAILURE;
3307 }
3308
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303309 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003310
3311 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303312 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003313
3314 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003315 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 if ( DOT11F_FAILED( status ) )
3317 {
3318 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3319 status, nPayload);
3320 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303321 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 return eSIR_FAILURE;
3323 }
3324 else if ( DOT11F_WARNED( status ) )
3325 {
3326 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3327 status, nPayload );
3328 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3329 }
3330
3331 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3332 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303333 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3334 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003335
3336 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003337 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003338
3339 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003340 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3341 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3342 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3343 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3344 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3345 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3346 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3347 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3348 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3349 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3350 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3351 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3352 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3353 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3354 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3355 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003356
Jeff Johnson32d95a32012-09-10 13:15:23 -07003357 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003358 {
3359 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3360 }
3361 else
3362 {
3363 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003364 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 }
3366
Jeff Johnson32d95a32012-09-10 13:15:23 -07003367 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 {
3369 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3370 }
3371 else
3372 {
3373 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003374 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 }
3376
Jeff Johnson32d95a32012-09-10 13:15:23 -07003377 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 {
3379 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003380 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 }
3382
3383
Jeff Johnson32d95a32012-09-10 13:15:23 -07003384 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 {
3386 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003387 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003388 }
3389
Jeff Johnson32d95a32012-09-10 13:15:23 -07003390 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 {
3392 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003393 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 }
3395
Jeff Johnson32d95a32012-09-10 13:15:23 -07003396 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 {
3398 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003399 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 }
3401
3402 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003403 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003404 {
3405 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003406 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003407 }
3408
Jeff Johnson32d95a32012-09-10 13:15:23 -07003409 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003410 {
3411 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003412 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003413 }
3414
Jeff Johnson32d95a32012-09-10 13:15:23 -07003415 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 {
3417 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303418 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 sizeof(tDot11fIEChanSwitchAnn) );
3420 }
3421
Jeff Johnson32d95a32012-09-10 13:15:23 -07003422 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 {
3424 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303425 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 sizeof(tDot11fIEExtChanSwitchAnn) );
3427 }
3428
Jeff Johnson32d95a32012-09-10 13:15:23 -07003429 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 {
3431 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303432 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003433 sizeof(tDot11fIETPCReport));
3434 }
3435
Jeff Johnson32d95a32012-09-10 13:15:23 -07003436 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 {
3438 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303439 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003440 sizeof(tDot11fIEPowerConstraints));
3441 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003442
3443 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003444 {
3445 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303446 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 }
3448
Jeff Johnson32d95a32012-09-10 13:15:23 -07003449 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303451 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003452 }
3453
Jeff Johnson32d95a32012-09-10 13:15:23 -07003454 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303456 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003457
3458 }
3459
Jeff Johnson32d95a32012-09-10 13:15:23 -07003460 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003461 {
3462 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003463 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003465 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003466 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003467 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003468 }
3469 else
3470 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003471 if ((!rfBand) || IS_5G_BAND(rfBand))
3472 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3473 else if (IS_24G_BAND(rfBand))
3474 pBeaconStruct->channelNumber = mappedRXCh;
3475 else
3476 {
3477 /*Only 0, 1, 2 are expected values for RF band from FW
3478 * if FW fixes are not present then rf band value will
3479 * be 0, else either 1 or 2 are expected from FW, 3 is
3480 * not expected from FW */
3481 PELOGE(limLog(pMac, LOGE,
3482 FL("Channel info is not present in Beacon and"
3483 " mapping is not done correctly"));)
3484 pBeaconStruct->channelNumber = mappedRXCh;
3485 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 }
3487
Jeff Johnson32d95a32012-09-10 13:15:23 -07003488 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 {
3490 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003491 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 }
3493
Jeff Johnson32d95a32012-09-10 13:15:23 -07003494 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 {
3496 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003497 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 }
3499
Jeff Johnson32d95a32012-09-10 13:15:23 -07003500 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 {
3502 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003503 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003504 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003505 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003506 }
3507
Jeff Johnson32d95a32012-09-10 13:15:23 -07003508 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 {
3510 pBeaconStruct->wmeInfoPresent = 1;
3511 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3512 }
3513
Jeff Johnson32d95a32012-09-10 13:15:23 -07003514 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003515 {
3516 pBeaconStruct->wsmCapablePresent = 1;
3517 }
3518
Jeff Johnson32d95a32012-09-10 13:15:23 -07003519 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003520 {
3521 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003522 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003523 }
3524
3525#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003526 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 {
3528 // MobilityDomain
3529 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303530 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3531 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003532 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003533
3534 }
3535#endif
3536
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003537#ifdef FEATURE_WLAN_ESE
3538 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303539 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003540 //ESE Tx Power
3541 pBeaconStruct->eseTxPwr.present = 1;
3542 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3543 &pBeacon->ESETxmitPower,
3544 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303545 }
3546#endif
3547
Jeff Johnsone7245742012-09-05 17:12:55 -07003548#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003549 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003550 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303551 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003552 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003553 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003554 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303555 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3556 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003557 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003558 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003559 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303560 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3561 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003562 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003563 if(pBeacon->OperatingMode.present)
3564 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303565 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3566 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003567 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003568 if(pBeacon->WiderBWChanSwitchAnn.present)
3569 {
3570 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303571 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3572 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003573 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003574#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303575 if(pBeacon->OBSSScanParameters.present)
3576 {
3577 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3578 &pBeacon->OBSSScanParameters,
3579 sizeof( tDot11fIEOBSSScanParameters));
3580 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303581 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 return eSIR_SUCCESS;
3583
3584} // End sirConvertBeaconFrame2Struct.
3585
3586tSirRetStatus
3587sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3588 tANI_U8 *pFrame,
3589 tANI_U32 nFrame,
3590 tpSirMacAuthFrameBody pAuth)
3591{
3592 static tDot11fAuthentication auth;
3593 tANI_U32 status;
3594
3595 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303596 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003597
3598 // delegate to the framesc-generated code,
3599 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3600 if ( DOT11F_FAILED( status ) )
3601 {
3602 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3603 status, nFrame);
3604 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3605 return eSIR_FAILURE;
3606 }
3607 else if ( DOT11F_WARNED( status ) )
3608 {
3609 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3610 status, nFrame );
3611 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3612 }
3613
3614 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3615 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3616 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3617 pAuth->authStatusCode = auth.Status.status;
3618
3619 if ( auth.ChallengeText.present )
3620 {
3621 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3622 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303623 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003624 }
3625
3626 return eSIR_SUCCESS;
3627
3628} // End sirConvertAuthFrame2Struct.
3629
3630tSirRetStatus
3631sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3632 tANI_U8 *pFrame,
3633 tANI_U32 nFrame,
3634 tSirAddtsReqInfo *pAddTs)
3635{
3636 tDot11fAddTSRequest addts = {{0}};
3637 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3638 tANI_U8 j;
3639 tANI_U16 i;
3640 tANI_U32 status;
3641
3642 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3643 {
3644 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3645 "with an Action of %d; this is not "
3646 "supported & is probably an error."),
3647 *( pFrame + 1 ) );
3648 return eSIR_FAILURE;
3649 }
3650
3651 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303652 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003653
3654 // delegate to the framesc-generated code,
3655 switch ( *pFrame )
3656 {
3657 case SIR_MAC_ACTION_QOS_MGMT:
3658 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3659 break;
3660 case SIR_MAC_ACTION_WME:
3661 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3662 break;
3663 default:
3664 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3665 "with a Category of %d; this is not"
3666 " supported & is probably an error."),
3667 *pFrame );
3668 return eSIR_FAILURE;
3669 }
3670
3671 if ( DOT11F_FAILED( status ) )
3672 {
3673 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3674 "rame (0x%08x, %d bytes):\n"),
3675 status, nFrame);
3676 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3677 return eSIR_FAILURE;
3678 }
3679 else if ( DOT11F_WARNED( status ) )
3680 {
3681 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3682 "g an Add TS Request frame (0x%08x,"
3683 "%d bytes):\n"),
3684 status, nFrame );
3685 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3686 }
3687
3688 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3689 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3690 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3691 {
3692 pAddTs->dialogToken = addts.DialogToken.token;
3693
3694 if ( addts.TSPEC.present )
3695 {
3696 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3697 }
3698 else
3699 {
3700 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3701 return eSIR_FAILURE;
3702 }
3703
3704 if ( addts.num_TCLAS )
3705 {
3706 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3707
3708 for ( i = 0U; i < addts.num_TCLAS; ++i )
3709 {
3710 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3711 {
3712 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3713 return eSIR_FAILURE;
3714 }
3715 }
3716 }
3717
3718 if ( addts.TCLASSPROC.present )
3719 {
3720 pAddTs->tclasProcPresent = 1;
3721 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3722 }
3723
3724 if ( addts.WMMTSPEC.present )
3725 {
3726 pAddTs->wsmTspecPresent = 1;
3727 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3728 }
3729
3730 if ( addts.num_WMMTCLAS )
3731 {
3732 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3733 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3734
3735 for ( i = pAddTs->numTclas; i < j; ++i )
3736 {
3737 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3738 {
3739 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3740 return eSIR_FAILURE;
3741 }
3742 }
3743 }
3744
3745 if ( addts.WMMTCLASPROC.present )
3746 {
3747 pAddTs->tclasProcPresent = 1;
3748 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3749 }
3750
3751 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3752 {
3753 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3754 pAddTs->numTclas );
3755 return eSIR_FAILURE;
3756 }
3757 }
3758 else
3759 {
3760 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3761
3762 if ( wmmaddts.WMMTSPEC.present )
3763 {
3764 pAddTs->wmeTspecPresent = 1;
3765 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3766 }
3767 else
3768 {
3769 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3770 return eSIR_FAILURE;
3771 }
3772 }
3773
3774 return eSIR_SUCCESS;
3775
3776} // End sirConvertAddtsReq2Struct.
3777
3778tSirRetStatus
3779sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3780 tANI_U8 *pFrame,
3781 tANI_U32 nFrame,
3782 tSirAddtsRspInfo *pAddTs)
3783{
3784 tDot11fAddTSResponse addts = {{0}};
3785 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3786 tANI_U8 j;
3787 tANI_U16 i;
3788 tANI_U32 status;
3789
3790 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3791 {
3792 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3793 "with an Action of %d; this is not "
3794 "supported & is probably an error."),
3795 *( pFrame + 1 ) );
3796 return eSIR_FAILURE;
3797 }
3798
3799 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303800 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3801 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3802 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003803
3804
3805 // delegate to the framesc-generated code,
3806 switch ( *pFrame )
3807 {
3808 case SIR_MAC_ACTION_QOS_MGMT:
3809 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3810 break;
3811 case SIR_MAC_ACTION_WME:
3812 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3813 break;
3814 default:
3815 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3816 "with a Category of %d; this is not"
3817 " supported & is probably an error."),
3818 *pFrame );
3819 return eSIR_FAILURE;
3820 }
3821
3822 if ( DOT11F_FAILED( status ) )
3823 {
3824 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
3825 "rame (0x%08x, %d bytes):\n"),
3826 status, nFrame);
3827 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3828 return eSIR_FAILURE;
3829 }
3830 else if ( DOT11F_WARNED( status ) )
3831 {
3832 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3833 "g an Add TS Response frame (0x%08x,"
3834 "%d bytes):\n"),
3835 status, nFrame );
3836 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3837 }
3838
3839 // & "transliterate" from a 'tDot11fAddTSResponse' or a
3840 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
3841 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3842 {
3843 pAddTs->dialogToken = addts.DialogToken.token;
3844 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
3845
3846 if ( addts.TSDelay.present )
3847 {
3848 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
3849 }
3850
3851 // TS Delay is present iff status indicates its presence
3852 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
3853 {
3854 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
3855 }
3856
3857 if ( addts.TSPEC.present )
3858 {
3859 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3860 }
3861 else
3862 {
3863 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
3864 return eSIR_FAILURE;
3865 }
3866
3867 if ( addts.num_TCLAS )
3868 {
3869 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3870
3871 for ( i = 0U; i < addts.num_TCLAS; ++i )
3872 {
3873 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3874 {
3875 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3876 return eSIR_FAILURE;
3877 }
3878 }
3879 }
3880
3881 if ( addts.TCLASSPROC.present )
3882 {
3883 pAddTs->tclasProcPresent = 1;
3884 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3885 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003886#ifdef FEATURE_WLAN_ESE
3887 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 {
3889 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303890 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003891 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003892 }
3893#endif
3894 if ( addts.Schedule.present )
3895 {
3896 pAddTs->schedulePresent = 1;
3897 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
3898 }
3899
3900 if ( addts.WMMSchedule.present )
3901 {
3902 pAddTs->schedulePresent = 1;
3903 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
3904 }
3905
3906 if ( addts.WMMTSPEC.present )
3907 {
3908 pAddTs->wsmTspecPresent = 1;
3909 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3910 }
3911
3912 if ( addts.num_WMMTCLAS )
3913 {
3914 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3915 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3916
3917 for ( i = pAddTs->numTclas; i < j; ++i )
3918 {
3919 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3920 {
3921 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3922 return eSIR_FAILURE;
3923 }
3924 }
3925 }
3926
3927 if ( addts.WMMTCLASPROC.present )
3928 {
3929 pAddTs->tclasProcPresent = 1;
3930 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3931 }
3932
3933 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3934 {
3935 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3936 pAddTs->numTclas );
3937 return eSIR_FAILURE;
3938 }
3939 }
3940 else
3941 {
3942 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3943 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
3944
3945 if ( wmmaddts.WMMTSPEC.present )
3946 {
3947 pAddTs->wmeTspecPresent = 1;
3948 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3949 }
3950 else
3951 {
3952 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3953 return eSIR_FAILURE;
3954 }
3955
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003956#ifdef FEATURE_WLAN_ESE
3957 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003958 {
3959 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303960 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003961 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003962 }
3963#endif
3964
3965 }
3966
3967 return eSIR_SUCCESS;
3968
3969} // End sirConvertAddtsRsp2Struct.
3970
3971tSirRetStatus
3972sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
3973 tANI_U8 *pFrame,
3974 tANI_U32 nFrame,
3975 tSirDeltsReqInfo *pDelTs)
3976{
3977 tDot11fDelTS delts = {{0}};
3978 tDot11fWMMDelTS wmmdelts = {{0}};
3979 tANI_U32 status;
3980
3981 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
3982 {
3983 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3984 "with an Action of %d; this is not "
3985 "supported & is probably an error."),
3986 *( pFrame + 1 ) );
3987 return eSIR_FAILURE;
3988 }
3989
3990 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303991 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003992
3993 // delegate to the framesc-generated code,
3994 switch ( *pFrame )
3995 {
3996 case SIR_MAC_ACTION_QOS_MGMT:
3997 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
3998 break;
3999 case SIR_MAC_ACTION_WME:
4000 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4001 break;
4002 default:
4003 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4004 "with a Category of %d; this is not"
4005 " supported & is probably an error."),
4006 *pFrame );
4007 return eSIR_FAILURE;
4008 }
4009
4010 if ( DOT11F_FAILED( status ) )
4011 {
4012 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
4013 "rame (0x%08x, %d bytes):\n"),
4014 status, nFrame);
4015 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4016 return eSIR_FAILURE;
4017 }
4018 else if ( DOT11F_WARNED( status ) )
4019 {
4020 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4021 "g an Del TS Request frame (0x%08x,"
4022 "%d bytes):\n"),
4023 status, nFrame );
4024 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4025 }
4026
4027 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4028 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4029 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4030 {
4031 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4032 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4033 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4034 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4035 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4036 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4037 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4038 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4039
4040 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4041 }
4042 else
4043 {
4044 if ( wmmdelts.WMMTSPEC.present )
4045 {
4046 pDelTs->wmeTspecPresent = 1;
4047 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4048 }
4049 else
4050 {
4051 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
4052 return eSIR_FAILURE;
4053 }
4054 }
4055
4056 return eSIR_SUCCESS;
4057
4058} // End sirConvertDeltsReq2Struct.
4059
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004060tSirRetStatus
4061sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4062 tANI_U8 *pFrame,
4063 tANI_U32 nFrame,
4064 tSirQosMapSet *pQosMapSet)
4065{
4066 tDot11fQosMapConfigure mapConfigure;
4067 tANI_U32 status;
4068 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
4069 if ( DOT11F_FAILED( status ) )
4070 {
4071 dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):\n"),
4072 status, nFrame);
4073 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4074 return eSIR_FAILURE;
4075 }
4076 else if ( DOT11F_WARNED( status ) )
4077 {
4078 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):\n"),
4079 status, nFrame );
4080 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4081 }
4082 pQosMapSet->present = mapConfigure.QosMapSet.present;
4083 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004084 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004085 return eSIR_SUCCESS;
4086}
Jeff Johnson295189b2012-06-20 16:38:30 -07004087
4088#ifdef ANI_SUPPORT_11H
4089tSirRetStatus
4090sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4091 tANI_U8 *pFrame,
4092 tpSirMacTpcReqActionFrame pTpcReqFrame,
4093 tANI_U32 nFrame)
4094{
4095 tDot11fTPCRequest req;
4096 tANI_U32 status;
4097
4098 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304099 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004100
4101 // delegate to the framesc-generated code,
4102 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4103 if ( DOT11F_FAILED( status ) )
4104 {
4105 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
4106 status, nFrame);
4107 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4108 return eSIR_FAILURE;
4109 }
4110 else if ( DOT11F_WARNED( status ) )
4111 {
4112 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
4113 status, nFrame );
4114 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4115 }
4116
4117 // & "transliterate" from a 'tDot11fTPCRequest' to a
4118 // 'tSirMacTpcReqActionFrame'...
4119 pTpcReqFrame->actionHeader.category = req.Category.category;
4120 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4121 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4122 if ( req.TPCRequest.present )
4123 {
4124 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4125 pTpcReqFrame->length = 0;
4126 }
4127 else
4128 {
4129 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
4130 return eSIR_FAILURE;
4131 }
4132
4133 return eSIR_SUCCESS;
4134
4135} // End sirConvertTpcReqFrame2Struct.
4136
4137
4138tSirRetStatus
4139sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4140 tANI_U8 *pFrame,
4141 tpSirMacMeasReqActionFrame pMeasReqFrame,
4142 tANI_U32 nFrame)
4143{
4144 tDot11fMeasurementRequest mr;
4145 tANI_U32 status;
4146
4147 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304148 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004149
4150 // delegate to the framesc-generated code,
4151 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4152 if ( DOT11F_FAILED( status ) )
4153 {
4154 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4155 status, nFrame);
4156 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4157 return eSIR_FAILURE;
4158 }
4159 else if ( DOT11F_WARNED( status ) )
4160 {
4161 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4162 status, nFrame );
4163 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4164 }
4165
4166 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4167 // 'tpSirMacMeasReqActionFrame'...
4168 pMeasReqFrame->actionHeader.category = mr.Category.category;
4169 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4170 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4171
4172 if ( 0 == mr.num_MeasurementRequest )
4173 {
4174 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4175 return eSIR_FAILURE;
4176 }
4177 else if ( 1 < mr.num_MeasurementRequest )
4178 {
4179 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4180 }
4181
4182 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4183 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4184 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4185 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4186 ( mr.MeasurementRequest[0].enable << 2 ) |
4187 ( mr.MeasurementRequest[0].request << 1 ) |
4188 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4189 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4190
4191 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4192
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304193 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004194 mr.MeasurementRequest[0].meas_start_time, 8 );
4195
4196 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4197
4198 return eSIR_SUCCESS;
4199
4200} // End sirConvertMeasReqFrame2Struct.
4201#endif
4202
4203
4204void
4205PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4206 tDot11fIETSPEC *pDot11f)
4207{
4208 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4209 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4210 pDot11f->direction = pOld->tsinfo.traffic.direction;
4211 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4212 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4213 pDot11f->psb = pOld->tsinfo.traffic.psb;
4214 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4215 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4216 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4217 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4218 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4219 */
4220 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4221 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4222 pDot11f->max_msdu_size = pOld->maxMsduSz;
4223 pDot11f->min_service_int = pOld->minSvcInterval;
4224 pDot11f->max_service_int = pOld->maxSvcInterval;
4225 pDot11f->inactivity_int = pOld->inactInterval;
4226 pDot11f->suspension_int = pOld->suspendInterval;
4227 pDot11f->service_start_time = pOld->svcStartTime;
4228 pDot11f->min_data_rate = pOld->minDataRate;
4229 pDot11f->mean_data_rate = pOld->meanDataRate;
4230 pDot11f->peak_data_rate = pOld->peakDataRate;
4231 pDot11f->burst_size = pOld->maxBurstSz;
4232 pDot11f->delay_bound = pOld->delayBound;
4233 pDot11f->min_phy_rate = pOld->minPhyRate;
4234 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4235 pDot11f->medium_time = pOld->mediumTime;
4236
4237 pDot11f->present = 1;
4238
4239} // End PopulateDot11fTSPEC.
4240
4241void
4242PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4243 tDot11fIEWMMTSPEC *pDot11f)
4244{
4245 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4246 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4247 pDot11f->direction = pOld->tsinfo.traffic.direction;
4248 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4249 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4250 pDot11f->psb = pOld->tsinfo.traffic.psb;
4251 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4252 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4253 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4254 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4255 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4256 */
4257 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4258 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4259 pDot11f->max_msdu_size = pOld->maxMsduSz;
4260 pDot11f->min_service_int = pOld->minSvcInterval;
4261 pDot11f->max_service_int = pOld->maxSvcInterval;
4262 pDot11f->inactivity_int = pOld->inactInterval;
4263 pDot11f->suspension_int = pOld->suspendInterval;
4264 pDot11f->service_start_time = pOld->svcStartTime;
4265 pDot11f->min_data_rate = pOld->minDataRate;
4266 pDot11f->mean_data_rate = pOld->meanDataRate;
4267 pDot11f->peak_data_rate = pOld->peakDataRate;
4268 pDot11f->burst_size = pOld->maxBurstSz;
4269 pDot11f->delay_bound = pOld->delayBound;
4270 pDot11f->min_phy_rate = pOld->minPhyRate;
4271 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4272 pDot11f->medium_time = pOld->mediumTime;
4273
4274 pDot11f->version = 1;
4275 pDot11f->present = 1;
4276
4277} // End PopulateDot11fWMMTSPEC.
4278
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004279#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004280
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004281// Fill the ESE version currently supported
4282void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004283{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004284 pESEVersion->present = 1;
4285 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004286}
4287
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004288// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004289// The State is Normal (1)
4290// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004291void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004292{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004293 pESERadMgmtCap->present = 1;
4294 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4295 pESERadMgmtCap->mbssid_mask = 0;
4296 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004297}
4298
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004299tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004300 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004301 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004302{
4303 int idx;
4304
4305 if ( pCCKMie->length )
4306 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004307 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004308 {
4309 pDot11f->present = 1;
4310 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004311 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004312 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4313 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4314 }
4315 }
4316
4317 return eSIR_SUCCESS;
4318
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004319} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004320
Jeff Johnson295189b2012-06-20 16:38:30 -07004321void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004322 tSirMacESETSRSIE *pOld,
4323 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004324 tANI_U8 rate_length)
4325{
4326 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304327 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 pDot11f->num_tsrates = rate_length;
4329 pDot11f->present = 1;
4330}
4331#endif
4332
4333
4334tSirRetStatus
4335PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4336 tSirTclasInfo *pOld,
4337 tDot11fIETCLAS *pDot11f)
4338{
4339 pDot11f->user_priority = pOld->tclas.userPrio;
4340 pDot11f->classifier_type = pOld->tclas.classifierType;
4341 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4342
4343 switch ( pDot11f->classifier_type )
4344 {
4345 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304346 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4347 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4348 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4349 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004350 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4351 break;
4352 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4353 pDot11f->info.IpParams.version = pOld->version;
4354 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4355 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304356 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304357 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304358 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4359 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304360 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304361 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004362 pDot11f->info.IpParams.params.IpV4Params.src_port =
4363 pOld->tclasParams.ipv4.srcPort;
4364 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4365 pOld->tclasParams.ipv4.dstPort;
4366 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4367 pOld->tclasParams.ipv4.dscp;
4368 pDot11f->info.IpParams.params.IpV4Params.proto =
4369 pOld->tclasParams.ipv4.protocol;
4370 pDot11f->info.IpParams.params.IpV4Params.reserved =
4371 pOld->tclasParams.ipv4.rsvd;
4372 }
4373 else
4374 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304375 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 IpV6Params.source,
4377 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304378 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 IpV6Params.dest,
4380 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4381 pDot11f->info.IpParams.params.IpV6Params.src_port =
4382 pOld->tclasParams.ipv6.srcPort;
4383 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4384 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304385 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004386 IpV6Params.flow_label,
4387 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4388 }
4389 break;
4390 case SIR_MAC_TCLASTYPE_8021DQ:
4391 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4392 break;
4393 default:
4394 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4395 pDot11f->classifier_type );
4396 return eSIR_FAILURE;
4397 }
4398
4399 pDot11f->present = 1;
4400
4401 return eSIR_SUCCESS;
4402
4403} // End PopulateDot11fTCLAS.
4404
4405tSirRetStatus
4406PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4407 tSirTclasInfo *pOld,
4408 tDot11fIEWMMTCLAS *pDot11f)
4409{
4410 pDot11f->version = 1;
4411 pDot11f->user_priority = pOld->tclas.userPrio;
4412 pDot11f->classifier_type = pOld->tclas.classifierType;
4413 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4414
4415 switch ( pDot11f->classifier_type )
4416 {
4417 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304418 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304420 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004421 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4422 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4423 break;
4424 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4425 pDot11f->info.IpParams.version = pOld->version;
4426 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4427 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304428 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004429 IpV4Params.source,
4430 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304431 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004432 IpV4Params.dest,
4433 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4434 pDot11f->info.IpParams.params.IpV4Params.src_port =
4435 pOld->tclasParams.ipv4.srcPort;
4436 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4437 pOld->tclasParams.ipv4.dstPort;
4438 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4439 pOld->tclasParams.ipv4.dscp;
4440 pDot11f->info.IpParams.params.IpV4Params.proto =
4441 pOld->tclasParams.ipv4.protocol;
4442 pDot11f->info.IpParams.params.IpV4Params.reserved =
4443 pOld->tclasParams.ipv4.rsvd;
4444 }
4445 else
4446 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304447 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004448 IpV6Params.source,
4449 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304450 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004451 IpV6Params.dest,
4452 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4453 pDot11f->info.IpParams.params.IpV6Params.src_port =
4454 pOld->tclasParams.ipv6.srcPort;
4455 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4456 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304457 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004458 IpV6Params.flow_label,
4459 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4460 }
4461 break;
4462 case SIR_MAC_TCLASTYPE_8021DQ:
4463 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4464 break;
4465 default:
4466 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4467 pDot11f->classifier_type );
4468 return eSIR_FAILURE;
4469 }
4470
4471 pDot11f->present = 1;
4472
4473 return eSIR_SUCCESS;
4474
4475} // End PopulateDot11fWMMTCLAS.
4476
Jeff Johnson295189b2012-06-20 16:38:30 -07004477
4478tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4479 tDot11fIEWscBeacon *pDot11f)
4480{
4481
4482 tANI_U32 wpsState;
4483
4484 pDot11f->Version.present = 1;
4485 pDot11f->Version.major = 0x01;
4486 pDot11f->Version.minor = 0x00;
4487
4488 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4489 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4490
4491 pDot11f->WPSState.present = 1;
4492 pDot11f->WPSState.state = (tANI_U8) wpsState;
4493
4494 pDot11f->APSetupLocked.present = 0;
4495
4496 pDot11f->SelectedRegistrar.present = 0;
4497
4498 pDot11f->DevicePasswordID.present = 0;
4499
4500 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4501
4502 pDot11f->UUID_E.present = 0;
4503
4504 pDot11f->RFBands.present = 0;
4505
4506 pDot11f->present = 1;
4507 return eSIR_SUCCESS;
4508}
4509
4510tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4511 tDot11fIEWscBeacon *pDot11f)
4512{
4513 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4514 tANI_U32 devicepasswdId;
4515
4516
4517 pDot11f->APSetupLocked.present = 1;
4518 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4519
4520 pDot11f->SelectedRegistrar.present = 1;
4521 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4522
4523 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4524 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4525
4526 pDot11f->DevicePasswordID.present = 1;
4527 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4528
4529 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4530 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4531
4532 // UUID_E and RF Bands are applicable only for dual band AP
4533
4534 return eSIR_SUCCESS;
4535}
4536
4537tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4538 tDot11fIEWscBeacon *pDot11f)
4539{
4540 pDot11f->APSetupLocked.present = 0;
4541 pDot11f->SelectedRegistrar.present = 0;
4542 pDot11f->DevicePasswordID.present = 0;
4543 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4544
4545 return eSIR_SUCCESS;
4546}
Jeff Johnson295189b2012-06-20 16:38:30 -07004547tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4548{
4549
4550 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4551
4552 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4553
4554
4555 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4556 {
4557 pDot11f->present = 1;
4558 pDot11f->Version.present = 1;
4559 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4560 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4561 }
4562 else
4563 {
4564 pDot11f->present = 0;
4565 pDot11f->Version.present = 0;
4566 }
4567
4568 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4569 {
4570
4571 pDot11f->WPSState.present = 1;
4572 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4573 }
4574 else
4575 pDot11f->WPSState.present = 0;
4576
4577 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4578 {
4579 pDot11f->APSetupLocked.present = 1;
4580 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4581 }
4582 else
4583 pDot11f->APSetupLocked.present = 0;
4584
4585 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4586 {
4587 pDot11f->SelectedRegistrar.present = 1;
4588 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4589 }
4590 else
4591 pDot11f->SelectedRegistrar.present = 0;
4592
4593 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4594 {
4595 pDot11f->DevicePasswordID.present = 1;
4596 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4597 }
4598 else
4599 pDot11f->DevicePasswordID.present = 0;
4600
4601 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4602 {
4603 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4604 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4605 }
4606 else
4607 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4608
4609 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4610 {
4611 pDot11f->ResponseType.present = 1;
4612 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4613 }
4614 else
4615 pDot11f->ResponseType.present = 0;
4616
4617 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4618 {
4619 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304620 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 }
4622 else
4623 pDot11f->UUID_E.present = 0;
4624
4625 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4626 {
4627 pDot11f->Manufacturer.present = 1;
4628 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304629 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4630 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004631 }
4632 else
4633 pDot11f->Manufacturer.present = 0;
4634
4635 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4636 {
4637 pDot11f->ModelName.present = 1;
4638 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304639 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4640 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004641 }
4642 else
4643 pDot11f->ModelName.present = 0;
4644
4645 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4646 {
4647 pDot11f->ModelNumber.present = 1;
4648 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304649 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4650 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 }
4652 else
4653 pDot11f->ModelNumber.present = 0;
4654
4655 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4656 {
4657 pDot11f->SerialNumber.present = 1;
4658 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304659 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4660 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004661 }
4662 else
4663 pDot11f->SerialNumber.present = 0;
4664
4665 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4666 {
4667 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304668 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4669 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004670 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4671 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4672 }
4673 else
4674 pDot11f->PrimaryDeviceType.present = 0;
4675
4676 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4677 {
4678 pDot11f->DeviceName.present = 1;
4679 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304680 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4681 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004682 }
4683 else
4684 pDot11f->DeviceName.present = 0;
4685
4686 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4687 {
4688 pDot11f->ConfigMethods.present = 1;
4689 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4690 }
4691 else
4692 pDot11f->ConfigMethods.present = 0;
4693
4694
4695 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4696 {
4697 pDot11f->RFBands.present = 1;
4698 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4699 }
4700 else
4701 pDot11f->RFBands.present = 0;
4702
4703 return eSIR_SUCCESS;
4704}
4705tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4706{
4707 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4708
4709 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4710
4711 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4712 {
4713 pDot11f->present = 1;
4714 pDot11f->Version.present = 1;
4715 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4716 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4717 }
4718 else
4719 {
4720 pDot11f->present = 0;
4721 pDot11f->Version.present = 0;
4722 }
4723
4724 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4725 {
4726 pDot11f->ResponseType.present = 1;
4727 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4728 }
4729 else
4730 pDot11f->ResponseType.present = 0;
4731
4732 return eSIR_SUCCESS;
4733}
4734
4735tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4736{
4737
4738 tSirWPSBeaconIE *pSirWPSBeaconIE;
4739
4740 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4741
4742
4743 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4744 {
4745 pDot11f->present = 1;
4746 pDot11f->Version.present = 1;
4747 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4748 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4749 }
4750 else
4751 {
4752 pDot11f->present = 0;
4753 pDot11f->Version.present = 0;
4754 }
4755
4756 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4757 {
4758
4759 pDot11f->WPSState.present = 1;
4760 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4761 }
4762 else
4763 pDot11f->WPSState.present = 0;
4764
4765 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4766 {
4767 pDot11f->APSetupLocked.present = 1;
4768 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4769 }
4770 else
4771 pDot11f->APSetupLocked.present = 0;
4772
4773 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4774 {
4775 pDot11f->SelectedRegistrar.present = 1;
4776 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4777 }
4778 else
4779 pDot11f->SelectedRegistrar.present = 0;
4780
4781 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4782 {
4783 pDot11f->DevicePasswordID.present = 1;
4784 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4785 }
4786 else
4787 pDot11f->DevicePasswordID.present = 0;
4788
4789 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4790 {
4791 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4792 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4793 }
4794 else
4795 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4796
4797 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4798 {
4799 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304800 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 }
4802 else
4803 pDot11f->UUID_E.present = 0;
4804
4805
4806 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4807 {
4808 pDot11f->RFBands.present = 1;
4809 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4810 }
4811 else
4812 pDot11f->RFBands.present = 0;
4813
4814 return eSIR_SUCCESS;
4815}
Jeff Johnson295189b2012-06-20 16:38:30 -07004816tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4817 tDot11fIEWscProbeRes *pDot11f)
4818{
4819 tANI_U32 cfgMethods;
4820 tANI_U32 cfgStrLen;
4821 tANI_U32 val;
4822 tANI_U32 wpsVersion, wpsState;
4823
4824
4825 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
4826 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
4827
4828 pDot11f->Version.present = 1;
4829 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
4830 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
4831
4832 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4833 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4834
4835 pDot11f->WPSState.present = 1;
4836 pDot11f->WPSState.state = (tANI_U8) wpsState;
4837
4838 pDot11f->APSetupLocked.present = 0;
4839
4840 pDot11f->SelectedRegistrar.present = 0;
4841
4842 pDot11f->DevicePasswordID.present = 0;
4843
4844 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4845
4846 pDot11f->ResponseType.present = 1;
4847 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
4848 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
4849 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4850 }
4851 else{
4852 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4853 }
4854
4855 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
4856 pDot11f->UUID_E.present = 1;
4857 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
4858 if (wlan_cfgGetStr(pMac,
4859 WNI_CFG_WPS_UUID,
4860 pDot11f->UUID_E.uuid,
4861 &cfgStrLen) != eSIR_SUCCESS)
4862 {
4863 *(pDot11f->UUID_E.uuid) = '\0';
4864 }
4865
4866 pDot11f->Manufacturer.present = 1;
4867 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
4868 if (wlan_cfgGetStr(pMac,
4869 WNI_CFG_MANUFACTURER_NAME,
4870 pDot11f->Manufacturer.name,
4871 &cfgStrLen) != eSIR_SUCCESS)
4872 {
4873 pDot11f->Manufacturer.num_name = 0;
4874 *(pDot11f->Manufacturer.name) = '\0';
4875 }
4876 else
4877 {
4878 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
4879 pDot11f->Manufacturer.name[cfgStrLen] = '\0';
4880 }
4881
4882 pDot11f->ModelName.present = 1;
4883 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
4884 if (wlan_cfgGetStr(pMac,
4885 WNI_CFG_MODEL_NAME,
4886 pDot11f->ModelName.text,
4887 &cfgStrLen) != eSIR_SUCCESS)
4888 {
4889 pDot11f->ModelName.num_text = 0;
4890 *(pDot11f->ModelName.text) = '\0';
4891 }
4892 else
4893 {
4894 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4895 pDot11f->ModelName.text[cfgStrLen] = '\0';
4896 }
4897
4898 pDot11f->ModelNumber.present = 1;
4899 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
4900 if (wlan_cfgGetStr(pMac,
4901 WNI_CFG_MODEL_NUMBER,
4902 pDot11f->ModelNumber.text,
4903 &cfgStrLen) != eSIR_SUCCESS)
4904 {
4905 pDot11f->ModelNumber.num_text = 0;
4906 *(pDot11f->ModelNumber.text) = '\0';
4907 }
4908 else
4909 {
4910 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4911 pDot11f->ModelNumber.text[cfgStrLen] = '\0';
4912 }
4913
4914 pDot11f->SerialNumber.present = 1;
4915 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
4916 if (wlan_cfgGetStr(pMac,
4917 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
4918 pDot11f->SerialNumber.text,
4919 &cfgStrLen) != eSIR_SUCCESS)
4920 {
4921 pDot11f->SerialNumber.num_text = 0;
4922 *(pDot11f->SerialNumber.text) = '\0';
4923 }
4924 else
4925 {
4926 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4927 pDot11f->SerialNumber.text[cfgStrLen] = '\0';
4928 }
4929
4930 pDot11f->PrimaryDeviceType.present = 1;
4931
4932 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
4933 {
4934 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
4935 }
4936 else
4937 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
4938
4939 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
4940 {
4941 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
4942 }
4943 else
4944 {
4945 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
4946 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
4947 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
4948 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
4949 }
4950
4951 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
4952 {
4953 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
4954 }
4955 else
4956 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
4957
4958 pDot11f->DeviceName.present = 1;
4959 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
4960 if (wlan_cfgGetStr(pMac,
4961 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
4962 pDot11f->DeviceName.text,
4963 &cfgStrLen) != eSIR_SUCCESS)
4964 {
4965 pDot11f->DeviceName.num_text = 0;
4966 *(pDot11f->DeviceName.text) = '\0';
4967 }
4968 else
4969 {
4970 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4971 pDot11f->DeviceName.text[cfgStrLen] = '\0';
4972 }
4973
4974 if (wlan_cfgGetInt(pMac,
4975 WNI_CFG_WPS_CFG_METHOD,
4976 &cfgMethods) != eSIR_SUCCESS)
4977 {
4978 pDot11f->ConfigMethods.present = 0;
4979 pDot11f->ConfigMethods.methods = 0;
4980 }
4981 else
4982 {
4983 pDot11f->ConfigMethods.present = 1;
4984 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
4985 }
4986
4987 pDot11f->RFBands.present = 0;
4988
4989 pDot11f->present = 1;
4990 return eSIR_SUCCESS;
4991}
4992
4993tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4994 tDot11fIEWscProbeRes *pDot11f)
4995{
4996 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4997 tANI_U32 devicepasswdId;
4998
4999 pDot11f->APSetupLocked.present = 1;
5000 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5001
5002 pDot11f->SelectedRegistrar.present = 1;
5003 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5004
5005 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
5006 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
5007
5008 pDot11f->DevicePasswordID.present = 1;
5009 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5010
5011 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5012 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5013
5014 // UUID_E and RF Bands are applicable only for dual band AP
5015
5016 return eSIR_SUCCESS;
5017}
5018
5019tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5020 tDot11fIEWscProbeRes *pDot11f)
5021{
5022 pDot11f->APSetupLocked.present = 0;
5023 pDot11f->SelectedRegistrar.present = 0;
5024 pDot11f->DevicePasswordID.present = 0;
5025 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5026
5027 return eSIR_SUCCESS;
5028}
5029
5030tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5031 tDot11fIEWscAssocRes *pDot11f,
5032 tpSirAssocReq pRcvdAssocReq)
5033{
5034 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5035 tANI_U8 *wscIe;
5036
5037
5038 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5039 if(wscIe != NULL)
5040 {
5041 // retreive WSC IE from given AssocReq
5042 dot11fUnpackIeWscAssocReq( pMac,
5043 wscIe + 2 + 4, // EID, length, OUI
5044 wscIe[ 1 ] - 4, // length without OUI
5045 &parsedWscAssocReq );
5046 pDot11f->present = 1;
5047 // version has to be 0x10
5048 pDot11f->Version.present = 1;
5049 pDot11f->Version.major = 0x1;
5050 pDot11f->Version.minor = 0x0;
5051
5052 pDot11f->ResponseType.present = 1;
5053
5054 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5055 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5056 {
5057 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5058 }
5059 else
5060 {
5061 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5062 }
5063 // Version infomration should be taken from our capability as well as peers
5064 // TODO: currently it takes from peers only
5065 if(parsedWscAssocReq.VendorExtension.present &&
5066 parsedWscAssocReq.VendorExtension.Version2.present)
5067 {
5068 pDot11f->VendorExtension.present = 1;
5069 pDot11f->VendorExtension.vendorId[0] = 0x00;
5070 pDot11f->VendorExtension.vendorId[1] = 0x37;
5071 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5072 pDot11f->VendorExtension.Version2.present = 1;
5073 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5074 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5075 }
5076 }
5077 return eSIR_SUCCESS;
5078}
5079
Jeff Johnson295189b2012-06-20 16:38:30 -07005080tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5081 tDot11fIEP2PAssocRes *pDot11f,
5082 tpSirAssocReq pRcvdAssocReq)
5083{
5084 tANI_U8 *p2pIe;
5085
5086 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5087 if(p2pIe != NULL)
5088 {
5089 pDot11f->present = 1;
5090 pDot11f->P2PStatus.present = 1;
5091 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5092 pDot11f->ExtendedListenTiming.present = 0;
5093 }
5094 return eSIR_SUCCESS;
5095}
Jeff Johnson295189b2012-06-20 16:38:30 -07005096
5097#if defined WLAN_FEATURE_VOWIFI
5098
5099tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5100 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5101{
5102 pDot11f->txPower = txPower;
5103 pDot11f->linkMargin = linkMargin;
5104 pDot11f->present = 1;
5105
5106 return eSIR_SUCCESS;
5107}
5108
5109tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5110{
5111
5112 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5113 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305114 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5115 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005116 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5117 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5118 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5119 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5120 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305121 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005122 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5123 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5124
5125 if( pBeaconReport->numIes )
5126 {
5127 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305128 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5129 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005130 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5131 }
5132
5133 return eSIR_SUCCESS;
5134
5135}
5136
5137tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5138{
5139 tpRRMCaps pRrmCaps;
5140
5141 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5142
5143 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5144 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5145 pDot11f->parallel = pRrmCaps->parallel ;
5146 pDot11f->repeated = pRrmCaps->repeated ;
5147 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5148 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5149 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5150 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5151 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5152 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5153 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5154 pDot11f->statistics = pRrmCaps->statistics ;
5155 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5156 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5157 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5158 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5159 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5160 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5161 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5162 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5163 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5164 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5165 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5166 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5167 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5168 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5169 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5170 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5171
5172 pDot11f->present = 1;
5173 return eSIR_SUCCESS;
5174}
5175#endif
5176
5177#if defined WLAN_FEATURE_VOWIFI_11R
5178void PopulateMDIE( tpAniSirGlobal pMac,
5179 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5180{
5181 pDot11f->present = 1;
5182 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5183
5184 // Plugfest fix
5185 pDot11f->overDSCap = (mdie[2] & 0x01);
5186 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5187
5188}
5189
5190void PopulateFTInfo( tpAniSirGlobal pMac,
5191 tDot11fIEFTInfo *pDot11f )
5192{
5193 pDot11f->present = 1;
5194 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5195 //All other info is zero.
5196
5197}
5198#endif
5199
5200void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5201 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5202{
5203 tANI_U8 num_supp = 0, num_ext = 0;
5204 tANI_U8 i,j;
5205
5206 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5207 {
5208 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5209 }
5210 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5211 {
5212 if( num_supp < 8 )
5213 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5214 else
5215 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5216 }
5217
5218 if( num_supp )
5219 {
5220 pSupp->num_rates = num_supp;
5221 pSupp->present = 1;
5222 }
5223 if( num_ext )
5224 {
5225 pExt->num_rates = num_ext;
5226 pExt->present = 1;
5227 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005228}
5229
5230void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5231 tDot11fIETimeoutInterval *pDot11f,
5232 tANI_U8 type, tANI_U32 value )
5233{
5234 pDot11f->present = 1;
5235 pDot11f->timeoutType = type;
5236 pDot11f->timeoutValue = value;
5237}
Jeff Johnson295189b2012-06-20 16:38:30 -07005238// parserApi.c ends here.