blob: a13c893ce100016f1f63ffbc946501b7dc5a87ee [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,
769 tDot11fIEVHTCaps *pDot11f)
770{
771 tSirRetStatus nStatus;
772 tANI_U32 nCfgValue=0;
773
774 pDot11f->present = 1;
775
776 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
777 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
778
779 nCfgValue = 0;
780 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
781 nCfgValue );
782 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
783
784 nCfgValue = 0;
785 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
786 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
787
788 nCfgValue = 0;
789 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
790 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
791
792 nCfgValue = 0;
793 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
794 nCfgValue );
795 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
796
797 nCfgValue = 0;
798 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
799 pDot11f->txSTBC = (nCfgValue & 0x0001);
800
801 nCfgValue = 0;
802 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
803 pDot11f->rxSTBC = (nCfgValue & 0x0007);
804
805 nCfgValue = 0;
806 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
807 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
808
809 nCfgValue = 0;
810 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
811 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
812
813 nCfgValue = 0;
814 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
815 nCfgValue );
816 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
817
818 nCfgValue = 0;
819 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
820 nCfgValue );
821 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
822
823 nCfgValue = 0;
824 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
825 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
826
827 nCfgValue = 0;
828 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
829 pDot11f->muBeamformeeCap = (nCfgValue & 0x0001);
830
831 nCfgValue = 0;
832 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
833 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
834
835 nCfgValue = 0;
836 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
837 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
838
839 nCfgValue = 0;
840 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
841 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
842
843 nCfgValue = 0;
844 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
845 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
846
847 nCfgValue = 0;
848 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
849 pDot11f->rxAntPattern = nCfgValue;
850
851 nCfgValue = 0;
852 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
853 pDot11f->txAntPattern = nCfgValue;
854
855 pDot11f->reserved1= 0;
856
857 nCfgValue = 0;
858 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
859 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
860
861 nCfgValue = 0;
862 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
863 nCfgValue );
864 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
865
866 pDot11f->reserved2= 0;
867
868 nCfgValue = 0;
869 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
870 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
871
872 nCfgValue = 0;
873 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
874 nCfgValue );
875 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
876
877 pDot11f->reserved3= 0;
878
879 limLogVHTCap(pMac, pDot11f);
880
881 return eSIR_SUCCESS;
882
883}
884
885tSirRetStatus
886PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
887 tDot11fIEVHTOperation *pDot11f)
888{
889 tSirRetStatus nStatus;
890 tANI_U32 nCfgValue=0;
891
892 pDot11f->present = 1;
893
894 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
895 pDot11f->chanWidth = (tANI_U8)nCfgValue;
896
897 nCfgValue = 0;
898 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
899 nCfgValue );
900 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
901
902 nCfgValue = 0;
903 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
904 nCfgValue );
905 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
906
907 nCfgValue = 0;
908 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
909 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
910
911 limLogVHTOperation(pMac,pDot11f);
912
913 return eSIR_SUCCESS;
914
915}
916
917tSirRetStatus
918PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
919 tDot11fIEVHTExtBssLoad *pDot11f)
920{
921 tSirRetStatus nStatus;
922 tANI_U32 nCfgValue=0;
923
924 pDot11f->present = 1;
925
926 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
927 nCfgValue );
928 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
929
930 nCfgValue = 0;
931 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
932 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
933
934 nCfgValue=0;
935 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
936 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
937
938 nCfgValue=0;
939 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
940 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
941
942 nCfgValue=0;
943 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
944 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
945
946 limLogVHTExtBssLoad(pMac,pDot11f);
947
948 return eSIR_SUCCESS;
949}
950
Mohit Khanna4a70d262012-09-11 16:30:12 -0700951tSirRetStatus
952PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +0530953 tDot11fIEExtCap *pDot11f,
954 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700955{
Sandeep Puligilla60342762014-01-30 21:05:37 +0530956 tANI_U32 val;
957
Mohit Khanna4a70d262012-09-11 16:30:12 -0700958 pDot11f->present = 1;
Sandeep Puligilla60342762014-01-30 21:05:37 +0530959#ifdef WLAN_FEATURE_11AC
960 if (psessionEntry->vhtCapability)
961 pDot11f->operModeNotification = 1;
962#endif
963 /* while operating in 2.4GHz only then STA need to advertize
964 the bss co-ex capability*/
965 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
966 {
967 if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_24G, &val) !=
968 eSIR_SUCCESS)
969 PELOGE(limLog(pMac, LOGE, FL("could not retrieve "
970 "24G Chan bond Length \n"));)
971 if (TRUE == val)
972 pDot11f->bssCoexistMgmtSupport = 1;
973 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700974 return eSIR_SUCCESS;
975}
976
977tSirRetStatus
978PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
979 tDot11fIEOperatingMode *pDot11f,
980 tpPESession psessionEntry)
981{
982 pDot11f->present = 1;
983
984 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
985 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
986 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
987
988 return eSIR_SUCCESS;
989}
Jeff Johnsone7245742012-09-05 17:12:55 -0700990
991#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700992tSirRetStatus
993PopulateDot11fHTInfo(tpAniSirGlobal pMac,
994 tDot11fIEHTInfo *pDot11f,
995 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -0700996{
997 tANI_U32 nCfgValue, nCfgLen;
998 tANI_U8 htInfoField1;
999 tANI_U16 htInfoField2;
1000 tSirRetStatus nSirStatus;
1001 tSirMacHTInfoField1 *pHTInfoField1;
1002 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 union {
1004 tANI_U16 nCfgValue16;
1005 tSirMacHTInfoField3 infoField3;
1006 }uHTInfoField;
1007 union {
1008 tANI_U16 nCfgValue16;
1009 tSirMacHTInfoField2 infoField2;
1010 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001011
Jeff Johnson295189b2012-06-20 16:38:30 -07001012
1013 #if 0
1014 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1015 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301016
1017 if (NULL == psessionEntry)
1018 {
1019 PELOGE(limLog(pMac, LOG1,
1020 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
1021 return eSIR_FAILURE;
1022 }
1023
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1025
1026 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1027
1028 htInfoField1 = ( tANI_U8 ) nCfgValue;
1029
1030 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1032 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1033
Jeff Johnsone7245742012-09-05 17:12:55 -07001034 if (psessionEntry == NULL)
1035 {
1036 PELOGE(limLog(pMac, LOG1,
1037 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
1038 }
1039 else
1040 {
1041 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1042 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001044
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001045 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1047
1048 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1049
1050 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1051 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1052 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1053
1054 uHTInfoField2.infoField2.reserved = 0;
1055
1056 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1058
1059 htInfoField2 = ( tANI_U16 ) nCfgValue;
1060
1061 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1062 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1063 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1064 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1065
1066 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001068
1069 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1070
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1073
1074
1075 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1076 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1077 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1078 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1079 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1080 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1081 uHTInfoField.infoField3.reserved = 0;
1082
Jeff Johnson295189b2012-06-20 16:38:30 -07001083
1084 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1085 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1086 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1087 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1088 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1089
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1091 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1092 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1093 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1094
Jeff Johnson295189b2012-06-20 16:38:30 -07001095
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1097 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1098 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1099 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1100 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1101 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1102 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1104 pDot11f->basicMCSSet, nCfgLen,
1105 SIZE_OF_BASIC_MCS_SET );
1106
1107 pDot11f->present = 1;
1108
1109 return eSIR_SUCCESS;
1110
1111} // End PopulateDot11fHTInfo.
1112
1113void
1114PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1115 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1116{
1117 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1118 {
1119 pDot11f->present = 1;
1120 // ATIM duration is always set to 0
1121 pDot11f->atim = 0;
1122 }
1123
1124} // End PopulateDot11fIBSSParams.
1125
1126
1127#ifdef ANI_SUPPORT_11H
1128tSirRetStatus
1129PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1130 tpSirMacMeasReqActionFrame pReq,
1131 tDot11fIEMeasurementReport *pDot11f)
1132{
1133 pDot11f->token = pReq->measReqIE.measToken;
1134 pDot11f->late = 0;
1135 pDot11f->incapable = 0;
1136 pDot11f->refused = 1;
1137 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1138
1139 pDot11f->present = 1;
1140
1141 return eSIR_SUCCESS;
1142
1143} // End PopulatedDot11fMeasurementReport0.
1144
1145tSirRetStatus
1146PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1147 tpSirMacMeasReqActionFrame pReq,
1148 tDot11fIEMeasurementReport *pDot11f)
1149{
1150 pDot11f->token = pReq->measReqIE.measToken;
1151 pDot11f->late = 0;
1152 pDot11f->incapable = 0;
1153 pDot11f->refused = 1;
1154 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1155
1156 pDot11f->present = 1;
1157
1158 return eSIR_SUCCESS;
1159
1160} // End PopulatedDot11fMeasurementReport1.
1161
1162tSirRetStatus
1163PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1164 tpSirMacMeasReqActionFrame pReq,
1165 tDot11fIEMeasurementReport *pDot11f)
1166{
1167 pDot11f->token = pReq->measReqIE.measToken;
1168 pDot11f->late = 0;
1169 pDot11f->incapable = 0;
1170 pDot11f->refused = 1;
1171 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1172
1173 pDot11f->present = 1;
1174
1175 return eSIR_SUCCESS;
1176
1177} // End PopulatedDot11fMeasurementReport2.
1178#endif
1179
1180void
1181PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1182 tDot11fIEPowerCaps *pCaps,
1183 tANI_U8 nAssocType,
1184 tpPESession psessionEntry)
1185{
1186 if (nAssocType == LIM_REASSOC)
1187 {
1188 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1189 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1190 }else
1191 {
1192 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1193 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1194
1195 }
1196
1197 pCaps->present = 1;
1198} // End PopulateDot11fPowerCaps.
1199
1200tSirRetStatus
1201PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1202 tDot11fIEPowerConstraints *pDot11f)
1203{
1204 tANI_U32 cfg;
1205 tSirRetStatus nSirStatus;
1206
1207 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1208
1209 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1210 pDot11f->present = 1;
1211
1212 return eSIR_SUCCESS;
1213} // End PopulateDot11fPowerConstraints.
1214
1215void
1216PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1217 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1218{
1219 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1220 pDot11f->reserved = 0;
1221 pDot11f->txopreq = 0;
1222 pDot11f->qreq = 0;
1223 pDot11f->qack = 0;
1224 pDot11f->present = 1;
1225} // End PopulatedDot11fQOSCaps.
1226
1227void
1228PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1229 tDot11fIEQOSCapsStation *pDot11f)
1230{
1231 tANI_U32 val = 0;
1232
1233 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1234 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1235
1236 pDot11f->more_data_ack = 0;
1237 pDot11f->max_sp_length = (tANI_U8)val;
1238 pDot11f->qack = 0;
1239
1240 if (pMac->lim.gUapsdEnable)
1241 {
1242 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1243 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1244 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1245 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1246 }
1247 pDot11f->present = 1;
1248} // End PopulatedDot11fQOSCaps.
1249
1250tSirRetStatus
1251PopulateDot11fRSN(tpAniSirGlobal pMac,
1252 tpSirRSNie pRsnIe,
1253 tDot11fIERSN *pDot11f)
1254{
1255 tANI_U32 status;
1256 int idx;
1257
1258 if ( pRsnIe->length )
1259 {
1260 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1261 {
1262 status = dot11fUnpackIeRSN( pMac,
1263 pRsnIe->rsnIEdata + idx + 2, //EID, length
1264 pRsnIe->rsnIEdata[ idx + 1 ],
1265 pDot11f );
1266 if ( DOT11F_FAILED( status ) )
1267 {
1268 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1269 "N (0x%08x).\n"),
1270 status );
1271 return eSIR_FAILURE;
1272 }
1273 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1274 "PopulateDot11fRSN.\n"), status );
1275 }
1276
1277 }
1278
1279 return eSIR_SUCCESS;
1280} // End PopulateDot11fRSN.
1281
1282tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1283 tpSirRSNie pRsnIe,
1284 tDot11fIERSNOpaque *pDot11f )
1285{
1286 int idx;
1287
1288 if ( pRsnIe->length )
1289 {
1290 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1291 {
1292 pDot11f->present = 1;
1293 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301294 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 pRsnIe->rsnIEdata + idx + 2, // EID, len
1296 pRsnIe->rsnIEdata[ idx + 1 ] );
1297 }
1298 }
1299
1300 return eSIR_SUCCESS;
1301
1302} // End PopulateDot11fRSNOpaque.
1303
1304
1305
1306#if defined(FEATURE_WLAN_WAPI)
1307
1308tSirRetStatus
1309PopulateDot11fWAPI(tpAniSirGlobal pMac,
1310 tpSirRSNie pRsnIe,
1311 tDot11fIEWAPI *pDot11f)
1312 {
1313 tANI_U32 status;
1314 int idx;
1315
1316 if ( pRsnIe->length )
1317 {
1318 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1319 {
1320 status = dot11fUnpackIeWAPI( pMac,
1321 pRsnIe->rsnIEdata + idx + 2, //EID, length
1322 pRsnIe->rsnIEdata[ idx + 1 ],
1323 pDot11f );
1324 if ( DOT11F_FAILED( status ) )
1325 {
1326 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1327 status );
1328 return eSIR_FAILURE;
1329 }
1330 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1331 "PopulateDot11fWAPI.\n"), status );
1332 }
1333 }
1334
1335 return eSIR_SUCCESS;
1336} // End PopulateDot11fWAPI.
1337
1338tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1339 tpSirRSNie pRsnIe,
1340 tDot11fIEWAPIOpaque *pDot11f )
1341{
1342 int idx;
1343
1344 if ( pRsnIe->length )
1345 {
1346 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1347 {
1348 pDot11f->present = 1;
1349 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301350 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 pRsnIe->rsnIEdata + idx + 2, // EID, len
1352 pRsnIe->rsnIEdata[ idx + 1 ] );
1353 }
1354 }
1355
1356 return eSIR_SUCCESS;
1357
1358} // End PopulateDot11fWAPIOpaque.
1359
1360
1361#endif //defined(FEATURE_WLAN_WAPI)
1362
1363void
1364PopulateDot11fSSID(tpAniSirGlobal pMac,
1365 tSirMacSSid *pInternal,
1366 tDot11fIESSID *pDot11f)
1367{
1368 pDot11f->present = 1;
1369 pDot11f->num_ssid = pInternal->length;
1370 if ( pInternal->length )
1371 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301372 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 pInternal->length );
1374 }
1375} // End PopulateDot11fSSID.
1376
1377tSirRetStatus
1378PopulateDot11fSSID2(tpAniSirGlobal pMac,
1379 tDot11fIESSID *pDot11f)
1380{
1381 tANI_U32 nCfg;
1382 tSirRetStatus nSirStatus;
1383
1384 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1385 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1386 pDot11f->present = 1;
1387 return eSIR_SUCCESS;
1388} // End PopulateDot11fSSID2.
1389
1390void
1391PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1392 tDot11fIESchedule *pDot11f)
1393{
1394 pDot11f->aggregation = pSchedule->info.aggregation;
1395 pDot11f->tsid = pSchedule->info.tsid;
1396 pDot11f->direction = pSchedule->info.direction;
1397 pDot11f->reserved = pSchedule->info.rsvd;
1398 pDot11f->service_start_time = pSchedule->svcStartTime;
1399 pDot11f->service_interval = pSchedule->svcInterval;
1400 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1401 pDot11f->spec_interval = pSchedule->specInterval;
1402
1403 pDot11f->present = 1;
1404} // End PopulateDot11fSchedule.
1405
1406void
1407PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1408 tDot11fIESuppChannels *pDot11f,
1409 tANI_U8 nAssocType,
1410 tpPESession psessionEntry)
1411{
1412 tANI_U8 i;
1413 tANI_U8 *p;
1414
1415 if (nAssocType == LIM_REASSOC)
1416 {
1417 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1418 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1419 }else
1420 {
1421 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1422 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1423 }
1424 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1425 {
1426 pDot11f->bands[i][0] = *p;
1427 pDot11f->bands[i][1] = 1;
1428 }
1429
1430 pDot11f->present = 1;
1431
1432} // End PopulateDot11fSuppChannels.
1433
1434tSirRetStatus
1435PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1436 tANI_U8 nChannelNum,
1437 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1438{
1439 tSirRetStatus nSirStatus;
1440 tANI_U32 nRates;
1441 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1442
1443 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1444 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1445 sending mgmt frames (lile probe req) which need to go out before any session is present.
1446 */
1447 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1448 {
1449 #if 0
1450 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1451 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1452 #endif //TO SUPPORT BT-AMP
1453 if(psessionEntry != NULL)
1454 {
1455 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301456 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 nRates);
1458 }
1459 else
1460 {
1461 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1462 nRates = 0;
1463 }
1464 }
1465 else if ( 14 >= nChannelNum )
1466 {
1467 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1468 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1469 }
1470 else
1471 {
1472 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1473 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1474 }
1475
1476 if ( 0 != nRates )
1477 {
1478 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301479 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 pDot11f->present = 1;
1481 }
1482
1483 return eSIR_SUCCESS;
1484
1485} // End PopulateDot11fSuppRates.
1486
1487tSirRetStatus
1488PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1489 tDot11fIETPCReport *pDot11f,
1490 tpPESession psessionEntry)
1491{
1492 tANI_U16 staid, txPower;
1493 tSirRetStatus nSirStatus;
1494
1495 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1496 if ( eSIR_SUCCESS != nSirStatus )
1497 {
1498 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1499 "eDot11fTPCReport; limGetMgmtStaid "
1500 "returned status %d.\n"),
1501 nSirStatus );
1502 return eSIR_FAILURE;
1503 }
1504
1505 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1506 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1507 txPower = 0;
1508 pDot11f->tx_power = ( tANI_U8 )txPower;
1509 pDot11f->link_margin = 0;
1510 pDot11f->present = 1;
1511
1512 return eSIR_SUCCESS;
1513} // End PopulateDot11fTPCReport.
1514
1515
1516void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1517 tDot11fFfTSInfo *pDot11f)
1518{
1519 pDot11f->traffic_type = pInfo->traffic.trafficType;
1520 pDot11f->tsid = pInfo->traffic.tsid;
1521 pDot11f->direction = pInfo->traffic.direction;
1522 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1523 pDot11f->aggregation = pInfo->traffic.aggregation;
1524 pDot11f->psb = pInfo->traffic.psb;
1525 pDot11f->user_priority = pInfo->traffic.userPrio;
1526 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1527 pDot11f->schedule = pInfo->schedule.schedule;
1528} // End PopulatedDot11fTSInfo.
1529
1530void PopulateDot11fWMM(tpAniSirGlobal pMac,
1531 tDot11fIEWMMInfoAp *pInfo,
1532 tDot11fIEWMMParams *pParams,
1533 tDot11fIEWMMCaps *pCaps,
1534 tpPESession psessionEntry)
1535{
1536 if ( psessionEntry->limWmeEnabled )
1537 {
1538 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1539 {
1540 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1541 {
1542 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1543 }
1544 }
1545 else
1546 {
1547 {
1548 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1549 }
1550
1551 if ( psessionEntry->limWsmEnabled )
1552 {
1553 PopulateDot11fWMMCaps( pCaps );
1554 }
1555 }
1556 }
1557} // End PopulateDot11fWMM.
1558
1559void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1560{
1561 pCaps->version = SIR_MAC_OUI_VERSION_1;
1562 pCaps->qack = 0;
1563 pCaps->queue_request = 1;
1564 pCaps->txop_request = 0;
1565 pCaps->more_ack = 0;
1566 pCaps->present = 1;
1567} // End PopulateDot11fWmmCaps.
1568
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001569#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001570void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1571{
1572 tANI_U8 numTspecs = 0, idx;
1573 tTspecInfo *pTspec = NULL;
1574
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001575 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1576 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 pReassoc->num_WMMTSPEC = numTspecs;
1578 if (numTspecs) {
1579 for (idx=0; idx<numTspecs; idx++) {
1580 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sandeep Puligillaa4c9ff52014-05-30 01:20:02 +05301581 pTspec->tspec.medium_time = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 pTspec++;
1583 }
1584 }
1585}
1586#endif
1587
1588void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1589 tpPESession psessionEntry)
1590{
1591 pInfo->version = SIR_MAC_OUI_VERSION_1;
1592
1593 /* WMM Specification 3.1.3, 3.2.3
1594 * An IBSS staion shall always use its default WMM parameters.
1595 */
1596 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1597 {
1598 pInfo->param_set_count = 0;
1599 pInfo->uapsd = 0;
1600 }
1601 else
1602 {
1603 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1605 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1606 }
1607 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1609 }
1610 pInfo->present = 1;
1611}
1612
1613void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1614{
1615 tANI_U32 val = 0;
1616
1617 pInfo->version = SIR_MAC_OUI_VERSION_1;
1618 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1619 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1620 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1621 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1622
1623 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1624 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1625
1626 pInfo->max_sp_length = (tANI_U8)val;
1627 pInfo->present = 1;
1628}
1629
Jeff Johnson295189b2012-06-20 16:38:30 -07001630void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1631 tDot11fIEWMMParams *pParams,
1632 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001633{
1634 pParams->version = SIR_MAC_OUI_VERSION_1;
1635
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1637 pParams->qosInfo =
1638 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1639 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 pParams->qosInfo =
1641 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1642
1643 // Fill each EDCA parameter set in order: be, bk, vi, vo
1644 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1645 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1646 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1647 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1648 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1649 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1650
1651 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1652 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1653 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1654 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1655 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1656 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1657
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1659 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1660 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1662
1663
1664
1665 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1666 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1667 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1668 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1669 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1670
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1672 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1673 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1675
1676 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1677 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1678 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1679 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1680 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1681
1682 pParams->present = 1;
1683
1684} // End PopulateDot11fWMMParams.
1685
1686void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1687 tDot11fIEWMMSchedule *pDot11f)
1688{
1689 pDot11f->version = 1;
1690 pDot11f->aggregation = pSchedule->info.aggregation;
1691 pDot11f->tsid = pSchedule->info.tsid;
1692 pDot11f->direction = pSchedule->info.direction;
1693 pDot11f->reserved = pSchedule->info.rsvd;
1694 pDot11f->service_start_time = pSchedule->svcStartTime;
1695 pDot11f->service_interval = pSchedule->svcInterval;
1696 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1697 pDot11f->spec_interval = pSchedule->specInterval;
1698
1699 pDot11f->present = 1;
1700} // End PopulateDot11fWMMSchedule.
1701
1702tSirRetStatus
1703PopulateDot11fWPA(tpAniSirGlobal pMac,
1704 tpSirRSNie pRsnIe,
1705 tDot11fIEWPA *pDot11f)
1706{
1707 tANI_U32 status;
1708 int idx;
1709
1710 if ( pRsnIe->length )
1711 {
1712 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1713 {
1714 status = dot11fUnpackIeWPA( pMac,
1715 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1716 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1717 pDot11f );
1718 if ( DOT11F_FAILED( status ) )
1719 {
1720 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1721 "A (0x%08x).\n"),
1722 status );
1723 return eSIR_FAILURE;
1724 }
1725 }
1726 }
1727
1728 return eSIR_SUCCESS;
1729} // End PopulateDot11fWPA.
1730
1731
1732
1733tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1734 tpSirRSNie pRsnIe,
1735 tDot11fIEWPAOpaque *pDot11f )
1736{
1737 int idx;
1738
1739 if ( pRsnIe->length )
1740 {
1741 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1742 {
1743 pDot11f->present = 1;
1744 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301745 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001746 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1747 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1748 }
1749 }
1750
1751 return eSIR_SUCCESS;
1752
1753} // End PopulateDot11fWPAOpaque.
1754
1755////////////////////////////////////////////////////////////////////////
1756
1757tSirRetStatus
1758sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1759{
1760#if 0
1761 tANI_U32 val;
1762
1763 *caps = 0;
1764 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1765 != eSIR_SUCCESS)
1766 {
1767 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1768 return eSIR_FAILURE;
1769 }
1770 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1771 {
1772 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1773 return eSIR_FAILURE;
1774 }
1775
1776 *caps = (tANI_U16) val;
1777#endif
1778 return eSIR_SUCCESS;
1779}
1780
1781tSirRetStatus
1782sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1783 tANI_U8 *pFrame,
1784 tANI_U32 nFrame,
1785 tpSirProbeReq pProbeReq)
1786{
1787 tANI_U32 status;
1788 tDot11fProbeRequest pr;
1789
1790 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301791 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001792
1793 // delegate to the framesc-generated code,
1794 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1795 if ( DOT11F_FAILED( status ) )
1796 {
1797 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1798 status, nFrame);
1799 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1800 return eSIR_FAILURE;
1801 }
1802 else if ( DOT11F_WARNED( status ) )
1803 {
1804 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1805 status, nFrame );
1806 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1807 }
1808
1809 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1810 if ( ! pr.SSID.present )
1811 {
1812 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1813 }
1814 else
1815 {
1816 pProbeReq->ssidPresent = 1;
1817 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
1818 }
1819
1820 if ( ! pr.SuppRates.present )
1821 {
1822 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1823 return eSIR_FAILURE;
1824 }
1825 else
1826 {
1827 pProbeReq->suppRatesPresent = 1;
1828 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
1829 }
1830
1831 if ( pr.ExtSuppRates.present )
1832 {
1833 pProbeReq->extendedRatesPresent = 1;
1834 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
1835 }
1836
1837 if ( pr.HTCaps.present )
1838 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301839 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 }
1841
1842 if ( pr.WscProbeReq.present )
1843 {
1844 pProbeReq->wscIePresent = 1;
1845 memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
1846 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001847#ifdef WLAN_FEATURE_11AC
1848 if ( pr.VHTCaps.present )
1849 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301850 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07001851 }
1852#endif
1853
Jeff Johnson295189b2012-06-20 16:38:30 -07001854
1855 if ( pr.P2PProbeReq.present )
1856 {
1857 pProbeReq->p2pIePresent = 1;
1858 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001859
Jeff Johnson295189b2012-06-20 16:38:30 -07001860 return eSIR_SUCCESS;
1861
1862} // End sirConvertProbeReqFrame2Struct.
1863
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301864/* function ValidateAndRectifyIEs checks for the malformed frame.
1865 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301866 * (Tagged elements).
1867 * Every Tagged IE has tag number, tag length and data. Tag length indicates
1868 * the size of data in bytes.
1869 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301870 * And also rectifies missing optional fields in IE.
1871 *
1872 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
1873 * extended to rectify other optional fields in other IEs.
1874 *
1875 */
1876tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
1877 tANI_U8 *pMgmtFrame,
1878 tANI_U32 nFrameBytes,
1879 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301880{
1881 tANI_U32 length = SIZE_OF_FIXED_PARAM;
1882 tANI_U8 *refFrame;
1883
1884 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301885 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301886 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301887 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301888 {
1889 /*refFrame points to next IE */
1890 refFrame = pMgmtFrame + length;
1891 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
1892 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
1893 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301894 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301895 {
1896 /* Workaround : Some APs may not include RSN Capability but
1897 * the length of which is included in RSN IE length.
1898 * this may cause in updating RSN Capability with junk value.
1899 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301900 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301901 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301902 if ((*refFrame == RSNIEID) &&
1903 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301904 {
1905 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301906 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301907 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301908 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301909 limLog(pMac, LOG1,
1910 FL("Added RSN Capability to the RSNIE as 0x00 0x00\n"));
1911
1912 return eHAL_STATUS_SUCCESS;
1913 }
1914 return eSIR_FAILURE;
1915 }
1916 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301917 return eHAL_STATUS_SUCCESS;
1918}
1919
Jeff Johnson295189b2012-06-20 16:38:30 -07001920tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
1921 tANI_U8 *pFrame,
1922 tANI_U32 nFrame,
1923 tpSirProbeRespBeacon pProbeResp)
1924{
1925 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001926 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07001927
1928 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301929 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001930
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301931 pr = vos_mem_malloc(sizeof(tDot11fProbeResponse));
1932 if ( NULL == pr )
1933 status = eHAL_STATUS_FAILURE;
1934 else
1935 status = eHAL_STATUS_SUCCESS;
1936 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07001937 {
1938 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
1939 return eSIR_FAILURE;
1940 }
1941
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301942 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07001943
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07001945 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 if ( DOT11F_FAILED( status ) )
1947 {
1948 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
1949 status, nFrame);
1950 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301951 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 return eSIR_FAILURE;
1953 }
1954 else if ( DOT11F_WARNED( status ) )
1955 {
1956 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
1957 status, nFrame );
1958 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1959 }
1960
1961 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
1962
1963 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301964 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
1965 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001966
1967 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07001968 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07001969
1970 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07001971 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
1972 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
1973 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
1974 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
1975 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
1976 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
1977 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
1978 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
1979 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
1980 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
1981 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
1982 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
1983 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
1984 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
1985 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
1986 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07001987
Jeff Johnson32d95a32012-09-10 13:15:23 -07001988 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001989 {
1990 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1991 }
1992 else
1993 {
1994 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001995 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 }
1997
Jeff Johnson32d95a32012-09-10 13:15:23 -07001998 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 {
2000 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2001 }
2002 else
2003 {
2004 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002005 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 }
2007
Jeff Johnson32d95a32012-09-10 13:15:23 -07002008 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 {
2010 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002011 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002012 }
2013
2014
Jeff Johnson32d95a32012-09-10 13:15:23 -07002015 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 {
2017 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002018 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 }
2020
Jeff Johnson32d95a32012-09-10 13:15:23 -07002021 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 {
2023 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002024 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 }
2026
Jeff Johnson32d95a32012-09-10 13:15:23 -07002027 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 {
2029 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002030 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 }
2032
Jeff Johnson32d95a32012-09-10 13:15:23 -07002033 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 {
2035 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302036 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 sizeof(tDot11fIEExtChanSwitchAnn) );
2038 }
2039
Jeff Johnson32d95a32012-09-10 13:15:23 -07002040 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 {
2042 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302043 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 sizeof(tDot11fIEExtChanSwitchAnn) );
2045 }
2046
Jeff Johnson32d95a32012-09-10 13:15:23 -07002047 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 {
2049 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302050 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002051 }
2052
Jeff Johnson32d95a32012-09-10 13:15:23 -07002053 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 {
2055 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302056 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2057 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 }
2059
Jeff Johnson32d95a32012-09-10 13:15:23 -07002060 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 {
2062 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302063 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 }
2065
Jeff Johnson32d95a32012-09-10 13:15:23 -07002066 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302068 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 }
2070
Jeff Johnson32d95a32012-09-10 13:15:23 -07002071 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302073 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 }
2075
Jeff Johnson32d95a32012-09-10 13:15:23 -07002076 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 {
2078 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002079 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002081 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002083 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 }
2085
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002086 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 {
2088 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002089 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 }
2091
Jeff Johnson32d95a32012-09-10 13:15:23 -07002092 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 {
2094 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002095 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 }
2097
Jeff Johnson32d95a32012-09-10 13:15:23 -07002098 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 {
2100 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002101 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002103 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 }
2105
Jeff Johnson32d95a32012-09-10 13:15:23 -07002106 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 {
2108 pProbeResp->wmeInfoPresent = 1;
2109 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2110 }
2111
Jeff Johnson32d95a32012-09-10 13:15:23 -07002112 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 {
2114 pProbeResp->wsmCapablePresent = 1;
2115 }
2116
2117
Jeff Johnson32d95a32012-09-10 13:15:23 -07002118 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 {
2120 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002121 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 }
2123
2124#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002125 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 {
2127 // MobilityDomain
2128 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302129 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2130 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002131 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002132#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002133 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2135#endif
2136 }
2137#endif
2138
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002139#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002140 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302142 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 }
2144#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002145 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302147 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 sizeof(tDot11fIEP2PProbeRes) );
2149 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002150#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002151 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002152 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302153 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002154 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002155 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002156 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302157 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002158 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002159 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002160 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302161 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002162 }
2163#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302164 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002165 return eSIR_SUCCESS;
2166
2167} // End sirConvertProbeFrame2Struct.
2168
2169tSirRetStatus
2170sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2171 tANI_U8 *pFrame,
2172 tANI_U32 nFrame,
2173 tpSirAssocReq pAssocReq)
2174{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002175 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 tANI_U32 status;
2177
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302178 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2179 if ( NULL == ar )
2180 status = eHAL_STATUS_FAILURE;
2181 else
2182 status = eHAL_STATUS_SUCCESS;
2183 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002184 {
2185 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2186 return eSIR_FAILURE;
2187 }
2188 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302189 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2190 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002191
2192 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002193 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 if ( DOT11F_FAILED( status ) )
2195 {
2196 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2197 status, nFrame);
2198 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302199 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 return eSIR_FAILURE;
2201 }
2202 else if ( DOT11F_WARNED( status ) )
2203 {
2204 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2205 status, nFrame );
2206 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2207 }
2208
2209 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2210
2211 // make sure this is seen as an assoc request
2212 pAssocReq->reassocRequest = 0;
2213
2214 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002215 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2216 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2217 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2218 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2219 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2220 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2221 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2222 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2223 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2224 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2225 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2226 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2227 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2228 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2229 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2230 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002231
2232 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002233 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002234
2235 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002236 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 {
2238 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002239 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 }
2241
2242 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002243 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 {
2245 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002246 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 }
2248
2249 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002250 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002251 {
2252 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002253 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 }
2255
2256 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002257 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 {
2259 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002260 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 }
2262
2263 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002264 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 {
2266 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002267 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 }
2269
2270 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002271 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 {
2273 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002274 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 }
2276
2277 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002278 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 {
2280 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002281 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 }
2283
2284
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002285 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 {
2287 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002288 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002290#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002291 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002292 {
2293 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002294 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002295 }
2296#endif
2297
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002299 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 {
2301 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002302 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 }
2304
2305 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002306 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 {
2308 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002309 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 }
2311
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002312 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302314 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 }
2316
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002317 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 {
2319 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302320 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2321 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002322
2323 }
2324
2325
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002326 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002327
2328 if ( ! pAssocReq->ssidPresent )
2329 {
2330 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302331 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 return eSIR_FAILURE;
2333 }
2334
2335 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2336 {
2337 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302338 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002339 return eSIR_FAILURE;
2340 }
2341
Jeff Johnsone7245742012-09-05 17:12:55 -07002342#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002343 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002344 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302345 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002346 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2347 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2348 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002349 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002350 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302351 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002352 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2353 limLogOperatingMode( pMac, &pAssocReq->operMode);
2354 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002355#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302356 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002357 return eSIR_SUCCESS;
2358
2359} // End sirConvertAssocReqFrame2Struct.
2360
2361tSirRetStatus
2362sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2363 tANI_U8 *pFrame,
2364 tANI_U32 nFrame,
2365 tpSirAssocRsp pAssocRsp)
2366{
2367 static tDot11fAssocResponse ar;
2368 tANI_U32 status;
2369 tANI_U8 cnt =0;
2370
2371 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302372 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002373
2374 // delegate to the framesc-generated code,
2375 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2376 if ( DOT11F_FAILED( status ) )
2377 {
2378 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2379 status, nFrame);
2380 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2381 return eSIR_FAILURE;
2382 }
2383 else if ( DOT11F_WARNED( status ) )
2384 {
2385 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2386 status, nFrame );
2387 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2388 }
2389
2390 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2391
2392 // Capabilities
2393 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2394 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2395 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2396 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2397 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2398 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2399 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2400 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2401 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2402 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2403 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2404 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2405 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2406 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2407 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2408 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2409
2410 pAssocRsp->statusCode = ar.Status.status;
2411 pAssocRsp->aid = ar.AID.associd;
2412
2413 if ( ! ar.SuppRates.present )
2414 {
2415 pAssocRsp->suppRatesPresent = 0;
2416 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2417 }
2418 else
2419 {
2420 pAssocRsp->suppRatesPresent = 1;
2421 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2422 }
2423
2424 if ( ar.ExtSuppRates.present )
2425 {
2426 pAssocRsp->extendedRatesPresent = 1;
2427 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2428 }
2429
2430 if ( ar.EDCAParamSet.present )
2431 {
2432 pAssocRsp->edcaPresent = 1;
2433 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2434 }
2435
2436
2437 if ( ar.WMMParams.present )
2438 {
2439 pAssocRsp->wmeEdcaPresent = 1;
2440 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002441 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 __printWMMParams(pMac, &ar.WMMParams);
2443 }
2444
2445 if ( ar.HTCaps.present )
2446 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302447 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 }
2449
2450 if ( ar.HTInfo.present )
2451 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302452 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002453 }
2454
2455#ifdef WLAN_FEATURE_VOWIFI_11R
2456 if (ar.MobilityDomain.present)
2457 {
2458 // MobilityDomain
2459 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302460 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2461 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002462 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2463#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002464 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002465 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2466#endif
2467 }
2468
2469 if ( ar.FTInfo.present )
2470 {
2471#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002472 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 -07002473 ar.FTInfo.R0KH_ID.present,
2474 ar.FTInfo.R1KH_ID.present);
2475#endif
2476 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302477 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002478 }
2479#endif
2480
2481#ifdef WLAN_FEATURE_VOWIFI_11R
2482 if (ar.num_RICDataDesc) {
2483 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2484 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302485 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2486 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002487 }
2488 }
2489 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2490 pAssocRsp->ricPresent = TRUE;
2491 }
2492#endif
2493
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002494#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002495 if (ar.num_WMMTSPEC) {
2496 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2497 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302498 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2499 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002500 }
2501 pAssocRsp->tspecPresent = TRUE;
2502 }
2503
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002504 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 {
2506 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302507 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002508 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002509 }
2510#endif
2511
Jeff Johnsone7245742012-09-05 17:12:55 -07002512#ifdef WLAN_FEATURE_11AC
2513 if ( ar.VHTCaps.present )
2514 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302515 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002516 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002517 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2518 }
2519 if ( ar.VHTOperation.present )
2520 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302521 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002522 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002523 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2524 }
2525#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302526 if(ar.OBSSScanParameters.present)
2527 {
2528 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2529 sizeof( tDot11fIEOBSSScanParameters));
2530 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002531 if ( ar.QosMapSet.present )
2532 {
2533 pMac->QosMapSet.present = 1;
2534 ConvertQosMapsetFrame( pMac, &pMac->QosMapSet, &ar.QosMapSet);
2535 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
2536 limLogQosMapSet(pMac, &pMac->QosMapSet);
2537 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002539} // End sirConvertAssocRespFrame2Struct.
2540
2541tSirRetStatus
2542sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2543 tANI_U8 *pFrame,
2544 tANI_U32 nFrame,
2545 tpSirAssocReq pAssocReq)
2546{
2547 static tDot11fReAssocRequest ar;
2548 tANI_U32 status;
2549
2550 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302551 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002552
2553 // delegate to the framesc-generated code,
2554 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2555 if ( DOT11F_FAILED( status ) )
2556 {
2557 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2558 status, nFrame);
2559 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2560 return eSIR_FAILURE;
2561 }
2562 else if ( DOT11F_WARNED( status ) )
2563 {
2564 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2565 status, nFrame );
2566 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2567 }
2568
2569 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2570
2571 // make sure this is seen as a re-assoc request
2572 pAssocReq->reassocRequest = 1;
2573
2574 // Capabilities
2575 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2576 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2577 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2578 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2579 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2580 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2581 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2582 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2583 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2584 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2585 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2586 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2587 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2588 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2589 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2590 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2591
2592 // Listen Interval
2593 pAssocReq->listenInterval = ar.ListenInterval.interval;
2594
2595 // SSID
2596 if ( ar.SSID.present )
2597 {
2598 pAssocReq->ssidPresent = 1;
2599 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2600 }
2601
2602 // Supported Rates
2603 if ( ar.SuppRates.present )
2604 {
2605 pAssocReq->suppRatesPresent = 1;
2606 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2607 }
2608
2609 // Extended Supported Rates
2610 if ( ar.ExtSuppRates.present )
2611 {
2612 pAssocReq->extendedRatesPresent = 1;
2613 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2614 &ar.ExtSuppRates );
2615 }
2616
2617 // QOS Capabilities:
2618 if ( ar.QOSCapsStation.present )
2619 {
2620 pAssocReq->qosCapabilityPresent = 1;
2621 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2622 }
2623
2624 // WPA
2625 if ( ar.WPAOpaque.present )
2626 {
2627 pAssocReq->wpaPresent = 1;
2628 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2629 }
2630
2631 // RSN
2632 if ( ar.RSNOpaque.present )
2633 {
2634 pAssocReq->rsnPresent = 1;
2635 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2636 }
2637
2638
2639 // Power Capabilities
2640 if ( ar.PowerCaps.present )
2641 {
2642 pAssocReq->powerCapabilityPresent = 1;
2643 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2644 }
2645
2646 // Supported Channels
2647 if ( ar.SuppChannels.present )
2648 {
2649 pAssocReq->supportedChannelsPresent = 1;
2650 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2651 }
2652
2653 if ( ar.HTCaps.present )
2654 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302655 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 }
2657
2658 if ( ar.WMMInfoStation.present )
2659 {
2660 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302661 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2662 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002663
2664 }
2665
2666 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2667
2668 if ( ! pAssocReq->ssidPresent )
2669 {
2670 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2671 return eSIR_FAILURE;
2672 }
2673
2674 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2675 {
2676 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2677 return eSIR_FAILURE;
2678 }
2679
2680 // Why no call to 'updateAssocReqFromPropCapability' here, like
2681 // there is in 'sirConvertAssocReqFrame2Struct'?
2682
2683 // WSC IE
2684 if (ar.WscIEOpaque.present)
2685 {
2686 pAssocReq->addIEPresent = 1;
2687 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2688 }
2689
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 if(ar.P2PIEOpaque.present)
2691 {
2692 pAssocReq->addIEPresent = 1;
2693 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2694 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002695
Jeff Johnsone7245742012-09-05 17:12:55 -07002696#ifdef WLAN_FEATURE_WFD
2697 if(ar.WFDIEOpaque.present)
2698 {
2699 pAssocReq->addIEPresent = 1;
2700 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2701 }
2702#endif
2703
2704#ifdef WLAN_FEATURE_11AC
2705 if ( ar.VHTCaps.present )
2706 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302707 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002708 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002709 if ( ar.OperatingMode.present )
2710 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302711 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002712 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2713 limLogOperatingMode( pMac, &pAssocReq->operMode);
2714 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002715#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002716 return eSIR_SUCCESS;
2717
2718} // End sirConvertReassocReqFrame2Struct.
2719
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002720
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002721#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002722tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002723sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002724 tANI_U8 *pPayload,
2725 const tANI_U32 nPayload,
2726 tANI_U8 **outIeBuf,
2727 tANI_U32 *pOutIeLen)
2728{
2729 tDot11fBeaconIEs *pBies = NULL;
2730 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002731 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002732 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002733
2734 /* To store how many bytes are required to be allocated
2735 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002736 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002737 tANI_U8 *pos = NULL;
2738
2739 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002740 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002741 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2742 if ( NULL == pBies )
2743 status = eHAL_STATUS_FAILURE;
2744 else
2745 status = eHAL_STATUS_SUCCESS;
2746 if (!HAL_STATUS_SUCCESS(status))
2747 {
2748 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2749 return eSIR_FAILURE;
2750 }
2751 // delegate to the framesc-generated code,
2752 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2753
2754 if ( DOT11F_FAILED( status ) )
2755 {
2756 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2757 status, nPayload);
2758 vos_mem_free(pBies);
2759 return eSIR_FAILURE;
2760 }
2761 else if ( DOT11F_WARNED( status ) )
2762 {
2763 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2764 status, nPayload );
2765 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2766 }
2767
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002768 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002769 if ( !pBies->SSID.present )
2770 {
2771 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2772 }
2773 else
2774 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002775 eseBcnReportMandatoryIe.ssidPresent = 1;
2776 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002777 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002778 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002779 }
2780
2781 if ( !pBies->SuppRates.present )
2782 {
2783 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2784 }
2785 else
2786 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002787 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2788 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2789 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002790 }
2791
2792 if ( pBies->FHParamSet.present)
2793 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002794 eseBcnReportMandatoryIe.fhParamPresent = 1;
2795 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002796 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2797 }
2798
2799 if ( pBies->DSParams.present )
2800 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002801 eseBcnReportMandatoryIe.dsParamsPresent = 1;
2802 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002803 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2804 }
2805
2806 if ( pBies->CFParams.present )
2807 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002808 eseBcnReportMandatoryIe.cfPresent = 1;
2809 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002810 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
2811 }
2812
2813 if ( pBies->IBSSParams.present )
2814 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002815 eseBcnReportMandatoryIe.ibssParamPresent = 1;
2816 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002817 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2818 }
2819
2820 if ( pBies->TIM.present )
2821 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002822 eseBcnReportMandatoryIe.timPresent = 1;
2823 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
2824 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
2825 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
2826 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002827 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
2828 }
2829
2830 if ( pBies->RRMEnabledCap.present )
2831 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002832 eseBcnReportMandatoryIe.rrmPresent = 1;
2833 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002834 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2835 }
2836
2837 *outIeBuf = vos_mem_malloc(numBytes);
2838 if (NULL == *outIeBuf)
2839 {
2840 limLog(pMac, LOGP, FL("Memory Allocation failure"));
2841 vos_mem_free(pBies);
2842 return eSIR_FAILURE;
2843 }
2844 pos = *outIeBuf;
2845 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002846 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002847
2848 /* Start filling the output Ie with Mandatory IE information */
2849 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002850 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002851 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002852 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002853 {
2854 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
2855 retStatus = eSIR_FAILURE;
2856 goto err_bcnrep;
2857 }
2858 *pos = SIR_MAC_SSID_EID;
2859 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002860 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002861 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002862 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
2863 eseBcnReportMandatoryIe.ssId.length);
2864 pos += eseBcnReportMandatoryIe.ssId.length;
2865 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002866 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002867
2868 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002869 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002870 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002871 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002872 {
2873 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
2874 retStatus = eSIR_FAILURE;
2875 goto err_bcnrep;
2876 }
2877 *pos = SIR_MAC_RATESET_EID;
2878 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002879 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002880 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002881 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
2882 eseBcnReportMandatoryIe.supportedRates.numRates);
2883 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
2884 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002885 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002886
2887 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002888 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002889 {
2890 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
2891 {
2892 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
2893 retStatus = eSIR_FAILURE;
2894 goto err_bcnrep;
2895 }
2896 *pos = SIR_MAC_FH_PARAM_SET_EID;
2897 pos++;
2898 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
2899 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002900 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002901 SIR_MAC_FH_PARAM_SET_EID_MAX);
2902 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
2903 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
2904 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002905
2906 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002907 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002908 {
2909 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
2910 {
2911 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
2912 retStatus = eSIR_FAILURE;
2913 goto err_bcnrep;
2914 }
2915 *pos = SIR_MAC_DS_PARAM_SET_EID;
2916 pos++;
2917 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
2918 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002919 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002920 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
2921 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
2922 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002923
2924 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002925 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002926 {
2927 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
2928 {
2929 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
2930 retStatus = eSIR_FAILURE;
2931 goto err_bcnrep;
2932 }
2933 *pos = SIR_MAC_CF_PARAM_SET_EID;
2934 pos++;
2935 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
2936 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002937 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002938 SIR_MAC_CF_PARAM_SET_EID_MAX);
2939 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
2940 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
2941 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002942
2943 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002944 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002945 {
2946 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
2947 {
2948 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
2949 retStatus = eSIR_FAILURE;
2950 goto err_bcnrep;
2951 }
2952 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
2953 pos++;
2954 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2955 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002956 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002957 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2958 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2959 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2960 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002961
2962 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002963 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002964 {
2965 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
2966 {
2967 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
2968 retStatus = eSIR_FAILURE;
2969 goto err_bcnrep;
2970 }
2971 *pos = SIR_MAC_TIM_EID;
2972 pos++;
2973 *pos = SIR_MAC_TIM_EID_MIN;
2974 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002975 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002976 SIR_MAC_TIM_EID_MIN);
2977 pos += SIR_MAC_TIM_EID_MIN;
2978 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
2979 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002980
2981 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002982 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002983 {
2984 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
2985 {
2986 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
2987 retStatus = eSIR_FAILURE;
2988 goto err_bcnrep;
2989 }
2990 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
2991 pos++;
2992 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2993 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002994 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002995 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2996 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2997 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002998
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002999 if (freeBytes != 0)
3000 {
3001 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3002 retStatus = eSIR_FAILURE;
3003 }
3004
3005err_bcnrep:
3006 /* The message counter would not be incremented in case of
3007 * returning failure and hence next time, this function gets
3008 * called, it would be using the same msg ctr for a different
3009 * BSS.So, it is good to clear the memory allocated for a BSS
3010 * that is returning failure.On success, the caller would take
3011 * care of freeing up the memory*/
3012 if (retStatus == eSIR_FAILURE)
3013 {
3014 vos_mem_free(*outIeBuf);
3015 *outIeBuf = NULL;
3016 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003017 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003018 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003019}
3020
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003021#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003022
Jeff Johnson295189b2012-06-20 16:38:30 -07003023tSirRetStatus
3024sirParseBeaconIE(tpAniSirGlobal pMac,
3025 tpSirProbeRespBeacon pBeaconStruct,
3026 tANI_U8 *pPayload,
3027 tANI_U32 nPayload)
3028{
3029 tDot11fBeaconIEs *pBies;
3030 tANI_U32 status;
3031
3032 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303033 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003034
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303035 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3036 if ( NULL == pBies )
3037 status = eHAL_STATUS_FAILURE;
3038 else
3039 status = eHAL_STATUS_SUCCESS;
3040 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003041 {
3042 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3043 return eSIR_FAILURE;
3044 }
3045 // delegate to the framesc-generated code,
3046 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3047
3048 if ( DOT11F_FAILED( status ) )
3049 {
3050 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3051 status, nPayload);
3052 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303053 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003054 return eSIR_FAILURE;
3055 }
3056 else if ( DOT11F_WARNED( status ) )
3057 {
3058 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3059 status, nPayload );
3060 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3061 }
3062
3063 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3064 if ( ! pBies->SSID.present )
3065 {
3066 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3067 }
3068 else
3069 {
3070 pBeaconStruct->ssidPresent = 1;
3071 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3072 }
3073
3074 if ( ! pBies->SuppRates.present )
3075 {
3076 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3077 }
3078 else
3079 {
3080 pBeaconStruct->suppRatesPresent = 1;
3081 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3082 }
3083
3084 if ( pBies->ExtSuppRates.present )
3085 {
3086 pBeaconStruct->extendedRatesPresent = 1;
3087 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3088 }
3089
3090 if ( pBies->CFParams.present )
3091 {
3092 pBeaconStruct->cfPresent = 1;
3093 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3094 }
3095
3096 if ( pBies->TIM.present )
3097 {
3098 pBeaconStruct->timPresent = 1;
3099 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3100 }
3101
3102 if ( pBies->Country.present )
3103 {
3104 pBeaconStruct->countryInfoPresent = 1;
3105 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3106 }
3107
3108 // 11h IEs
3109 if(pBies->TPCReport.present)
3110 {
3111 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303112 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003113 &pBies->TPCReport,
3114 sizeof( tDot11fIETPCReport));
3115 }
3116
3117 if(pBies->PowerConstraints.present)
3118 {
3119 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303120 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003121 &pBies->PowerConstraints,
3122 sizeof(tDot11fIEPowerConstraints));
3123 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003124#ifdef FEATURE_WLAN_ESE
3125 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003127 pBeaconStruct->eseTxPwr.present = 1;
3128 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003129 }
3130 if (pBies->QBSSLoad.present)
3131 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303132 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003133 }
3134#endif
3135
3136 if ( pBies->EDCAParamSet.present )
3137 {
3138 pBeaconStruct->edcaPresent = 1;
3139 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3140 }
3141
3142 // QOS Capabilities:
3143 if ( pBies->QOSCapsAp.present )
3144 {
3145 pBeaconStruct->qosCapabilityPresent = 1;
3146 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3147 }
3148
3149
3150
3151 if ( pBies->ChanSwitchAnn.present )
3152 {
3153 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303154 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003155 sizeof(tDot11fIEChanSwitchAnn));
3156 }
3157
3158 if ( pBies->ExtChanSwitchAnn.present)
3159 {
3160 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303161 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003162 sizeof(tDot11fIEExtChanSwitchAnn));
3163 }
3164
3165 if ( pBies->Quiet.present )
3166 {
3167 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303168 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003169 }
3170
3171 if ( pBies->HTCaps.present )
3172 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303173 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003174 }
3175
3176 if ( pBies->HTInfo.present )
3177 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303178 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 }
3180
3181 if ( pBies->DSParams.present )
3182 {
3183 pBeaconStruct->dsParamsPresent = 1;
3184 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3185 }
3186 else if(pBies->HTInfo.present)
3187 {
3188 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3189 }
3190
3191 if ( pBies->RSN.present )
3192 {
3193 pBeaconStruct->rsnPresent = 1;
3194 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3195 }
3196
3197 if ( pBies->WPA.present )
3198 {
3199 pBeaconStruct->wpaPresent = 1;
3200 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3201 }
3202
3203 if ( pBies->WMMParams.present )
3204 {
3205 pBeaconStruct->wmeEdcaPresent = 1;
3206 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3207 }
3208
3209 if ( pBies->WMMInfoAp.present )
3210 {
3211 pBeaconStruct->wmeInfoPresent = 1;
3212 }
3213
3214 if ( pBies->WMMCaps.present )
3215 {
3216 pBeaconStruct->wsmCapablePresent = 1;
3217 }
3218
3219
3220 if ( pBies->ERPInfo.present )
3221 {
3222 pBeaconStruct->erpPresent = 1;
3223 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3224 }
3225
Jeff Johnsone7245742012-09-05 17:12:55 -07003226#ifdef WLAN_FEATURE_11AC
3227 if ( pBies->VHTCaps.present )
3228 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303229 pBeaconStruct->VHTCaps.present = 1;
3230 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003231 }
3232 if ( pBies->VHTOperation.present )
3233 {
3234 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303235 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3236 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003237 }
3238 if ( pBies->VHTExtBssLoad.present )
3239 {
3240 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303241 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3242 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003243 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003244 if( pBies->OperatingMode.present)
3245 {
3246 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303247 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3248 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003249 }
3250
Jeff Johnsone7245742012-09-05 17:12:55 -07003251#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303252 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003253
Jeff Johnsone7245742012-09-05 17:12:55 -07003254
Jeff Johnson295189b2012-06-20 16:38:30 -07003255 return eSIR_SUCCESS;
3256
3257} // End sirParseBeaconIE.
3258
3259tSirRetStatus
3260sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3261 tANI_U8 *pFrame,
3262 tpSirProbeRespBeacon pBeaconStruct)
3263{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003264 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 tANI_U32 status, nPayload;
3266 tANI_U8 *pPayload;
3267 tpSirMacMgmtHdr pHdr;
3268 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003269 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003270
3271 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3272 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3273 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3274 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003275 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003276
3277 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303278 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3279
3280 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
3281 if ( NULL == pBeacon )
3282 status = eHAL_STATUS_FAILURE;
3283 else
3284 status = eHAL_STATUS_SUCCESS;
3285 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003286 {
3287 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3288 return eSIR_FAILURE;
3289 }
3290
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303291 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003292
3293 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303294 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003295
3296 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003297 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003298 if ( DOT11F_FAILED( status ) )
3299 {
3300 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3301 status, nPayload);
3302 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303303 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003304 return eSIR_FAILURE;
3305 }
3306 else if ( DOT11F_WARNED( status ) )
3307 {
3308 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3309 status, nPayload );
3310 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3311 }
3312
3313 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3314 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303315 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3316 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003317
3318 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003319 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003320
3321 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003322 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3323 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3324 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3325 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3326 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3327 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3328 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3329 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3330 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3331 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3332 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3333 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3334 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3335 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3336 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3337 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003338
Jeff Johnson32d95a32012-09-10 13:15:23 -07003339 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 {
3341 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3342 }
3343 else
3344 {
3345 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003346 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 }
3348
Jeff Johnson32d95a32012-09-10 13:15:23 -07003349 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003350 {
3351 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3352 }
3353 else
3354 {
3355 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003356 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003357 }
3358
Jeff Johnson32d95a32012-09-10 13:15:23 -07003359 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 {
3361 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003362 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 }
3364
3365
Jeff Johnson32d95a32012-09-10 13:15:23 -07003366 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003367 {
3368 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003369 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003370 }
3371
Jeff Johnson32d95a32012-09-10 13:15:23 -07003372 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003373 {
3374 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003375 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003376 }
3377
Jeff Johnson32d95a32012-09-10 13:15:23 -07003378 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003379 {
3380 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003381 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003382 }
3383
3384 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003385 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003386 {
3387 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003388 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 }
3390
Jeff Johnson32d95a32012-09-10 13:15:23 -07003391 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 {
3393 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003394 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003395 }
3396
Jeff Johnson32d95a32012-09-10 13:15:23 -07003397 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 {
3399 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303400 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003401 sizeof(tDot11fIEChanSwitchAnn) );
3402 }
3403
Jeff Johnson32d95a32012-09-10 13:15:23 -07003404 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003405 {
3406 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303407 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 sizeof(tDot11fIEExtChanSwitchAnn) );
3409 }
3410
Jeff Johnson32d95a32012-09-10 13:15:23 -07003411 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 {
3413 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303414 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003415 sizeof(tDot11fIETPCReport));
3416 }
3417
Jeff Johnson32d95a32012-09-10 13:15:23 -07003418 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 {
3420 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303421 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 sizeof(tDot11fIEPowerConstraints));
3423 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003424
3425 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 {
3427 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303428 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 }
3430
Jeff Johnson32d95a32012-09-10 13:15:23 -07003431 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003432 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303433 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 }
3435
Jeff Johnson32d95a32012-09-10 13:15:23 -07003436 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303438 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003439
3440 }
3441
Jeff Johnson32d95a32012-09-10 13:15:23 -07003442 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003443 {
3444 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003445 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003446 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003447 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003449 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 }
3451 else
3452 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003453 if ((!rfBand) || IS_5G_BAND(rfBand))
3454 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3455 else if (IS_24G_BAND(rfBand))
3456 pBeaconStruct->channelNumber = mappedRXCh;
3457 else
3458 {
3459 /*Only 0, 1, 2 are expected values for RF band from FW
3460 * if FW fixes are not present then rf band value will
3461 * be 0, else either 1 or 2 are expected from FW, 3 is
3462 * not expected from FW */
3463 PELOGE(limLog(pMac, LOGE,
3464 FL("Channel info is not present in Beacon and"
3465 " mapping is not done correctly"));)
3466 pBeaconStruct->channelNumber = mappedRXCh;
3467 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003468 }
3469
Jeff Johnson32d95a32012-09-10 13:15:23 -07003470 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003471 {
3472 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003473 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003474 }
3475
Jeff Johnson32d95a32012-09-10 13:15:23 -07003476 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 {
3478 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003479 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003480 }
3481
Jeff Johnson32d95a32012-09-10 13:15:23 -07003482 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 {
3484 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003485 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003486 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003487 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003488 }
3489
Jeff Johnson32d95a32012-09-10 13:15:23 -07003490 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 {
3492 pBeaconStruct->wmeInfoPresent = 1;
3493 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3494 }
3495
Jeff Johnson32d95a32012-09-10 13:15:23 -07003496 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003497 {
3498 pBeaconStruct->wsmCapablePresent = 1;
3499 }
3500
Jeff Johnson32d95a32012-09-10 13:15:23 -07003501 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003502 {
3503 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003504 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003505 }
3506
3507#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003508 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003509 {
3510 // MobilityDomain
3511 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303512 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3513 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003514 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003515
3516 }
3517#endif
3518
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003519#ifdef FEATURE_WLAN_ESE
3520 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303521 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003522 //ESE Tx Power
3523 pBeaconStruct->eseTxPwr.present = 1;
3524 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3525 &pBeacon->ESETxmitPower,
3526 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303527 }
3528#endif
3529
Jeff Johnsone7245742012-09-05 17:12:55 -07003530#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003531 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003532 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303533 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003534 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003535 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003536 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303537 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3538 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003539 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003540 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003541 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303542 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3543 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003544 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003545 if(pBeacon->OperatingMode.present)
3546 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303547 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3548 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003549 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003550 if(pBeacon->WiderBWChanSwitchAnn.present)
3551 {
3552 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303553 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3554 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003555 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003556#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303557 if(pBeacon->OBSSScanParameters.present)
3558 {
3559 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3560 &pBeacon->OBSSScanParameters,
3561 sizeof( tDot11fIEOBSSScanParameters));
3562 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303563 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003564 return eSIR_SUCCESS;
3565
3566} // End sirConvertBeaconFrame2Struct.
3567
3568tSirRetStatus
3569sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3570 tANI_U8 *pFrame,
3571 tANI_U32 nFrame,
3572 tpSirMacAuthFrameBody pAuth)
3573{
3574 static tDot11fAuthentication auth;
3575 tANI_U32 status;
3576
3577 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303578 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003579
3580 // delegate to the framesc-generated code,
3581 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3582 if ( DOT11F_FAILED( status ) )
3583 {
3584 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3585 status, nFrame);
3586 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3587 return eSIR_FAILURE;
3588 }
3589 else if ( DOT11F_WARNED( status ) )
3590 {
3591 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3592 status, nFrame );
3593 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3594 }
3595
3596 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3597 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3598 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3599 pAuth->authStatusCode = auth.Status.status;
3600
3601 if ( auth.ChallengeText.present )
3602 {
3603 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3604 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303605 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 }
3607
3608 return eSIR_SUCCESS;
3609
3610} // End sirConvertAuthFrame2Struct.
3611
3612tSirRetStatus
3613sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3614 tANI_U8 *pFrame,
3615 tANI_U32 nFrame,
3616 tSirAddtsReqInfo *pAddTs)
3617{
3618 tDot11fAddTSRequest addts = {{0}};
3619 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3620 tANI_U8 j;
3621 tANI_U16 i;
3622 tANI_U32 status;
3623
3624 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3625 {
3626 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3627 "with an Action of %d; this is not "
3628 "supported & is probably an error."),
3629 *( pFrame + 1 ) );
3630 return eSIR_FAILURE;
3631 }
3632
3633 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303634 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003635
3636 // delegate to the framesc-generated code,
3637 switch ( *pFrame )
3638 {
3639 case SIR_MAC_ACTION_QOS_MGMT:
3640 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3641 break;
3642 case SIR_MAC_ACTION_WME:
3643 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3644 break;
3645 default:
3646 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3647 "with a Category of %d; this is not"
3648 " supported & is probably an error."),
3649 *pFrame );
3650 return eSIR_FAILURE;
3651 }
3652
3653 if ( DOT11F_FAILED( status ) )
3654 {
3655 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3656 "rame (0x%08x, %d bytes):\n"),
3657 status, nFrame);
3658 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3659 return eSIR_FAILURE;
3660 }
3661 else if ( DOT11F_WARNED( status ) )
3662 {
3663 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3664 "g an Add TS Request frame (0x%08x,"
3665 "%d bytes):\n"),
3666 status, nFrame );
3667 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3668 }
3669
3670 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3671 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3672 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3673 {
3674 pAddTs->dialogToken = addts.DialogToken.token;
3675
3676 if ( addts.TSPEC.present )
3677 {
3678 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3679 }
3680 else
3681 {
3682 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3683 return eSIR_FAILURE;
3684 }
3685
3686 if ( addts.num_TCLAS )
3687 {
3688 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3689
3690 for ( i = 0U; i < addts.num_TCLAS; ++i )
3691 {
3692 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3693 {
3694 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3695 return eSIR_FAILURE;
3696 }
3697 }
3698 }
3699
3700 if ( addts.TCLASSPROC.present )
3701 {
3702 pAddTs->tclasProcPresent = 1;
3703 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3704 }
3705
3706 if ( addts.WMMTSPEC.present )
3707 {
3708 pAddTs->wsmTspecPresent = 1;
3709 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3710 }
3711
3712 if ( addts.num_WMMTCLAS )
3713 {
3714 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3715 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3716
3717 for ( i = pAddTs->numTclas; i < j; ++i )
3718 {
3719 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3720 {
3721 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3722 return eSIR_FAILURE;
3723 }
3724 }
3725 }
3726
3727 if ( addts.WMMTCLASPROC.present )
3728 {
3729 pAddTs->tclasProcPresent = 1;
3730 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3731 }
3732
3733 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3734 {
3735 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3736 pAddTs->numTclas );
3737 return eSIR_FAILURE;
3738 }
3739 }
3740 else
3741 {
3742 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3743
3744 if ( wmmaddts.WMMTSPEC.present )
3745 {
3746 pAddTs->wmeTspecPresent = 1;
3747 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3748 }
3749 else
3750 {
3751 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3752 return eSIR_FAILURE;
3753 }
3754 }
3755
3756 return eSIR_SUCCESS;
3757
3758} // End sirConvertAddtsReq2Struct.
3759
3760tSirRetStatus
3761sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3762 tANI_U8 *pFrame,
3763 tANI_U32 nFrame,
3764 tSirAddtsRspInfo *pAddTs)
3765{
3766 tDot11fAddTSResponse addts = {{0}};
3767 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3768 tANI_U8 j;
3769 tANI_U16 i;
3770 tANI_U32 status;
3771
3772 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3773 {
3774 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3775 "with an Action of %d; this is not "
3776 "supported & is probably an error."),
3777 *( pFrame + 1 ) );
3778 return eSIR_FAILURE;
3779 }
3780
3781 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303782 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3783 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3784 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003785
3786
3787 // delegate to the framesc-generated code,
3788 switch ( *pFrame )
3789 {
3790 case SIR_MAC_ACTION_QOS_MGMT:
3791 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3792 break;
3793 case SIR_MAC_ACTION_WME:
3794 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3795 break;
3796 default:
3797 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3798 "with a Category of %d; this is not"
3799 " supported & is probably an error."),
3800 *pFrame );
3801 return eSIR_FAILURE;
3802 }
3803
3804 if ( DOT11F_FAILED( status ) )
3805 {
3806 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
3807 "rame (0x%08x, %d bytes):\n"),
3808 status, nFrame);
3809 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3810 return eSIR_FAILURE;
3811 }
3812 else if ( DOT11F_WARNED( status ) )
3813 {
3814 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3815 "g an Add TS Response frame (0x%08x,"
3816 "%d bytes):\n"),
3817 status, nFrame );
3818 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3819 }
3820
3821 // & "transliterate" from a 'tDot11fAddTSResponse' or a
3822 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
3823 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3824 {
3825 pAddTs->dialogToken = addts.DialogToken.token;
3826 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
3827
3828 if ( addts.TSDelay.present )
3829 {
3830 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
3831 }
3832
3833 // TS Delay is present iff status indicates its presence
3834 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
3835 {
3836 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
3837 }
3838
3839 if ( addts.TSPEC.present )
3840 {
3841 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3842 }
3843 else
3844 {
3845 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
3846 return eSIR_FAILURE;
3847 }
3848
3849 if ( addts.num_TCLAS )
3850 {
3851 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3852
3853 for ( i = 0U; i < addts.num_TCLAS; ++i )
3854 {
3855 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3856 {
3857 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3858 return eSIR_FAILURE;
3859 }
3860 }
3861 }
3862
3863 if ( addts.TCLASSPROC.present )
3864 {
3865 pAddTs->tclasProcPresent = 1;
3866 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3867 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003868#ifdef FEATURE_WLAN_ESE
3869 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 {
3871 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303872 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003873 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 }
3875#endif
3876 if ( addts.Schedule.present )
3877 {
3878 pAddTs->schedulePresent = 1;
3879 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
3880 }
3881
3882 if ( addts.WMMSchedule.present )
3883 {
3884 pAddTs->schedulePresent = 1;
3885 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
3886 }
3887
3888 if ( addts.WMMTSPEC.present )
3889 {
3890 pAddTs->wsmTspecPresent = 1;
3891 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3892 }
3893
3894 if ( addts.num_WMMTCLAS )
3895 {
3896 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3897 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3898
3899 for ( i = pAddTs->numTclas; i < j; ++i )
3900 {
3901 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3902 {
3903 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3904 return eSIR_FAILURE;
3905 }
3906 }
3907 }
3908
3909 if ( addts.WMMTCLASPROC.present )
3910 {
3911 pAddTs->tclasProcPresent = 1;
3912 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3913 }
3914
3915 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3916 {
3917 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3918 pAddTs->numTclas );
3919 return eSIR_FAILURE;
3920 }
3921 }
3922 else
3923 {
3924 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3925 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
3926
3927 if ( wmmaddts.WMMTSPEC.present )
3928 {
3929 pAddTs->wmeTspecPresent = 1;
3930 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3931 }
3932 else
3933 {
3934 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3935 return eSIR_FAILURE;
3936 }
3937
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003938#ifdef FEATURE_WLAN_ESE
3939 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 {
3941 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303942 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003943 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003944 }
3945#endif
3946
3947 }
3948
3949 return eSIR_SUCCESS;
3950
3951} // End sirConvertAddtsRsp2Struct.
3952
3953tSirRetStatus
3954sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
3955 tANI_U8 *pFrame,
3956 tANI_U32 nFrame,
3957 tSirDeltsReqInfo *pDelTs)
3958{
3959 tDot11fDelTS delts = {{0}};
3960 tDot11fWMMDelTS wmmdelts = {{0}};
3961 tANI_U32 status;
3962
3963 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
3964 {
3965 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3966 "with an Action of %d; this is not "
3967 "supported & is probably an error."),
3968 *( pFrame + 1 ) );
3969 return eSIR_FAILURE;
3970 }
3971
3972 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303973 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003974
3975 // delegate to the framesc-generated code,
3976 switch ( *pFrame )
3977 {
3978 case SIR_MAC_ACTION_QOS_MGMT:
3979 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
3980 break;
3981 case SIR_MAC_ACTION_WME:
3982 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
3983 break;
3984 default:
3985 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3986 "with a Category of %d; this is not"
3987 " supported & is probably an error."),
3988 *pFrame );
3989 return eSIR_FAILURE;
3990 }
3991
3992 if ( DOT11F_FAILED( status ) )
3993 {
3994 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
3995 "rame (0x%08x, %d bytes):\n"),
3996 status, nFrame);
3997 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3998 return eSIR_FAILURE;
3999 }
4000 else if ( DOT11F_WARNED( status ) )
4001 {
4002 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4003 "g an Del TS Request frame (0x%08x,"
4004 "%d bytes):\n"),
4005 status, nFrame );
4006 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4007 }
4008
4009 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4010 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4011 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4012 {
4013 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4014 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4015 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4016 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4017 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4018 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4019 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4020 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4021
4022 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4023 }
4024 else
4025 {
4026 if ( wmmdelts.WMMTSPEC.present )
4027 {
4028 pDelTs->wmeTspecPresent = 1;
4029 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4030 }
4031 else
4032 {
4033 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
4034 return eSIR_FAILURE;
4035 }
4036 }
4037
4038 return eSIR_SUCCESS;
4039
4040} // End sirConvertDeltsReq2Struct.
4041
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004042tSirRetStatus
4043sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4044 tANI_U8 *pFrame,
4045 tANI_U32 nFrame,
4046 tSirQosMapSet *pQosMapSet)
4047{
4048 tDot11fQosMapConfigure mapConfigure;
4049 tANI_U32 status;
4050 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
4051 if ( DOT11F_FAILED( status ) )
4052 {
4053 dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):\n"),
4054 status, nFrame);
4055 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4056 return eSIR_FAILURE;
4057 }
4058 else if ( DOT11F_WARNED( status ) )
4059 {
4060 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):\n"),
4061 status, nFrame );
4062 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4063 }
4064 pQosMapSet->present = mapConfigure.QosMapSet.present;
4065 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
4066 limLogQosMapSet(pMac, &pMac->QosMapSet);
4067 return eSIR_SUCCESS;
4068}
Jeff Johnson295189b2012-06-20 16:38:30 -07004069
4070#ifdef ANI_SUPPORT_11H
4071tSirRetStatus
4072sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4073 tANI_U8 *pFrame,
4074 tpSirMacTpcReqActionFrame pTpcReqFrame,
4075 tANI_U32 nFrame)
4076{
4077 tDot11fTPCRequest req;
4078 tANI_U32 status;
4079
4080 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304081 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004082
4083 // delegate to the framesc-generated code,
4084 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4085 if ( DOT11F_FAILED( status ) )
4086 {
4087 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
4088 status, nFrame);
4089 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4090 return eSIR_FAILURE;
4091 }
4092 else if ( DOT11F_WARNED( status ) )
4093 {
4094 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
4095 status, nFrame );
4096 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4097 }
4098
4099 // & "transliterate" from a 'tDot11fTPCRequest' to a
4100 // 'tSirMacTpcReqActionFrame'...
4101 pTpcReqFrame->actionHeader.category = req.Category.category;
4102 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4103 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4104 if ( req.TPCRequest.present )
4105 {
4106 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4107 pTpcReqFrame->length = 0;
4108 }
4109 else
4110 {
4111 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
4112 return eSIR_FAILURE;
4113 }
4114
4115 return eSIR_SUCCESS;
4116
4117} // End sirConvertTpcReqFrame2Struct.
4118
4119
4120tSirRetStatus
4121sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4122 tANI_U8 *pFrame,
4123 tpSirMacMeasReqActionFrame pMeasReqFrame,
4124 tANI_U32 nFrame)
4125{
4126 tDot11fMeasurementRequest mr;
4127 tANI_U32 status;
4128
4129 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304130 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004131
4132 // delegate to the framesc-generated code,
4133 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4134 if ( DOT11F_FAILED( status ) )
4135 {
4136 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4137 status, nFrame);
4138 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4139 return eSIR_FAILURE;
4140 }
4141 else if ( DOT11F_WARNED( status ) )
4142 {
4143 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4144 status, nFrame );
4145 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4146 }
4147
4148 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4149 // 'tpSirMacMeasReqActionFrame'...
4150 pMeasReqFrame->actionHeader.category = mr.Category.category;
4151 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4152 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4153
4154 if ( 0 == mr.num_MeasurementRequest )
4155 {
4156 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4157 return eSIR_FAILURE;
4158 }
4159 else if ( 1 < mr.num_MeasurementRequest )
4160 {
4161 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4162 }
4163
4164 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4165 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4166 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4167 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4168 ( mr.MeasurementRequest[0].enable << 2 ) |
4169 ( mr.MeasurementRequest[0].request << 1 ) |
4170 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4171 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4172
4173 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4174
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304175 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004176 mr.MeasurementRequest[0].meas_start_time, 8 );
4177
4178 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4179
4180 return eSIR_SUCCESS;
4181
4182} // End sirConvertMeasReqFrame2Struct.
4183#endif
4184
4185
4186void
4187PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4188 tDot11fIETSPEC *pDot11f)
4189{
4190 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4191 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4192 pDot11f->direction = pOld->tsinfo.traffic.direction;
4193 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4194 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4195 pDot11f->psb = pOld->tsinfo.traffic.psb;
4196 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4197 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4198 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4199 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4200 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4201 */
4202 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4203 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4204 pDot11f->max_msdu_size = pOld->maxMsduSz;
4205 pDot11f->min_service_int = pOld->minSvcInterval;
4206 pDot11f->max_service_int = pOld->maxSvcInterval;
4207 pDot11f->inactivity_int = pOld->inactInterval;
4208 pDot11f->suspension_int = pOld->suspendInterval;
4209 pDot11f->service_start_time = pOld->svcStartTime;
4210 pDot11f->min_data_rate = pOld->minDataRate;
4211 pDot11f->mean_data_rate = pOld->meanDataRate;
4212 pDot11f->peak_data_rate = pOld->peakDataRate;
4213 pDot11f->burst_size = pOld->maxBurstSz;
4214 pDot11f->delay_bound = pOld->delayBound;
4215 pDot11f->min_phy_rate = pOld->minPhyRate;
4216 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4217 pDot11f->medium_time = pOld->mediumTime;
4218
4219 pDot11f->present = 1;
4220
4221} // End PopulateDot11fTSPEC.
4222
4223void
4224PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4225 tDot11fIEWMMTSPEC *pDot11f)
4226{
4227 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4228 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4229 pDot11f->direction = pOld->tsinfo.traffic.direction;
4230 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4231 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4232 pDot11f->psb = pOld->tsinfo.traffic.psb;
4233 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4234 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4235 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4236 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4237 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4238 */
4239 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4240 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4241 pDot11f->max_msdu_size = pOld->maxMsduSz;
4242 pDot11f->min_service_int = pOld->minSvcInterval;
4243 pDot11f->max_service_int = pOld->maxSvcInterval;
4244 pDot11f->inactivity_int = pOld->inactInterval;
4245 pDot11f->suspension_int = pOld->suspendInterval;
4246 pDot11f->service_start_time = pOld->svcStartTime;
4247 pDot11f->min_data_rate = pOld->minDataRate;
4248 pDot11f->mean_data_rate = pOld->meanDataRate;
4249 pDot11f->peak_data_rate = pOld->peakDataRate;
4250 pDot11f->burst_size = pOld->maxBurstSz;
4251 pDot11f->delay_bound = pOld->delayBound;
4252 pDot11f->min_phy_rate = pOld->minPhyRate;
4253 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4254 pDot11f->medium_time = pOld->mediumTime;
4255
4256 pDot11f->version = 1;
4257 pDot11f->present = 1;
4258
4259} // End PopulateDot11fWMMTSPEC.
4260
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004261#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004262
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004263// Fill the ESE version currently supported
4264void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004265{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004266 pESEVersion->present = 1;
4267 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004268}
4269
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004270// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004271// The State is Normal (1)
4272// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004273void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004274{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004275 pESERadMgmtCap->present = 1;
4276 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4277 pESERadMgmtCap->mbssid_mask = 0;
4278 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004279}
4280
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004281tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004282 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004283 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004284{
4285 int idx;
4286
4287 if ( pCCKMie->length )
4288 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004289 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004290 {
4291 pDot11f->present = 1;
4292 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004293 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004294 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4295 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4296 }
4297 }
4298
4299 return eSIR_SUCCESS;
4300
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004301} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004302
Jeff Johnson295189b2012-06-20 16:38:30 -07004303void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004304 tSirMacESETSRSIE *pOld,
4305 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 tANI_U8 rate_length)
4307{
4308 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304309 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 pDot11f->num_tsrates = rate_length;
4311 pDot11f->present = 1;
4312}
4313#endif
4314
4315
4316tSirRetStatus
4317PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4318 tSirTclasInfo *pOld,
4319 tDot11fIETCLAS *pDot11f)
4320{
4321 pDot11f->user_priority = pOld->tclas.userPrio;
4322 pDot11f->classifier_type = pOld->tclas.classifierType;
4323 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4324
4325 switch ( pDot11f->classifier_type )
4326 {
4327 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304328 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4329 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4330 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4331 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004332 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4333 break;
4334 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4335 pDot11f->info.IpParams.version = pOld->version;
4336 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4337 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304338 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304339 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304340 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4341 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304342 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304343 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 pDot11f->info.IpParams.params.IpV4Params.src_port =
4345 pOld->tclasParams.ipv4.srcPort;
4346 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4347 pOld->tclasParams.ipv4.dstPort;
4348 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4349 pOld->tclasParams.ipv4.dscp;
4350 pDot11f->info.IpParams.params.IpV4Params.proto =
4351 pOld->tclasParams.ipv4.protocol;
4352 pDot11f->info.IpParams.params.IpV4Params.reserved =
4353 pOld->tclasParams.ipv4.rsvd;
4354 }
4355 else
4356 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304357 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004358 IpV6Params.source,
4359 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304360 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004361 IpV6Params.dest,
4362 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4363 pDot11f->info.IpParams.params.IpV6Params.src_port =
4364 pOld->tclasParams.ipv6.srcPort;
4365 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4366 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304367 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004368 IpV6Params.flow_label,
4369 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4370 }
4371 break;
4372 case SIR_MAC_TCLASTYPE_8021DQ:
4373 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4374 break;
4375 default:
4376 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4377 pDot11f->classifier_type );
4378 return eSIR_FAILURE;
4379 }
4380
4381 pDot11f->present = 1;
4382
4383 return eSIR_SUCCESS;
4384
4385} // End PopulateDot11fTCLAS.
4386
4387tSirRetStatus
4388PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4389 tSirTclasInfo *pOld,
4390 tDot11fIEWMMTCLAS *pDot11f)
4391{
4392 pDot11f->version = 1;
4393 pDot11f->user_priority = pOld->tclas.userPrio;
4394 pDot11f->classifier_type = pOld->tclas.classifierType;
4395 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4396
4397 switch ( pDot11f->classifier_type )
4398 {
4399 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304400 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004401 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304402 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004403 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4404 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4405 break;
4406 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4407 pDot11f->info.IpParams.version = pOld->version;
4408 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4409 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304410 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 IpV4Params.source,
4412 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304413 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004414 IpV4Params.dest,
4415 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4416 pDot11f->info.IpParams.params.IpV4Params.src_port =
4417 pOld->tclasParams.ipv4.srcPort;
4418 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4419 pOld->tclasParams.ipv4.dstPort;
4420 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4421 pOld->tclasParams.ipv4.dscp;
4422 pDot11f->info.IpParams.params.IpV4Params.proto =
4423 pOld->tclasParams.ipv4.protocol;
4424 pDot11f->info.IpParams.params.IpV4Params.reserved =
4425 pOld->tclasParams.ipv4.rsvd;
4426 }
4427 else
4428 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304429 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004430 IpV6Params.source,
4431 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304432 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004433 IpV6Params.dest,
4434 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4435 pDot11f->info.IpParams.params.IpV6Params.src_port =
4436 pOld->tclasParams.ipv6.srcPort;
4437 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4438 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304439 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 IpV6Params.flow_label,
4441 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4442 }
4443 break;
4444 case SIR_MAC_TCLASTYPE_8021DQ:
4445 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4446 break;
4447 default:
4448 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4449 pDot11f->classifier_type );
4450 return eSIR_FAILURE;
4451 }
4452
4453 pDot11f->present = 1;
4454
4455 return eSIR_SUCCESS;
4456
4457} // End PopulateDot11fWMMTCLAS.
4458
Jeff Johnson295189b2012-06-20 16:38:30 -07004459
4460tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4461 tDot11fIEWscBeacon *pDot11f)
4462{
4463
4464 tANI_U32 wpsState;
4465
4466 pDot11f->Version.present = 1;
4467 pDot11f->Version.major = 0x01;
4468 pDot11f->Version.minor = 0x00;
4469
4470 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4471 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4472
4473 pDot11f->WPSState.present = 1;
4474 pDot11f->WPSState.state = (tANI_U8) wpsState;
4475
4476 pDot11f->APSetupLocked.present = 0;
4477
4478 pDot11f->SelectedRegistrar.present = 0;
4479
4480 pDot11f->DevicePasswordID.present = 0;
4481
4482 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4483
4484 pDot11f->UUID_E.present = 0;
4485
4486 pDot11f->RFBands.present = 0;
4487
4488 pDot11f->present = 1;
4489 return eSIR_SUCCESS;
4490}
4491
4492tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4493 tDot11fIEWscBeacon *pDot11f)
4494{
4495 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4496 tANI_U32 devicepasswdId;
4497
4498
4499 pDot11f->APSetupLocked.present = 1;
4500 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4501
4502 pDot11f->SelectedRegistrar.present = 1;
4503 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4504
4505 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4506 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4507
4508 pDot11f->DevicePasswordID.present = 1;
4509 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4510
4511 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4512 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4513
4514 // UUID_E and RF Bands are applicable only for dual band AP
4515
4516 return eSIR_SUCCESS;
4517}
4518
4519tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4520 tDot11fIEWscBeacon *pDot11f)
4521{
4522 pDot11f->APSetupLocked.present = 0;
4523 pDot11f->SelectedRegistrar.present = 0;
4524 pDot11f->DevicePasswordID.present = 0;
4525 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4526
4527 return eSIR_SUCCESS;
4528}
Jeff Johnson295189b2012-06-20 16:38:30 -07004529tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4530{
4531
4532 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4533
4534 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4535
4536
4537 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4538 {
4539 pDot11f->present = 1;
4540 pDot11f->Version.present = 1;
4541 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4542 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4543 }
4544 else
4545 {
4546 pDot11f->present = 0;
4547 pDot11f->Version.present = 0;
4548 }
4549
4550 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4551 {
4552
4553 pDot11f->WPSState.present = 1;
4554 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4555 }
4556 else
4557 pDot11f->WPSState.present = 0;
4558
4559 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4560 {
4561 pDot11f->APSetupLocked.present = 1;
4562 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4563 }
4564 else
4565 pDot11f->APSetupLocked.present = 0;
4566
4567 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4568 {
4569 pDot11f->SelectedRegistrar.present = 1;
4570 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4571 }
4572 else
4573 pDot11f->SelectedRegistrar.present = 0;
4574
4575 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4576 {
4577 pDot11f->DevicePasswordID.present = 1;
4578 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4579 }
4580 else
4581 pDot11f->DevicePasswordID.present = 0;
4582
4583 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4584 {
4585 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4586 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4587 }
4588 else
4589 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4590
4591 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4592 {
4593 pDot11f->ResponseType.present = 1;
4594 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4595 }
4596 else
4597 pDot11f->ResponseType.present = 0;
4598
4599 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4600 {
4601 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304602 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004603 }
4604 else
4605 pDot11f->UUID_E.present = 0;
4606
4607 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4608 {
4609 pDot11f->Manufacturer.present = 1;
4610 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304611 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4612 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004613 }
4614 else
4615 pDot11f->Manufacturer.present = 0;
4616
4617 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4618 {
4619 pDot11f->ModelName.present = 1;
4620 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304621 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4622 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 }
4624 else
4625 pDot11f->ModelName.present = 0;
4626
4627 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4628 {
4629 pDot11f->ModelNumber.present = 1;
4630 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304631 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4632 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 }
4634 else
4635 pDot11f->ModelNumber.present = 0;
4636
4637 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4638 {
4639 pDot11f->SerialNumber.present = 1;
4640 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304641 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4642 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 }
4644 else
4645 pDot11f->SerialNumber.present = 0;
4646
4647 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4648 {
4649 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304650 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4651 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4653 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4654 }
4655 else
4656 pDot11f->PrimaryDeviceType.present = 0;
4657
4658 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4659 {
4660 pDot11f->DeviceName.present = 1;
4661 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304662 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4663 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004664 }
4665 else
4666 pDot11f->DeviceName.present = 0;
4667
4668 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4669 {
4670 pDot11f->ConfigMethods.present = 1;
4671 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4672 }
4673 else
4674 pDot11f->ConfigMethods.present = 0;
4675
4676
4677 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4678 {
4679 pDot11f->RFBands.present = 1;
4680 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4681 }
4682 else
4683 pDot11f->RFBands.present = 0;
4684
4685 return eSIR_SUCCESS;
4686}
4687tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4688{
4689 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4690
4691 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4692
4693 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4694 {
4695 pDot11f->present = 1;
4696 pDot11f->Version.present = 1;
4697 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4698 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4699 }
4700 else
4701 {
4702 pDot11f->present = 0;
4703 pDot11f->Version.present = 0;
4704 }
4705
4706 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4707 {
4708 pDot11f->ResponseType.present = 1;
4709 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4710 }
4711 else
4712 pDot11f->ResponseType.present = 0;
4713
4714 return eSIR_SUCCESS;
4715}
4716
4717tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4718{
4719
4720 tSirWPSBeaconIE *pSirWPSBeaconIE;
4721
4722 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4723
4724
4725 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4726 {
4727 pDot11f->present = 1;
4728 pDot11f->Version.present = 1;
4729 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4730 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4731 }
4732 else
4733 {
4734 pDot11f->present = 0;
4735 pDot11f->Version.present = 0;
4736 }
4737
4738 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4739 {
4740
4741 pDot11f->WPSState.present = 1;
4742 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4743 }
4744 else
4745 pDot11f->WPSState.present = 0;
4746
4747 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4748 {
4749 pDot11f->APSetupLocked.present = 1;
4750 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4751 }
4752 else
4753 pDot11f->APSetupLocked.present = 0;
4754
4755 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4756 {
4757 pDot11f->SelectedRegistrar.present = 1;
4758 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4759 }
4760 else
4761 pDot11f->SelectedRegistrar.present = 0;
4762
4763 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4764 {
4765 pDot11f->DevicePasswordID.present = 1;
4766 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4767 }
4768 else
4769 pDot11f->DevicePasswordID.present = 0;
4770
4771 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4772 {
4773 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4774 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4775 }
4776 else
4777 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4778
4779 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4780 {
4781 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304782 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004783 }
4784 else
4785 pDot11f->UUID_E.present = 0;
4786
4787
4788 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4789 {
4790 pDot11f->RFBands.present = 1;
4791 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4792 }
4793 else
4794 pDot11f->RFBands.present = 0;
4795
4796 return eSIR_SUCCESS;
4797}
Jeff Johnson295189b2012-06-20 16:38:30 -07004798tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4799 tDot11fIEWscProbeRes *pDot11f)
4800{
4801 tANI_U32 cfgMethods;
4802 tANI_U32 cfgStrLen;
4803 tANI_U32 val;
4804 tANI_U32 wpsVersion, wpsState;
4805
4806
4807 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
4808 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
4809
4810 pDot11f->Version.present = 1;
4811 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
4812 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
4813
4814 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4815 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4816
4817 pDot11f->WPSState.present = 1;
4818 pDot11f->WPSState.state = (tANI_U8) wpsState;
4819
4820 pDot11f->APSetupLocked.present = 0;
4821
4822 pDot11f->SelectedRegistrar.present = 0;
4823
4824 pDot11f->DevicePasswordID.present = 0;
4825
4826 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4827
4828 pDot11f->ResponseType.present = 1;
4829 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
4830 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
4831 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4832 }
4833 else{
4834 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4835 }
4836
4837 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
4838 pDot11f->UUID_E.present = 1;
4839 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
4840 if (wlan_cfgGetStr(pMac,
4841 WNI_CFG_WPS_UUID,
4842 pDot11f->UUID_E.uuid,
4843 &cfgStrLen) != eSIR_SUCCESS)
4844 {
4845 *(pDot11f->UUID_E.uuid) = '\0';
4846 }
4847
4848 pDot11f->Manufacturer.present = 1;
4849 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
4850 if (wlan_cfgGetStr(pMac,
4851 WNI_CFG_MANUFACTURER_NAME,
4852 pDot11f->Manufacturer.name,
4853 &cfgStrLen) != eSIR_SUCCESS)
4854 {
4855 pDot11f->Manufacturer.num_name = 0;
4856 *(pDot11f->Manufacturer.name) = '\0';
4857 }
4858 else
4859 {
4860 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
4861 pDot11f->Manufacturer.name[cfgStrLen] = '\0';
4862 }
4863
4864 pDot11f->ModelName.present = 1;
4865 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
4866 if (wlan_cfgGetStr(pMac,
4867 WNI_CFG_MODEL_NAME,
4868 pDot11f->ModelName.text,
4869 &cfgStrLen) != eSIR_SUCCESS)
4870 {
4871 pDot11f->ModelName.num_text = 0;
4872 *(pDot11f->ModelName.text) = '\0';
4873 }
4874 else
4875 {
4876 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4877 pDot11f->ModelName.text[cfgStrLen] = '\0';
4878 }
4879
4880 pDot11f->ModelNumber.present = 1;
4881 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
4882 if (wlan_cfgGetStr(pMac,
4883 WNI_CFG_MODEL_NUMBER,
4884 pDot11f->ModelNumber.text,
4885 &cfgStrLen) != eSIR_SUCCESS)
4886 {
4887 pDot11f->ModelNumber.num_text = 0;
4888 *(pDot11f->ModelNumber.text) = '\0';
4889 }
4890 else
4891 {
4892 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4893 pDot11f->ModelNumber.text[cfgStrLen] = '\0';
4894 }
4895
4896 pDot11f->SerialNumber.present = 1;
4897 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
4898 if (wlan_cfgGetStr(pMac,
4899 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
4900 pDot11f->SerialNumber.text,
4901 &cfgStrLen) != eSIR_SUCCESS)
4902 {
4903 pDot11f->SerialNumber.num_text = 0;
4904 *(pDot11f->SerialNumber.text) = '\0';
4905 }
4906 else
4907 {
4908 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4909 pDot11f->SerialNumber.text[cfgStrLen] = '\0';
4910 }
4911
4912 pDot11f->PrimaryDeviceType.present = 1;
4913
4914 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
4915 {
4916 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
4917 }
4918 else
4919 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
4920
4921 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
4922 {
4923 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
4924 }
4925 else
4926 {
4927 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
4928 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
4929 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
4930 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
4931 }
4932
4933 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
4934 {
4935 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
4936 }
4937 else
4938 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
4939
4940 pDot11f->DeviceName.present = 1;
4941 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
4942 if (wlan_cfgGetStr(pMac,
4943 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
4944 pDot11f->DeviceName.text,
4945 &cfgStrLen) != eSIR_SUCCESS)
4946 {
4947 pDot11f->DeviceName.num_text = 0;
4948 *(pDot11f->DeviceName.text) = '\0';
4949 }
4950 else
4951 {
4952 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4953 pDot11f->DeviceName.text[cfgStrLen] = '\0';
4954 }
4955
4956 if (wlan_cfgGetInt(pMac,
4957 WNI_CFG_WPS_CFG_METHOD,
4958 &cfgMethods) != eSIR_SUCCESS)
4959 {
4960 pDot11f->ConfigMethods.present = 0;
4961 pDot11f->ConfigMethods.methods = 0;
4962 }
4963 else
4964 {
4965 pDot11f->ConfigMethods.present = 1;
4966 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
4967 }
4968
4969 pDot11f->RFBands.present = 0;
4970
4971 pDot11f->present = 1;
4972 return eSIR_SUCCESS;
4973}
4974
4975tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4976 tDot11fIEWscProbeRes *pDot11f)
4977{
4978 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4979 tANI_U32 devicepasswdId;
4980
4981 pDot11f->APSetupLocked.present = 1;
4982 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4983
4984 pDot11f->SelectedRegistrar.present = 1;
4985 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4986
4987 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4988 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4989
4990 pDot11f->DevicePasswordID.present = 1;
4991 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4992
4993 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4994 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4995
4996 // UUID_E and RF Bands are applicable only for dual band AP
4997
4998 return eSIR_SUCCESS;
4999}
5000
5001tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5002 tDot11fIEWscProbeRes *pDot11f)
5003{
5004 pDot11f->APSetupLocked.present = 0;
5005 pDot11f->SelectedRegistrar.present = 0;
5006 pDot11f->DevicePasswordID.present = 0;
5007 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5008
5009 return eSIR_SUCCESS;
5010}
5011
5012tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5013 tDot11fIEWscAssocRes *pDot11f,
5014 tpSirAssocReq pRcvdAssocReq)
5015{
5016 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5017 tANI_U8 *wscIe;
5018
5019
5020 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5021 if(wscIe != NULL)
5022 {
5023 // retreive WSC IE from given AssocReq
5024 dot11fUnpackIeWscAssocReq( pMac,
5025 wscIe + 2 + 4, // EID, length, OUI
5026 wscIe[ 1 ] - 4, // length without OUI
5027 &parsedWscAssocReq );
5028 pDot11f->present = 1;
5029 // version has to be 0x10
5030 pDot11f->Version.present = 1;
5031 pDot11f->Version.major = 0x1;
5032 pDot11f->Version.minor = 0x0;
5033
5034 pDot11f->ResponseType.present = 1;
5035
5036 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5037 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5038 {
5039 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5040 }
5041 else
5042 {
5043 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5044 }
5045 // Version infomration should be taken from our capability as well as peers
5046 // TODO: currently it takes from peers only
5047 if(parsedWscAssocReq.VendorExtension.present &&
5048 parsedWscAssocReq.VendorExtension.Version2.present)
5049 {
5050 pDot11f->VendorExtension.present = 1;
5051 pDot11f->VendorExtension.vendorId[0] = 0x00;
5052 pDot11f->VendorExtension.vendorId[1] = 0x37;
5053 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5054 pDot11f->VendorExtension.Version2.present = 1;
5055 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5056 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5057 }
5058 }
5059 return eSIR_SUCCESS;
5060}
5061
Jeff Johnson295189b2012-06-20 16:38:30 -07005062tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5063 tDot11fIEP2PAssocRes *pDot11f,
5064 tpSirAssocReq pRcvdAssocReq)
5065{
5066 tANI_U8 *p2pIe;
5067
5068 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5069 if(p2pIe != NULL)
5070 {
5071 pDot11f->present = 1;
5072 pDot11f->P2PStatus.present = 1;
5073 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5074 pDot11f->ExtendedListenTiming.present = 0;
5075 }
5076 return eSIR_SUCCESS;
5077}
Jeff Johnson295189b2012-06-20 16:38:30 -07005078
5079#if defined WLAN_FEATURE_VOWIFI
5080
5081tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5082 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5083{
5084 pDot11f->txPower = txPower;
5085 pDot11f->linkMargin = linkMargin;
5086 pDot11f->present = 1;
5087
5088 return eSIR_SUCCESS;
5089}
5090
5091tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5092{
5093
5094 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5095 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305096 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5097 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005098 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5099 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5100 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5101 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5102 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305103 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005104 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5105 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5106
5107 if( pBeaconReport->numIes )
5108 {
5109 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305110 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5111 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005112 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5113 }
5114
5115 return eSIR_SUCCESS;
5116
5117}
5118
5119tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5120{
5121 tpRRMCaps pRrmCaps;
5122
5123 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5124
5125 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5126 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5127 pDot11f->parallel = pRrmCaps->parallel ;
5128 pDot11f->repeated = pRrmCaps->repeated ;
5129 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5130 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5131 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5132 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5133 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5134 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5135 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5136 pDot11f->statistics = pRrmCaps->statistics ;
5137 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5138 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5139 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5140 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5141 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5142 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5143 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5144 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5145 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5146 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5147 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5148 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5149 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5150 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5151 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5152 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5153
5154 pDot11f->present = 1;
5155 return eSIR_SUCCESS;
5156}
5157#endif
5158
5159#if defined WLAN_FEATURE_VOWIFI_11R
5160void PopulateMDIE( tpAniSirGlobal pMac,
5161 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5162{
5163 pDot11f->present = 1;
5164 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5165
5166 // Plugfest fix
5167 pDot11f->overDSCap = (mdie[2] & 0x01);
5168 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5169
5170}
5171
5172void PopulateFTInfo( tpAniSirGlobal pMac,
5173 tDot11fIEFTInfo *pDot11f )
5174{
5175 pDot11f->present = 1;
5176 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5177 //All other info is zero.
5178
5179}
5180#endif
5181
5182void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5183 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5184{
5185 tANI_U8 num_supp = 0, num_ext = 0;
5186 tANI_U8 i,j;
5187
5188 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5189 {
5190 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5191 }
5192 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5193 {
5194 if( num_supp < 8 )
5195 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5196 else
5197 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5198 }
5199
5200 if( num_supp )
5201 {
5202 pSupp->num_rates = num_supp;
5203 pSupp->present = 1;
5204 }
5205 if( num_ext )
5206 {
5207 pExt->num_rates = num_ext;
5208 pExt->present = 1;
5209 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005210}
5211
5212void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5213 tDot11fIETimeoutInterval *pDot11f,
5214 tANI_U8 type, tANI_U32 value )
5215{
5216 pDot11f->present = 1;
5217 pDot11f->timeoutType = type;
5218 pDot11f->timeoutValue = value;
5219}
Jeff Johnson295189b2012-06-20 16:38:30 -07005220// parserApi.c ends here.