blob: a26fcef68170967ae17e092cd885e1eda7f87e72 [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
Sandeep Puligilla60342762014-01-30 21:05:37 +0530958#ifdef WLAN_FEATURE_11AC
959 if (psessionEntry->vhtCapability)
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530960 {
Sandeep Puligilla60342762014-01-30 21:05:37 +0530961 pDot11f->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530962 pDot11f->present = 1;
963 }
Sandeep Puligilla60342762014-01-30 21:05:37 +0530964#endif
965 /* while operating in 2.4GHz only then STA need to advertize
966 the bss co-ex capability*/
967 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
968 {
969 if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_24G, &val) !=
970 eSIR_SUCCESS)
971 PELOGE(limLog(pMac, LOGE, FL("could not retrieve "
972 "24G Chan bond Length \n"));)
973 if (TRUE == val)
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530974 {
Sandeep Puligilla60342762014-01-30 21:05:37 +0530975 pDot11f->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +0530976 pDot11f->present = 1;
977 }
Sandeep Puligilla60342762014-01-30 21:05:37 +0530978 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700979 return eSIR_SUCCESS;
980}
981
982tSirRetStatus
983PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
984 tDot11fIEOperatingMode *pDot11f,
985 tpPESession psessionEntry)
986{
987 pDot11f->present = 1;
988
989 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
990 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
991 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
992
993 return eSIR_SUCCESS;
994}
Jeff Johnsone7245742012-09-05 17:12:55 -0700995
996#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700997tSirRetStatus
998PopulateDot11fHTInfo(tpAniSirGlobal pMac,
999 tDot11fIEHTInfo *pDot11f,
1000 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001001{
1002 tANI_U32 nCfgValue, nCfgLen;
1003 tANI_U8 htInfoField1;
1004 tANI_U16 htInfoField2;
1005 tSirRetStatus nSirStatus;
1006 tSirMacHTInfoField1 *pHTInfoField1;
1007 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 union {
1009 tANI_U16 nCfgValue16;
1010 tSirMacHTInfoField3 infoField3;
1011 }uHTInfoField;
1012 union {
1013 tANI_U16 nCfgValue16;
1014 tSirMacHTInfoField2 infoField2;
1015 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001016
Jeff Johnson295189b2012-06-20 16:38:30 -07001017
1018 #if 0
1019 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1020 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301021
1022 if (NULL == psessionEntry)
1023 {
1024 PELOGE(limLog(pMac, LOG1,
1025 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
1026 return eSIR_FAILURE;
1027 }
1028
Jeff Johnson295189b2012-06-20 16:38:30 -07001029 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1030
1031 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1032
1033 htInfoField1 = ( tANI_U8 ) nCfgValue;
1034
1035 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1037 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1038
Jeff Johnsone7245742012-09-05 17:12:55 -07001039 if (psessionEntry == NULL)
1040 {
1041 PELOGE(limLog(pMac, LOG1,
1042 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
1043 }
1044 else
1045 {
1046 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1047 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1048 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001049
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001050 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1052
1053 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1054
1055 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1056 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1057 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1058
1059 uHTInfoField2.infoField2.reserved = 0;
1060
1061 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1063
1064 htInfoField2 = ( tANI_U16 ) nCfgValue;
1065
1066 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1067 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1068 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1069 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1070
1071 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001073
1074 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1075
1076
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1078
1079
1080 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1081 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1082 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1083 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1084 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1085 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1086 uHTInfoField.infoField3.reserved = 0;
1087
Jeff Johnson295189b2012-06-20 16:38:30 -07001088
1089 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1090 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1091 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1092 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1093 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1094
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1096 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1097 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1098 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1099
Jeff Johnson295189b2012-06-20 16:38:30 -07001100
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1102 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1103 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1104 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1105 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1106 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1107 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1109 pDot11f->basicMCSSet, nCfgLen,
1110 SIZE_OF_BASIC_MCS_SET );
1111
1112 pDot11f->present = 1;
1113
1114 return eSIR_SUCCESS;
1115
1116} // End PopulateDot11fHTInfo.
1117
1118void
1119PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1120 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1121{
1122 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1123 {
1124 pDot11f->present = 1;
1125 // ATIM duration is always set to 0
1126 pDot11f->atim = 0;
1127 }
1128
1129} // End PopulateDot11fIBSSParams.
1130
1131
1132#ifdef ANI_SUPPORT_11H
1133tSirRetStatus
1134PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1135 tpSirMacMeasReqActionFrame pReq,
1136 tDot11fIEMeasurementReport *pDot11f)
1137{
1138 pDot11f->token = pReq->measReqIE.measToken;
1139 pDot11f->late = 0;
1140 pDot11f->incapable = 0;
1141 pDot11f->refused = 1;
1142 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1143
1144 pDot11f->present = 1;
1145
1146 return eSIR_SUCCESS;
1147
1148} // End PopulatedDot11fMeasurementReport0.
1149
1150tSirRetStatus
1151PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1152 tpSirMacMeasReqActionFrame pReq,
1153 tDot11fIEMeasurementReport *pDot11f)
1154{
1155 pDot11f->token = pReq->measReqIE.measToken;
1156 pDot11f->late = 0;
1157 pDot11f->incapable = 0;
1158 pDot11f->refused = 1;
1159 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1160
1161 pDot11f->present = 1;
1162
1163 return eSIR_SUCCESS;
1164
1165} // End PopulatedDot11fMeasurementReport1.
1166
1167tSirRetStatus
1168PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1169 tpSirMacMeasReqActionFrame pReq,
1170 tDot11fIEMeasurementReport *pDot11f)
1171{
1172 pDot11f->token = pReq->measReqIE.measToken;
1173 pDot11f->late = 0;
1174 pDot11f->incapable = 0;
1175 pDot11f->refused = 1;
1176 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1177
1178 pDot11f->present = 1;
1179
1180 return eSIR_SUCCESS;
1181
1182} // End PopulatedDot11fMeasurementReport2.
1183#endif
1184
1185void
1186PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1187 tDot11fIEPowerCaps *pCaps,
1188 tANI_U8 nAssocType,
1189 tpPESession psessionEntry)
1190{
1191 if (nAssocType == LIM_REASSOC)
1192 {
1193 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1194 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1195 }else
1196 {
1197 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1198 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1199
1200 }
1201
1202 pCaps->present = 1;
1203} // End PopulateDot11fPowerCaps.
1204
1205tSirRetStatus
1206PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1207 tDot11fIEPowerConstraints *pDot11f)
1208{
1209 tANI_U32 cfg;
1210 tSirRetStatus nSirStatus;
1211
1212 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1213
1214 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1215 pDot11f->present = 1;
1216
1217 return eSIR_SUCCESS;
1218} // End PopulateDot11fPowerConstraints.
1219
1220void
1221PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1222 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1223{
1224 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1225 pDot11f->reserved = 0;
1226 pDot11f->txopreq = 0;
1227 pDot11f->qreq = 0;
1228 pDot11f->qack = 0;
1229 pDot11f->present = 1;
1230} // End PopulatedDot11fQOSCaps.
1231
1232void
1233PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1234 tDot11fIEQOSCapsStation *pDot11f)
1235{
1236 tANI_U32 val = 0;
1237
1238 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1239 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1240
1241 pDot11f->more_data_ack = 0;
1242 pDot11f->max_sp_length = (tANI_U8)val;
1243 pDot11f->qack = 0;
1244
1245 if (pMac->lim.gUapsdEnable)
1246 {
1247 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1248 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1249 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1250 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1251 }
1252 pDot11f->present = 1;
1253} // End PopulatedDot11fQOSCaps.
1254
1255tSirRetStatus
1256PopulateDot11fRSN(tpAniSirGlobal pMac,
1257 tpSirRSNie pRsnIe,
1258 tDot11fIERSN *pDot11f)
1259{
1260 tANI_U32 status;
1261 int idx;
1262
1263 if ( pRsnIe->length )
1264 {
1265 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1266 {
1267 status = dot11fUnpackIeRSN( pMac,
1268 pRsnIe->rsnIEdata + idx + 2, //EID, length
1269 pRsnIe->rsnIEdata[ idx + 1 ],
1270 pDot11f );
1271 if ( DOT11F_FAILED( status ) )
1272 {
1273 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1274 "N (0x%08x).\n"),
1275 status );
1276 return eSIR_FAILURE;
1277 }
1278 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1279 "PopulateDot11fRSN.\n"), status );
1280 }
1281
1282 }
1283
1284 return eSIR_SUCCESS;
1285} // End PopulateDot11fRSN.
1286
1287tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1288 tpSirRSNie pRsnIe,
1289 tDot11fIERSNOpaque *pDot11f )
1290{
1291 int idx;
1292
1293 if ( pRsnIe->length )
1294 {
1295 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1296 {
1297 pDot11f->present = 1;
1298 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301299 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 pRsnIe->rsnIEdata + idx + 2, // EID, len
1301 pRsnIe->rsnIEdata[ idx + 1 ] );
1302 }
1303 }
1304
1305 return eSIR_SUCCESS;
1306
1307} // End PopulateDot11fRSNOpaque.
1308
1309
1310
1311#if defined(FEATURE_WLAN_WAPI)
1312
1313tSirRetStatus
1314PopulateDot11fWAPI(tpAniSirGlobal pMac,
1315 tpSirRSNie pRsnIe,
1316 tDot11fIEWAPI *pDot11f)
1317 {
1318 tANI_U32 status;
1319 int idx;
1320
1321 if ( pRsnIe->length )
1322 {
1323 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1324 {
1325 status = dot11fUnpackIeWAPI( pMac,
1326 pRsnIe->rsnIEdata + idx + 2, //EID, length
1327 pRsnIe->rsnIEdata[ idx + 1 ],
1328 pDot11f );
1329 if ( DOT11F_FAILED( status ) )
1330 {
1331 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1332 status );
1333 return eSIR_FAILURE;
1334 }
1335 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1336 "PopulateDot11fWAPI.\n"), status );
1337 }
1338 }
1339
1340 return eSIR_SUCCESS;
1341} // End PopulateDot11fWAPI.
1342
1343tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1344 tpSirRSNie pRsnIe,
1345 tDot11fIEWAPIOpaque *pDot11f )
1346{
1347 int idx;
1348
1349 if ( pRsnIe->length )
1350 {
1351 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1352 {
1353 pDot11f->present = 1;
1354 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301355 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 pRsnIe->rsnIEdata + idx + 2, // EID, len
1357 pRsnIe->rsnIEdata[ idx + 1 ] );
1358 }
1359 }
1360
1361 return eSIR_SUCCESS;
1362
1363} // End PopulateDot11fWAPIOpaque.
1364
1365
1366#endif //defined(FEATURE_WLAN_WAPI)
1367
1368void
1369PopulateDot11fSSID(tpAniSirGlobal pMac,
1370 tSirMacSSid *pInternal,
1371 tDot11fIESSID *pDot11f)
1372{
1373 pDot11f->present = 1;
1374 pDot11f->num_ssid = pInternal->length;
1375 if ( pInternal->length )
1376 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301377 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 pInternal->length );
1379 }
1380} // End PopulateDot11fSSID.
1381
1382tSirRetStatus
1383PopulateDot11fSSID2(tpAniSirGlobal pMac,
1384 tDot11fIESSID *pDot11f)
1385{
1386 tANI_U32 nCfg;
1387 tSirRetStatus nSirStatus;
1388
1389 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1390 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1391 pDot11f->present = 1;
1392 return eSIR_SUCCESS;
1393} // End PopulateDot11fSSID2.
1394
1395void
1396PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1397 tDot11fIESchedule *pDot11f)
1398{
1399 pDot11f->aggregation = pSchedule->info.aggregation;
1400 pDot11f->tsid = pSchedule->info.tsid;
1401 pDot11f->direction = pSchedule->info.direction;
1402 pDot11f->reserved = pSchedule->info.rsvd;
1403 pDot11f->service_start_time = pSchedule->svcStartTime;
1404 pDot11f->service_interval = pSchedule->svcInterval;
1405 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1406 pDot11f->spec_interval = pSchedule->specInterval;
1407
1408 pDot11f->present = 1;
1409} // End PopulateDot11fSchedule.
1410
1411void
1412PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1413 tDot11fIESuppChannels *pDot11f,
1414 tANI_U8 nAssocType,
1415 tpPESession psessionEntry)
1416{
1417 tANI_U8 i;
1418 tANI_U8 *p;
1419
1420 if (nAssocType == LIM_REASSOC)
1421 {
1422 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1423 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1424 }else
1425 {
1426 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1427 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1428 }
1429 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1430 {
1431 pDot11f->bands[i][0] = *p;
1432 pDot11f->bands[i][1] = 1;
1433 }
1434
1435 pDot11f->present = 1;
1436
1437} // End PopulateDot11fSuppChannels.
1438
1439tSirRetStatus
1440PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1441 tANI_U8 nChannelNum,
1442 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1443{
1444 tSirRetStatus nSirStatus;
1445 tANI_U32 nRates;
1446 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1447
1448 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1449 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1450 sending mgmt frames (lile probe req) which need to go out before any session is present.
1451 */
1452 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1453 {
1454 #if 0
1455 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1456 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1457 #endif //TO SUPPORT BT-AMP
1458 if(psessionEntry != NULL)
1459 {
1460 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301461 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001462 nRates);
1463 }
1464 else
1465 {
1466 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1467 nRates = 0;
1468 }
1469 }
1470 else if ( 14 >= nChannelNum )
1471 {
1472 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1473 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1474 }
1475 else
1476 {
1477 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1478 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1479 }
1480
1481 if ( 0 != nRates )
1482 {
1483 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301484 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 pDot11f->present = 1;
1486 }
1487
1488 return eSIR_SUCCESS;
1489
1490} // End PopulateDot11fSuppRates.
1491
1492tSirRetStatus
1493PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1494 tDot11fIETPCReport *pDot11f,
1495 tpPESession psessionEntry)
1496{
1497 tANI_U16 staid, txPower;
1498 tSirRetStatus nSirStatus;
1499
1500 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1501 if ( eSIR_SUCCESS != nSirStatus )
1502 {
1503 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1504 "eDot11fTPCReport; limGetMgmtStaid "
1505 "returned status %d.\n"),
1506 nSirStatus );
1507 return eSIR_FAILURE;
1508 }
1509
1510 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1511 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1512 txPower = 0;
1513 pDot11f->tx_power = ( tANI_U8 )txPower;
1514 pDot11f->link_margin = 0;
1515 pDot11f->present = 1;
1516
1517 return eSIR_SUCCESS;
1518} // End PopulateDot11fTPCReport.
1519
1520
1521void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1522 tDot11fFfTSInfo *pDot11f)
1523{
1524 pDot11f->traffic_type = pInfo->traffic.trafficType;
1525 pDot11f->tsid = pInfo->traffic.tsid;
1526 pDot11f->direction = pInfo->traffic.direction;
1527 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1528 pDot11f->aggregation = pInfo->traffic.aggregation;
1529 pDot11f->psb = pInfo->traffic.psb;
1530 pDot11f->user_priority = pInfo->traffic.userPrio;
1531 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1532 pDot11f->schedule = pInfo->schedule.schedule;
1533} // End PopulatedDot11fTSInfo.
1534
1535void PopulateDot11fWMM(tpAniSirGlobal pMac,
1536 tDot11fIEWMMInfoAp *pInfo,
1537 tDot11fIEWMMParams *pParams,
1538 tDot11fIEWMMCaps *pCaps,
1539 tpPESession psessionEntry)
1540{
1541 if ( psessionEntry->limWmeEnabled )
1542 {
1543 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1544 {
1545 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1546 {
1547 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1548 }
1549 }
1550 else
1551 {
1552 {
1553 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1554 }
1555
1556 if ( psessionEntry->limWsmEnabled )
1557 {
1558 PopulateDot11fWMMCaps( pCaps );
1559 }
1560 }
1561 }
1562} // End PopulateDot11fWMM.
1563
1564void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1565{
1566 pCaps->version = SIR_MAC_OUI_VERSION_1;
1567 pCaps->qack = 0;
1568 pCaps->queue_request = 1;
1569 pCaps->txop_request = 0;
1570 pCaps->more_ack = 0;
1571 pCaps->present = 1;
1572} // End PopulateDot11fWmmCaps.
1573
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001574#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001575void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1576{
1577 tANI_U8 numTspecs = 0, idx;
1578 tTspecInfo *pTspec = NULL;
1579
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001580 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1581 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 pReassoc->num_WMMTSPEC = numTspecs;
1583 if (numTspecs) {
1584 for (idx=0; idx<numTspecs; idx++) {
1585 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301586 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 pTspec++;
1588 }
1589 }
1590}
1591#endif
1592
1593void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1594 tpPESession psessionEntry)
1595{
1596 pInfo->version = SIR_MAC_OUI_VERSION_1;
1597
1598 /* WMM Specification 3.1.3, 3.2.3
1599 * An IBSS staion shall always use its default WMM parameters.
1600 */
1601 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1602 {
1603 pInfo->param_set_count = 0;
1604 pInfo->uapsd = 0;
1605 }
1606 else
1607 {
1608 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1610 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1611 }
1612 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1614 }
1615 pInfo->present = 1;
1616}
1617
1618void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1619{
1620 tANI_U32 val = 0;
1621
1622 pInfo->version = SIR_MAC_OUI_VERSION_1;
1623 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1624 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1625 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1626 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1627
1628 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1629 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1630
1631 pInfo->max_sp_length = (tANI_U8)val;
1632 pInfo->present = 1;
1633}
1634
Jeff Johnson295189b2012-06-20 16:38:30 -07001635void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1636 tDot11fIEWMMParams *pParams,
1637 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001638{
1639 pParams->version = SIR_MAC_OUI_VERSION_1;
1640
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1642 pParams->qosInfo =
1643 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1644 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 pParams->qosInfo =
1646 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1647
1648 // Fill each EDCA parameter set in order: be, bk, vi, vo
1649 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1650 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1651 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1652 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1653 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1654 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1655
1656 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1657 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1658 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1659 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1660 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1661 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1662
Jeff Johnson295189b2012-06-20 16:38:30 -07001663 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1664 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1665 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1667
1668
1669
1670 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1671 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1672 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1673 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1674 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1675
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1677 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1678 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1680
1681 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1682 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1683 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1684 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1685 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1686
1687 pParams->present = 1;
1688
1689} // End PopulateDot11fWMMParams.
1690
1691void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1692 tDot11fIEWMMSchedule *pDot11f)
1693{
1694 pDot11f->version = 1;
1695 pDot11f->aggregation = pSchedule->info.aggregation;
1696 pDot11f->tsid = pSchedule->info.tsid;
1697 pDot11f->direction = pSchedule->info.direction;
1698 pDot11f->reserved = pSchedule->info.rsvd;
1699 pDot11f->service_start_time = pSchedule->svcStartTime;
1700 pDot11f->service_interval = pSchedule->svcInterval;
1701 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1702 pDot11f->spec_interval = pSchedule->specInterval;
1703
1704 pDot11f->present = 1;
1705} // End PopulateDot11fWMMSchedule.
1706
1707tSirRetStatus
1708PopulateDot11fWPA(tpAniSirGlobal pMac,
1709 tpSirRSNie pRsnIe,
1710 tDot11fIEWPA *pDot11f)
1711{
1712 tANI_U32 status;
1713 int idx;
1714
1715 if ( pRsnIe->length )
1716 {
1717 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1718 {
1719 status = dot11fUnpackIeWPA( pMac,
1720 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1721 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1722 pDot11f );
1723 if ( DOT11F_FAILED( status ) )
1724 {
1725 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1726 "A (0x%08x).\n"),
1727 status );
1728 return eSIR_FAILURE;
1729 }
1730 }
1731 }
1732
1733 return eSIR_SUCCESS;
1734} // End PopulateDot11fWPA.
1735
1736
1737
1738tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1739 tpSirRSNie pRsnIe,
1740 tDot11fIEWPAOpaque *pDot11f )
1741{
1742 int idx;
1743
1744 if ( pRsnIe->length )
1745 {
1746 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1747 {
1748 pDot11f->present = 1;
1749 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301750 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001751 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1752 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1753 }
1754 }
1755
1756 return eSIR_SUCCESS;
1757
1758} // End PopulateDot11fWPAOpaque.
1759
1760////////////////////////////////////////////////////////////////////////
1761
1762tSirRetStatus
1763sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1764{
1765#if 0
1766 tANI_U32 val;
1767
1768 *caps = 0;
1769 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1770 != eSIR_SUCCESS)
1771 {
1772 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1773 return eSIR_FAILURE;
1774 }
1775 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1776 {
1777 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1778 return eSIR_FAILURE;
1779 }
1780
1781 *caps = (tANI_U16) val;
1782#endif
1783 return eSIR_SUCCESS;
1784}
1785
1786tSirRetStatus
1787sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1788 tANI_U8 *pFrame,
1789 tANI_U32 nFrame,
1790 tpSirProbeReq pProbeReq)
1791{
1792 tANI_U32 status;
1793 tDot11fProbeRequest pr;
1794
1795 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301796 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001797
1798 // delegate to the framesc-generated code,
1799 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1800 if ( DOT11F_FAILED( status ) )
1801 {
1802 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1803 status, nFrame);
1804 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1805 return eSIR_FAILURE;
1806 }
1807 else if ( DOT11F_WARNED( status ) )
1808 {
1809 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1810 status, nFrame );
1811 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1812 }
1813
1814 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1815 if ( ! pr.SSID.present )
1816 {
1817 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1818 }
1819 else
1820 {
1821 pProbeReq->ssidPresent = 1;
1822 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
1823 }
1824
1825 if ( ! pr.SuppRates.present )
1826 {
1827 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1828 return eSIR_FAILURE;
1829 }
1830 else
1831 {
1832 pProbeReq->suppRatesPresent = 1;
1833 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
1834 }
1835
1836 if ( pr.ExtSuppRates.present )
1837 {
1838 pProbeReq->extendedRatesPresent = 1;
1839 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
1840 }
1841
1842 if ( pr.HTCaps.present )
1843 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301844 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001845 }
1846
1847 if ( pr.WscProbeReq.present )
1848 {
1849 pProbeReq->wscIePresent = 1;
1850 memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
1851 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001852#ifdef WLAN_FEATURE_11AC
1853 if ( pr.VHTCaps.present )
1854 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301855 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07001856 }
1857#endif
1858
Jeff Johnson295189b2012-06-20 16:38:30 -07001859
1860 if ( pr.P2PProbeReq.present )
1861 {
1862 pProbeReq->p2pIePresent = 1;
1863 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001864
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 return eSIR_SUCCESS;
1866
1867} // End sirConvertProbeReqFrame2Struct.
1868
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301869/* function ValidateAndRectifyIEs checks for the malformed frame.
1870 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301871 * (Tagged elements).
1872 * Every Tagged IE has tag number, tag length and data. Tag length indicates
1873 * the size of data in bytes.
1874 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301875 * And also rectifies missing optional fields in IE.
1876 *
1877 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
1878 * extended to rectify other optional fields in other IEs.
1879 *
1880 */
1881tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
1882 tANI_U8 *pMgmtFrame,
1883 tANI_U32 nFrameBytes,
1884 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301885{
1886 tANI_U32 length = SIZE_OF_FIXED_PARAM;
1887 tANI_U8 *refFrame;
1888
1889 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301890 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301891 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301892 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301893 {
1894 /*refFrame points to next IE */
1895 refFrame = pMgmtFrame + length;
1896 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
1897 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
1898 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301899 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301900 {
1901 /* Workaround : Some APs may not include RSN Capability but
1902 * the length of which is included in RSN IE length.
1903 * this may cause in updating RSN Capability with junk value.
1904 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301905 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301906 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301907 if ((*refFrame == RSNIEID) &&
1908 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301909 {
1910 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301911 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301912 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05301913 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301914 limLog(pMac, LOG1,
1915 FL("Added RSN Capability to the RSNIE as 0x00 0x00\n"));
1916
1917 return eHAL_STATUS_SUCCESS;
1918 }
1919 return eSIR_FAILURE;
1920 }
1921 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05301922 return eHAL_STATUS_SUCCESS;
1923}
1924
Jeff Johnson295189b2012-06-20 16:38:30 -07001925tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
1926 tANI_U8 *pFrame,
1927 tANI_U32 nFrame,
1928 tpSirProbeRespBeacon pProbeResp)
1929{
1930 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001931 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07001932
1933 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301934 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001935
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301936 pr = vos_mem_malloc(sizeof(tDot11fProbeResponse));
1937 if ( NULL == pr )
1938 status = eHAL_STATUS_FAILURE;
1939 else
1940 status = eHAL_STATUS_SUCCESS;
1941 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07001942 {
1943 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
1944 return eSIR_FAILURE;
1945 }
1946
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301947 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07001948
Jeff Johnson295189b2012-06-20 16:38:30 -07001949 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07001950 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 if ( DOT11F_FAILED( status ) )
1952 {
1953 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
1954 status, nFrame);
1955 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301956 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 return eSIR_FAILURE;
1958 }
1959 else if ( DOT11F_WARNED( status ) )
1960 {
1961 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
1962 status, nFrame );
1963 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1964 }
1965
1966 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
1967
1968 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301969 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
1970 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001971
1972 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07001973 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07001974
1975 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07001976 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
1977 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
1978 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
1979 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
1980 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
1981 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
1982 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
1983 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
1984 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
1985 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
1986 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
1987 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
1988 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
1989 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
1990 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
1991 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07001992
Jeff Johnson32d95a32012-09-10 13:15:23 -07001993 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 {
1995 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1996 }
1997 else
1998 {
1999 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002000 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 }
2002
Jeff Johnson32d95a32012-09-10 13:15:23 -07002003 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 {
2005 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2006 }
2007 else
2008 {
2009 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002010 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002011 }
2012
Jeff Johnson32d95a32012-09-10 13:15:23 -07002013 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 {
2015 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002016 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 }
2018
2019
Jeff Johnson32d95a32012-09-10 13:15:23 -07002020 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002021 {
2022 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002023 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 }
2025
Jeff Johnson32d95a32012-09-10 13:15:23 -07002026 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 {
2028 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002029 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 }
2031
Jeff Johnson32d95a32012-09-10 13:15:23 -07002032 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 {
2034 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002035 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 }
2037
Jeff Johnson32d95a32012-09-10 13:15:23 -07002038 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 {
2040 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302041 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 sizeof(tDot11fIEExtChanSwitchAnn) );
2043 }
2044
Jeff Johnson32d95a32012-09-10 13:15:23 -07002045 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 {
2047 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302048 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 sizeof(tDot11fIEExtChanSwitchAnn) );
2050 }
2051
Jeff Johnson32d95a32012-09-10 13:15:23 -07002052 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 {
2054 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302055 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 }
2057
Jeff Johnson32d95a32012-09-10 13:15:23 -07002058 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 {
2060 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302061 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2062 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 }
2064
Jeff Johnson32d95a32012-09-10 13:15:23 -07002065 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 {
2067 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302068 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 }
2070
Jeff Johnson32d95a32012-09-10 13:15:23 -07002071 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302073 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 }
2075
Jeff Johnson32d95a32012-09-10 13:15:23 -07002076 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302078 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 }
2080
Jeff Johnson32d95a32012-09-10 13:15:23 -07002081 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 {
2083 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002084 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002086 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002087 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002088 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 }
2090
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002091 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002092 {
2093 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002094 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 }
2096
Jeff Johnson32d95a32012-09-10 13:15:23 -07002097 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 {
2099 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002100 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002101 }
2102
Jeff Johnson32d95a32012-09-10 13:15:23 -07002103 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 {
2105 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002106 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002108 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 }
2110
Jeff Johnson32d95a32012-09-10 13:15:23 -07002111 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 {
2113 pProbeResp->wmeInfoPresent = 1;
2114 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2115 }
2116
Jeff Johnson32d95a32012-09-10 13:15:23 -07002117 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 {
2119 pProbeResp->wsmCapablePresent = 1;
2120 }
2121
2122
Jeff Johnson32d95a32012-09-10 13:15:23 -07002123 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 {
2125 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002126 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002127 }
2128
2129#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002130 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 {
2132 // MobilityDomain
2133 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302134 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2135 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002136 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002137#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002138 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2140#endif
2141 }
2142#endif
2143
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002144#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002145 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302147 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002148 }
2149#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002150 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302152 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 sizeof(tDot11fIEP2PProbeRes) );
2154 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002155#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002156 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002157 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302158 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002159 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002160 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002161 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302162 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002163 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002164 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002165 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302166 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002167 }
2168#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302169 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 return eSIR_SUCCESS;
2171
2172} // End sirConvertProbeFrame2Struct.
2173
2174tSirRetStatus
2175sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2176 tANI_U8 *pFrame,
2177 tANI_U32 nFrame,
2178 tpSirAssocReq pAssocReq)
2179{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002180 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 tANI_U32 status;
2182
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302183 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2184 if ( NULL == ar )
2185 status = eHAL_STATUS_FAILURE;
2186 else
2187 status = eHAL_STATUS_SUCCESS;
2188 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002189 {
2190 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2191 return eSIR_FAILURE;
2192 }
2193 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302194 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2195 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002196
2197 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002198 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 if ( DOT11F_FAILED( status ) )
2200 {
2201 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2202 status, nFrame);
2203 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302204 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 return eSIR_FAILURE;
2206 }
2207 else if ( DOT11F_WARNED( status ) )
2208 {
2209 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2210 status, nFrame );
2211 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2212 }
2213
2214 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2215
2216 // make sure this is seen as an assoc request
2217 pAssocReq->reassocRequest = 0;
2218
2219 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002220 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2221 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2222 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2223 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2224 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2225 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2226 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2227 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2228 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2229 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2230 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2231 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2232 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2233 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2234 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2235 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002236
2237 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002238 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002239
2240 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002241 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 {
2243 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002244 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 }
2246
2247 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002248 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 {
2250 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002251 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 }
2253
2254 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002255 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 {
2257 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002258 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 }
2260
2261 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002262 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 {
2264 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002265 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 }
2267
2268 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002269 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 {
2271 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002272 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 }
2274
2275 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002276 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 {
2278 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002279 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 }
2281
2282 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002283 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 {
2285 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002286 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 }
2288
2289
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002290 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 {
2292 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002293 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002295#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002296 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002297 {
2298 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002299 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002300 }
2301#endif
2302
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002304 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 {
2306 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002307 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 }
2309
2310 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002311 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 {
2313 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002314 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 }
2316
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002317 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302319 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 }
2321
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002322 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 {
2324 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302325 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2326 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002327
2328 }
2329
2330
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002331 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002332
2333 if ( ! pAssocReq->ssidPresent )
2334 {
2335 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302336 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 return eSIR_FAILURE;
2338 }
2339
2340 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2341 {
2342 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302343 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002344 return eSIR_FAILURE;
2345 }
2346
Jeff Johnsone7245742012-09-05 17:12:55 -07002347#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002348 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002349 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302350 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002351 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2352 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2353 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002354 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002355 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302356 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002357 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2358 limLogOperatingMode( pMac, &pAssocReq->operMode);
2359 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002360#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302361 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002362 return eSIR_SUCCESS;
2363
2364} // End sirConvertAssocReqFrame2Struct.
2365
2366tSirRetStatus
2367sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2368 tANI_U8 *pFrame,
2369 tANI_U32 nFrame,
2370 tpSirAssocRsp pAssocRsp)
2371{
2372 static tDot11fAssocResponse ar;
2373 tANI_U32 status;
2374 tANI_U8 cnt =0;
2375
2376 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302377 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002378
2379 // delegate to the framesc-generated code,
2380 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2381 if ( DOT11F_FAILED( status ) )
2382 {
2383 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2384 status, nFrame);
2385 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2386 return eSIR_FAILURE;
2387 }
2388 else if ( DOT11F_WARNED( status ) )
2389 {
2390 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2391 status, nFrame );
2392 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2393 }
2394
2395 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2396
2397 // Capabilities
2398 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2399 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2400 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2401 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2402 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2403 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2404 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2405 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2406 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2407 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2408 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2409 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2410 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2411 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2412 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2413 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2414
2415 pAssocRsp->statusCode = ar.Status.status;
2416 pAssocRsp->aid = ar.AID.associd;
2417
2418 if ( ! ar.SuppRates.present )
2419 {
2420 pAssocRsp->suppRatesPresent = 0;
2421 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2422 }
2423 else
2424 {
2425 pAssocRsp->suppRatesPresent = 1;
2426 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2427 }
2428
2429 if ( ar.ExtSuppRates.present )
2430 {
2431 pAssocRsp->extendedRatesPresent = 1;
2432 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2433 }
2434
2435 if ( ar.EDCAParamSet.present )
2436 {
2437 pAssocRsp->edcaPresent = 1;
2438 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2439 }
2440
2441
2442 if ( ar.WMMParams.present )
2443 {
2444 pAssocRsp->wmeEdcaPresent = 1;
2445 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002446 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 __printWMMParams(pMac, &ar.WMMParams);
2448 }
2449
2450 if ( ar.HTCaps.present )
2451 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302452 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002453 }
2454
2455 if ( ar.HTInfo.present )
2456 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302457 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 }
2459
2460#ifdef WLAN_FEATURE_VOWIFI_11R
2461 if (ar.MobilityDomain.present)
2462 {
2463 // MobilityDomain
2464 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302465 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2466 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002467 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2468#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002469 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2471#endif
2472 }
2473
2474 if ( ar.FTInfo.present )
2475 {
2476#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002477 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 -07002478 ar.FTInfo.R0KH_ID.present,
2479 ar.FTInfo.R1KH_ID.present);
2480#endif
2481 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302482 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 }
2484#endif
2485
2486#ifdef WLAN_FEATURE_VOWIFI_11R
2487 if (ar.num_RICDataDesc) {
2488 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2489 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302490 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2491 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 }
2493 }
2494 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2495 pAssocRsp->ricPresent = TRUE;
2496 }
2497#endif
2498
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002499#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002500 if (ar.num_WMMTSPEC) {
2501 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2502 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302503 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2504 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 }
2506 pAssocRsp->tspecPresent = TRUE;
2507 }
2508
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002509 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002510 {
2511 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302512 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002513 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 }
2515#endif
2516
Jeff Johnsone7245742012-09-05 17:12:55 -07002517#ifdef WLAN_FEATURE_11AC
2518 if ( ar.VHTCaps.present )
2519 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302520 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002521 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002522 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2523 }
2524 if ( ar.VHTOperation.present )
2525 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302526 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002527 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002528 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2529 }
2530#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302531 if(ar.OBSSScanParameters.present)
2532 {
2533 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2534 sizeof( tDot11fIEOBSSScanParameters));
2535 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002536 if ( ar.QosMapSet.present )
2537 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002538 pAssocRsp->QosMapSet.present = 1;
2539 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002540 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002541 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002542 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002543 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002544} // End sirConvertAssocRespFrame2Struct.
2545
2546tSirRetStatus
2547sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2548 tANI_U8 *pFrame,
2549 tANI_U32 nFrame,
2550 tpSirAssocReq pAssocReq)
2551{
2552 static tDot11fReAssocRequest ar;
2553 tANI_U32 status;
2554
2555 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302556 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002557
2558 // delegate to the framesc-generated code,
2559 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2560 if ( DOT11F_FAILED( status ) )
2561 {
2562 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2563 status, nFrame);
2564 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2565 return eSIR_FAILURE;
2566 }
2567 else if ( DOT11F_WARNED( status ) )
2568 {
2569 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2570 status, nFrame );
2571 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2572 }
2573
2574 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2575
2576 // make sure this is seen as a re-assoc request
2577 pAssocReq->reassocRequest = 1;
2578
2579 // Capabilities
2580 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2581 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2582 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2583 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2584 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2585 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2586 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2587 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2588 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2589 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2590 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2591 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2592 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2593 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2594 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2595 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2596
2597 // Listen Interval
2598 pAssocReq->listenInterval = ar.ListenInterval.interval;
2599
2600 // SSID
2601 if ( ar.SSID.present )
2602 {
2603 pAssocReq->ssidPresent = 1;
2604 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2605 }
2606
2607 // Supported Rates
2608 if ( ar.SuppRates.present )
2609 {
2610 pAssocReq->suppRatesPresent = 1;
2611 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2612 }
2613
2614 // Extended Supported Rates
2615 if ( ar.ExtSuppRates.present )
2616 {
2617 pAssocReq->extendedRatesPresent = 1;
2618 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2619 &ar.ExtSuppRates );
2620 }
2621
2622 // QOS Capabilities:
2623 if ( ar.QOSCapsStation.present )
2624 {
2625 pAssocReq->qosCapabilityPresent = 1;
2626 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2627 }
2628
2629 // WPA
2630 if ( ar.WPAOpaque.present )
2631 {
2632 pAssocReq->wpaPresent = 1;
2633 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2634 }
2635
2636 // RSN
2637 if ( ar.RSNOpaque.present )
2638 {
2639 pAssocReq->rsnPresent = 1;
2640 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2641 }
2642
2643
2644 // Power Capabilities
2645 if ( ar.PowerCaps.present )
2646 {
2647 pAssocReq->powerCapabilityPresent = 1;
2648 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2649 }
2650
2651 // Supported Channels
2652 if ( ar.SuppChannels.present )
2653 {
2654 pAssocReq->supportedChannelsPresent = 1;
2655 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2656 }
2657
2658 if ( ar.HTCaps.present )
2659 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302660 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 }
2662
2663 if ( ar.WMMInfoStation.present )
2664 {
2665 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302666 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2667 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002668
2669 }
2670
2671 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2672
2673 if ( ! pAssocReq->ssidPresent )
2674 {
2675 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2676 return eSIR_FAILURE;
2677 }
2678
2679 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2680 {
2681 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2682 return eSIR_FAILURE;
2683 }
2684
2685 // Why no call to 'updateAssocReqFromPropCapability' here, like
2686 // there is in 'sirConvertAssocReqFrame2Struct'?
2687
2688 // WSC IE
2689 if (ar.WscIEOpaque.present)
2690 {
2691 pAssocReq->addIEPresent = 1;
2692 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2693 }
2694
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 if(ar.P2PIEOpaque.present)
2696 {
2697 pAssocReq->addIEPresent = 1;
2698 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2699 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002700
Jeff Johnsone7245742012-09-05 17:12:55 -07002701#ifdef WLAN_FEATURE_WFD
2702 if(ar.WFDIEOpaque.present)
2703 {
2704 pAssocReq->addIEPresent = 1;
2705 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2706 }
2707#endif
2708
2709#ifdef WLAN_FEATURE_11AC
2710 if ( ar.VHTCaps.present )
2711 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302712 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002713 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002714 if ( ar.OperatingMode.present )
2715 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302716 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002717 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2718 limLogOperatingMode( pMac, &pAssocReq->operMode);
2719 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002720#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 return eSIR_SUCCESS;
2722
2723} // End sirConvertReassocReqFrame2Struct.
2724
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002725
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002726#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002727tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002728sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002729 tANI_U8 *pPayload,
2730 const tANI_U32 nPayload,
2731 tANI_U8 **outIeBuf,
2732 tANI_U32 *pOutIeLen)
2733{
2734 tDot11fBeaconIEs *pBies = NULL;
2735 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002736 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002737 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002738
2739 /* To store how many bytes are required to be allocated
2740 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002741 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002742 tANI_U8 *pos = NULL;
2743
2744 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002745 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002746 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2747 if ( NULL == pBies )
2748 status = eHAL_STATUS_FAILURE;
2749 else
2750 status = eHAL_STATUS_SUCCESS;
2751 if (!HAL_STATUS_SUCCESS(status))
2752 {
2753 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2754 return eSIR_FAILURE;
2755 }
2756 // delegate to the framesc-generated code,
2757 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2758
2759 if ( DOT11F_FAILED( status ) )
2760 {
2761 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2762 status, nPayload);
2763 vos_mem_free(pBies);
2764 return eSIR_FAILURE;
2765 }
2766 else if ( DOT11F_WARNED( status ) )
2767 {
2768 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2769 status, nPayload );
2770 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2771 }
2772
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002773 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002774 if ( !pBies->SSID.present )
2775 {
2776 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2777 }
2778 else
2779 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002780 eseBcnReportMandatoryIe.ssidPresent = 1;
2781 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002782 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002783 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002784 }
2785
2786 if ( !pBies->SuppRates.present )
2787 {
2788 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2789 }
2790 else
2791 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002792 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2793 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2794 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002795 }
2796
2797 if ( pBies->FHParamSet.present)
2798 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002799 eseBcnReportMandatoryIe.fhParamPresent = 1;
2800 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002801 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2802 }
2803
2804 if ( pBies->DSParams.present )
2805 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002806 eseBcnReportMandatoryIe.dsParamsPresent = 1;
2807 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002808 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2809 }
2810
2811 if ( pBies->CFParams.present )
2812 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002813 eseBcnReportMandatoryIe.cfPresent = 1;
2814 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002815 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
2816 }
2817
2818 if ( pBies->IBSSParams.present )
2819 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002820 eseBcnReportMandatoryIe.ibssParamPresent = 1;
2821 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002822 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2823 }
2824
2825 if ( pBies->TIM.present )
2826 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002827 eseBcnReportMandatoryIe.timPresent = 1;
2828 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
2829 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
2830 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
2831 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002832 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
2833 }
2834
2835 if ( pBies->RRMEnabledCap.present )
2836 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002837 eseBcnReportMandatoryIe.rrmPresent = 1;
2838 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002839 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2840 }
2841
2842 *outIeBuf = vos_mem_malloc(numBytes);
2843 if (NULL == *outIeBuf)
2844 {
2845 limLog(pMac, LOGP, FL("Memory Allocation failure"));
2846 vos_mem_free(pBies);
2847 return eSIR_FAILURE;
2848 }
2849 pos = *outIeBuf;
2850 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002851 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002852
2853 /* Start filling the output Ie with Mandatory IE information */
2854 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002855 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002856 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002857 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002858 {
2859 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
2860 retStatus = eSIR_FAILURE;
2861 goto err_bcnrep;
2862 }
2863 *pos = SIR_MAC_SSID_EID;
2864 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002865 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002866 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002867 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
2868 eseBcnReportMandatoryIe.ssId.length);
2869 pos += eseBcnReportMandatoryIe.ssId.length;
2870 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002871 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002872
2873 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002874 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002875 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002876 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002877 {
2878 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
2879 retStatus = eSIR_FAILURE;
2880 goto err_bcnrep;
2881 }
2882 *pos = SIR_MAC_RATESET_EID;
2883 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002884 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002885 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002886 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
2887 eseBcnReportMandatoryIe.supportedRates.numRates);
2888 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
2889 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002890 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002891
2892 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002893 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002894 {
2895 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
2896 {
2897 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
2898 retStatus = eSIR_FAILURE;
2899 goto err_bcnrep;
2900 }
2901 *pos = SIR_MAC_FH_PARAM_SET_EID;
2902 pos++;
2903 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
2904 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002905 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002906 SIR_MAC_FH_PARAM_SET_EID_MAX);
2907 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
2908 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
2909 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002910
2911 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002912 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002913 {
2914 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
2915 {
2916 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
2917 retStatus = eSIR_FAILURE;
2918 goto err_bcnrep;
2919 }
2920 *pos = SIR_MAC_DS_PARAM_SET_EID;
2921 pos++;
2922 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
2923 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002924 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002925 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
2926 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
2927 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002928
2929 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002930 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002931 {
2932 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
2933 {
2934 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
2935 retStatus = eSIR_FAILURE;
2936 goto err_bcnrep;
2937 }
2938 *pos = SIR_MAC_CF_PARAM_SET_EID;
2939 pos++;
2940 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
2941 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002942 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002943 SIR_MAC_CF_PARAM_SET_EID_MAX);
2944 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
2945 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
2946 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002947
2948 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002949 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002950 {
2951 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
2952 {
2953 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
2954 retStatus = eSIR_FAILURE;
2955 goto err_bcnrep;
2956 }
2957 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
2958 pos++;
2959 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2960 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002961 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002962 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2963 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2964 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2965 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002966
2967 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002968 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002969 {
2970 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
2971 {
2972 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
2973 retStatus = eSIR_FAILURE;
2974 goto err_bcnrep;
2975 }
2976 *pos = SIR_MAC_TIM_EID;
2977 pos++;
2978 *pos = SIR_MAC_TIM_EID_MIN;
2979 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002980 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002981 SIR_MAC_TIM_EID_MIN);
2982 pos += SIR_MAC_TIM_EID_MIN;
2983 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
2984 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002985
2986 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002987 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002988 {
2989 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
2990 {
2991 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
2992 retStatus = eSIR_FAILURE;
2993 goto err_bcnrep;
2994 }
2995 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
2996 pos++;
2997 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2998 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002999 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003000 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3001 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3002 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003003
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003004 if (freeBytes != 0)
3005 {
3006 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3007 retStatus = eSIR_FAILURE;
3008 }
3009
3010err_bcnrep:
3011 /* The message counter would not be incremented in case of
3012 * returning failure and hence next time, this function gets
3013 * called, it would be using the same msg ctr for a different
3014 * BSS.So, it is good to clear the memory allocated for a BSS
3015 * that is returning failure.On success, the caller would take
3016 * care of freeing up the memory*/
3017 if (retStatus == eSIR_FAILURE)
3018 {
3019 vos_mem_free(*outIeBuf);
3020 *outIeBuf = NULL;
3021 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003022 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003023 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003024}
3025
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003026#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003027
Jeff Johnson295189b2012-06-20 16:38:30 -07003028tSirRetStatus
3029sirParseBeaconIE(tpAniSirGlobal pMac,
3030 tpSirProbeRespBeacon pBeaconStruct,
3031 tANI_U8 *pPayload,
3032 tANI_U32 nPayload)
3033{
3034 tDot11fBeaconIEs *pBies;
3035 tANI_U32 status;
3036
3037 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303038 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003039
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303040 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3041 if ( NULL == pBies )
3042 status = eHAL_STATUS_FAILURE;
3043 else
3044 status = eHAL_STATUS_SUCCESS;
3045 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003046 {
3047 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3048 return eSIR_FAILURE;
3049 }
3050 // delegate to the framesc-generated code,
3051 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3052
3053 if ( DOT11F_FAILED( status ) )
3054 {
3055 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3056 status, nPayload);
3057 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303058 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 return eSIR_FAILURE;
3060 }
3061 else if ( DOT11F_WARNED( status ) )
3062 {
3063 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3064 status, nPayload );
3065 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3066 }
3067
3068 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3069 if ( ! pBies->SSID.present )
3070 {
3071 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3072 }
3073 else
3074 {
3075 pBeaconStruct->ssidPresent = 1;
3076 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3077 }
3078
3079 if ( ! pBies->SuppRates.present )
3080 {
3081 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3082 }
3083 else
3084 {
3085 pBeaconStruct->suppRatesPresent = 1;
3086 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3087 }
3088
3089 if ( pBies->ExtSuppRates.present )
3090 {
3091 pBeaconStruct->extendedRatesPresent = 1;
3092 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3093 }
3094
3095 if ( pBies->CFParams.present )
3096 {
3097 pBeaconStruct->cfPresent = 1;
3098 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3099 }
3100
3101 if ( pBies->TIM.present )
3102 {
3103 pBeaconStruct->timPresent = 1;
3104 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3105 }
3106
3107 if ( pBies->Country.present )
3108 {
3109 pBeaconStruct->countryInfoPresent = 1;
3110 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3111 }
3112
3113 // 11h IEs
3114 if(pBies->TPCReport.present)
3115 {
3116 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303117 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 &pBies->TPCReport,
3119 sizeof( tDot11fIETPCReport));
3120 }
3121
3122 if(pBies->PowerConstraints.present)
3123 {
3124 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303125 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 &pBies->PowerConstraints,
3127 sizeof(tDot11fIEPowerConstraints));
3128 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003129#ifdef FEATURE_WLAN_ESE
3130 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003132 pBeaconStruct->eseTxPwr.present = 1;
3133 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003134 }
3135 if (pBies->QBSSLoad.present)
3136 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303137 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003138 }
3139#endif
3140
3141 if ( pBies->EDCAParamSet.present )
3142 {
3143 pBeaconStruct->edcaPresent = 1;
3144 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3145 }
3146
3147 // QOS Capabilities:
3148 if ( pBies->QOSCapsAp.present )
3149 {
3150 pBeaconStruct->qosCapabilityPresent = 1;
3151 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3152 }
3153
3154
3155
3156 if ( pBies->ChanSwitchAnn.present )
3157 {
3158 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303159 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003160 sizeof(tDot11fIEChanSwitchAnn));
3161 }
3162
3163 if ( pBies->ExtChanSwitchAnn.present)
3164 {
3165 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303166 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003167 sizeof(tDot11fIEExtChanSwitchAnn));
3168 }
3169
3170 if ( pBies->Quiet.present )
3171 {
3172 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303173 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003174 }
3175
3176 if ( pBies->HTCaps.present )
3177 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303178 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 }
3180
3181 if ( pBies->HTInfo.present )
3182 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303183 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003184 }
3185
3186 if ( pBies->DSParams.present )
3187 {
3188 pBeaconStruct->dsParamsPresent = 1;
3189 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3190 }
3191 else if(pBies->HTInfo.present)
3192 {
3193 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3194 }
3195
3196 if ( pBies->RSN.present )
3197 {
3198 pBeaconStruct->rsnPresent = 1;
3199 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3200 }
3201
3202 if ( pBies->WPA.present )
3203 {
3204 pBeaconStruct->wpaPresent = 1;
3205 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3206 }
3207
3208 if ( pBies->WMMParams.present )
3209 {
3210 pBeaconStruct->wmeEdcaPresent = 1;
3211 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3212 }
3213
3214 if ( pBies->WMMInfoAp.present )
3215 {
3216 pBeaconStruct->wmeInfoPresent = 1;
3217 }
3218
3219 if ( pBies->WMMCaps.present )
3220 {
3221 pBeaconStruct->wsmCapablePresent = 1;
3222 }
3223
3224
3225 if ( pBies->ERPInfo.present )
3226 {
3227 pBeaconStruct->erpPresent = 1;
3228 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3229 }
3230
Jeff Johnsone7245742012-09-05 17:12:55 -07003231#ifdef WLAN_FEATURE_11AC
3232 if ( pBies->VHTCaps.present )
3233 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303234 pBeaconStruct->VHTCaps.present = 1;
3235 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003236 }
3237 if ( pBies->VHTOperation.present )
3238 {
3239 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303240 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3241 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003242 }
3243 if ( pBies->VHTExtBssLoad.present )
3244 {
3245 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303246 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3247 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003248 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003249 if( pBies->OperatingMode.present)
3250 {
3251 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303252 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3253 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003254 }
3255
Jeff Johnsone7245742012-09-05 17:12:55 -07003256#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303257 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003258
Jeff Johnsone7245742012-09-05 17:12:55 -07003259
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 return eSIR_SUCCESS;
3261
3262} // End sirParseBeaconIE.
3263
3264tSirRetStatus
3265sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3266 tANI_U8 *pFrame,
3267 tpSirProbeRespBeacon pBeaconStruct)
3268{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003269 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 tANI_U32 status, nPayload;
3271 tANI_U8 *pPayload;
3272 tpSirMacMgmtHdr pHdr;
3273 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003274 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003275
3276 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3277 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3278 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3279 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003280 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003281
3282 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303283 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3284
3285 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
3286 if ( NULL == pBeacon )
3287 status = eHAL_STATUS_FAILURE;
3288 else
3289 status = eHAL_STATUS_SUCCESS;
3290 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003291 {
3292 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3293 return eSIR_FAILURE;
3294 }
3295
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303296 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003297
3298 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303299 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003300
3301 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003302 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 if ( DOT11F_FAILED( status ) )
3304 {
3305 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3306 status, nPayload);
3307 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303308 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003309 return eSIR_FAILURE;
3310 }
3311 else if ( DOT11F_WARNED( status ) )
3312 {
3313 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3314 status, nPayload );
3315 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3316 }
3317
3318 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3319 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303320 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3321 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003322
3323 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003324 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003325
3326 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003327 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3328 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3329 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3330 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3331 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3332 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3333 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3334 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3335 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3336 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3337 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3338 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3339 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3340 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3341 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3342 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003343
Jeff Johnson32d95a32012-09-10 13:15:23 -07003344 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 {
3346 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3347 }
3348 else
3349 {
3350 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003351 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 }
3353
Jeff Johnson32d95a32012-09-10 13:15:23 -07003354 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 {
3356 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3357 }
3358 else
3359 {
3360 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003361 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 }
3363
Jeff Johnson32d95a32012-09-10 13:15:23 -07003364 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 {
3366 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003367 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 }
3369
3370
Jeff Johnson32d95a32012-09-10 13:15:23 -07003371 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 {
3373 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003374 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 }
3376
Jeff Johnson32d95a32012-09-10 13:15:23 -07003377 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 {
3379 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003380 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 }
3382
Jeff Johnson32d95a32012-09-10 13:15:23 -07003383 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 {
3385 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003386 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003387 }
3388
3389 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003390 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 {
3392 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003393 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 }
3395
Jeff Johnson32d95a32012-09-10 13:15:23 -07003396 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 {
3398 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003399 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 }
3401
Jeff Johnson32d95a32012-09-10 13:15:23 -07003402 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 {
3404 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303405 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003406 sizeof(tDot11fIEChanSwitchAnn) );
3407 }
3408
Jeff Johnson32d95a32012-09-10 13:15:23 -07003409 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003410 {
3411 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303412 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003413 sizeof(tDot11fIEExtChanSwitchAnn) );
3414 }
3415
Jeff Johnson32d95a32012-09-10 13:15:23 -07003416 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 {
3418 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303419 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003420 sizeof(tDot11fIETPCReport));
3421 }
3422
Jeff Johnson32d95a32012-09-10 13:15:23 -07003423 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003424 {
3425 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303426 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003427 sizeof(tDot11fIEPowerConstraints));
3428 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003429
3430 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003431 {
3432 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303433 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 }
3435
Jeff Johnson32d95a32012-09-10 13:15:23 -07003436 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303438 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003439 }
3440
Jeff Johnson32d95a32012-09-10 13:15:23 -07003441 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003442 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303443 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003444
3445 }
3446
Jeff Johnson32d95a32012-09-10 13:15:23 -07003447 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 {
3449 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003450 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003452 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003454 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 }
3456 else
3457 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003458 if ((!rfBand) || IS_5G_BAND(rfBand))
3459 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3460 else if (IS_24G_BAND(rfBand))
3461 pBeaconStruct->channelNumber = mappedRXCh;
3462 else
3463 {
3464 /*Only 0, 1, 2 are expected values for RF band from FW
3465 * if FW fixes are not present then rf band value will
3466 * be 0, else either 1 or 2 are expected from FW, 3 is
3467 * not expected from FW */
3468 PELOGE(limLog(pMac, LOGE,
3469 FL("Channel info is not present in Beacon and"
3470 " mapping is not done correctly"));)
3471 pBeaconStruct->channelNumber = mappedRXCh;
3472 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003473 }
3474
Jeff Johnson32d95a32012-09-10 13:15:23 -07003475 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003476 {
3477 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003478 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003479 }
3480
Jeff Johnson32d95a32012-09-10 13:15:23 -07003481 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003482 {
3483 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003484 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003485 }
3486
Jeff Johnson32d95a32012-09-10 13:15:23 -07003487 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003488 {
3489 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003490 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003492 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003493 }
3494
Jeff Johnson32d95a32012-09-10 13:15:23 -07003495 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003496 {
3497 pBeaconStruct->wmeInfoPresent = 1;
3498 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3499 }
3500
Jeff Johnson32d95a32012-09-10 13:15:23 -07003501 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003502 {
3503 pBeaconStruct->wsmCapablePresent = 1;
3504 }
3505
Jeff Johnson32d95a32012-09-10 13:15:23 -07003506 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 {
3508 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003509 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003510 }
3511
3512#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003513 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003514 {
3515 // MobilityDomain
3516 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303517 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3518 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003519 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003520
3521 }
3522#endif
3523
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003524#ifdef FEATURE_WLAN_ESE
3525 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303526 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003527 //ESE Tx Power
3528 pBeaconStruct->eseTxPwr.present = 1;
3529 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3530 &pBeacon->ESETxmitPower,
3531 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303532 }
3533#endif
3534
Jeff Johnsone7245742012-09-05 17:12:55 -07003535#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003536 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003537 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303538 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003539 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003540 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003541 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303542 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3543 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003544 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003545 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003546 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303547 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3548 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003549 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003550 if(pBeacon->OperatingMode.present)
3551 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303552 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3553 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003554 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003555 if(pBeacon->WiderBWChanSwitchAnn.present)
3556 {
3557 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303558 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3559 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003560 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003561#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303562 if(pBeacon->OBSSScanParameters.present)
3563 {
3564 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3565 &pBeacon->OBSSScanParameters,
3566 sizeof( tDot11fIEOBSSScanParameters));
3567 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303568 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003569 return eSIR_SUCCESS;
3570
3571} // End sirConvertBeaconFrame2Struct.
3572
3573tSirRetStatus
3574sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3575 tANI_U8 *pFrame,
3576 tANI_U32 nFrame,
3577 tpSirMacAuthFrameBody pAuth)
3578{
3579 static tDot11fAuthentication auth;
3580 tANI_U32 status;
3581
3582 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303583 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003584
3585 // delegate to the framesc-generated code,
3586 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3587 if ( DOT11F_FAILED( status ) )
3588 {
3589 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3590 status, nFrame);
3591 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3592 return eSIR_FAILURE;
3593 }
3594 else if ( DOT11F_WARNED( status ) )
3595 {
3596 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3597 status, nFrame );
3598 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3599 }
3600
3601 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3602 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3603 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3604 pAuth->authStatusCode = auth.Status.status;
3605
3606 if ( auth.ChallengeText.present )
3607 {
3608 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3609 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303610 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 }
3612
3613 return eSIR_SUCCESS;
3614
3615} // End sirConvertAuthFrame2Struct.
3616
3617tSirRetStatus
3618sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3619 tANI_U8 *pFrame,
3620 tANI_U32 nFrame,
3621 tSirAddtsReqInfo *pAddTs)
3622{
3623 tDot11fAddTSRequest addts = {{0}};
3624 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3625 tANI_U8 j;
3626 tANI_U16 i;
3627 tANI_U32 status;
3628
3629 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3630 {
3631 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3632 "with an Action of %d; this is not "
3633 "supported & is probably an error."),
3634 *( pFrame + 1 ) );
3635 return eSIR_FAILURE;
3636 }
3637
3638 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303639 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003640
3641 // delegate to the framesc-generated code,
3642 switch ( *pFrame )
3643 {
3644 case SIR_MAC_ACTION_QOS_MGMT:
3645 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3646 break;
3647 case SIR_MAC_ACTION_WME:
3648 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3649 break;
3650 default:
3651 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3652 "with a Category of %d; this is not"
3653 " supported & is probably an error."),
3654 *pFrame );
3655 return eSIR_FAILURE;
3656 }
3657
3658 if ( DOT11F_FAILED( status ) )
3659 {
3660 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3661 "rame (0x%08x, %d bytes):\n"),
3662 status, nFrame);
3663 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3664 return eSIR_FAILURE;
3665 }
3666 else if ( DOT11F_WARNED( status ) )
3667 {
3668 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3669 "g an Add TS Request frame (0x%08x,"
3670 "%d bytes):\n"),
3671 status, nFrame );
3672 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3673 }
3674
3675 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3676 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3677 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3678 {
3679 pAddTs->dialogToken = addts.DialogToken.token;
3680
3681 if ( addts.TSPEC.present )
3682 {
3683 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3684 }
3685 else
3686 {
3687 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3688 return eSIR_FAILURE;
3689 }
3690
3691 if ( addts.num_TCLAS )
3692 {
3693 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3694
3695 for ( i = 0U; i < addts.num_TCLAS; ++i )
3696 {
3697 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3698 {
3699 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3700 return eSIR_FAILURE;
3701 }
3702 }
3703 }
3704
3705 if ( addts.TCLASSPROC.present )
3706 {
3707 pAddTs->tclasProcPresent = 1;
3708 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3709 }
3710
3711 if ( addts.WMMTSPEC.present )
3712 {
3713 pAddTs->wsmTspecPresent = 1;
3714 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3715 }
3716
3717 if ( addts.num_WMMTCLAS )
3718 {
3719 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3720 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3721
3722 for ( i = pAddTs->numTclas; i < j; ++i )
3723 {
3724 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3725 {
3726 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3727 return eSIR_FAILURE;
3728 }
3729 }
3730 }
3731
3732 if ( addts.WMMTCLASPROC.present )
3733 {
3734 pAddTs->tclasProcPresent = 1;
3735 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3736 }
3737
3738 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3739 {
3740 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3741 pAddTs->numTclas );
3742 return eSIR_FAILURE;
3743 }
3744 }
3745 else
3746 {
3747 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3748
3749 if ( wmmaddts.WMMTSPEC.present )
3750 {
3751 pAddTs->wmeTspecPresent = 1;
3752 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3753 }
3754 else
3755 {
3756 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3757 return eSIR_FAILURE;
3758 }
3759 }
3760
3761 return eSIR_SUCCESS;
3762
3763} // End sirConvertAddtsReq2Struct.
3764
3765tSirRetStatus
3766sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3767 tANI_U8 *pFrame,
3768 tANI_U32 nFrame,
3769 tSirAddtsRspInfo *pAddTs)
3770{
3771 tDot11fAddTSResponse addts = {{0}};
3772 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3773 tANI_U8 j;
3774 tANI_U16 i;
3775 tANI_U32 status;
3776
3777 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3778 {
3779 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3780 "with an Action of %d; this is not "
3781 "supported & is probably an error."),
3782 *( pFrame + 1 ) );
3783 return eSIR_FAILURE;
3784 }
3785
3786 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303787 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3788 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3789 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003790
3791
3792 // delegate to the framesc-generated code,
3793 switch ( *pFrame )
3794 {
3795 case SIR_MAC_ACTION_QOS_MGMT:
3796 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3797 break;
3798 case SIR_MAC_ACTION_WME:
3799 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3800 break;
3801 default:
3802 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3803 "with a Category of %d; this is not"
3804 " supported & is probably an error."),
3805 *pFrame );
3806 return eSIR_FAILURE;
3807 }
3808
3809 if ( DOT11F_FAILED( status ) )
3810 {
3811 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
3812 "rame (0x%08x, %d bytes):\n"),
3813 status, nFrame);
3814 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3815 return eSIR_FAILURE;
3816 }
3817 else if ( DOT11F_WARNED( status ) )
3818 {
3819 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3820 "g an Add TS Response frame (0x%08x,"
3821 "%d bytes):\n"),
3822 status, nFrame );
3823 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3824 }
3825
3826 // & "transliterate" from a 'tDot11fAddTSResponse' or a
3827 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
3828 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3829 {
3830 pAddTs->dialogToken = addts.DialogToken.token;
3831 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
3832
3833 if ( addts.TSDelay.present )
3834 {
3835 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
3836 }
3837
3838 // TS Delay is present iff status indicates its presence
3839 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
3840 {
3841 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
3842 }
3843
3844 if ( addts.TSPEC.present )
3845 {
3846 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3847 }
3848 else
3849 {
3850 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
3851 return eSIR_FAILURE;
3852 }
3853
3854 if ( addts.num_TCLAS )
3855 {
3856 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3857
3858 for ( i = 0U; i < addts.num_TCLAS; ++i )
3859 {
3860 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3861 {
3862 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3863 return eSIR_FAILURE;
3864 }
3865 }
3866 }
3867
3868 if ( addts.TCLASSPROC.present )
3869 {
3870 pAddTs->tclasProcPresent = 1;
3871 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3872 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003873#ifdef FEATURE_WLAN_ESE
3874 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003875 {
3876 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303877 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003878 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 }
3880#endif
3881 if ( addts.Schedule.present )
3882 {
3883 pAddTs->schedulePresent = 1;
3884 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
3885 }
3886
3887 if ( addts.WMMSchedule.present )
3888 {
3889 pAddTs->schedulePresent = 1;
3890 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
3891 }
3892
3893 if ( addts.WMMTSPEC.present )
3894 {
3895 pAddTs->wsmTspecPresent = 1;
3896 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3897 }
3898
3899 if ( addts.num_WMMTCLAS )
3900 {
3901 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3902 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3903
3904 for ( i = pAddTs->numTclas; i < j; ++i )
3905 {
3906 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3907 {
3908 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3909 return eSIR_FAILURE;
3910 }
3911 }
3912 }
3913
3914 if ( addts.WMMTCLASPROC.present )
3915 {
3916 pAddTs->tclasProcPresent = 1;
3917 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3918 }
3919
3920 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3921 {
3922 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3923 pAddTs->numTclas );
3924 return eSIR_FAILURE;
3925 }
3926 }
3927 else
3928 {
3929 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3930 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
3931
3932 if ( wmmaddts.WMMTSPEC.present )
3933 {
3934 pAddTs->wmeTspecPresent = 1;
3935 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3936 }
3937 else
3938 {
3939 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3940 return eSIR_FAILURE;
3941 }
3942
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003943#ifdef FEATURE_WLAN_ESE
3944 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 {
3946 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303947 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003948 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003949 }
3950#endif
3951
3952 }
3953
3954 return eSIR_SUCCESS;
3955
3956} // End sirConvertAddtsRsp2Struct.
3957
3958tSirRetStatus
3959sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
3960 tANI_U8 *pFrame,
3961 tANI_U32 nFrame,
3962 tSirDeltsReqInfo *pDelTs)
3963{
3964 tDot11fDelTS delts = {{0}};
3965 tDot11fWMMDelTS wmmdelts = {{0}};
3966 tANI_U32 status;
3967
3968 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
3969 {
3970 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3971 "with an Action of %d; this is not "
3972 "supported & is probably an error."),
3973 *( pFrame + 1 ) );
3974 return eSIR_FAILURE;
3975 }
3976
3977 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303978 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003979
3980 // delegate to the framesc-generated code,
3981 switch ( *pFrame )
3982 {
3983 case SIR_MAC_ACTION_QOS_MGMT:
3984 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
3985 break;
3986 case SIR_MAC_ACTION_WME:
3987 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
3988 break;
3989 default:
3990 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3991 "with a Category of %d; this is not"
3992 " supported & is probably an error."),
3993 *pFrame );
3994 return eSIR_FAILURE;
3995 }
3996
3997 if ( DOT11F_FAILED( status ) )
3998 {
3999 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
4000 "rame (0x%08x, %d bytes):\n"),
4001 status, nFrame);
4002 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4003 return eSIR_FAILURE;
4004 }
4005 else if ( DOT11F_WARNED( status ) )
4006 {
4007 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4008 "g an Del TS Request frame (0x%08x,"
4009 "%d bytes):\n"),
4010 status, nFrame );
4011 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4012 }
4013
4014 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4015 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4016 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4017 {
4018 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4019 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4020 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4021 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4022 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4023 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4024 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4025 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4026
4027 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4028 }
4029 else
4030 {
4031 if ( wmmdelts.WMMTSPEC.present )
4032 {
4033 pDelTs->wmeTspecPresent = 1;
4034 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4035 }
4036 else
4037 {
4038 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
4039 return eSIR_FAILURE;
4040 }
4041 }
4042
4043 return eSIR_SUCCESS;
4044
4045} // End sirConvertDeltsReq2Struct.
4046
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004047tSirRetStatus
4048sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4049 tANI_U8 *pFrame,
4050 tANI_U32 nFrame,
4051 tSirQosMapSet *pQosMapSet)
4052{
4053 tDot11fQosMapConfigure mapConfigure;
4054 tANI_U32 status;
4055 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
4056 if ( DOT11F_FAILED( status ) )
4057 {
4058 dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):\n"),
4059 status, nFrame);
4060 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4061 return eSIR_FAILURE;
4062 }
4063 else if ( DOT11F_WARNED( status ) )
4064 {
4065 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):\n"),
4066 status, nFrame );
4067 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4068 }
4069 pQosMapSet->present = mapConfigure.QosMapSet.present;
4070 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004071 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004072 return eSIR_SUCCESS;
4073}
Jeff Johnson295189b2012-06-20 16:38:30 -07004074
4075#ifdef ANI_SUPPORT_11H
4076tSirRetStatus
4077sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4078 tANI_U8 *pFrame,
4079 tpSirMacTpcReqActionFrame pTpcReqFrame,
4080 tANI_U32 nFrame)
4081{
4082 tDot11fTPCRequest req;
4083 tANI_U32 status;
4084
4085 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304086 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004087
4088 // delegate to the framesc-generated code,
4089 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4090 if ( DOT11F_FAILED( status ) )
4091 {
4092 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
4093 status, nFrame);
4094 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4095 return eSIR_FAILURE;
4096 }
4097 else if ( DOT11F_WARNED( status ) )
4098 {
4099 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
4100 status, nFrame );
4101 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4102 }
4103
4104 // & "transliterate" from a 'tDot11fTPCRequest' to a
4105 // 'tSirMacTpcReqActionFrame'...
4106 pTpcReqFrame->actionHeader.category = req.Category.category;
4107 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4108 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4109 if ( req.TPCRequest.present )
4110 {
4111 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4112 pTpcReqFrame->length = 0;
4113 }
4114 else
4115 {
4116 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
4117 return eSIR_FAILURE;
4118 }
4119
4120 return eSIR_SUCCESS;
4121
4122} // End sirConvertTpcReqFrame2Struct.
4123
4124
4125tSirRetStatus
4126sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4127 tANI_U8 *pFrame,
4128 tpSirMacMeasReqActionFrame pMeasReqFrame,
4129 tANI_U32 nFrame)
4130{
4131 tDot11fMeasurementRequest mr;
4132 tANI_U32 status;
4133
4134 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304135 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004136
4137 // delegate to the framesc-generated code,
4138 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4139 if ( DOT11F_FAILED( status ) )
4140 {
4141 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4142 status, nFrame);
4143 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4144 return eSIR_FAILURE;
4145 }
4146 else if ( DOT11F_WARNED( status ) )
4147 {
4148 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4149 status, nFrame );
4150 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4151 }
4152
4153 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4154 // 'tpSirMacMeasReqActionFrame'...
4155 pMeasReqFrame->actionHeader.category = mr.Category.category;
4156 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4157 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4158
4159 if ( 0 == mr.num_MeasurementRequest )
4160 {
4161 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4162 return eSIR_FAILURE;
4163 }
4164 else if ( 1 < mr.num_MeasurementRequest )
4165 {
4166 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4167 }
4168
4169 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4170 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4171 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4172 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4173 ( mr.MeasurementRequest[0].enable << 2 ) |
4174 ( mr.MeasurementRequest[0].request << 1 ) |
4175 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4176 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4177
4178 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4179
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304180 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004181 mr.MeasurementRequest[0].meas_start_time, 8 );
4182
4183 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4184
4185 return eSIR_SUCCESS;
4186
4187} // End sirConvertMeasReqFrame2Struct.
4188#endif
4189
4190
4191void
4192PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4193 tDot11fIETSPEC *pDot11f)
4194{
4195 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4196 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4197 pDot11f->direction = pOld->tsinfo.traffic.direction;
4198 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4199 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4200 pDot11f->psb = pOld->tsinfo.traffic.psb;
4201 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4202 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4203 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4204 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4205 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4206 */
4207 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4208 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4209 pDot11f->max_msdu_size = pOld->maxMsduSz;
4210 pDot11f->min_service_int = pOld->minSvcInterval;
4211 pDot11f->max_service_int = pOld->maxSvcInterval;
4212 pDot11f->inactivity_int = pOld->inactInterval;
4213 pDot11f->suspension_int = pOld->suspendInterval;
4214 pDot11f->service_start_time = pOld->svcStartTime;
4215 pDot11f->min_data_rate = pOld->minDataRate;
4216 pDot11f->mean_data_rate = pOld->meanDataRate;
4217 pDot11f->peak_data_rate = pOld->peakDataRate;
4218 pDot11f->burst_size = pOld->maxBurstSz;
4219 pDot11f->delay_bound = pOld->delayBound;
4220 pDot11f->min_phy_rate = pOld->minPhyRate;
4221 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4222 pDot11f->medium_time = pOld->mediumTime;
4223
4224 pDot11f->present = 1;
4225
4226} // End PopulateDot11fTSPEC.
4227
4228void
4229PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4230 tDot11fIEWMMTSPEC *pDot11f)
4231{
4232 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4233 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4234 pDot11f->direction = pOld->tsinfo.traffic.direction;
4235 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4236 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4237 pDot11f->psb = pOld->tsinfo.traffic.psb;
4238 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4239 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4240 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4241 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4242 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4243 */
4244 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4245 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4246 pDot11f->max_msdu_size = pOld->maxMsduSz;
4247 pDot11f->min_service_int = pOld->minSvcInterval;
4248 pDot11f->max_service_int = pOld->maxSvcInterval;
4249 pDot11f->inactivity_int = pOld->inactInterval;
4250 pDot11f->suspension_int = pOld->suspendInterval;
4251 pDot11f->service_start_time = pOld->svcStartTime;
4252 pDot11f->min_data_rate = pOld->minDataRate;
4253 pDot11f->mean_data_rate = pOld->meanDataRate;
4254 pDot11f->peak_data_rate = pOld->peakDataRate;
4255 pDot11f->burst_size = pOld->maxBurstSz;
4256 pDot11f->delay_bound = pOld->delayBound;
4257 pDot11f->min_phy_rate = pOld->minPhyRate;
4258 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4259 pDot11f->medium_time = pOld->mediumTime;
4260
4261 pDot11f->version = 1;
4262 pDot11f->present = 1;
4263
4264} // End PopulateDot11fWMMTSPEC.
4265
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004266#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004267
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004268// Fill the ESE version currently supported
4269void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004270{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004271 pESEVersion->present = 1;
4272 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004273}
4274
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004275// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004276// The State is Normal (1)
4277// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004278void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004279{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004280 pESERadMgmtCap->present = 1;
4281 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4282 pESERadMgmtCap->mbssid_mask = 0;
4283 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004284}
4285
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004286tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004287 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004288 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004289{
4290 int idx;
4291
4292 if ( pCCKMie->length )
4293 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004294 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004295 {
4296 pDot11f->present = 1;
4297 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004298 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004299 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4300 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4301 }
4302 }
4303
4304 return eSIR_SUCCESS;
4305
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004306} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004307
Jeff Johnson295189b2012-06-20 16:38:30 -07004308void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004309 tSirMacESETSRSIE *pOld,
4310 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 tANI_U8 rate_length)
4312{
4313 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304314 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004315 pDot11f->num_tsrates = rate_length;
4316 pDot11f->present = 1;
4317}
4318#endif
4319
4320
4321tSirRetStatus
4322PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4323 tSirTclasInfo *pOld,
4324 tDot11fIETCLAS *pDot11f)
4325{
4326 pDot11f->user_priority = pOld->tclas.userPrio;
4327 pDot11f->classifier_type = pOld->tclas.classifierType;
4328 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4329
4330 switch ( pDot11f->classifier_type )
4331 {
4332 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304333 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4334 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4335 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4336 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004337 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4338 break;
4339 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4340 pDot11f->info.IpParams.version = pOld->version;
4341 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4342 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304343 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304344 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304345 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4346 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304347 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304348 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004349 pDot11f->info.IpParams.params.IpV4Params.src_port =
4350 pOld->tclasParams.ipv4.srcPort;
4351 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4352 pOld->tclasParams.ipv4.dstPort;
4353 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4354 pOld->tclasParams.ipv4.dscp;
4355 pDot11f->info.IpParams.params.IpV4Params.proto =
4356 pOld->tclasParams.ipv4.protocol;
4357 pDot11f->info.IpParams.params.IpV4Params.reserved =
4358 pOld->tclasParams.ipv4.rsvd;
4359 }
4360 else
4361 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304362 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004363 IpV6Params.source,
4364 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304365 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 IpV6Params.dest,
4367 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4368 pDot11f->info.IpParams.params.IpV6Params.src_port =
4369 pOld->tclasParams.ipv6.srcPort;
4370 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4371 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304372 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004373 IpV6Params.flow_label,
4374 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4375 }
4376 break;
4377 case SIR_MAC_TCLASTYPE_8021DQ:
4378 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4379 break;
4380 default:
4381 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4382 pDot11f->classifier_type );
4383 return eSIR_FAILURE;
4384 }
4385
4386 pDot11f->present = 1;
4387
4388 return eSIR_SUCCESS;
4389
4390} // End PopulateDot11fTCLAS.
4391
4392tSirRetStatus
4393PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4394 tSirTclasInfo *pOld,
4395 tDot11fIEWMMTCLAS *pDot11f)
4396{
4397 pDot11f->version = 1;
4398 pDot11f->user_priority = pOld->tclas.userPrio;
4399 pDot11f->classifier_type = pOld->tclas.classifierType;
4400 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4401
4402 switch ( pDot11f->classifier_type )
4403 {
4404 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304405 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304407 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004408 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4409 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4410 break;
4411 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4412 pDot11f->info.IpParams.version = pOld->version;
4413 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4414 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304415 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004416 IpV4Params.source,
4417 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304418 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 IpV4Params.dest,
4420 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4421 pDot11f->info.IpParams.params.IpV4Params.src_port =
4422 pOld->tclasParams.ipv4.srcPort;
4423 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4424 pOld->tclasParams.ipv4.dstPort;
4425 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4426 pOld->tclasParams.ipv4.dscp;
4427 pDot11f->info.IpParams.params.IpV4Params.proto =
4428 pOld->tclasParams.ipv4.protocol;
4429 pDot11f->info.IpParams.params.IpV4Params.reserved =
4430 pOld->tclasParams.ipv4.rsvd;
4431 }
4432 else
4433 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304434 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 IpV6Params.source,
4436 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304437 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004438 IpV6Params.dest,
4439 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4440 pDot11f->info.IpParams.params.IpV6Params.src_port =
4441 pOld->tclasParams.ipv6.srcPort;
4442 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4443 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304444 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004445 IpV6Params.flow_label,
4446 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4447 }
4448 break;
4449 case SIR_MAC_TCLASTYPE_8021DQ:
4450 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4451 break;
4452 default:
4453 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4454 pDot11f->classifier_type );
4455 return eSIR_FAILURE;
4456 }
4457
4458 pDot11f->present = 1;
4459
4460 return eSIR_SUCCESS;
4461
4462} // End PopulateDot11fWMMTCLAS.
4463
Jeff Johnson295189b2012-06-20 16:38:30 -07004464
4465tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4466 tDot11fIEWscBeacon *pDot11f)
4467{
4468
4469 tANI_U32 wpsState;
4470
4471 pDot11f->Version.present = 1;
4472 pDot11f->Version.major = 0x01;
4473 pDot11f->Version.minor = 0x00;
4474
4475 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4476 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4477
4478 pDot11f->WPSState.present = 1;
4479 pDot11f->WPSState.state = (tANI_U8) wpsState;
4480
4481 pDot11f->APSetupLocked.present = 0;
4482
4483 pDot11f->SelectedRegistrar.present = 0;
4484
4485 pDot11f->DevicePasswordID.present = 0;
4486
4487 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4488
4489 pDot11f->UUID_E.present = 0;
4490
4491 pDot11f->RFBands.present = 0;
4492
4493 pDot11f->present = 1;
4494 return eSIR_SUCCESS;
4495}
4496
4497tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4498 tDot11fIEWscBeacon *pDot11f)
4499{
4500 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4501 tANI_U32 devicepasswdId;
4502
4503
4504 pDot11f->APSetupLocked.present = 1;
4505 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4506
4507 pDot11f->SelectedRegistrar.present = 1;
4508 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4509
4510 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4511 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4512
4513 pDot11f->DevicePasswordID.present = 1;
4514 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4515
4516 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4517 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4518
4519 // UUID_E and RF Bands are applicable only for dual band AP
4520
4521 return eSIR_SUCCESS;
4522}
4523
4524tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4525 tDot11fIEWscBeacon *pDot11f)
4526{
4527 pDot11f->APSetupLocked.present = 0;
4528 pDot11f->SelectedRegistrar.present = 0;
4529 pDot11f->DevicePasswordID.present = 0;
4530 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4531
4532 return eSIR_SUCCESS;
4533}
Jeff Johnson295189b2012-06-20 16:38:30 -07004534tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4535{
4536
4537 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4538
4539 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4540
4541
4542 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4543 {
4544 pDot11f->present = 1;
4545 pDot11f->Version.present = 1;
4546 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4547 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4548 }
4549 else
4550 {
4551 pDot11f->present = 0;
4552 pDot11f->Version.present = 0;
4553 }
4554
4555 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4556 {
4557
4558 pDot11f->WPSState.present = 1;
4559 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4560 }
4561 else
4562 pDot11f->WPSState.present = 0;
4563
4564 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4565 {
4566 pDot11f->APSetupLocked.present = 1;
4567 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4568 }
4569 else
4570 pDot11f->APSetupLocked.present = 0;
4571
4572 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4573 {
4574 pDot11f->SelectedRegistrar.present = 1;
4575 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4576 }
4577 else
4578 pDot11f->SelectedRegistrar.present = 0;
4579
4580 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4581 {
4582 pDot11f->DevicePasswordID.present = 1;
4583 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4584 }
4585 else
4586 pDot11f->DevicePasswordID.present = 0;
4587
4588 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4589 {
4590 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4591 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4592 }
4593 else
4594 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4595
4596 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4597 {
4598 pDot11f->ResponseType.present = 1;
4599 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4600 }
4601 else
4602 pDot11f->ResponseType.present = 0;
4603
4604 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4605 {
4606 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304607 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 }
4609 else
4610 pDot11f->UUID_E.present = 0;
4611
4612 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4613 {
4614 pDot11f->Manufacturer.present = 1;
4615 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304616 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4617 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004618 }
4619 else
4620 pDot11f->Manufacturer.present = 0;
4621
4622 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4623 {
4624 pDot11f->ModelName.present = 1;
4625 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304626 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4627 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004628 }
4629 else
4630 pDot11f->ModelName.present = 0;
4631
4632 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4633 {
4634 pDot11f->ModelNumber.present = 1;
4635 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304636 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4637 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004638 }
4639 else
4640 pDot11f->ModelNumber.present = 0;
4641
4642 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4643 {
4644 pDot11f->SerialNumber.present = 1;
4645 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304646 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4647 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004648 }
4649 else
4650 pDot11f->SerialNumber.present = 0;
4651
4652 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4653 {
4654 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304655 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4656 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004657 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4658 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4659 }
4660 else
4661 pDot11f->PrimaryDeviceType.present = 0;
4662
4663 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4664 {
4665 pDot11f->DeviceName.present = 1;
4666 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304667 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4668 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004669 }
4670 else
4671 pDot11f->DeviceName.present = 0;
4672
4673 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4674 {
4675 pDot11f->ConfigMethods.present = 1;
4676 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4677 }
4678 else
4679 pDot11f->ConfigMethods.present = 0;
4680
4681
4682 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4683 {
4684 pDot11f->RFBands.present = 1;
4685 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4686 }
4687 else
4688 pDot11f->RFBands.present = 0;
4689
4690 return eSIR_SUCCESS;
4691}
4692tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4693{
4694 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4695
4696 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4697
4698 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4699 {
4700 pDot11f->present = 1;
4701 pDot11f->Version.present = 1;
4702 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4703 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4704 }
4705 else
4706 {
4707 pDot11f->present = 0;
4708 pDot11f->Version.present = 0;
4709 }
4710
4711 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4712 {
4713 pDot11f->ResponseType.present = 1;
4714 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4715 }
4716 else
4717 pDot11f->ResponseType.present = 0;
4718
4719 return eSIR_SUCCESS;
4720}
4721
4722tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4723{
4724
4725 tSirWPSBeaconIE *pSirWPSBeaconIE;
4726
4727 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4728
4729
4730 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4731 {
4732 pDot11f->present = 1;
4733 pDot11f->Version.present = 1;
4734 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4735 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4736 }
4737 else
4738 {
4739 pDot11f->present = 0;
4740 pDot11f->Version.present = 0;
4741 }
4742
4743 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4744 {
4745
4746 pDot11f->WPSState.present = 1;
4747 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4748 }
4749 else
4750 pDot11f->WPSState.present = 0;
4751
4752 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4753 {
4754 pDot11f->APSetupLocked.present = 1;
4755 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4756 }
4757 else
4758 pDot11f->APSetupLocked.present = 0;
4759
4760 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4761 {
4762 pDot11f->SelectedRegistrar.present = 1;
4763 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4764 }
4765 else
4766 pDot11f->SelectedRegistrar.present = 0;
4767
4768 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4769 {
4770 pDot11f->DevicePasswordID.present = 1;
4771 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4772 }
4773 else
4774 pDot11f->DevicePasswordID.present = 0;
4775
4776 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4777 {
4778 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4779 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4780 }
4781 else
4782 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4783
4784 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4785 {
4786 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304787 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 }
4789 else
4790 pDot11f->UUID_E.present = 0;
4791
4792
4793 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4794 {
4795 pDot11f->RFBands.present = 1;
4796 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4797 }
4798 else
4799 pDot11f->RFBands.present = 0;
4800
4801 return eSIR_SUCCESS;
4802}
Jeff Johnson295189b2012-06-20 16:38:30 -07004803tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4804 tDot11fIEWscProbeRes *pDot11f)
4805{
4806 tANI_U32 cfgMethods;
4807 tANI_U32 cfgStrLen;
4808 tANI_U32 val;
4809 tANI_U32 wpsVersion, wpsState;
4810
4811
4812 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
4813 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
4814
4815 pDot11f->Version.present = 1;
4816 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
4817 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
4818
4819 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4820 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4821
4822 pDot11f->WPSState.present = 1;
4823 pDot11f->WPSState.state = (tANI_U8) wpsState;
4824
4825 pDot11f->APSetupLocked.present = 0;
4826
4827 pDot11f->SelectedRegistrar.present = 0;
4828
4829 pDot11f->DevicePasswordID.present = 0;
4830
4831 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4832
4833 pDot11f->ResponseType.present = 1;
4834 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
4835 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
4836 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4837 }
4838 else{
4839 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4840 }
4841
4842 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
4843 pDot11f->UUID_E.present = 1;
4844 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
4845 if (wlan_cfgGetStr(pMac,
4846 WNI_CFG_WPS_UUID,
4847 pDot11f->UUID_E.uuid,
4848 &cfgStrLen) != eSIR_SUCCESS)
4849 {
4850 *(pDot11f->UUID_E.uuid) = '\0';
4851 }
4852
4853 pDot11f->Manufacturer.present = 1;
4854 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
4855 if (wlan_cfgGetStr(pMac,
4856 WNI_CFG_MANUFACTURER_NAME,
4857 pDot11f->Manufacturer.name,
4858 &cfgStrLen) != eSIR_SUCCESS)
4859 {
4860 pDot11f->Manufacturer.num_name = 0;
4861 *(pDot11f->Manufacturer.name) = '\0';
4862 }
4863 else
4864 {
4865 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
4866 pDot11f->Manufacturer.name[cfgStrLen] = '\0';
4867 }
4868
4869 pDot11f->ModelName.present = 1;
4870 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
4871 if (wlan_cfgGetStr(pMac,
4872 WNI_CFG_MODEL_NAME,
4873 pDot11f->ModelName.text,
4874 &cfgStrLen) != eSIR_SUCCESS)
4875 {
4876 pDot11f->ModelName.num_text = 0;
4877 *(pDot11f->ModelName.text) = '\0';
4878 }
4879 else
4880 {
4881 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4882 pDot11f->ModelName.text[cfgStrLen] = '\0';
4883 }
4884
4885 pDot11f->ModelNumber.present = 1;
4886 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
4887 if (wlan_cfgGetStr(pMac,
4888 WNI_CFG_MODEL_NUMBER,
4889 pDot11f->ModelNumber.text,
4890 &cfgStrLen) != eSIR_SUCCESS)
4891 {
4892 pDot11f->ModelNumber.num_text = 0;
4893 *(pDot11f->ModelNumber.text) = '\0';
4894 }
4895 else
4896 {
4897 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4898 pDot11f->ModelNumber.text[cfgStrLen] = '\0';
4899 }
4900
4901 pDot11f->SerialNumber.present = 1;
4902 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
4903 if (wlan_cfgGetStr(pMac,
4904 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
4905 pDot11f->SerialNumber.text,
4906 &cfgStrLen) != eSIR_SUCCESS)
4907 {
4908 pDot11f->SerialNumber.num_text = 0;
4909 *(pDot11f->SerialNumber.text) = '\0';
4910 }
4911 else
4912 {
4913 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4914 pDot11f->SerialNumber.text[cfgStrLen] = '\0';
4915 }
4916
4917 pDot11f->PrimaryDeviceType.present = 1;
4918
4919 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
4920 {
4921 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
4922 }
4923 else
4924 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
4925
4926 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
4927 {
4928 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
4929 }
4930 else
4931 {
4932 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
4933 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
4934 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
4935 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
4936 }
4937
4938 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
4939 {
4940 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
4941 }
4942 else
4943 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
4944
4945 pDot11f->DeviceName.present = 1;
4946 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
4947 if (wlan_cfgGetStr(pMac,
4948 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
4949 pDot11f->DeviceName.text,
4950 &cfgStrLen) != eSIR_SUCCESS)
4951 {
4952 pDot11f->DeviceName.num_text = 0;
4953 *(pDot11f->DeviceName.text) = '\0';
4954 }
4955 else
4956 {
4957 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4958 pDot11f->DeviceName.text[cfgStrLen] = '\0';
4959 }
4960
4961 if (wlan_cfgGetInt(pMac,
4962 WNI_CFG_WPS_CFG_METHOD,
4963 &cfgMethods) != eSIR_SUCCESS)
4964 {
4965 pDot11f->ConfigMethods.present = 0;
4966 pDot11f->ConfigMethods.methods = 0;
4967 }
4968 else
4969 {
4970 pDot11f->ConfigMethods.present = 1;
4971 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
4972 }
4973
4974 pDot11f->RFBands.present = 0;
4975
4976 pDot11f->present = 1;
4977 return eSIR_SUCCESS;
4978}
4979
4980tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4981 tDot11fIEWscProbeRes *pDot11f)
4982{
4983 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4984 tANI_U32 devicepasswdId;
4985
4986 pDot11f->APSetupLocked.present = 1;
4987 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4988
4989 pDot11f->SelectedRegistrar.present = 1;
4990 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4991
4992 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4993 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4994
4995 pDot11f->DevicePasswordID.present = 1;
4996 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4997
4998 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4999 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5000
5001 // UUID_E and RF Bands are applicable only for dual band AP
5002
5003 return eSIR_SUCCESS;
5004}
5005
5006tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5007 tDot11fIEWscProbeRes *pDot11f)
5008{
5009 pDot11f->APSetupLocked.present = 0;
5010 pDot11f->SelectedRegistrar.present = 0;
5011 pDot11f->DevicePasswordID.present = 0;
5012 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5013
5014 return eSIR_SUCCESS;
5015}
5016
5017tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5018 tDot11fIEWscAssocRes *pDot11f,
5019 tpSirAssocReq pRcvdAssocReq)
5020{
5021 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5022 tANI_U8 *wscIe;
5023
5024
5025 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5026 if(wscIe != NULL)
5027 {
5028 // retreive WSC IE from given AssocReq
5029 dot11fUnpackIeWscAssocReq( pMac,
5030 wscIe + 2 + 4, // EID, length, OUI
5031 wscIe[ 1 ] - 4, // length without OUI
5032 &parsedWscAssocReq );
5033 pDot11f->present = 1;
5034 // version has to be 0x10
5035 pDot11f->Version.present = 1;
5036 pDot11f->Version.major = 0x1;
5037 pDot11f->Version.minor = 0x0;
5038
5039 pDot11f->ResponseType.present = 1;
5040
5041 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5042 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5043 {
5044 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5045 }
5046 else
5047 {
5048 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5049 }
5050 // Version infomration should be taken from our capability as well as peers
5051 // TODO: currently it takes from peers only
5052 if(parsedWscAssocReq.VendorExtension.present &&
5053 parsedWscAssocReq.VendorExtension.Version2.present)
5054 {
5055 pDot11f->VendorExtension.present = 1;
5056 pDot11f->VendorExtension.vendorId[0] = 0x00;
5057 pDot11f->VendorExtension.vendorId[1] = 0x37;
5058 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5059 pDot11f->VendorExtension.Version2.present = 1;
5060 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5061 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5062 }
5063 }
5064 return eSIR_SUCCESS;
5065}
5066
Jeff Johnson295189b2012-06-20 16:38:30 -07005067tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5068 tDot11fIEP2PAssocRes *pDot11f,
5069 tpSirAssocReq pRcvdAssocReq)
5070{
5071 tANI_U8 *p2pIe;
5072
5073 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5074 if(p2pIe != NULL)
5075 {
5076 pDot11f->present = 1;
5077 pDot11f->P2PStatus.present = 1;
5078 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5079 pDot11f->ExtendedListenTiming.present = 0;
5080 }
5081 return eSIR_SUCCESS;
5082}
Jeff Johnson295189b2012-06-20 16:38:30 -07005083
5084#if defined WLAN_FEATURE_VOWIFI
5085
5086tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5087 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5088{
5089 pDot11f->txPower = txPower;
5090 pDot11f->linkMargin = linkMargin;
5091 pDot11f->present = 1;
5092
5093 return eSIR_SUCCESS;
5094}
5095
5096tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5097{
5098
5099 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5100 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305101 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5102 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5104 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5105 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5106 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5107 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305108 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005109 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5110 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5111
5112 if( pBeaconReport->numIes )
5113 {
5114 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305115 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5116 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005117 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5118 }
5119
5120 return eSIR_SUCCESS;
5121
5122}
5123
5124tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5125{
5126 tpRRMCaps pRrmCaps;
5127
5128 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5129
5130 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5131 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5132 pDot11f->parallel = pRrmCaps->parallel ;
5133 pDot11f->repeated = pRrmCaps->repeated ;
5134 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5135 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5136 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5137 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5138 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5139 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5140 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5141 pDot11f->statistics = pRrmCaps->statistics ;
5142 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5143 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5144 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5145 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5146 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5147 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5148 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5149 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5150 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5151 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5152 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5153 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5154 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5155 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5156 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5157 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5158
5159 pDot11f->present = 1;
5160 return eSIR_SUCCESS;
5161}
5162#endif
5163
5164#if defined WLAN_FEATURE_VOWIFI_11R
5165void PopulateMDIE( tpAniSirGlobal pMac,
5166 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5167{
5168 pDot11f->present = 1;
5169 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5170
5171 // Plugfest fix
5172 pDot11f->overDSCap = (mdie[2] & 0x01);
5173 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5174
5175}
5176
5177void PopulateFTInfo( tpAniSirGlobal pMac,
5178 tDot11fIEFTInfo *pDot11f )
5179{
5180 pDot11f->present = 1;
5181 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5182 //All other info is zero.
5183
5184}
5185#endif
5186
5187void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5188 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5189{
5190 tANI_U8 num_supp = 0, num_ext = 0;
5191 tANI_U8 i,j;
5192
5193 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5194 {
5195 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5196 }
5197 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5198 {
5199 if( num_supp < 8 )
5200 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5201 else
5202 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5203 }
5204
5205 if( num_supp )
5206 {
5207 pSupp->num_rates = num_supp;
5208 pSupp->present = 1;
5209 }
5210 if( num_ext )
5211 {
5212 pExt->num_rates = num_ext;
5213 pExt->present = 1;
5214 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005215}
5216
5217void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5218 tDot11fIETimeoutInterval *pDot11f,
5219 tANI_U8 type, tANI_U32 value )
5220{
5221 pDot11f->present = 1;
5222 pDot11f->timeoutType = type;
5223 pDot11f->timeoutValue = value;
5224}
Jeff Johnson295189b2012-06-20 16:38:30 -07005225// parserApi.c ends here.