blob: 4381fe90921f0f15ce48908f560a477e2cea33ab [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
Kiet Lamaa8e15a2014-02-11 23:30:06 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file parserApi.cc contains the code for parsing
30 * 802.11 messages.
31 * Author: Pierre Vandwalle
32 * Date: 03/18/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38
39#include "sirApi.h"
40#include "aniGlobal.h"
41#include "parserApi.h"
42#include "cfgApi.h"
43#include "limUtils.h"
44#include "utilsParser.h"
45#include "limSerDesUtils.h"
46#include "schApi.h"
47#include "palApi.h"
48#include "wmmApsd.h"
49#if defined WLAN_FEATURE_VOWIFI
50#include "rrmApi.h"
51#endif
52
53
54
55////////////////////////////////////////////////////////////////////////
56void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
57{
58#ifdef WLAN_DEBUG
59 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
60 {
61 return;
62 }
63 else
64 {
65 va_list marker;
66
67 va_start( marker, pString ); /* Initialize variable arguments. */
68
69 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
70
71 va_end( marker ); /* Reset variable arguments. */
72 }
73#endif
74}
75
76void
77swapBitField16(tANI_U16 in, tANI_U16 *out)
78{
79# ifdef ANI_LITTLE_BIT_ENDIAN
80 *out = in;
81# else // Big-Endian...
82 *out = ( ( in & 0x8000 ) >> 15 ) |
83 ( ( in & 0x4000 ) >> 13 ) |
84 ( ( in & 0x2000 ) >> 11 ) |
85 ( ( in & 0x1000 ) >> 9 ) |
86 ( ( in & 0x0800 ) >> 7 ) |
87 ( ( in & 0x0400 ) >> 5 ) |
88 ( ( in & 0x0200 ) >> 3 ) |
89 ( ( in & 0x0100 ) >> 1 ) |
90 ( ( in & 0x0080 ) << 1 ) |
91 ( ( in & 0x0040 ) << 3 ) |
92 ( ( in & 0x0020 ) << 5 ) |
93 ( ( in & 0x0010 ) << 7 ) |
94 ( ( in & 0x0008 ) << 9 ) |
95 ( ( in & 0x0004 ) << 11 ) |
96 ( ( in & 0x0002 ) << 13 ) |
97 ( ( in & 0x0001 ) << 15 );
98# endif // ANI_LITTLE_BIT_ENDIAN
99}
100
101void
102swapBitField32(tANI_U32 in, tANI_U32 *out)
103{
104# ifdef ANI_LITTLE_BIT_ENDIAN
105 *out = in;
106# else // Big-Endian...
107 *out = ( ( in & 0x80000000 ) >> 31 ) |
108 ( ( in & 0x40000000 ) >> 29 ) |
109 ( ( in & 0x20000000 ) >> 27 ) |
110 ( ( in & 0x10000000 ) >> 25 ) |
111 ( ( in & 0x08000000 ) >> 23 ) |
112 ( ( in & 0x04000000 ) >> 21 ) |
113 ( ( in & 0x02000000 ) >> 19 ) |
114 ( ( in & 0x01000000 ) >> 17 ) |
115 ( ( in & 0x00800000 ) >> 15 ) |
116 ( ( in & 0x00400000 ) >> 13 ) |
117 ( ( in & 0x00200000 ) >> 11 ) |
118 ( ( in & 0x00100000 ) >> 9 ) |
119 ( ( in & 0x00080000 ) >> 7 ) |
120 ( ( in & 0x00040000 ) >> 5 ) |
121 ( ( in & 0x00020000 ) >> 3 ) |
122 ( ( in & 0x00010000 ) >> 1 ) |
123 ( ( in & 0x00008000 ) << 1 ) |
124 ( ( in & 0x00004000 ) << 3 ) |
125 ( ( in & 0x00002000 ) << 5 ) |
126 ( ( in & 0x00001000 ) << 7 ) |
127 ( ( in & 0x00000800 ) << 9 ) |
128 ( ( in & 0x00000400 ) << 11 ) |
129 ( ( in & 0x00000200 ) << 13 ) |
130 ( ( in & 0x00000100 ) << 15 ) |
131 ( ( in & 0x00000080 ) << 17 ) |
132 ( ( in & 0x00000040 ) << 19 ) |
133 ( ( in & 0x00000020 ) << 21 ) |
134 ( ( in & 0x00000010 ) << 23 ) |
135 ( ( in & 0x00000008 ) << 25 ) |
136 ( ( in & 0x00000004 ) << 27 ) |
137 ( ( in & 0x00000002 ) << 29 ) |
138 ( ( in & 0x00000001 ) << 31 );
139# endif // ANI_LITTLE_BIT_ENDIAN
140}
141
142inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
143{
144 limLog(pMac, LOG1, FL("WMM Parameters Received: \n"));
145 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
146 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
147
148 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
149 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
150
151 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
152 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
153
154 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
155 pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
156
157 return;
158}
159
160////////////////////////////////////////////////////////////////////////
161// Functions for populating "dot11f" style IEs
162
163
164// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
165// < 0, cannot find
166int FindIELocation( tpAniSirGlobal pMac,
167 tpSirRSNie pRsnIe,
168 tANI_U8 EID)
169{
170 int idx, ieLen, bytesLeft;
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800171 int ret_val = -1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700172
173 // Here's what's going on: 'rsnIe' looks like this:
174
175 // typedef struct sSirRSNie
176 // {
177 // tANI_U16 length;
178 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
179 // } tSirRSNie, *tpSirRSNie;
180
181 // other code records both the WPA & RSN IEs (including their EIDs &
182 // lengths) into the array 'rsnIEdata'. We may have:
183
184 // With WAPI support, there may be 3 IEs here
185 // It can be only WPA IE, or only RSN IE or only WAPI IE
186 // Or two or all three of them with no particular ordering
187
188 // The if/then/else statements that follow are here to figure out
189 // whether we have the WPA IE, and where it is if we *do* have it.
190
191 //Save the first IE length
192 ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
193 idx = 0;
194 bytesLeft = pRsnIe->length;
195
196 while( 1 )
197 {
198 if ( EID == pRsnIe->rsnIEdata[ idx ] )
199 {
200 //Found it
201 return (idx);
202 }
203 else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
204 // & if no more IE,
205 bytesLeft <= (tANI_U16)( ieLen ) )
206 {
207 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800208 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 }
210 bytesLeft -= ieLen;
211 ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
212 idx += ieLen;
213 }
214
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800215 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700216}
217
218
219tSirRetStatus
220PopulateDot11fCapabilities(tpAniSirGlobal pMac,
221 tDot11fFfCapabilities *pDot11f,
222 tpPESession psessionEntry)
223{
224 tANI_U16 cfg;
225 tSirRetStatus nSirStatus;
226
227 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
228 if ( eSIR_SUCCESS != nSirStatus )
229 {
230 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
231 "itfield from CFG (%d).\n"), nSirStatus );
232 return nSirStatus;
233 }
234
235#if 0
236 if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
237 {
238 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
239 }
240#endif
241 swapBitField16( cfg, ( tANI_U16* )pDot11f );
242
243 return eSIR_SUCCESS;
244} // End PopulateDot11fCapabilities.
245
246tSirRetStatus
247PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
248 tDot11fFfCapabilities *pDot11f,
249 tpDphHashNode pSta,
250 tpPESession psessionEntry)
251{
252 tANI_U16 cfg;
253 tSirRetStatus nSirStatus;
254 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
255 if ( eSIR_SUCCESS != nSirStatus )
256 {
257 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
258 "itfield from CFG (%d).\n"), nSirStatus );
259 return nSirStatus;
260 }
261
262 if ( ( NULL != pSta ) && pSta->aniPeer &&
263 PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
264 {
265 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
266 }
267
268 swapBitField16( cfg, ( tANI_U16* )pDot11f );
269
270 return eSIR_SUCCESS;
271
272} // End PopulateDot11fCapabilities2.
273
274void
275PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700276 tDot11fIEChanSwitchAnn *pDot11f,
277 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700278{
Jeff Johnsone7245742012-09-05 17:12:55 -0700279 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
280 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
281 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700282
283 pDot11f->present = 1;
284} // End PopulateDot11fChanSwitchAnn.
285
286void
287PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700288 tDot11fIEExtChanSwitchAnn *pDot11f,
289 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700290{
291 //Has to be updated on the cb state basis
292 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700293 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700294
295 pDot11f->present = 1;
296}
297
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700298#ifdef WLAN_FEATURE_11AC
299void
300PopulateDot11fWiderBWChanSwitchAnn(tpAniSirGlobal pMac,
301 tDot11fIEWiderBWChanSwitchAnn *pDot11f,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700302 tpPESession psessionEntry)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700303{
304 pDot11f->present = 1;
305 pDot11f->newChanWidth = psessionEntry->gLimWiderBWChannelSwitch.newChanWidth;
306 pDot11f->newCenterChanFreq0 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0;
307 pDot11f->newCenterChanFreq1 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1;
308}
309#endif
310
Jeff Johnson295189b2012-06-20 16:38:30 -0700311tSirRetStatus
312PopulateDot11fCountry(tpAniSirGlobal pMac,
313 tDot11fIECountry *pDot11f,
314 tpPESession psessionEntry)
315{
316 tANI_U32 len, maxlen, codelen;
317 tANI_U16 item;
318 tSirRetStatus nSirStatus;
319 tSirRFBand rfBand;
320 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
321
322 if (psessionEntry->lim11dEnabled )
323 {
324 limGetRfBand(pMac, &rfBand, psessionEntry);
325 if (rfBand == SIR_BAND_5_GHZ)
326 {
327 item = WNI_CFG_MAX_TX_POWER_5;
328 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
329 }
330 else
331 {
332 item = WNI_CFG_MAX_TX_POWER_2_4;
333 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
334 }
335
336 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
337
338 if ( 3 > len )
339 {
340 // no limit on tx power, cannot include the IE because at least
341 // one (channel,num,tx power) must be present
342 return eSIR_SUCCESS;
343 }
344
345 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
346 code, codelen, 3 );
347
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530348 vos_mem_copy( pDot11f->country, code, codelen );
Jeff Johnson295189b2012-06-20 16:38:30 -0700349
350 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
351 {
352 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting.\n"), len);
353 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
354 }
355
356 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530357 vos_mem_copy( ( tANI_U8* )pDot11f->triplets, temp, len );
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
359 pDot11f->present = 1;
360 }
361
362 return eSIR_SUCCESS;
363} // End PopulateDot11fCountry.
364
365tSirRetStatus
366PopulateDot11fDSParams(tpAniSirGlobal pMac,
367 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
368 tpPESession psessionEntry)
369{
Kiran Kumar Lokere27090372013-07-19 20:13:55 -0700370 if ((IS_24G_CH(channel)) || pMac->rrm.rrmPEContext.rrmEnable)
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 {
372 // .11b/g mode PHY => Include the DS Parameter Set IE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pDot11f->curr_channel = channel;
374 pDot11f->present = 1;
375 }
376
377 return eSIR_SUCCESS;
378} // End PopulateDot11fDSParams.
379
380#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
381
382
383void
384PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
385 tDot11fIEEDCAParamSet *pDot11f,
386 tpPESession psessionEntry)
387{
388
389 if ( psessionEntry->limQosEnabled )
390 {
391 //change to bitwise operation, after this is fixed in frames.
392 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
393
394 // Fill each EDCA parameter set in order: be, bk, vi, vo
395 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
396 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
397 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
398 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
399 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
400 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
401
402 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
403 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
404 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
405 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
406 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
407 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
408
409 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
410 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
411 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
412 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
413 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
414 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
415
416 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
417 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
418 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
419 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
420 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
421 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
422
423 pDot11f->present = 1;
424 }
425
426} // End PopluateDot11fEDCAParamSet.
427
428tSirRetStatus
429PopulateDot11fERPInfo(tpAniSirGlobal pMac,
430 tDot11fIEERPInfo *pDot11f,
431 tpPESession psessionEntry)
432{
433 tSirRetStatus nSirStatus;
434 tANI_U32 val;
435 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
436
437 limGetRfBand(pMac, &rfBand, psessionEntry);
438 if(SIR_BAND_2_4_GHZ == rfBand)
439 {
440 pDot11f->present = 1;
441
442 val = psessionEntry->cfgProtection.fromllb;
443 if(!val ){
444 dot11fLog( pMac, LOGE, FL("11B protection not enabled. Not populating ERP IE %d\n" ),val );
445 return eSIR_SUCCESS;
446 }
447
448 if (psessionEntry->gLim11bParams.protectionEnabled)
449 {
450 pDot11f->non_erp_present = 1;
451 pDot11f->use_prot = 1;
452 }
453
454 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
455 {
456 //FIXME_PROTECTION: we should be setting non_erp present also.
457 //check the test plan first.
458 pDot11f->use_prot = 1;
459 }
460
461
462 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
463 || !psessionEntry->beaconParams.fShortPreamble){
464 pDot11f->barker_preamble = 1;
465
466 }
467 // if protection always flag is set, advertise protection enabled
468 // regardless of legacy stations presence
469 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
470
471 if ( val )
472 {
473 pDot11f->use_prot = 1;
474 }
475 }
476
477 return eSIR_SUCCESS;
478} // End PopulateDot11fERPInfo.
479
480tSirRetStatus
481PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
482 tDot11fIEExtSuppRates *pDot11f,
483 tpPESession psessionEntry)
484{
485 tSirRetStatus nSirStatus;
486 tANI_U32 nRates = 0;
487 tANI_U8 rates[WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN];
488
489 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
490 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
491 sending mgmt frames (lile probe req) which need to go out before any session is present.
492 */
493 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
494 {
495 if(psessionEntry != NULL)
496 {
497 nRates = psessionEntry->extRateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530498 vos_mem_copy( rates, psessionEntry->extRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 nRates);
500 }
501 else
502 {
503 dot11fLog( pMac, LOGE, FL("no session context exists while"
504 " populating Operational Rate Set\n"));
505 }
506 }
507 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
508 {
509 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
510 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
511 }
512
513 if ( 0 != nRates )
514 {
515 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530516 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 pDot11f->present = 1;
518 }
519
520 return eSIR_SUCCESS;
521
522} // End PopulateDot11fExtSuppRates.
523
524tSirRetStatus
525PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
526 tANI_U8 nChannelNum,
527 tDot11fIEExtSuppRates *pDot11f)
528{
529 tANI_U32 nRates;
530 tSirRetStatus nSirStatus;
531 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
532
533 if ( 14 < nChannelNum )
534 {
535 pDot11f->present = 0;
536 return eSIR_SUCCESS;
537 }
538
539 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
540 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
541 // previously & I'm afraid to change it!
542 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
543 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
544
545 if ( 0 != nRates )
546 {
547 pDot11f->num_rates = ( tANI_U8 ) nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530548 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 pDot11f->present = 1;
550 }
551
552 return eSIR_SUCCESS;
553} // PopulateDot11fExtSuppRates1.
554
555tSirRetStatus
556PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700557 tpPESession psessionEntry,
558 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559{
560 tANI_U32 nCfgValue, nCfgLen;
561 tANI_U8 nCfgValue8;
562 tSirRetStatus nSirStatus;
563 tSirMacHTParametersInfo *pHTParametersInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 union {
565 tANI_U16 nCfgValue16;
566 tSirMacHTCapabilityInfo htCapInfo;
567 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
568 } uHTCapabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700569
570 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
571 tSirMacASCapabilityInfo *pASCapabilityInfo;
572
573 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
574
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700576
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
579 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
580 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
581 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
582 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
583 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
584 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
585 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
586 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
587 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
588 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
589 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700590
Jeff Johnsone7245742012-09-05 17:12:55 -0700591 // All sessionized entries will need the check below
592 if (psessionEntry == NULL) // Only in case of NO session
593 {
594 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
595 }
596 else
597 {
598 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
599 }
600
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
602 eHT_CHANNEL_WIDTH_20MHZ */
603 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
604 {
605 pDot11f->shortGI40MHz = 0;
606 }
607
Mohit Khanna23863762012-09-11 17:40:09 -0700608 dot11fLog(pMac, LOG2, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave, pDot11f->greenField,
610 pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
611
612
613 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
614
615 nCfgValue8 = ( tANI_U8 ) nCfgValue;
616 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
617
618 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
619 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
620 pDot11f->reserved1 = pHTParametersInfo->reserved;
621
Mohit Khanna23863762012-09-11 17:40:09 -0700622 dot11fLog( pMac, LOG2, FL( "AMPDU Param: %x\n" ), nCfgValue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700623
624
625 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
626 pDot11f->supportedMCSSet, nCfgLen,
627 SIZE_OF_SUPPORTED_MCS_SET );
628
629
630 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
631
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
633
634 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
635 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
636 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
637
Jeff Johnson295189b2012-06-20 16:38:30 -0700638
639 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
640
641 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
642 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
643 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
644 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
645 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
646 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
647 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
648 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
649 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
650 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
651 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
652 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
653 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
654 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
655 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
656 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
657
658 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
659
660 nCfgValue8 = ( tANI_U8 ) nCfgValue;
661
662 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
663 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
664 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
665 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
666 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
667 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
668 pDot11f->rxAS = pASCapabilityInfo->rxAS;
669 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
670
671 pDot11f->present = 1;
672
673 return eSIR_SUCCESS;
674
675} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700676#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700677
Jeff Johnsone7245742012-09-05 17:12:55 -0700678void limLogVHTCap(tpAniSirGlobal pMac,
679 tDot11fIEVHTCaps *pDot11f)
680{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700681#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700682 limLog(pMac, LOG1, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
683 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
684 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
685 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
686 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
687 limLog(pMac, LOG1, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
688 limLog(pMac, LOG1, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
689 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
690 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
691 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
692 limLog(pMac, LOG1, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
693 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
694 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
695 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
696 limLog(pMac, LOG1, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
697 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
698 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
699 limLog(pMac, LOG1, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
700 limLog(pMac, LOG1, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
701 limLog(pMac, LOG1, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
702 limLog(pMac, LOG1, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
703 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
704 limLog(pMac, LOG1, FL("reserve (3): %d\n"), pDot11f->reserved2);
705 limLog(pMac, LOG1, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
706 limLog(pMac, LOG1, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
707 limLog(pMac, LOG1, FL("reserv (3): %d\n"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700708#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700709}
710
711void limLogVHTOperation(tpAniSirGlobal pMac,
712 tDot11fIEVHTOperation *pDot11f)
713{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700714#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700715 limLog(pMac, LOG1, FL("chanWidth : %d\n"), pDot11f->chanWidth);
716 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
717 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
718 limLog(pMac, LOG1, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700719#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700720}
721
722void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
723 tDot11fIEVHTExtBssLoad *pDot11f)
724{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700725#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700726 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
727 limLog(pMac, LOG1, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
728 limLog(pMac, LOG1, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
729 limLog(pMac, LOG1, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
730 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700731#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700732}
733
734
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700735void limLogOperatingMode( tpAniSirGlobal pMac,
736 tDot11fIEOperatingMode *pDot11f)
737{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700738#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700739 limLog(pMac, LOG1, FL("ChanWidth : %d\n"), pDot11f->chanWidth);
740 limLog(pMac, LOG1, FL("reserved: %d\n"), pDot11f->reserved);
741 limLog(pMac, LOG1, FL("rxNSS: %d\n"), pDot11f->rxNSS);
742 limLog(pMac, LOG1, FL("rxNSS Type: %d\n"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700743#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700744}
745
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700746void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
747{
748 tANI_U8 i;
749 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
750 pQosMapSet->num_dscp_exceptions);
751 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
752 {
753 limLog(pMac, LOG1, FL("dscp value: %d"),
754 pQosMapSet->dscp_exceptions[i][0]);
755 limLog(pMac, LOG1, FL("User priority value: %d"),
756 pQosMapSet->dscp_exceptions[i][1]);
757 }
758 for (i=0;i<8;i++)
759 {
760 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
761 pQosMapSet->dscp_range[i][0]);
762 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
763 pQosMapSet->dscp_range[i][1]);
764 }
765}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700766
Jeff Johnsone7245742012-09-05 17:12:55 -0700767tSirRetStatus
768PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
769 tDot11fIEVHTCaps *pDot11f)
770{
771 tSirRetStatus nStatus;
772 tANI_U32 nCfgValue=0;
773
774 pDot11f->present = 1;
775
776 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
777 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
778
779 nCfgValue = 0;
780 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
781 nCfgValue );
782 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
783
784 nCfgValue = 0;
785 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
786 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
787
788 nCfgValue = 0;
789 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
790 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
791
792 nCfgValue = 0;
793 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
794 nCfgValue );
795 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
796
797 nCfgValue = 0;
798 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
799 pDot11f->txSTBC = (nCfgValue & 0x0001);
800
801 nCfgValue = 0;
802 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
803 pDot11f->rxSTBC = (nCfgValue & 0x0007);
804
805 nCfgValue = 0;
806 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
807 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
808
809 nCfgValue = 0;
810 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
811 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
812
813 nCfgValue = 0;
814 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
815 nCfgValue );
816 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
817
818 nCfgValue = 0;
819 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
820 nCfgValue );
821 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
822
823 nCfgValue = 0;
824 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
825 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
826
827 nCfgValue = 0;
828 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
829 pDot11f->muBeamformeeCap = (nCfgValue & 0x0001);
830
831 nCfgValue = 0;
832 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
833 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
834
835 nCfgValue = 0;
836 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
837 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
838
839 nCfgValue = 0;
840 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
841 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
842
843 nCfgValue = 0;
844 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
845 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
846
847 nCfgValue = 0;
848 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
849 pDot11f->rxAntPattern = nCfgValue;
850
851 nCfgValue = 0;
852 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
853 pDot11f->txAntPattern = nCfgValue;
854
855 pDot11f->reserved1= 0;
856
857 nCfgValue = 0;
858 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
859 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
860
861 nCfgValue = 0;
862 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
863 nCfgValue );
864 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
865
866 pDot11f->reserved2= 0;
867
868 nCfgValue = 0;
869 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
870 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
871
872 nCfgValue = 0;
873 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
874 nCfgValue );
875 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
876
877 pDot11f->reserved3= 0;
878
879 limLogVHTCap(pMac, pDot11f);
880
881 return eSIR_SUCCESS;
882
883}
884
885tSirRetStatus
886PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
887 tDot11fIEVHTOperation *pDot11f)
888{
889 tSirRetStatus nStatus;
890 tANI_U32 nCfgValue=0;
891
892 pDot11f->present = 1;
893
894 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
895 pDot11f->chanWidth = (tANI_U8)nCfgValue;
896
897 nCfgValue = 0;
898 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
899 nCfgValue );
900 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
901
902 nCfgValue = 0;
903 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
904 nCfgValue );
905 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
906
907 nCfgValue = 0;
908 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
909 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
910
911 limLogVHTOperation(pMac,pDot11f);
912
913 return eSIR_SUCCESS;
914
915}
916
917tSirRetStatus
918PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
919 tDot11fIEVHTExtBssLoad *pDot11f)
920{
921 tSirRetStatus nStatus;
922 tANI_U32 nCfgValue=0;
923
924 pDot11f->present = 1;
925
926 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
927 nCfgValue );
928 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
929
930 nCfgValue = 0;
931 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
932 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
933
934 nCfgValue=0;
935 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
936 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
937
938 nCfgValue=0;
939 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
940 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
941
942 nCfgValue=0;
943 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
944 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
945
946 limLogVHTExtBssLoad(pMac,pDot11f);
947
948 return eSIR_SUCCESS;
949}
950
Mohit Khanna4a70d262012-09-11 16:30:12 -0700951tSirRetStatus
952PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +0530953 tDot11fIEExtCap *pDot11f,
954 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700955{
Sandeep Puligilla60342762014-01-30 21:05:37 +0530956 tANI_U32 val;
957
Mohit Khanna4a70d262012-09-11 16:30:12 -0700958 pDot11f->present = 1;
Sandeep Puligilla60342762014-01-30 21:05:37 +0530959#ifdef WLAN_FEATURE_11AC
960 if (psessionEntry->vhtCapability)
961 pDot11f->operModeNotification = 1;
962#endif
963 /* while operating in 2.4GHz only then STA need to advertize
964 the bss co-ex capability*/
965 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
966 {
967 if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_24G, &val) !=
968 eSIR_SUCCESS)
969 PELOGE(limLog(pMac, LOGE, FL("could not retrieve "
970 "24G Chan bond Length \n"));)
971 if (TRUE == val)
972 pDot11f->bssCoexistMgmtSupport = 1;
973 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700974 return eSIR_SUCCESS;
975}
976
977tSirRetStatus
978PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
979 tDot11fIEOperatingMode *pDot11f,
980 tpPESession psessionEntry)
981{
982 pDot11f->present = 1;
983
984 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
985 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
986 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
987
988 return eSIR_SUCCESS;
989}
Jeff Johnsone7245742012-09-05 17:12:55 -0700990
991#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700992tSirRetStatus
993PopulateDot11fHTInfo(tpAniSirGlobal pMac,
994 tDot11fIEHTInfo *pDot11f,
995 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -0700996{
997 tANI_U32 nCfgValue, nCfgLen;
998 tANI_U8 htInfoField1;
999 tANI_U16 htInfoField2;
1000 tSirRetStatus nSirStatus;
1001 tSirMacHTInfoField1 *pHTInfoField1;
1002 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 union {
1004 tANI_U16 nCfgValue16;
1005 tSirMacHTInfoField3 infoField3;
1006 }uHTInfoField;
1007 union {
1008 tANI_U16 nCfgValue16;
1009 tSirMacHTInfoField2 infoField2;
1010 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001011
Jeff Johnson295189b2012-06-20 16:38:30 -07001012
1013 #if 0
1014 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1015 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301016
1017 if (NULL == psessionEntry)
1018 {
1019 PELOGE(limLog(pMac, LOG1,
1020 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
1021 return eSIR_FAILURE;
1022 }
1023
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1025
1026 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1027
1028 htInfoField1 = ( tANI_U8 ) nCfgValue;
1029
1030 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1032 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1033
Jeff Johnsone7245742012-09-05 17:12:55 -07001034 if (psessionEntry == NULL)
1035 {
1036 PELOGE(limLog(pMac, LOG1,
1037 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
1038 }
1039 else
1040 {
1041 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1042 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001044
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001045 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1047
1048 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1049
1050 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1051 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1052 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1053
1054 uHTInfoField2.infoField2.reserved = 0;
1055
1056 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1058
1059 htInfoField2 = ( tANI_U16 ) nCfgValue;
1060
1061 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1062 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1063 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1064 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1065
1066 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001067 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001068
1069 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1070
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1073
1074
1075 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1076 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1077 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1078 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1079 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1080 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1081 uHTInfoField.infoField3.reserved = 0;
1082
Jeff Johnson295189b2012-06-20 16:38:30 -07001083
1084 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1085 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1086 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1087 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1088 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1089
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1091 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1092 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1093 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1094
Jeff Johnson295189b2012-06-20 16:38:30 -07001095
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1097 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1098 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1099 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1100 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1101 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1102 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1104 pDot11f->basicMCSSet, nCfgLen,
1105 SIZE_OF_BASIC_MCS_SET );
1106
1107 pDot11f->present = 1;
1108
1109 return eSIR_SUCCESS;
1110
1111} // End PopulateDot11fHTInfo.
1112
1113void
1114PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1115 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1116{
1117 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1118 {
1119 pDot11f->present = 1;
1120 // ATIM duration is always set to 0
1121 pDot11f->atim = 0;
1122 }
1123
1124} // End PopulateDot11fIBSSParams.
1125
1126
1127#ifdef ANI_SUPPORT_11H
1128tSirRetStatus
1129PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1130 tpSirMacMeasReqActionFrame pReq,
1131 tDot11fIEMeasurementReport *pDot11f)
1132{
1133 pDot11f->token = pReq->measReqIE.measToken;
1134 pDot11f->late = 0;
1135 pDot11f->incapable = 0;
1136 pDot11f->refused = 1;
1137 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1138
1139 pDot11f->present = 1;
1140
1141 return eSIR_SUCCESS;
1142
1143} // End PopulatedDot11fMeasurementReport0.
1144
1145tSirRetStatus
1146PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1147 tpSirMacMeasReqActionFrame pReq,
1148 tDot11fIEMeasurementReport *pDot11f)
1149{
1150 pDot11f->token = pReq->measReqIE.measToken;
1151 pDot11f->late = 0;
1152 pDot11f->incapable = 0;
1153 pDot11f->refused = 1;
1154 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1155
1156 pDot11f->present = 1;
1157
1158 return eSIR_SUCCESS;
1159
1160} // End PopulatedDot11fMeasurementReport1.
1161
1162tSirRetStatus
1163PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1164 tpSirMacMeasReqActionFrame pReq,
1165 tDot11fIEMeasurementReport *pDot11f)
1166{
1167 pDot11f->token = pReq->measReqIE.measToken;
1168 pDot11f->late = 0;
1169 pDot11f->incapable = 0;
1170 pDot11f->refused = 1;
1171 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1172
1173 pDot11f->present = 1;
1174
1175 return eSIR_SUCCESS;
1176
1177} // End PopulatedDot11fMeasurementReport2.
1178#endif
1179
1180void
1181PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1182 tDot11fIEPowerCaps *pCaps,
1183 tANI_U8 nAssocType,
1184 tpPESession psessionEntry)
1185{
1186 if (nAssocType == LIM_REASSOC)
1187 {
1188 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1189 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1190 }else
1191 {
1192 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1193 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1194
1195 }
1196
1197 pCaps->present = 1;
1198} // End PopulateDot11fPowerCaps.
1199
1200tSirRetStatus
1201PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1202 tDot11fIEPowerConstraints *pDot11f)
1203{
1204 tANI_U32 cfg;
1205 tSirRetStatus nSirStatus;
1206
1207 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1208
1209 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1210 pDot11f->present = 1;
1211
1212 return eSIR_SUCCESS;
1213} // End PopulateDot11fPowerConstraints.
1214
1215void
1216PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1217 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1218{
1219 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1220 pDot11f->reserved = 0;
1221 pDot11f->txopreq = 0;
1222 pDot11f->qreq = 0;
1223 pDot11f->qack = 0;
1224 pDot11f->present = 1;
1225} // End PopulatedDot11fQOSCaps.
1226
1227void
1228PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1229 tDot11fIEQOSCapsStation *pDot11f)
1230{
1231 tANI_U32 val = 0;
1232
1233 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1234 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1235
1236 pDot11f->more_data_ack = 0;
1237 pDot11f->max_sp_length = (tANI_U8)val;
1238 pDot11f->qack = 0;
1239
1240 if (pMac->lim.gUapsdEnable)
1241 {
1242 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1243 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1244 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1245 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1246 }
1247 pDot11f->present = 1;
1248} // End PopulatedDot11fQOSCaps.
1249
1250tSirRetStatus
1251PopulateDot11fRSN(tpAniSirGlobal pMac,
1252 tpSirRSNie pRsnIe,
1253 tDot11fIERSN *pDot11f)
1254{
1255 tANI_U32 status;
1256 int idx;
1257
1258 if ( pRsnIe->length )
1259 {
1260 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1261 {
1262 status = dot11fUnpackIeRSN( pMac,
1263 pRsnIe->rsnIEdata + idx + 2, //EID, length
1264 pRsnIe->rsnIEdata[ idx + 1 ],
1265 pDot11f );
1266 if ( DOT11F_FAILED( status ) )
1267 {
1268 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1269 "N (0x%08x).\n"),
1270 status );
1271 return eSIR_FAILURE;
1272 }
1273 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1274 "PopulateDot11fRSN.\n"), status );
1275 }
1276
1277 }
1278
1279 return eSIR_SUCCESS;
1280} // End PopulateDot11fRSN.
1281
1282tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1283 tpSirRSNie pRsnIe,
1284 tDot11fIERSNOpaque *pDot11f )
1285{
1286 int idx;
1287
1288 if ( pRsnIe->length )
1289 {
1290 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1291 {
1292 pDot11f->present = 1;
1293 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301294 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 pRsnIe->rsnIEdata + idx + 2, // EID, len
1296 pRsnIe->rsnIEdata[ idx + 1 ] );
1297 }
1298 }
1299
1300 return eSIR_SUCCESS;
1301
1302} // End PopulateDot11fRSNOpaque.
1303
1304
1305
1306#if defined(FEATURE_WLAN_WAPI)
1307
1308tSirRetStatus
1309PopulateDot11fWAPI(tpAniSirGlobal pMac,
1310 tpSirRSNie pRsnIe,
1311 tDot11fIEWAPI *pDot11f)
1312 {
1313 tANI_U32 status;
1314 int idx;
1315
1316 if ( pRsnIe->length )
1317 {
1318 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1319 {
1320 status = dot11fUnpackIeWAPI( pMac,
1321 pRsnIe->rsnIEdata + idx + 2, //EID, length
1322 pRsnIe->rsnIEdata[ idx + 1 ],
1323 pDot11f );
1324 if ( DOT11F_FAILED( status ) )
1325 {
1326 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1327 status );
1328 return eSIR_FAILURE;
1329 }
1330 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1331 "PopulateDot11fWAPI.\n"), status );
1332 }
1333 }
1334
1335 return eSIR_SUCCESS;
1336} // End PopulateDot11fWAPI.
1337
1338tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1339 tpSirRSNie pRsnIe,
1340 tDot11fIEWAPIOpaque *pDot11f )
1341{
1342 int idx;
1343
1344 if ( pRsnIe->length )
1345 {
1346 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1347 {
1348 pDot11f->present = 1;
1349 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301350 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 pRsnIe->rsnIEdata + idx + 2, // EID, len
1352 pRsnIe->rsnIEdata[ idx + 1 ] );
1353 }
1354 }
1355
1356 return eSIR_SUCCESS;
1357
1358} // End PopulateDot11fWAPIOpaque.
1359
1360
1361#endif //defined(FEATURE_WLAN_WAPI)
1362
1363void
1364PopulateDot11fSSID(tpAniSirGlobal pMac,
1365 tSirMacSSid *pInternal,
1366 tDot11fIESSID *pDot11f)
1367{
1368 pDot11f->present = 1;
1369 pDot11f->num_ssid = pInternal->length;
1370 if ( pInternal->length )
1371 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301372 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 pInternal->length );
1374 }
1375} // End PopulateDot11fSSID.
1376
1377tSirRetStatus
1378PopulateDot11fSSID2(tpAniSirGlobal pMac,
1379 tDot11fIESSID *pDot11f)
1380{
1381 tANI_U32 nCfg;
1382 tSirRetStatus nSirStatus;
1383
1384 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1385 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1386 pDot11f->present = 1;
1387 return eSIR_SUCCESS;
1388} // End PopulateDot11fSSID2.
1389
1390void
1391PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1392 tDot11fIESchedule *pDot11f)
1393{
1394 pDot11f->aggregation = pSchedule->info.aggregation;
1395 pDot11f->tsid = pSchedule->info.tsid;
1396 pDot11f->direction = pSchedule->info.direction;
1397 pDot11f->reserved = pSchedule->info.rsvd;
1398 pDot11f->service_start_time = pSchedule->svcStartTime;
1399 pDot11f->service_interval = pSchedule->svcInterval;
1400 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1401 pDot11f->spec_interval = pSchedule->specInterval;
1402
1403 pDot11f->present = 1;
1404} // End PopulateDot11fSchedule.
1405
1406void
1407PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1408 tDot11fIESuppChannels *pDot11f,
1409 tANI_U8 nAssocType,
1410 tpPESession psessionEntry)
1411{
1412 tANI_U8 i;
1413 tANI_U8 *p;
1414
1415 if (nAssocType == LIM_REASSOC)
1416 {
1417 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1418 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1419 }else
1420 {
1421 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1422 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1423 }
1424 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1425 {
1426 pDot11f->bands[i][0] = *p;
1427 pDot11f->bands[i][1] = 1;
1428 }
1429
1430 pDot11f->present = 1;
1431
1432} // End PopulateDot11fSuppChannels.
1433
1434tSirRetStatus
1435PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1436 tANI_U8 nChannelNum,
1437 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1438{
1439 tSirRetStatus nSirStatus;
1440 tANI_U32 nRates;
1441 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1442
1443 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1444 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1445 sending mgmt frames (lile probe req) which need to go out before any session is present.
1446 */
1447 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1448 {
1449 #if 0
1450 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1451 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1452 #endif //TO SUPPORT BT-AMP
1453 if(psessionEntry != NULL)
1454 {
1455 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301456 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 nRates);
1458 }
1459 else
1460 {
1461 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1462 nRates = 0;
1463 }
1464 }
1465 else if ( 14 >= nChannelNum )
1466 {
1467 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1468 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1469 }
1470 else
1471 {
1472 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1473 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1474 }
1475
1476 if ( 0 != nRates )
1477 {
1478 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301479 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 pDot11f->present = 1;
1481 }
1482
1483 return eSIR_SUCCESS;
1484
1485} // End PopulateDot11fSuppRates.
1486
1487tSirRetStatus
1488PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1489 tDot11fIETPCReport *pDot11f,
1490 tpPESession psessionEntry)
1491{
1492 tANI_U16 staid, txPower;
1493 tSirRetStatus nSirStatus;
1494
1495 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1496 if ( eSIR_SUCCESS != nSirStatus )
1497 {
1498 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1499 "eDot11fTPCReport; limGetMgmtStaid "
1500 "returned status %d.\n"),
1501 nSirStatus );
1502 return eSIR_FAILURE;
1503 }
1504
1505 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1506 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1507 txPower = 0;
1508 pDot11f->tx_power = ( tANI_U8 )txPower;
1509 pDot11f->link_margin = 0;
1510 pDot11f->present = 1;
1511
1512 return eSIR_SUCCESS;
1513} // End PopulateDot11fTPCReport.
1514
1515
1516void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1517 tDot11fFfTSInfo *pDot11f)
1518{
1519 pDot11f->traffic_type = pInfo->traffic.trafficType;
1520 pDot11f->tsid = pInfo->traffic.tsid;
1521 pDot11f->direction = pInfo->traffic.direction;
1522 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1523 pDot11f->aggregation = pInfo->traffic.aggregation;
1524 pDot11f->psb = pInfo->traffic.psb;
1525 pDot11f->user_priority = pInfo->traffic.userPrio;
1526 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1527 pDot11f->schedule = pInfo->schedule.schedule;
1528} // End PopulatedDot11fTSInfo.
1529
1530void PopulateDot11fWMM(tpAniSirGlobal pMac,
1531 tDot11fIEWMMInfoAp *pInfo,
1532 tDot11fIEWMMParams *pParams,
1533 tDot11fIEWMMCaps *pCaps,
1534 tpPESession psessionEntry)
1535{
1536 if ( psessionEntry->limWmeEnabled )
1537 {
1538 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1539 {
1540 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1541 {
1542 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1543 }
1544 }
1545 else
1546 {
1547 {
1548 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1549 }
1550
1551 if ( psessionEntry->limWsmEnabled )
1552 {
1553 PopulateDot11fWMMCaps( pCaps );
1554 }
1555 }
1556 }
1557} // End PopulateDot11fWMM.
1558
1559void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1560{
1561 pCaps->version = SIR_MAC_OUI_VERSION_1;
1562 pCaps->qack = 0;
1563 pCaps->queue_request = 1;
1564 pCaps->txop_request = 0;
1565 pCaps->more_ack = 0;
1566 pCaps->present = 1;
1567} // End PopulateDot11fWmmCaps.
1568
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001569#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001570void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1571{
1572 tANI_U8 numTspecs = 0, idx;
1573 tTspecInfo *pTspec = NULL;
1574
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001575 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1576 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 pReassoc->num_WMMTSPEC = numTspecs;
1578 if (numTspecs) {
1579 for (idx=0; idx<numTspecs; idx++) {
1580 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
1581 pTspec++;
1582 }
1583 }
1584}
1585#endif
1586
1587void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1588 tpPESession psessionEntry)
1589{
1590 pInfo->version = SIR_MAC_OUI_VERSION_1;
1591
1592 /* WMM Specification 3.1.3, 3.2.3
1593 * An IBSS staion shall always use its default WMM parameters.
1594 */
1595 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1596 {
1597 pInfo->param_set_count = 0;
1598 pInfo->uapsd = 0;
1599 }
1600 else
1601 {
1602 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1604 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1605 }
1606 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001607 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1608 }
1609 pInfo->present = 1;
1610}
1611
1612void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1613{
1614 tANI_U32 val = 0;
1615
1616 pInfo->version = SIR_MAC_OUI_VERSION_1;
1617 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1618 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1619 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1620 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1621
1622 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1623 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1624
1625 pInfo->max_sp_length = (tANI_U8)val;
1626 pInfo->present = 1;
1627}
1628
Jeff Johnson295189b2012-06-20 16:38:30 -07001629void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1630 tDot11fIEWMMParams *pParams,
1631 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001632{
1633 pParams->version = SIR_MAC_OUI_VERSION_1;
1634
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1636 pParams->qosInfo =
1637 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1638 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 pParams->qosInfo =
1640 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1641
1642 // Fill each EDCA parameter set in order: be, bk, vi, vo
1643 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1644 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1645 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1646 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1647 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1648 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1649
1650 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1651 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1652 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1653 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1654 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1655 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1656
Jeff Johnson295189b2012-06-20 16:38:30 -07001657 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1658 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1659 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1661
1662
1663
1664 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1665 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1666 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1667 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1668 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1669
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1671 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1672 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1674
1675 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1676 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1677 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1678 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1679 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1680
1681 pParams->present = 1;
1682
1683} // End PopulateDot11fWMMParams.
1684
1685void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1686 tDot11fIEWMMSchedule *pDot11f)
1687{
1688 pDot11f->version = 1;
1689 pDot11f->aggregation = pSchedule->info.aggregation;
1690 pDot11f->tsid = pSchedule->info.tsid;
1691 pDot11f->direction = pSchedule->info.direction;
1692 pDot11f->reserved = pSchedule->info.rsvd;
1693 pDot11f->service_start_time = pSchedule->svcStartTime;
1694 pDot11f->service_interval = pSchedule->svcInterval;
1695 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1696 pDot11f->spec_interval = pSchedule->specInterval;
1697
1698 pDot11f->present = 1;
1699} // End PopulateDot11fWMMSchedule.
1700
1701tSirRetStatus
1702PopulateDot11fWPA(tpAniSirGlobal pMac,
1703 tpSirRSNie pRsnIe,
1704 tDot11fIEWPA *pDot11f)
1705{
1706 tANI_U32 status;
1707 int idx;
1708
1709 if ( pRsnIe->length )
1710 {
1711 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1712 {
1713 status = dot11fUnpackIeWPA( pMac,
1714 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1715 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1716 pDot11f );
1717 if ( DOT11F_FAILED( status ) )
1718 {
1719 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1720 "A (0x%08x).\n"),
1721 status );
1722 return eSIR_FAILURE;
1723 }
1724 }
1725 }
1726
1727 return eSIR_SUCCESS;
1728} // End PopulateDot11fWPA.
1729
1730
1731
1732tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1733 tpSirRSNie pRsnIe,
1734 tDot11fIEWPAOpaque *pDot11f )
1735{
1736 int idx;
1737
1738 if ( pRsnIe->length )
1739 {
1740 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1741 {
1742 pDot11f->present = 1;
1743 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301744 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1746 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1747 }
1748 }
1749
1750 return eSIR_SUCCESS;
1751
1752} // End PopulateDot11fWPAOpaque.
1753
1754////////////////////////////////////////////////////////////////////////
1755
1756tSirRetStatus
1757sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1758{
1759#if 0
1760 tANI_U32 val;
1761
1762 *caps = 0;
1763 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1764 != eSIR_SUCCESS)
1765 {
1766 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1767 return eSIR_FAILURE;
1768 }
1769 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1770 {
1771 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1772 return eSIR_FAILURE;
1773 }
1774
1775 *caps = (tANI_U16) val;
1776#endif
1777 return eSIR_SUCCESS;
1778}
1779
1780tSirRetStatus
1781sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1782 tANI_U8 *pFrame,
1783 tANI_U32 nFrame,
1784 tpSirProbeReq pProbeReq)
1785{
1786 tANI_U32 status;
1787 tDot11fProbeRequest pr;
1788
1789 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301790 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001791
1792 // delegate to the framesc-generated code,
1793 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1794 if ( DOT11F_FAILED( status ) )
1795 {
1796 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1797 status, nFrame);
1798 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1799 return eSIR_FAILURE;
1800 }
1801 else if ( DOT11F_WARNED( status ) )
1802 {
1803 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1804 status, nFrame );
1805 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1806 }
1807
1808 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1809 if ( ! pr.SSID.present )
1810 {
1811 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1812 }
1813 else
1814 {
1815 pProbeReq->ssidPresent = 1;
1816 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
1817 }
1818
1819 if ( ! pr.SuppRates.present )
1820 {
1821 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1822 return eSIR_FAILURE;
1823 }
1824 else
1825 {
1826 pProbeReq->suppRatesPresent = 1;
1827 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
1828 }
1829
1830 if ( pr.ExtSuppRates.present )
1831 {
1832 pProbeReq->extendedRatesPresent = 1;
1833 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
1834 }
1835
1836 if ( pr.HTCaps.present )
1837 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301838 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 }
1840
1841 if ( pr.WscProbeReq.present )
1842 {
1843 pProbeReq->wscIePresent = 1;
1844 memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
1845 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001846#ifdef WLAN_FEATURE_11AC
1847 if ( pr.VHTCaps.present )
1848 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301849 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07001850 }
1851#endif
1852
Jeff Johnson295189b2012-06-20 16:38:30 -07001853
1854 if ( pr.P2PProbeReq.present )
1855 {
1856 pProbeReq->p2pIePresent = 1;
1857 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001858
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 return eSIR_SUCCESS;
1860
1861} // End sirConvertProbeReqFrame2Struct.
1862
1863tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
1864 tANI_U8 *pFrame,
1865 tANI_U32 nFrame,
1866 tpSirProbeRespBeacon pProbeResp)
1867{
1868 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001869 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07001870
1871 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301872 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001873
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301874 pr = vos_mem_malloc(sizeof(tDot11fProbeResponse));
1875 if ( NULL == pr )
1876 status = eHAL_STATUS_FAILURE;
1877 else
1878 status = eHAL_STATUS_SUCCESS;
1879 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07001880 {
1881 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
1882 return eSIR_FAILURE;
1883 }
1884
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301885 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07001886
Jeff Johnson295189b2012-06-20 16:38:30 -07001887 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07001888 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07001889 if ( DOT11F_FAILED( status ) )
1890 {
1891 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
1892 status, nFrame);
1893 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301894 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 return eSIR_FAILURE;
1896 }
1897 else if ( DOT11F_WARNED( status ) )
1898 {
1899 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
1900 status, nFrame );
1901 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1902 }
1903
1904 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
1905
1906 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301907 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
1908 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001909
1910 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07001911 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07001912
1913 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07001914 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
1915 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
1916 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
1917 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
1918 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
1919 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
1920 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
1921 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
1922 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
1923 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
1924 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
1925 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
1926 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
1927 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
1928 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
1929 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07001930
Jeff Johnson32d95a32012-09-10 13:15:23 -07001931 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 {
1933 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1934 }
1935 else
1936 {
1937 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001938 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 }
1940
Jeff Johnson32d95a32012-09-10 13:15:23 -07001941 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 {
1943 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1944 }
1945 else
1946 {
1947 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001948 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001949 }
1950
Jeff Johnson32d95a32012-09-10 13:15:23 -07001951 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 {
1953 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001954 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001955 }
1956
1957
Jeff Johnson32d95a32012-09-10 13:15:23 -07001958 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 {
1960 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001961 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 }
1963
Jeff Johnson32d95a32012-09-10 13:15:23 -07001964 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001965 {
1966 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001967 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 }
1969
Jeff Johnson32d95a32012-09-10 13:15:23 -07001970 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001971 {
1972 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001973 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 }
1975
Jeff Johnson32d95a32012-09-10 13:15:23 -07001976 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 {
1978 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301979 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 sizeof(tDot11fIEExtChanSwitchAnn) );
1981 }
1982
Jeff Johnson32d95a32012-09-10 13:15:23 -07001983 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 {
1985 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301986 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 sizeof(tDot11fIEExtChanSwitchAnn) );
1988 }
1989
Jeff Johnson32d95a32012-09-10 13:15:23 -07001990 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 {
1992 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301993 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 }
1995
Jeff Johnson32d95a32012-09-10 13:15:23 -07001996 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 {
1998 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301999 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2000 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 }
2002
Jeff Johnson32d95a32012-09-10 13:15:23 -07002003 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 {
2005 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302006 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 }
2008
Jeff Johnson32d95a32012-09-10 13:15:23 -07002009 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302011 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002012 }
2013
Jeff Johnson32d95a32012-09-10 13:15:23 -07002014 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302016 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 }
2018
Jeff Johnson32d95a32012-09-10 13:15:23 -07002019 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 {
2021 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002022 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002024 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002026 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 }
2028
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002029 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 {
2031 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002032 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 }
2034
Jeff Johnson32d95a32012-09-10 13:15:23 -07002035 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 {
2037 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002038 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 }
2040
Jeff Johnson32d95a32012-09-10 13:15:23 -07002041 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 {
2043 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002044 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002046 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 }
2048
Jeff Johnson32d95a32012-09-10 13:15:23 -07002049 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 {
2051 pProbeResp->wmeInfoPresent = 1;
2052 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2053 }
2054
Jeff Johnson32d95a32012-09-10 13:15:23 -07002055 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 {
2057 pProbeResp->wsmCapablePresent = 1;
2058 }
2059
2060
Jeff Johnson32d95a32012-09-10 13:15:23 -07002061 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 {
2063 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002064 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 }
2066
2067#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002068 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 {
2070 // MobilityDomain
2071 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302072 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2073 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002074 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002075#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002076 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2078#endif
2079 }
2080#endif
2081
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002082#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002083 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302085 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 }
2087#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002088 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302090 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 sizeof(tDot11fIEP2PProbeRes) );
2092 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002093#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002094 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002095 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302096 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002097 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002098 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002099 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302100 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002101 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002102 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002103 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302104 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002105 }
2106#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302107 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 return eSIR_SUCCESS;
2109
2110} // End sirConvertProbeFrame2Struct.
2111
2112tSirRetStatus
2113sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2114 tANI_U8 *pFrame,
2115 tANI_U32 nFrame,
2116 tpSirAssocReq pAssocReq)
2117{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002118 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 tANI_U32 status;
2120
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302121 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2122 if ( NULL == ar )
2123 status = eHAL_STATUS_FAILURE;
2124 else
2125 status = eHAL_STATUS_SUCCESS;
2126 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002127 {
2128 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2129 return eSIR_FAILURE;
2130 }
2131 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302132 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2133 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002134
2135 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002136 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 if ( DOT11F_FAILED( status ) )
2138 {
2139 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2140 status, nFrame);
2141 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302142 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002143 return eSIR_FAILURE;
2144 }
2145 else if ( DOT11F_WARNED( status ) )
2146 {
2147 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2148 status, nFrame );
2149 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2150 }
2151
2152 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2153
2154 // make sure this is seen as an assoc request
2155 pAssocReq->reassocRequest = 0;
2156
2157 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002158 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2159 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2160 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2161 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2162 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2163 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2164 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2165 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2166 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2167 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2168 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2169 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2170 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2171 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2172 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2173 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002174
2175 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002176 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002177
2178 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002179 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 {
2181 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002182 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 }
2184
2185 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002186 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 {
2188 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002189 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 }
2191
2192 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002193 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 {
2195 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002196 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 }
2198
2199 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002200 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 {
2202 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002203 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 }
2205
2206 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002207 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 {
2209 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002210 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002211 }
2212
2213 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002214 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 {
2216 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002217 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 }
2219
2220 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002221 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 {
2223 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002224 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 }
2226
2227
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002228 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 {
2230 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002231 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002233#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002234 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002235 {
2236 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002237 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002238 }
2239#endif
2240
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002242 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 {
2244 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002245 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 }
2247
2248 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002249 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 {
2251 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002252 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002253 }
2254
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002255 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302257 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 }
2259
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002260 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 {
2262 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302263 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2264 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002265
2266 }
2267
2268
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002269 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002270
2271 if ( ! pAssocReq->ssidPresent )
2272 {
2273 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302274 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 return eSIR_FAILURE;
2276 }
2277
2278 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2279 {
2280 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302281 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 return eSIR_FAILURE;
2283 }
2284
Jeff Johnsone7245742012-09-05 17:12:55 -07002285#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002286 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002287 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302288 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002289 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2290 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2291 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002292 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002293 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302294 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002295 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2296 limLogOperatingMode( pMac, &pAssocReq->operMode);
2297 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002298#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302299 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 return eSIR_SUCCESS;
2301
2302} // End sirConvertAssocReqFrame2Struct.
2303
2304tSirRetStatus
2305sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2306 tANI_U8 *pFrame,
2307 tANI_U32 nFrame,
2308 tpSirAssocRsp pAssocRsp)
2309{
2310 static tDot11fAssocResponse ar;
2311 tANI_U32 status;
2312 tANI_U8 cnt =0;
2313
2314 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302315 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002316
2317 // delegate to the framesc-generated code,
2318 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2319 if ( DOT11F_FAILED( status ) )
2320 {
2321 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2322 status, nFrame);
2323 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2324 return eSIR_FAILURE;
2325 }
2326 else if ( DOT11F_WARNED( status ) )
2327 {
2328 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2329 status, nFrame );
2330 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2331 }
2332
2333 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2334
2335 // Capabilities
2336 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2337 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2338 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2339 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2340 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2341 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2342 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2343 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2344 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2345 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2346 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2347 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2348 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2349 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2350 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2351 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2352
2353 pAssocRsp->statusCode = ar.Status.status;
2354 pAssocRsp->aid = ar.AID.associd;
2355
2356 if ( ! ar.SuppRates.present )
2357 {
2358 pAssocRsp->suppRatesPresent = 0;
2359 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2360 }
2361 else
2362 {
2363 pAssocRsp->suppRatesPresent = 1;
2364 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2365 }
2366
2367 if ( ar.ExtSuppRates.present )
2368 {
2369 pAssocRsp->extendedRatesPresent = 1;
2370 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2371 }
2372
2373 if ( ar.EDCAParamSet.present )
2374 {
2375 pAssocRsp->edcaPresent = 1;
2376 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2377 }
2378
2379
2380 if ( ar.WMMParams.present )
2381 {
2382 pAssocRsp->wmeEdcaPresent = 1;
2383 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002384 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 __printWMMParams(pMac, &ar.WMMParams);
2386 }
2387
2388 if ( ar.HTCaps.present )
2389 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302390 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 }
2392
2393 if ( ar.HTInfo.present )
2394 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302395 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 }
2397
2398#ifdef WLAN_FEATURE_VOWIFI_11R
2399 if (ar.MobilityDomain.present)
2400 {
2401 // MobilityDomain
2402 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302403 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2404 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002405 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2406#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002407 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002408 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2409#endif
2410 }
2411
2412 if ( ar.FTInfo.present )
2413 {
2414#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002415 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 -07002416 ar.FTInfo.R0KH_ID.present,
2417 ar.FTInfo.R1KH_ID.present);
2418#endif
2419 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302420 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002421 }
2422#endif
2423
2424#ifdef WLAN_FEATURE_VOWIFI_11R
2425 if (ar.num_RICDataDesc) {
2426 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2427 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302428 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2429 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 }
2431 }
2432 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2433 pAssocRsp->ricPresent = TRUE;
2434 }
2435#endif
2436
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002437#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 if (ar.num_WMMTSPEC) {
2439 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2440 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302441 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2442 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 }
2444 pAssocRsp->tspecPresent = TRUE;
2445 }
2446
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002447 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 {
2449 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302450 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002451 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 }
2453#endif
2454
Jeff Johnsone7245742012-09-05 17:12:55 -07002455#ifdef WLAN_FEATURE_11AC
2456 if ( ar.VHTCaps.present )
2457 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302458 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002459 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002460 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2461 }
2462 if ( ar.VHTOperation.present )
2463 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302464 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002465 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002466 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2467 }
2468#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302469 if(ar.OBSSScanParameters.present)
2470 {
2471 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2472 sizeof( tDot11fIEOBSSScanParameters));
2473 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002474 if ( ar.QosMapSet.present )
2475 {
2476 pMac->QosMapSet.present = 1;
2477 ConvertQosMapsetFrame( pMac, &pMac->QosMapSet, &ar.QosMapSet);
2478 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
2479 limLogQosMapSet(pMac, &pMac->QosMapSet);
2480 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002482} // End sirConvertAssocRespFrame2Struct.
2483
2484tSirRetStatus
2485sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2486 tANI_U8 *pFrame,
2487 tANI_U32 nFrame,
2488 tpSirAssocReq pAssocReq)
2489{
2490 static tDot11fReAssocRequest ar;
2491 tANI_U32 status;
2492
2493 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302494 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002495
2496 // delegate to the framesc-generated code,
2497 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2498 if ( DOT11F_FAILED( status ) )
2499 {
2500 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2501 status, nFrame);
2502 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2503 return eSIR_FAILURE;
2504 }
2505 else if ( DOT11F_WARNED( status ) )
2506 {
2507 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2508 status, nFrame );
2509 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2510 }
2511
2512 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2513
2514 // make sure this is seen as a re-assoc request
2515 pAssocReq->reassocRequest = 1;
2516
2517 // Capabilities
2518 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2519 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2520 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2521 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2522 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2523 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2524 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2525 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2526 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2527 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2528 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2529 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2530 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2531 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2532 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2533 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2534
2535 // Listen Interval
2536 pAssocReq->listenInterval = ar.ListenInterval.interval;
2537
2538 // SSID
2539 if ( ar.SSID.present )
2540 {
2541 pAssocReq->ssidPresent = 1;
2542 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2543 }
2544
2545 // Supported Rates
2546 if ( ar.SuppRates.present )
2547 {
2548 pAssocReq->suppRatesPresent = 1;
2549 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2550 }
2551
2552 // Extended Supported Rates
2553 if ( ar.ExtSuppRates.present )
2554 {
2555 pAssocReq->extendedRatesPresent = 1;
2556 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2557 &ar.ExtSuppRates );
2558 }
2559
2560 // QOS Capabilities:
2561 if ( ar.QOSCapsStation.present )
2562 {
2563 pAssocReq->qosCapabilityPresent = 1;
2564 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2565 }
2566
2567 // WPA
2568 if ( ar.WPAOpaque.present )
2569 {
2570 pAssocReq->wpaPresent = 1;
2571 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2572 }
2573
2574 // RSN
2575 if ( ar.RSNOpaque.present )
2576 {
2577 pAssocReq->rsnPresent = 1;
2578 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2579 }
2580
2581
2582 // Power Capabilities
2583 if ( ar.PowerCaps.present )
2584 {
2585 pAssocReq->powerCapabilityPresent = 1;
2586 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2587 }
2588
2589 // Supported Channels
2590 if ( ar.SuppChannels.present )
2591 {
2592 pAssocReq->supportedChannelsPresent = 1;
2593 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2594 }
2595
2596 if ( ar.HTCaps.present )
2597 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302598 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 }
2600
2601 if ( ar.WMMInfoStation.present )
2602 {
2603 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302604 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2605 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002606
2607 }
2608
2609 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2610
2611 if ( ! pAssocReq->ssidPresent )
2612 {
2613 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2614 return eSIR_FAILURE;
2615 }
2616
2617 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2618 {
2619 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2620 return eSIR_FAILURE;
2621 }
2622
2623 // Why no call to 'updateAssocReqFromPropCapability' here, like
2624 // there is in 'sirConvertAssocReqFrame2Struct'?
2625
2626 // WSC IE
2627 if (ar.WscIEOpaque.present)
2628 {
2629 pAssocReq->addIEPresent = 1;
2630 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2631 }
2632
Jeff Johnson295189b2012-06-20 16:38:30 -07002633 if(ar.P2PIEOpaque.present)
2634 {
2635 pAssocReq->addIEPresent = 1;
2636 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2637 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002638
Jeff Johnsone7245742012-09-05 17:12:55 -07002639#ifdef WLAN_FEATURE_WFD
2640 if(ar.WFDIEOpaque.present)
2641 {
2642 pAssocReq->addIEPresent = 1;
2643 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2644 }
2645#endif
2646
2647#ifdef WLAN_FEATURE_11AC
2648 if ( ar.VHTCaps.present )
2649 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302650 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002651 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002652 if ( ar.OperatingMode.present )
2653 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302654 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002655 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2656 limLogOperatingMode( pMac, &pAssocReq->operMode);
2657 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002658#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 return eSIR_SUCCESS;
2660
2661} // End sirConvertReassocReqFrame2Struct.
2662
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002663
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002664#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002665tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002666sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002667 tANI_U8 *pPayload,
2668 const tANI_U32 nPayload,
2669 tANI_U8 **outIeBuf,
2670 tANI_U32 *pOutIeLen)
2671{
2672 tDot11fBeaconIEs *pBies = NULL;
2673 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002674 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002675 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002676
2677 /* To store how many bytes are required to be allocated
2678 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002679 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002680 tANI_U8 *pos = NULL;
2681
2682 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002683 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002684 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2685 if ( NULL == pBies )
2686 status = eHAL_STATUS_FAILURE;
2687 else
2688 status = eHAL_STATUS_SUCCESS;
2689 if (!HAL_STATUS_SUCCESS(status))
2690 {
2691 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2692 return eSIR_FAILURE;
2693 }
2694 // delegate to the framesc-generated code,
2695 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2696
2697 if ( DOT11F_FAILED( status ) )
2698 {
2699 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2700 status, nPayload);
2701 vos_mem_free(pBies);
2702 return eSIR_FAILURE;
2703 }
2704 else if ( DOT11F_WARNED( status ) )
2705 {
2706 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2707 status, nPayload );
2708 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2709 }
2710
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002711 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002712 if ( !pBies->SSID.present )
2713 {
2714 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2715 }
2716 else
2717 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002718 eseBcnReportMandatoryIe.ssidPresent = 1;
2719 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002720 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002721 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002722 }
2723
2724 if ( !pBies->SuppRates.present )
2725 {
2726 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2727 }
2728 else
2729 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002730 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2731 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2732 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002733 }
2734
2735 if ( pBies->FHParamSet.present)
2736 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002737 eseBcnReportMandatoryIe.fhParamPresent = 1;
2738 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002739 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2740 }
2741
2742 if ( pBies->DSParams.present )
2743 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002744 eseBcnReportMandatoryIe.dsParamsPresent = 1;
2745 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002746 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2747 }
2748
2749 if ( pBies->CFParams.present )
2750 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002751 eseBcnReportMandatoryIe.cfPresent = 1;
2752 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002753 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
2754 }
2755
2756 if ( pBies->IBSSParams.present )
2757 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002758 eseBcnReportMandatoryIe.ibssParamPresent = 1;
2759 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002760 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2761 }
2762
2763 if ( pBies->TIM.present )
2764 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002765 eseBcnReportMandatoryIe.timPresent = 1;
2766 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
2767 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
2768 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
2769 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002770 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
2771 }
2772
2773 if ( pBies->RRMEnabledCap.present )
2774 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002775 eseBcnReportMandatoryIe.rrmPresent = 1;
2776 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002777 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2778 }
2779
2780 *outIeBuf = vos_mem_malloc(numBytes);
2781 if (NULL == *outIeBuf)
2782 {
2783 limLog(pMac, LOGP, FL("Memory Allocation failure"));
2784 vos_mem_free(pBies);
2785 return eSIR_FAILURE;
2786 }
2787 pos = *outIeBuf;
2788 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002789 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002790
2791 /* Start filling the output Ie with Mandatory IE information */
2792 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002793 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002794 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002795 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002796 {
2797 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
2798 retStatus = eSIR_FAILURE;
2799 goto err_bcnrep;
2800 }
2801 *pos = SIR_MAC_SSID_EID;
2802 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002803 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002804 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002805 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
2806 eseBcnReportMandatoryIe.ssId.length);
2807 pos += eseBcnReportMandatoryIe.ssId.length;
2808 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002809 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002810
2811 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002812 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002813 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002814 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002815 {
2816 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
2817 retStatus = eSIR_FAILURE;
2818 goto err_bcnrep;
2819 }
2820 *pos = SIR_MAC_RATESET_EID;
2821 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002822 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002823 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002824 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
2825 eseBcnReportMandatoryIe.supportedRates.numRates);
2826 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
2827 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002828 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002829
2830 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002831 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002832 {
2833 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
2834 {
2835 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
2836 retStatus = eSIR_FAILURE;
2837 goto err_bcnrep;
2838 }
2839 *pos = SIR_MAC_FH_PARAM_SET_EID;
2840 pos++;
2841 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
2842 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002843 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002844 SIR_MAC_FH_PARAM_SET_EID_MAX);
2845 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
2846 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
2847 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002848
2849 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002850 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002851 {
2852 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
2853 {
2854 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
2855 retStatus = eSIR_FAILURE;
2856 goto err_bcnrep;
2857 }
2858 *pos = SIR_MAC_DS_PARAM_SET_EID;
2859 pos++;
2860 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
2861 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002862 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002863 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
2864 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
2865 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002866
2867 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002868 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002869 {
2870 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
2871 {
2872 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
2873 retStatus = eSIR_FAILURE;
2874 goto err_bcnrep;
2875 }
2876 *pos = SIR_MAC_CF_PARAM_SET_EID;
2877 pos++;
2878 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
2879 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002880 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002881 SIR_MAC_CF_PARAM_SET_EID_MAX);
2882 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
2883 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
2884 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002885
2886 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002887 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002888 {
2889 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
2890 {
2891 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
2892 retStatus = eSIR_FAILURE;
2893 goto err_bcnrep;
2894 }
2895 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
2896 pos++;
2897 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2898 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002899 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002900 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2901 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2902 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2903 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002904
2905 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002906 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002907 {
2908 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
2909 {
2910 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
2911 retStatus = eSIR_FAILURE;
2912 goto err_bcnrep;
2913 }
2914 *pos = SIR_MAC_TIM_EID;
2915 pos++;
2916 *pos = SIR_MAC_TIM_EID_MIN;
2917 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002918 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002919 SIR_MAC_TIM_EID_MIN);
2920 pos += SIR_MAC_TIM_EID_MIN;
2921 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
2922 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002923
2924 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002925 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002926 {
2927 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
2928 {
2929 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
2930 retStatus = eSIR_FAILURE;
2931 goto err_bcnrep;
2932 }
2933 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
2934 pos++;
2935 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2936 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002937 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002938 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2939 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2940 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002941
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002942 if (freeBytes != 0)
2943 {
2944 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
2945 retStatus = eSIR_FAILURE;
2946 }
2947
2948err_bcnrep:
2949 /* The message counter would not be incremented in case of
2950 * returning failure and hence next time, this function gets
2951 * called, it would be using the same msg ctr for a different
2952 * BSS.So, it is good to clear the memory allocated for a BSS
2953 * that is returning failure.On success, the caller would take
2954 * care of freeing up the memory*/
2955 if (retStatus == eSIR_FAILURE)
2956 {
2957 vos_mem_free(*outIeBuf);
2958 *outIeBuf = NULL;
2959 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002960 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002961 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002962}
2963
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002964#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002965
Jeff Johnson295189b2012-06-20 16:38:30 -07002966tSirRetStatus
2967sirParseBeaconIE(tpAniSirGlobal pMac,
2968 tpSirProbeRespBeacon pBeaconStruct,
2969 tANI_U8 *pPayload,
2970 tANI_U32 nPayload)
2971{
2972 tDot11fBeaconIEs *pBies;
2973 tANI_U32 status;
2974
2975 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302976 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002977
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302978 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2979 if ( NULL == pBies )
2980 status = eHAL_STATUS_FAILURE;
2981 else
2982 status = eHAL_STATUS_SUCCESS;
2983 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07002984 {
2985 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2986 return eSIR_FAILURE;
2987 }
2988 // delegate to the framesc-generated code,
2989 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2990
2991 if ( DOT11F_FAILED( status ) )
2992 {
2993 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2994 status, nPayload);
2995 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302996 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 return eSIR_FAILURE;
2998 }
2999 else if ( DOT11F_WARNED( status ) )
3000 {
3001 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3002 status, nPayload );
3003 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3004 }
3005
3006 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3007 if ( ! pBies->SSID.present )
3008 {
3009 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3010 }
3011 else
3012 {
3013 pBeaconStruct->ssidPresent = 1;
3014 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3015 }
3016
3017 if ( ! pBies->SuppRates.present )
3018 {
3019 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3020 }
3021 else
3022 {
3023 pBeaconStruct->suppRatesPresent = 1;
3024 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3025 }
3026
3027 if ( pBies->ExtSuppRates.present )
3028 {
3029 pBeaconStruct->extendedRatesPresent = 1;
3030 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3031 }
3032
3033 if ( pBies->CFParams.present )
3034 {
3035 pBeaconStruct->cfPresent = 1;
3036 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3037 }
3038
3039 if ( pBies->TIM.present )
3040 {
3041 pBeaconStruct->timPresent = 1;
3042 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3043 }
3044
3045 if ( pBies->Country.present )
3046 {
3047 pBeaconStruct->countryInfoPresent = 1;
3048 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3049 }
3050
3051 // 11h IEs
3052 if(pBies->TPCReport.present)
3053 {
3054 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303055 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003056 &pBies->TPCReport,
3057 sizeof( tDot11fIETPCReport));
3058 }
3059
3060 if(pBies->PowerConstraints.present)
3061 {
3062 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303063 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 &pBies->PowerConstraints,
3065 sizeof(tDot11fIEPowerConstraints));
3066 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003067#ifdef FEATURE_WLAN_ESE
3068 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003069 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003070 pBeaconStruct->eseTxPwr.present = 1;
3071 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 }
3073 if (pBies->QBSSLoad.present)
3074 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303075 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003076 }
3077#endif
3078
3079 if ( pBies->EDCAParamSet.present )
3080 {
3081 pBeaconStruct->edcaPresent = 1;
3082 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3083 }
3084
3085 // QOS Capabilities:
3086 if ( pBies->QOSCapsAp.present )
3087 {
3088 pBeaconStruct->qosCapabilityPresent = 1;
3089 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3090 }
3091
3092
3093
3094 if ( pBies->ChanSwitchAnn.present )
3095 {
3096 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303097 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003098 sizeof(tDot11fIEChanSwitchAnn));
3099 }
3100
3101 if ( pBies->ExtChanSwitchAnn.present)
3102 {
3103 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303104 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003105 sizeof(tDot11fIEExtChanSwitchAnn));
3106 }
3107
3108 if ( pBies->Quiet.present )
3109 {
3110 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303111 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 }
3113
3114 if ( pBies->HTCaps.present )
3115 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303116 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 }
3118
3119 if ( pBies->HTInfo.present )
3120 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303121 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003122 }
3123
3124 if ( pBies->DSParams.present )
3125 {
3126 pBeaconStruct->dsParamsPresent = 1;
3127 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3128 }
3129 else if(pBies->HTInfo.present)
3130 {
3131 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3132 }
3133
3134 if ( pBies->RSN.present )
3135 {
3136 pBeaconStruct->rsnPresent = 1;
3137 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3138 }
3139
3140 if ( pBies->WPA.present )
3141 {
3142 pBeaconStruct->wpaPresent = 1;
3143 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3144 }
3145
3146 if ( pBies->WMMParams.present )
3147 {
3148 pBeaconStruct->wmeEdcaPresent = 1;
3149 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3150 }
3151
3152 if ( pBies->WMMInfoAp.present )
3153 {
3154 pBeaconStruct->wmeInfoPresent = 1;
3155 }
3156
3157 if ( pBies->WMMCaps.present )
3158 {
3159 pBeaconStruct->wsmCapablePresent = 1;
3160 }
3161
3162
3163 if ( pBies->ERPInfo.present )
3164 {
3165 pBeaconStruct->erpPresent = 1;
3166 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3167 }
3168
Jeff Johnsone7245742012-09-05 17:12:55 -07003169#ifdef WLAN_FEATURE_11AC
3170 if ( pBies->VHTCaps.present )
3171 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303172 pBeaconStruct->VHTCaps.present = 1;
3173 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003174 }
3175 if ( pBies->VHTOperation.present )
3176 {
3177 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303178 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3179 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003180 }
3181 if ( pBies->VHTExtBssLoad.present )
3182 {
3183 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303184 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3185 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003186 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003187 if( pBies->OperatingMode.present)
3188 {
3189 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303190 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3191 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003192 }
3193
Jeff Johnsone7245742012-09-05 17:12:55 -07003194#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303195 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003196
Jeff Johnsone7245742012-09-05 17:12:55 -07003197
Jeff Johnson295189b2012-06-20 16:38:30 -07003198 return eSIR_SUCCESS;
3199
3200} // End sirParseBeaconIE.
3201
3202tSirRetStatus
3203sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3204 tANI_U8 *pFrame,
3205 tpSirProbeRespBeacon pBeaconStruct)
3206{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003207 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003208 tANI_U32 status, nPayload;
3209 tANI_U8 *pPayload;
3210 tpSirMacMgmtHdr pHdr;
3211 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003212 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003213
3214 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3215 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3216 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3217 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003218 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003219
3220 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303221 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3222
3223 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
3224 if ( NULL == pBeacon )
3225 status = eHAL_STATUS_FAILURE;
3226 else
3227 status = eHAL_STATUS_SUCCESS;
3228 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003229 {
3230 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3231 return eSIR_FAILURE;
3232 }
3233
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303234 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003235
3236 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303237 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003238
3239 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003240 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003241 if ( DOT11F_FAILED( status ) )
3242 {
3243 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3244 status, nPayload);
3245 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303246 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 return eSIR_FAILURE;
3248 }
3249 else if ( DOT11F_WARNED( status ) )
3250 {
3251 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3252 status, nPayload );
3253 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3254 }
3255
3256 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3257 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303258 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3259 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003260
3261 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003262 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003263
3264 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003265 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3266 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3267 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3268 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3269 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3270 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3271 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3272 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3273 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3274 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3275 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3276 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3277 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3278 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3279 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3280 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003281
Jeff Johnson32d95a32012-09-10 13:15:23 -07003282 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 {
3284 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3285 }
3286 else
3287 {
3288 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003289 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 }
3291
Jeff Johnson32d95a32012-09-10 13:15:23 -07003292 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 {
3294 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3295 }
3296 else
3297 {
3298 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003299 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003300 }
3301
Jeff Johnson32d95a32012-09-10 13:15:23 -07003302 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 {
3304 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003305 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 }
3307
3308
Jeff Johnson32d95a32012-09-10 13:15:23 -07003309 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 {
3311 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003312 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003313 }
3314
Jeff Johnson32d95a32012-09-10 13:15:23 -07003315 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 {
3317 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003318 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 }
3320
Jeff Johnson32d95a32012-09-10 13:15:23 -07003321 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 {
3323 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003324 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 }
3326
3327 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003328 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 {
3330 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003331 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 }
3333
Jeff Johnson32d95a32012-09-10 13:15:23 -07003334 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003335 {
3336 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003337 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 }
3339
Jeff Johnson32d95a32012-09-10 13:15:23 -07003340 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003341 {
3342 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303343 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 sizeof(tDot11fIEChanSwitchAnn) );
3345 }
3346
Jeff Johnson32d95a32012-09-10 13:15:23 -07003347 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 {
3349 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303350 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 sizeof(tDot11fIEExtChanSwitchAnn) );
3352 }
3353
Jeff Johnson32d95a32012-09-10 13:15:23 -07003354 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 {
3356 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303357 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003358 sizeof(tDot11fIETPCReport));
3359 }
3360
Jeff Johnson32d95a32012-09-10 13:15:23 -07003361 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 {
3363 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303364 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 sizeof(tDot11fIEPowerConstraints));
3366 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003367
3368 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 {
3370 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303371 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 }
3373
Jeff Johnson32d95a32012-09-10 13:15:23 -07003374 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303376 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 }
3378
Jeff Johnson32d95a32012-09-10 13:15:23 -07003379 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303381 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003382
3383 }
3384
Jeff Johnson32d95a32012-09-10 13:15:23 -07003385 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003386 {
3387 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003388 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003389 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003390 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003392 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003393 }
3394 else
3395 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003396 if ((!rfBand) || IS_5G_BAND(rfBand))
3397 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3398 else if (IS_24G_BAND(rfBand))
3399 pBeaconStruct->channelNumber = mappedRXCh;
3400 else
3401 {
3402 /*Only 0, 1, 2 are expected values for RF band from FW
3403 * if FW fixes are not present then rf band value will
3404 * be 0, else either 1 or 2 are expected from FW, 3 is
3405 * not expected from FW */
3406 PELOGE(limLog(pMac, LOGE,
3407 FL("Channel info is not present in Beacon and"
3408 " mapping is not done correctly"));)
3409 pBeaconStruct->channelNumber = mappedRXCh;
3410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003411 }
3412
Jeff Johnson32d95a32012-09-10 13:15:23 -07003413 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 {
3415 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003416 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 }
3418
Jeff Johnson32d95a32012-09-10 13:15:23 -07003419 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003420 {
3421 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003422 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 }
3424
Jeff Johnson32d95a32012-09-10 13:15:23 -07003425 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 {
3427 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003428 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003430 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003431 }
3432
Jeff Johnson32d95a32012-09-10 13:15:23 -07003433 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 {
3435 pBeaconStruct->wmeInfoPresent = 1;
3436 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3437 }
3438
Jeff Johnson32d95a32012-09-10 13:15:23 -07003439 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003440 {
3441 pBeaconStruct->wsmCapablePresent = 1;
3442 }
3443
Jeff Johnson32d95a32012-09-10 13:15:23 -07003444 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003445 {
3446 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003447 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 }
3449
3450#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003451 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003452 {
3453 // MobilityDomain
3454 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303455 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3456 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003457 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003458
3459 }
3460#endif
3461
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003462#ifdef FEATURE_WLAN_ESE
3463 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303464 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003465 //ESE Tx Power
3466 pBeaconStruct->eseTxPwr.present = 1;
3467 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3468 &pBeacon->ESETxmitPower,
3469 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303470 }
3471#endif
3472
Jeff Johnsone7245742012-09-05 17:12:55 -07003473#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003474 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003475 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303476 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003477 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003478 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003479 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303480 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3481 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003482 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003483 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003484 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303485 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3486 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003487 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003488 if(pBeacon->OperatingMode.present)
3489 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303490 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3491 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003492 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003493 if(pBeacon->WiderBWChanSwitchAnn.present)
3494 {
3495 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303496 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3497 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003498 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003499#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303500 if(pBeacon->OBSSScanParameters.present)
3501 {
3502 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3503 &pBeacon->OBSSScanParameters,
3504 sizeof( tDot11fIEOBSSScanParameters));
3505 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303506 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 return eSIR_SUCCESS;
3508
3509} // End sirConvertBeaconFrame2Struct.
3510
3511tSirRetStatus
3512sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3513 tANI_U8 *pFrame,
3514 tANI_U32 nFrame,
3515 tpSirMacAuthFrameBody pAuth)
3516{
3517 static tDot11fAuthentication auth;
3518 tANI_U32 status;
3519
3520 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303521 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003522
3523 // delegate to the framesc-generated code,
3524 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3525 if ( DOT11F_FAILED( status ) )
3526 {
3527 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3528 status, nFrame);
3529 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3530 return eSIR_FAILURE;
3531 }
3532 else if ( DOT11F_WARNED( status ) )
3533 {
3534 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3535 status, nFrame );
3536 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3537 }
3538
3539 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3540 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3541 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3542 pAuth->authStatusCode = auth.Status.status;
3543
3544 if ( auth.ChallengeText.present )
3545 {
3546 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3547 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303548 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003549 }
3550
3551 return eSIR_SUCCESS;
3552
3553} // End sirConvertAuthFrame2Struct.
3554
3555tSirRetStatus
3556sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3557 tANI_U8 *pFrame,
3558 tANI_U32 nFrame,
3559 tSirAddtsReqInfo *pAddTs)
3560{
3561 tDot11fAddTSRequest addts = {{0}};
3562 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3563 tANI_U8 j;
3564 tANI_U16 i;
3565 tANI_U32 status;
3566
3567 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3568 {
3569 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3570 "with an Action of %d; this is not "
3571 "supported & is probably an error."),
3572 *( pFrame + 1 ) );
3573 return eSIR_FAILURE;
3574 }
3575
3576 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303577 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003578
3579 // delegate to the framesc-generated code,
3580 switch ( *pFrame )
3581 {
3582 case SIR_MAC_ACTION_QOS_MGMT:
3583 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3584 break;
3585 case SIR_MAC_ACTION_WME:
3586 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3587 break;
3588 default:
3589 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3590 "with a Category of %d; this is not"
3591 " supported & is probably an error."),
3592 *pFrame );
3593 return eSIR_FAILURE;
3594 }
3595
3596 if ( DOT11F_FAILED( status ) )
3597 {
3598 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3599 "rame (0x%08x, %d bytes):\n"),
3600 status, nFrame);
3601 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3602 return eSIR_FAILURE;
3603 }
3604 else if ( DOT11F_WARNED( status ) )
3605 {
3606 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3607 "g an Add TS Request frame (0x%08x,"
3608 "%d bytes):\n"),
3609 status, nFrame );
3610 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3611 }
3612
3613 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3614 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3615 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3616 {
3617 pAddTs->dialogToken = addts.DialogToken.token;
3618
3619 if ( addts.TSPEC.present )
3620 {
3621 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3622 }
3623 else
3624 {
3625 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3626 return eSIR_FAILURE;
3627 }
3628
3629 if ( addts.num_TCLAS )
3630 {
3631 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3632
3633 for ( i = 0U; i < addts.num_TCLAS; ++i )
3634 {
3635 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3636 {
3637 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3638 return eSIR_FAILURE;
3639 }
3640 }
3641 }
3642
3643 if ( addts.TCLASSPROC.present )
3644 {
3645 pAddTs->tclasProcPresent = 1;
3646 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3647 }
3648
3649 if ( addts.WMMTSPEC.present )
3650 {
3651 pAddTs->wsmTspecPresent = 1;
3652 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3653 }
3654
3655 if ( addts.num_WMMTCLAS )
3656 {
3657 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3658 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3659
3660 for ( i = pAddTs->numTclas; i < j; ++i )
3661 {
3662 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3663 {
3664 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3665 return eSIR_FAILURE;
3666 }
3667 }
3668 }
3669
3670 if ( addts.WMMTCLASPROC.present )
3671 {
3672 pAddTs->tclasProcPresent = 1;
3673 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3674 }
3675
3676 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3677 {
3678 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3679 pAddTs->numTclas );
3680 return eSIR_FAILURE;
3681 }
3682 }
3683 else
3684 {
3685 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3686
3687 if ( wmmaddts.WMMTSPEC.present )
3688 {
3689 pAddTs->wmeTspecPresent = 1;
3690 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3691 }
3692 else
3693 {
3694 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3695 return eSIR_FAILURE;
3696 }
3697 }
3698
3699 return eSIR_SUCCESS;
3700
3701} // End sirConvertAddtsReq2Struct.
3702
3703tSirRetStatus
3704sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3705 tANI_U8 *pFrame,
3706 tANI_U32 nFrame,
3707 tSirAddtsRspInfo *pAddTs)
3708{
3709 tDot11fAddTSResponse addts = {{0}};
3710 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3711 tANI_U8 j;
3712 tANI_U16 i;
3713 tANI_U32 status;
3714
3715 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3716 {
3717 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3718 "with an Action of %d; this is not "
3719 "supported & is probably an error."),
3720 *( pFrame + 1 ) );
3721 return eSIR_FAILURE;
3722 }
3723
3724 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303725 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3726 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3727 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003728
3729
3730 // delegate to the framesc-generated code,
3731 switch ( *pFrame )
3732 {
3733 case SIR_MAC_ACTION_QOS_MGMT:
3734 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3735 break;
3736 case SIR_MAC_ACTION_WME:
3737 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3738 break;
3739 default:
3740 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3741 "with a Category of %d; this is not"
3742 " supported & is probably an error."),
3743 *pFrame );
3744 return eSIR_FAILURE;
3745 }
3746
3747 if ( DOT11F_FAILED( status ) )
3748 {
3749 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
3750 "rame (0x%08x, %d bytes):\n"),
3751 status, nFrame);
3752 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3753 return eSIR_FAILURE;
3754 }
3755 else if ( DOT11F_WARNED( status ) )
3756 {
3757 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3758 "g an Add TS Response frame (0x%08x,"
3759 "%d bytes):\n"),
3760 status, nFrame );
3761 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3762 }
3763
3764 // & "transliterate" from a 'tDot11fAddTSResponse' or a
3765 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
3766 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3767 {
3768 pAddTs->dialogToken = addts.DialogToken.token;
3769 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
3770
3771 if ( addts.TSDelay.present )
3772 {
3773 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
3774 }
3775
3776 // TS Delay is present iff status indicates its presence
3777 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
3778 {
3779 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
3780 }
3781
3782 if ( addts.TSPEC.present )
3783 {
3784 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3785 }
3786 else
3787 {
3788 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
3789 return eSIR_FAILURE;
3790 }
3791
3792 if ( addts.num_TCLAS )
3793 {
3794 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3795
3796 for ( i = 0U; i < addts.num_TCLAS; ++i )
3797 {
3798 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3799 {
3800 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3801 return eSIR_FAILURE;
3802 }
3803 }
3804 }
3805
3806 if ( addts.TCLASSPROC.present )
3807 {
3808 pAddTs->tclasProcPresent = 1;
3809 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3810 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003811#ifdef FEATURE_WLAN_ESE
3812 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 {
3814 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303815 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003816 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003817 }
3818#endif
3819 if ( addts.Schedule.present )
3820 {
3821 pAddTs->schedulePresent = 1;
3822 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
3823 }
3824
3825 if ( addts.WMMSchedule.present )
3826 {
3827 pAddTs->schedulePresent = 1;
3828 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
3829 }
3830
3831 if ( addts.WMMTSPEC.present )
3832 {
3833 pAddTs->wsmTspecPresent = 1;
3834 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3835 }
3836
3837 if ( addts.num_WMMTCLAS )
3838 {
3839 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3840 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3841
3842 for ( i = pAddTs->numTclas; i < j; ++i )
3843 {
3844 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3845 {
3846 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3847 return eSIR_FAILURE;
3848 }
3849 }
3850 }
3851
3852 if ( addts.WMMTCLASPROC.present )
3853 {
3854 pAddTs->tclasProcPresent = 1;
3855 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3856 }
3857
3858 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3859 {
3860 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3861 pAddTs->numTclas );
3862 return eSIR_FAILURE;
3863 }
3864 }
3865 else
3866 {
3867 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3868 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
3869
3870 if ( wmmaddts.WMMTSPEC.present )
3871 {
3872 pAddTs->wmeTspecPresent = 1;
3873 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3874 }
3875 else
3876 {
3877 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3878 return eSIR_FAILURE;
3879 }
3880
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003881#ifdef FEATURE_WLAN_ESE
3882 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 {
3884 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303885 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003886 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 }
3888#endif
3889
3890 }
3891
3892 return eSIR_SUCCESS;
3893
3894} // End sirConvertAddtsRsp2Struct.
3895
3896tSirRetStatus
3897sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
3898 tANI_U8 *pFrame,
3899 tANI_U32 nFrame,
3900 tSirDeltsReqInfo *pDelTs)
3901{
3902 tDot11fDelTS delts = {{0}};
3903 tDot11fWMMDelTS wmmdelts = {{0}};
3904 tANI_U32 status;
3905
3906 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
3907 {
3908 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3909 "with an Action of %d; this is not "
3910 "supported & is probably an error."),
3911 *( pFrame + 1 ) );
3912 return eSIR_FAILURE;
3913 }
3914
3915 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303916 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003917
3918 // delegate to the framesc-generated code,
3919 switch ( *pFrame )
3920 {
3921 case SIR_MAC_ACTION_QOS_MGMT:
3922 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
3923 break;
3924 case SIR_MAC_ACTION_WME:
3925 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
3926 break;
3927 default:
3928 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3929 "with a Category of %d; this is not"
3930 " supported & is probably an error."),
3931 *pFrame );
3932 return eSIR_FAILURE;
3933 }
3934
3935 if ( DOT11F_FAILED( status ) )
3936 {
3937 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
3938 "rame (0x%08x, %d bytes):\n"),
3939 status, nFrame);
3940 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3941 return eSIR_FAILURE;
3942 }
3943 else if ( DOT11F_WARNED( status ) )
3944 {
3945 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
3946 "g an Del TS Request frame (0x%08x,"
3947 "%d bytes):\n"),
3948 status, nFrame );
3949 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3950 }
3951
3952 // & "transliterate" from a 'tDot11fDelTSResponse' or a
3953 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
3954 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3955 {
3956 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
3957 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
3958 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
3959 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
3960 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
3961 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
3962 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
3963 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
3964
3965 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
3966 }
3967 else
3968 {
3969 if ( wmmdelts.WMMTSPEC.present )
3970 {
3971 pDelTs->wmeTspecPresent = 1;
3972 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
3973 }
3974 else
3975 {
3976 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3977 return eSIR_FAILURE;
3978 }
3979 }
3980
3981 return eSIR_SUCCESS;
3982
3983} // End sirConvertDeltsReq2Struct.
3984
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07003985tSirRetStatus
3986sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
3987 tANI_U8 *pFrame,
3988 tANI_U32 nFrame,
3989 tSirQosMapSet *pQosMapSet)
3990{
3991 tDot11fQosMapConfigure mapConfigure;
3992 tANI_U32 status;
3993 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
3994 if ( DOT11F_FAILED( status ) )
3995 {
3996 dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):\n"),
3997 status, nFrame);
3998 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3999 return eSIR_FAILURE;
4000 }
4001 else if ( DOT11F_WARNED( status ) )
4002 {
4003 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):\n"),
4004 status, nFrame );
4005 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4006 }
4007 pQosMapSet->present = mapConfigure.QosMapSet.present;
4008 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
4009 limLogQosMapSet(pMac, &pMac->QosMapSet);
4010 return eSIR_SUCCESS;
4011}
Jeff Johnson295189b2012-06-20 16:38:30 -07004012
4013#ifdef ANI_SUPPORT_11H
4014tSirRetStatus
4015sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4016 tANI_U8 *pFrame,
4017 tpSirMacTpcReqActionFrame pTpcReqFrame,
4018 tANI_U32 nFrame)
4019{
4020 tDot11fTPCRequest req;
4021 tANI_U32 status;
4022
4023 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304024 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004025
4026 // delegate to the framesc-generated code,
4027 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4028 if ( DOT11F_FAILED( status ) )
4029 {
4030 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
4031 status, nFrame);
4032 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4033 return eSIR_FAILURE;
4034 }
4035 else if ( DOT11F_WARNED( status ) )
4036 {
4037 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
4038 status, nFrame );
4039 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4040 }
4041
4042 // & "transliterate" from a 'tDot11fTPCRequest' to a
4043 // 'tSirMacTpcReqActionFrame'...
4044 pTpcReqFrame->actionHeader.category = req.Category.category;
4045 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4046 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4047 if ( req.TPCRequest.present )
4048 {
4049 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4050 pTpcReqFrame->length = 0;
4051 }
4052 else
4053 {
4054 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
4055 return eSIR_FAILURE;
4056 }
4057
4058 return eSIR_SUCCESS;
4059
4060} // End sirConvertTpcReqFrame2Struct.
4061
4062
4063tSirRetStatus
4064sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4065 tANI_U8 *pFrame,
4066 tpSirMacMeasReqActionFrame pMeasReqFrame,
4067 tANI_U32 nFrame)
4068{
4069 tDot11fMeasurementRequest mr;
4070 tANI_U32 status;
4071
4072 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304073 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004074
4075 // delegate to the framesc-generated code,
4076 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4077 if ( DOT11F_FAILED( status ) )
4078 {
4079 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4080 status, nFrame);
4081 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4082 return eSIR_FAILURE;
4083 }
4084 else if ( DOT11F_WARNED( status ) )
4085 {
4086 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4087 status, nFrame );
4088 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4089 }
4090
4091 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4092 // 'tpSirMacMeasReqActionFrame'...
4093 pMeasReqFrame->actionHeader.category = mr.Category.category;
4094 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4095 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4096
4097 if ( 0 == mr.num_MeasurementRequest )
4098 {
4099 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4100 return eSIR_FAILURE;
4101 }
4102 else if ( 1 < mr.num_MeasurementRequest )
4103 {
4104 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4105 }
4106
4107 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4108 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4109 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4110 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4111 ( mr.MeasurementRequest[0].enable << 2 ) |
4112 ( mr.MeasurementRequest[0].request << 1 ) |
4113 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4114 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4115
4116 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4117
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304118 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 mr.MeasurementRequest[0].meas_start_time, 8 );
4120
4121 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4122
4123 return eSIR_SUCCESS;
4124
4125} // End sirConvertMeasReqFrame2Struct.
4126#endif
4127
4128
4129void
4130PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4131 tDot11fIETSPEC *pDot11f)
4132{
4133 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4134 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4135 pDot11f->direction = pOld->tsinfo.traffic.direction;
4136 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4137 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4138 pDot11f->psb = pOld->tsinfo.traffic.psb;
4139 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4140 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4141 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4142 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4143 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4144 */
4145 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4146 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4147 pDot11f->max_msdu_size = pOld->maxMsduSz;
4148 pDot11f->min_service_int = pOld->minSvcInterval;
4149 pDot11f->max_service_int = pOld->maxSvcInterval;
4150 pDot11f->inactivity_int = pOld->inactInterval;
4151 pDot11f->suspension_int = pOld->suspendInterval;
4152 pDot11f->service_start_time = pOld->svcStartTime;
4153 pDot11f->min_data_rate = pOld->minDataRate;
4154 pDot11f->mean_data_rate = pOld->meanDataRate;
4155 pDot11f->peak_data_rate = pOld->peakDataRate;
4156 pDot11f->burst_size = pOld->maxBurstSz;
4157 pDot11f->delay_bound = pOld->delayBound;
4158 pDot11f->min_phy_rate = pOld->minPhyRate;
4159 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4160 pDot11f->medium_time = pOld->mediumTime;
4161
4162 pDot11f->present = 1;
4163
4164} // End PopulateDot11fTSPEC.
4165
4166void
4167PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4168 tDot11fIEWMMTSPEC *pDot11f)
4169{
4170 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4171 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4172 pDot11f->direction = pOld->tsinfo.traffic.direction;
4173 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4174 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4175 pDot11f->psb = pOld->tsinfo.traffic.psb;
4176 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4177 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4178 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4179 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4180 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4181 */
4182 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4183 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4184 pDot11f->max_msdu_size = pOld->maxMsduSz;
4185 pDot11f->min_service_int = pOld->minSvcInterval;
4186 pDot11f->max_service_int = pOld->maxSvcInterval;
4187 pDot11f->inactivity_int = pOld->inactInterval;
4188 pDot11f->suspension_int = pOld->suspendInterval;
4189 pDot11f->service_start_time = pOld->svcStartTime;
4190 pDot11f->min_data_rate = pOld->minDataRate;
4191 pDot11f->mean_data_rate = pOld->meanDataRate;
4192 pDot11f->peak_data_rate = pOld->peakDataRate;
4193 pDot11f->burst_size = pOld->maxBurstSz;
4194 pDot11f->delay_bound = pOld->delayBound;
4195 pDot11f->min_phy_rate = pOld->minPhyRate;
4196 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4197 pDot11f->medium_time = pOld->mediumTime;
4198
4199 pDot11f->version = 1;
4200 pDot11f->present = 1;
4201
4202} // End PopulateDot11fWMMTSPEC.
4203
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004204#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004205
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004206// Fill the ESE version currently supported
4207void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004208{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004209 pESEVersion->present = 1;
4210 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004211}
4212
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004213// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004214// The State is Normal (1)
4215// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004216void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004217{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004218 pESERadMgmtCap->present = 1;
4219 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4220 pESERadMgmtCap->mbssid_mask = 0;
4221 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004222}
4223
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004224tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004225 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004226 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004227{
4228 int idx;
4229
4230 if ( pCCKMie->length )
4231 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004232 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004233 {
4234 pDot11f->present = 1;
4235 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004236 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004237 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4238 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4239 }
4240 }
4241
4242 return eSIR_SUCCESS;
4243
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004244} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004245
Jeff Johnson295189b2012-06-20 16:38:30 -07004246void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004247 tSirMacESETSRSIE *pOld,
4248 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004249 tANI_U8 rate_length)
4250{
4251 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304252 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 pDot11f->num_tsrates = rate_length;
4254 pDot11f->present = 1;
4255}
4256#endif
4257
4258
4259tSirRetStatus
4260PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4261 tSirTclasInfo *pOld,
4262 tDot11fIETCLAS *pDot11f)
4263{
4264 pDot11f->user_priority = pOld->tclas.userPrio;
4265 pDot11f->classifier_type = pOld->tclas.classifierType;
4266 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4267
4268 switch ( pDot11f->classifier_type )
4269 {
4270 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304271 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4272 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4273 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4274 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004275 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4276 break;
4277 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4278 pDot11f->info.IpParams.version = pOld->version;
4279 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4280 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304281 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304282 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304283 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4284 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304285 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304286 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004287 pDot11f->info.IpParams.params.IpV4Params.src_port =
4288 pOld->tclasParams.ipv4.srcPort;
4289 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4290 pOld->tclasParams.ipv4.dstPort;
4291 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4292 pOld->tclasParams.ipv4.dscp;
4293 pDot11f->info.IpParams.params.IpV4Params.proto =
4294 pOld->tclasParams.ipv4.protocol;
4295 pDot11f->info.IpParams.params.IpV4Params.reserved =
4296 pOld->tclasParams.ipv4.rsvd;
4297 }
4298 else
4299 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304300 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004301 IpV6Params.source,
4302 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304303 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 IpV6Params.dest,
4305 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4306 pDot11f->info.IpParams.params.IpV6Params.src_port =
4307 pOld->tclasParams.ipv6.srcPort;
4308 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4309 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304310 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 IpV6Params.flow_label,
4312 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4313 }
4314 break;
4315 case SIR_MAC_TCLASTYPE_8021DQ:
4316 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4317 break;
4318 default:
4319 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4320 pDot11f->classifier_type );
4321 return eSIR_FAILURE;
4322 }
4323
4324 pDot11f->present = 1;
4325
4326 return eSIR_SUCCESS;
4327
4328} // End PopulateDot11fTCLAS.
4329
4330tSirRetStatus
4331PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4332 tSirTclasInfo *pOld,
4333 tDot11fIEWMMTCLAS *pDot11f)
4334{
4335 pDot11f->version = 1;
4336 pDot11f->user_priority = pOld->tclas.userPrio;
4337 pDot11f->classifier_type = pOld->tclas.classifierType;
4338 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4339
4340 switch ( pDot11f->classifier_type )
4341 {
4342 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304343 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304345 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004346 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4347 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4348 break;
4349 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4350 pDot11f->info.IpParams.version = pOld->version;
4351 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4352 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304353 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004354 IpV4Params.source,
4355 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304356 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004357 IpV4Params.dest,
4358 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4359 pDot11f->info.IpParams.params.IpV4Params.src_port =
4360 pOld->tclasParams.ipv4.srcPort;
4361 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4362 pOld->tclasParams.ipv4.dstPort;
4363 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4364 pOld->tclasParams.ipv4.dscp;
4365 pDot11f->info.IpParams.params.IpV4Params.proto =
4366 pOld->tclasParams.ipv4.protocol;
4367 pDot11f->info.IpParams.params.IpV4Params.reserved =
4368 pOld->tclasParams.ipv4.rsvd;
4369 }
4370 else
4371 {
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.source,
4374 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304375 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 IpV6Params.dest,
4377 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4378 pDot11f->info.IpParams.params.IpV6Params.src_port =
4379 pOld->tclasParams.ipv6.srcPort;
4380 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4381 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304382 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004383 IpV6Params.flow_label,
4384 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4385 }
4386 break;
4387 case SIR_MAC_TCLASTYPE_8021DQ:
4388 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4389 break;
4390 default:
4391 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4392 pDot11f->classifier_type );
4393 return eSIR_FAILURE;
4394 }
4395
4396 pDot11f->present = 1;
4397
4398 return eSIR_SUCCESS;
4399
4400} // End PopulateDot11fWMMTCLAS.
4401
Jeff Johnson295189b2012-06-20 16:38:30 -07004402
4403tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4404 tDot11fIEWscBeacon *pDot11f)
4405{
4406
4407 tANI_U32 wpsState;
4408
4409 pDot11f->Version.present = 1;
4410 pDot11f->Version.major = 0x01;
4411 pDot11f->Version.minor = 0x00;
4412
4413 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4414 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4415
4416 pDot11f->WPSState.present = 1;
4417 pDot11f->WPSState.state = (tANI_U8) wpsState;
4418
4419 pDot11f->APSetupLocked.present = 0;
4420
4421 pDot11f->SelectedRegistrar.present = 0;
4422
4423 pDot11f->DevicePasswordID.present = 0;
4424
4425 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4426
4427 pDot11f->UUID_E.present = 0;
4428
4429 pDot11f->RFBands.present = 0;
4430
4431 pDot11f->present = 1;
4432 return eSIR_SUCCESS;
4433}
4434
4435tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4436 tDot11fIEWscBeacon *pDot11f)
4437{
4438 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4439 tANI_U32 devicepasswdId;
4440
4441
4442 pDot11f->APSetupLocked.present = 1;
4443 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4444
4445 pDot11f->SelectedRegistrar.present = 1;
4446 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4447
4448 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4449 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4450
4451 pDot11f->DevicePasswordID.present = 1;
4452 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4453
4454 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4455 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4456
4457 // UUID_E and RF Bands are applicable only for dual band AP
4458
4459 return eSIR_SUCCESS;
4460}
4461
4462tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4463 tDot11fIEWscBeacon *pDot11f)
4464{
4465 pDot11f->APSetupLocked.present = 0;
4466 pDot11f->SelectedRegistrar.present = 0;
4467 pDot11f->DevicePasswordID.present = 0;
4468 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4469
4470 return eSIR_SUCCESS;
4471}
Jeff Johnson295189b2012-06-20 16:38:30 -07004472tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4473{
4474
4475 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4476
4477 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4478
4479
4480 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4481 {
4482 pDot11f->present = 1;
4483 pDot11f->Version.present = 1;
4484 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4485 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4486 }
4487 else
4488 {
4489 pDot11f->present = 0;
4490 pDot11f->Version.present = 0;
4491 }
4492
4493 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4494 {
4495
4496 pDot11f->WPSState.present = 1;
4497 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4498 }
4499 else
4500 pDot11f->WPSState.present = 0;
4501
4502 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4503 {
4504 pDot11f->APSetupLocked.present = 1;
4505 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4506 }
4507 else
4508 pDot11f->APSetupLocked.present = 0;
4509
4510 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4511 {
4512 pDot11f->SelectedRegistrar.present = 1;
4513 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4514 }
4515 else
4516 pDot11f->SelectedRegistrar.present = 0;
4517
4518 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4519 {
4520 pDot11f->DevicePasswordID.present = 1;
4521 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4522 }
4523 else
4524 pDot11f->DevicePasswordID.present = 0;
4525
4526 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4527 {
4528 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4529 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4530 }
4531 else
4532 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4533
4534 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4535 {
4536 pDot11f->ResponseType.present = 1;
4537 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4538 }
4539 else
4540 pDot11f->ResponseType.present = 0;
4541
4542 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4543 {
4544 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304545 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004546 }
4547 else
4548 pDot11f->UUID_E.present = 0;
4549
4550 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4551 {
4552 pDot11f->Manufacturer.present = 1;
4553 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304554 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4555 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 }
4557 else
4558 pDot11f->Manufacturer.present = 0;
4559
4560 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4561 {
4562 pDot11f->ModelName.present = 1;
4563 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304564 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4565 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004566 }
4567 else
4568 pDot11f->ModelName.present = 0;
4569
4570 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4571 {
4572 pDot11f->ModelNumber.present = 1;
4573 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304574 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4575 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004576 }
4577 else
4578 pDot11f->ModelNumber.present = 0;
4579
4580 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4581 {
4582 pDot11f->SerialNumber.present = 1;
4583 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304584 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4585 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004586 }
4587 else
4588 pDot11f->SerialNumber.present = 0;
4589
4590 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4591 {
4592 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304593 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4594 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4596 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4597 }
4598 else
4599 pDot11f->PrimaryDeviceType.present = 0;
4600
4601 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4602 {
4603 pDot11f->DeviceName.present = 1;
4604 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304605 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4606 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 }
4608 else
4609 pDot11f->DeviceName.present = 0;
4610
4611 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4612 {
4613 pDot11f->ConfigMethods.present = 1;
4614 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4615 }
4616 else
4617 pDot11f->ConfigMethods.present = 0;
4618
4619
4620 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4621 {
4622 pDot11f->RFBands.present = 1;
4623 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4624 }
4625 else
4626 pDot11f->RFBands.present = 0;
4627
4628 return eSIR_SUCCESS;
4629}
4630tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4631{
4632 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4633
4634 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4635
4636 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4637 {
4638 pDot11f->present = 1;
4639 pDot11f->Version.present = 1;
4640 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4641 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4642 }
4643 else
4644 {
4645 pDot11f->present = 0;
4646 pDot11f->Version.present = 0;
4647 }
4648
4649 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4650 {
4651 pDot11f->ResponseType.present = 1;
4652 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4653 }
4654 else
4655 pDot11f->ResponseType.present = 0;
4656
4657 return eSIR_SUCCESS;
4658}
4659
4660tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4661{
4662
4663 tSirWPSBeaconIE *pSirWPSBeaconIE;
4664
4665 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4666
4667
4668 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4669 {
4670 pDot11f->present = 1;
4671 pDot11f->Version.present = 1;
4672 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4673 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4674 }
4675 else
4676 {
4677 pDot11f->present = 0;
4678 pDot11f->Version.present = 0;
4679 }
4680
4681 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4682 {
4683
4684 pDot11f->WPSState.present = 1;
4685 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4686 }
4687 else
4688 pDot11f->WPSState.present = 0;
4689
4690 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4691 {
4692 pDot11f->APSetupLocked.present = 1;
4693 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4694 }
4695 else
4696 pDot11f->APSetupLocked.present = 0;
4697
4698 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4699 {
4700 pDot11f->SelectedRegistrar.present = 1;
4701 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4702 }
4703 else
4704 pDot11f->SelectedRegistrar.present = 0;
4705
4706 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4707 {
4708 pDot11f->DevicePasswordID.present = 1;
4709 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4710 }
4711 else
4712 pDot11f->DevicePasswordID.present = 0;
4713
4714 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4715 {
4716 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4717 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4718 }
4719 else
4720 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4721
4722 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4723 {
4724 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304725 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004726 }
4727 else
4728 pDot11f->UUID_E.present = 0;
4729
4730
4731 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4732 {
4733 pDot11f->RFBands.present = 1;
4734 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4735 }
4736 else
4737 pDot11f->RFBands.present = 0;
4738
4739 return eSIR_SUCCESS;
4740}
Jeff Johnson295189b2012-06-20 16:38:30 -07004741tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4742 tDot11fIEWscProbeRes *pDot11f)
4743{
4744 tANI_U32 cfgMethods;
4745 tANI_U32 cfgStrLen;
4746 tANI_U32 val;
4747 tANI_U32 wpsVersion, wpsState;
4748
4749
4750 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
4751 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
4752
4753 pDot11f->Version.present = 1;
4754 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
4755 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
4756
4757 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4758 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4759
4760 pDot11f->WPSState.present = 1;
4761 pDot11f->WPSState.state = (tANI_U8) wpsState;
4762
4763 pDot11f->APSetupLocked.present = 0;
4764
4765 pDot11f->SelectedRegistrar.present = 0;
4766
4767 pDot11f->DevicePasswordID.present = 0;
4768
4769 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4770
4771 pDot11f->ResponseType.present = 1;
4772 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
4773 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
4774 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4775 }
4776 else{
4777 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4778 }
4779
4780 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
4781 pDot11f->UUID_E.present = 1;
4782 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
4783 if (wlan_cfgGetStr(pMac,
4784 WNI_CFG_WPS_UUID,
4785 pDot11f->UUID_E.uuid,
4786 &cfgStrLen) != eSIR_SUCCESS)
4787 {
4788 *(pDot11f->UUID_E.uuid) = '\0';
4789 }
4790
4791 pDot11f->Manufacturer.present = 1;
4792 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
4793 if (wlan_cfgGetStr(pMac,
4794 WNI_CFG_MANUFACTURER_NAME,
4795 pDot11f->Manufacturer.name,
4796 &cfgStrLen) != eSIR_SUCCESS)
4797 {
4798 pDot11f->Manufacturer.num_name = 0;
4799 *(pDot11f->Manufacturer.name) = '\0';
4800 }
4801 else
4802 {
4803 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
4804 pDot11f->Manufacturer.name[cfgStrLen] = '\0';
4805 }
4806
4807 pDot11f->ModelName.present = 1;
4808 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
4809 if (wlan_cfgGetStr(pMac,
4810 WNI_CFG_MODEL_NAME,
4811 pDot11f->ModelName.text,
4812 &cfgStrLen) != eSIR_SUCCESS)
4813 {
4814 pDot11f->ModelName.num_text = 0;
4815 *(pDot11f->ModelName.text) = '\0';
4816 }
4817 else
4818 {
4819 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4820 pDot11f->ModelName.text[cfgStrLen] = '\0';
4821 }
4822
4823 pDot11f->ModelNumber.present = 1;
4824 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
4825 if (wlan_cfgGetStr(pMac,
4826 WNI_CFG_MODEL_NUMBER,
4827 pDot11f->ModelNumber.text,
4828 &cfgStrLen) != eSIR_SUCCESS)
4829 {
4830 pDot11f->ModelNumber.num_text = 0;
4831 *(pDot11f->ModelNumber.text) = '\0';
4832 }
4833 else
4834 {
4835 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4836 pDot11f->ModelNumber.text[cfgStrLen] = '\0';
4837 }
4838
4839 pDot11f->SerialNumber.present = 1;
4840 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
4841 if (wlan_cfgGetStr(pMac,
4842 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
4843 pDot11f->SerialNumber.text,
4844 &cfgStrLen) != eSIR_SUCCESS)
4845 {
4846 pDot11f->SerialNumber.num_text = 0;
4847 *(pDot11f->SerialNumber.text) = '\0';
4848 }
4849 else
4850 {
4851 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4852 pDot11f->SerialNumber.text[cfgStrLen] = '\0';
4853 }
4854
4855 pDot11f->PrimaryDeviceType.present = 1;
4856
4857 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
4858 {
4859 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
4860 }
4861 else
4862 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
4863
4864 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
4865 {
4866 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
4867 }
4868 else
4869 {
4870 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
4871 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
4872 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
4873 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
4874 }
4875
4876 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
4877 {
4878 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
4879 }
4880 else
4881 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
4882
4883 pDot11f->DeviceName.present = 1;
4884 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
4885 if (wlan_cfgGetStr(pMac,
4886 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
4887 pDot11f->DeviceName.text,
4888 &cfgStrLen) != eSIR_SUCCESS)
4889 {
4890 pDot11f->DeviceName.num_text = 0;
4891 *(pDot11f->DeviceName.text) = '\0';
4892 }
4893 else
4894 {
4895 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4896 pDot11f->DeviceName.text[cfgStrLen] = '\0';
4897 }
4898
4899 if (wlan_cfgGetInt(pMac,
4900 WNI_CFG_WPS_CFG_METHOD,
4901 &cfgMethods) != eSIR_SUCCESS)
4902 {
4903 pDot11f->ConfigMethods.present = 0;
4904 pDot11f->ConfigMethods.methods = 0;
4905 }
4906 else
4907 {
4908 pDot11f->ConfigMethods.present = 1;
4909 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
4910 }
4911
4912 pDot11f->RFBands.present = 0;
4913
4914 pDot11f->present = 1;
4915 return eSIR_SUCCESS;
4916}
4917
4918tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4919 tDot11fIEWscProbeRes *pDot11f)
4920{
4921 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4922 tANI_U32 devicepasswdId;
4923
4924 pDot11f->APSetupLocked.present = 1;
4925 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4926
4927 pDot11f->SelectedRegistrar.present = 1;
4928 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4929
4930 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4931 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4932
4933 pDot11f->DevicePasswordID.present = 1;
4934 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4935
4936 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4937 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4938
4939 // UUID_E and RF Bands are applicable only for dual band AP
4940
4941 return eSIR_SUCCESS;
4942}
4943
4944tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4945 tDot11fIEWscProbeRes *pDot11f)
4946{
4947 pDot11f->APSetupLocked.present = 0;
4948 pDot11f->SelectedRegistrar.present = 0;
4949 pDot11f->DevicePasswordID.present = 0;
4950 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4951
4952 return eSIR_SUCCESS;
4953}
4954
4955tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
4956 tDot11fIEWscAssocRes *pDot11f,
4957 tpSirAssocReq pRcvdAssocReq)
4958{
4959 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
4960 tANI_U8 *wscIe;
4961
4962
4963 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
4964 if(wscIe != NULL)
4965 {
4966 // retreive WSC IE from given AssocReq
4967 dot11fUnpackIeWscAssocReq( pMac,
4968 wscIe + 2 + 4, // EID, length, OUI
4969 wscIe[ 1 ] - 4, // length without OUI
4970 &parsedWscAssocReq );
4971 pDot11f->present = 1;
4972 // version has to be 0x10
4973 pDot11f->Version.present = 1;
4974 pDot11f->Version.major = 0x1;
4975 pDot11f->Version.minor = 0x0;
4976
4977 pDot11f->ResponseType.present = 1;
4978
4979 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
4980 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
4981 {
4982 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4983 }
4984 else
4985 {
4986 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4987 }
4988 // Version infomration should be taken from our capability as well as peers
4989 // TODO: currently it takes from peers only
4990 if(parsedWscAssocReq.VendorExtension.present &&
4991 parsedWscAssocReq.VendorExtension.Version2.present)
4992 {
4993 pDot11f->VendorExtension.present = 1;
4994 pDot11f->VendorExtension.vendorId[0] = 0x00;
4995 pDot11f->VendorExtension.vendorId[1] = 0x37;
4996 pDot11f->VendorExtension.vendorId[2] = 0x2A;
4997 pDot11f->VendorExtension.Version2.present = 1;
4998 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
4999 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5000 }
5001 }
5002 return eSIR_SUCCESS;
5003}
5004
Jeff Johnson295189b2012-06-20 16:38:30 -07005005tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5006 tDot11fIEP2PAssocRes *pDot11f,
5007 tpSirAssocReq pRcvdAssocReq)
5008{
5009 tANI_U8 *p2pIe;
5010
5011 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5012 if(p2pIe != NULL)
5013 {
5014 pDot11f->present = 1;
5015 pDot11f->P2PStatus.present = 1;
5016 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5017 pDot11f->ExtendedListenTiming.present = 0;
5018 }
5019 return eSIR_SUCCESS;
5020}
Jeff Johnson295189b2012-06-20 16:38:30 -07005021
5022#if defined WLAN_FEATURE_VOWIFI
5023
5024tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5025 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5026{
5027 pDot11f->txPower = txPower;
5028 pDot11f->linkMargin = linkMargin;
5029 pDot11f->present = 1;
5030
5031 return eSIR_SUCCESS;
5032}
5033
5034tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5035{
5036
5037 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5038 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305039 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5040 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005041 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5042 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5043 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5044 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5045 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305046 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005047 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5048 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5049
5050 if( pBeaconReport->numIes )
5051 {
5052 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305053 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5054 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005055 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5056 }
5057
5058 return eSIR_SUCCESS;
5059
5060}
5061
5062tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5063{
5064 tpRRMCaps pRrmCaps;
5065
5066 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5067
5068 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5069 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5070 pDot11f->parallel = pRrmCaps->parallel ;
5071 pDot11f->repeated = pRrmCaps->repeated ;
5072 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5073 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5074 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5075 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5076 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5077 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5078 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5079 pDot11f->statistics = pRrmCaps->statistics ;
5080 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5081 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5082 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5083 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5084 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5085 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5086 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5087 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5088 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5089 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5090 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5091 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5092 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5093 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5094 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5095 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5096
5097 pDot11f->present = 1;
5098 return eSIR_SUCCESS;
5099}
5100#endif
5101
5102#if defined WLAN_FEATURE_VOWIFI_11R
5103void PopulateMDIE( tpAniSirGlobal pMac,
5104 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5105{
5106 pDot11f->present = 1;
5107 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5108
5109 // Plugfest fix
5110 pDot11f->overDSCap = (mdie[2] & 0x01);
5111 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5112
5113}
5114
5115void PopulateFTInfo( tpAniSirGlobal pMac,
5116 tDot11fIEFTInfo *pDot11f )
5117{
5118 pDot11f->present = 1;
5119 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5120 //All other info is zero.
5121
5122}
5123#endif
5124
5125void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5126 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5127{
5128 tANI_U8 num_supp = 0, num_ext = 0;
5129 tANI_U8 i,j;
5130
5131 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5132 {
5133 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5134 }
5135 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5136 {
5137 if( num_supp < 8 )
5138 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5139 else
5140 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5141 }
5142
5143 if( num_supp )
5144 {
5145 pSupp->num_rates = num_supp;
5146 pSupp->present = 1;
5147 }
5148 if( num_ext )
5149 {
5150 pExt->num_rates = num_ext;
5151 pExt->present = 1;
5152 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005153}
5154
5155void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5156 tDot11fIETimeoutInterval *pDot11f,
5157 tANI_U8 type, tANI_U32 value )
5158{
5159 pDot11f->present = 1;
5160 pDot11f->timeoutType = type;
5161 pDot11f->timeoutValue = value;
5162}
Jeff Johnson295189b2012-06-20 16:38:30 -07005163// parserApi.c ends here.