blob: 9a9a7008704b0c3cd1e69cbe4e8b0c6727c9f93c [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
746
Jeff Johnsone7245742012-09-05 17:12:55 -0700747tSirRetStatus
748PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
749 tDot11fIEVHTCaps *pDot11f)
750{
751 tSirRetStatus nStatus;
752 tANI_U32 nCfgValue=0;
753
754 pDot11f->present = 1;
755
756 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
757 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
758
759 nCfgValue = 0;
760 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
761 nCfgValue );
762 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
763
764 nCfgValue = 0;
765 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
766 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
767
768 nCfgValue = 0;
769 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
770 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
771
772 nCfgValue = 0;
773 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
774 nCfgValue );
775 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
776
777 nCfgValue = 0;
778 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
779 pDot11f->txSTBC = (nCfgValue & 0x0001);
780
781 nCfgValue = 0;
782 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
783 pDot11f->rxSTBC = (nCfgValue & 0x0007);
784
785 nCfgValue = 0;
786 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
787 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
788
789 nCfgValue = 0;
790 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
791 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
792
793 nCfgValue = 0;
794 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
795 nCfgValue );
796 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
797
798 nCfgValue = 0;
799 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
800 nCfgValue );
801 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
802
803 nCfgValue = 0;
804 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
805 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
806
807 nCfgValue = 0;
808 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
809 pDot11f->muBeamformeeCap = (nCfgValue & 0x0001);
810
811 nCfgValue = 0;
812 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
813 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
814
815 nCfgValue = 0;
816 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
817 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
818
819 nCfgValue = 0;
820 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
821 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
822
823 nCfgValue = 0;
824 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
825 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
826
827 nCfgValue = 0;
828 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
829 pDot11f->rxAntPattern = nCfgValue;
830
831 nCfgValue = 0;
832 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
833 pDot11f->txAntPattern = nCfgValue;
834
835 pDot11f->reserved1= 0;
836
837 nCfgValue = 0;
838 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
839 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
840
841 nCfgValue = 0;
842 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
843 nCfgValue );
844 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
845
846 pDot11f->reserved2= 0;
847
848 nCfgValue = 0;
849 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
850 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
851
852 nCfgValue = 0;
853 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
854 nCfgValue );
855 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
856
857 pDot11f->reserved3= 0;
858
859 limLogVHTCap(pMac, pDot11f);
860
861 return eSIR_SUCCESS;
862
863}
864
865tSirRetStatus
866PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
867 tDot11fIEVHTOperation *pDot11f)
868{
869 tSirRetStatus nStatus;
870 tANI_U32 nCfgValue=0;
871
872 pDot11f->present = 1;
873
874 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
875 pDot11f->chanWidth = (tANI_U8)nCfgValue;
876
877 nCfgValue = 0;
878 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
879 nCfgValue );
880 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
881
882 nCfgValue = 0;
883 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
884 nCfgValue );
885 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
886
887 nCfgValue = 0;
888 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
889 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
890
891 limLogVHTOperation(pMac,pDot11f);
892
893 return eSIR_SUCCESS;
894
895}
896
897tSirRetStatus
898PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
899 tDot11fIEVHTExtBssLoad *pDot11f)
900{
901 tSirRetStatus nStatus;
902 tANI_U32 nCfgValue=0;
903
904 pDot11f->present = 1;
905
906 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
907 nCfgValue );
908 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
909
910 nCfgValue = 0;
911 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
912 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
913
914 nCfgValue=0;
915 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
916 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
917
918 nCfgValue=0;
919 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
920 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
921
922 nCfgValue=0;
923 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
924 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
925
926 limLogVHTExtBssLoad(pMac,pDot11f);
927
928 return eSIR_SUCCESS;
929}
930
Mohit Khanna4a70d262012-09-11 16:30:12 -0700931tSirRetStatus
932PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +0530933 tDot11fIEExtCap *pDot11f,
934 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -0700935{
Sandeep Puligilla60342762014-01-30 21:05:37 +0530936 tANI_U32 val;
937
Mohit Khanna4a70d262012-09-11 16:30:12 -0700938 pDot11f->present = 1;
Sandeep Puligilla60342762014-01-30 21:05:37 +0530939#ifdef WLAN_FEATURE_11AC
940 if (psessionEntry->vhtCapability)
941 pDot11f->operModeNotification = 1;
942#endif
943 /* while operating in 2.4GHz only then STA need to advertize
944 the bss co-ex capability*/
945 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
946 {
947 if (wlan_cfgGetInt(pMac, WNI_CFG_CHANNEL_BONDING_24G, &val) !=
948 eSIR_SUCCESS)
949 PELOGE(limLog(pMac, LOGE, FL("could not retrieve "
950 "24G Chan bond Length \n"));)
951 if (TRUE == val)
952 pDot11f->bssCoexistMgmtSupport = 1;
953 }
Mohit Khanna4a70d262012-09-11 16:30:12 -0700954 return eSIR_SUCCESS;
955}
956
957tSirRetStatus
958PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
959 tDot11fIEOperatingMode *pDot11f,
960 tpPESession psessionEntry)
961{
962 pDot11f->present = 1;
963
964 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
965 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
966 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
967
968 return eSIR_SUCCESS;
969}
Jeff Johnsone7245742012-09-05 17:12:55 -0700970
971#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700972tSirRetStatus
973PopulateDot11fHTInfo(tpAniSirGlobal pMac,
974 tDot11fIEHTInfo *pDot11f,
975 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -0700976{
977 tANI_U32 nCfgValue, nCfgLen;
978 tANI_U8 htInfoField1;
979 tANI_U16 htInfoField2;
980 tSirRetStatus nSirStatus;
981 tSirMacHTInfoField1 *pHTInfoField1;
982 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -0700983 union {
984 tANI_U16 nCfgValue16;
985 tSirMacHTInfoField3 infoField3;
986 }uHTInfoField;
987 union {
988 tANI_U16 nCfgValue16;
989 tSirMacHTInfoField2 infoField2;
990 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -0700991
Jeff Johnson295189b2012-06-20 16:38:30 -0700992
993 #if 0
994 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
995 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +0530996
997 if (NULL == psessionEntry)
998 {
999 PELOGE(limLog(pMac, LOG1,
1000 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
1001 return eSIR_FAILURE;
1002 }
1003
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1005
1006 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1007
1008 htInfoField1 = ( tANI_U8 ) nCfgValue;
1009
1010 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1012 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1013
Jeff Johnsone7245742012-09-05 17:12:55 -07001014 if (psessionEntry == NULL)
1015 {
1016 PELOGE(limLog(pMac, LOG1,
1017 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
1018 }
1019 else
1020 {
1021 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1022 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1023 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001024
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001025 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1027
1028 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1029
1030 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1031 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1032 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1033
1034 uHTInfoField2.infoField2.reserved = 0;
1035
1036 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1038
1039 htInfoField2 = ( tANI_U16 ) nCfgValue;
1040
1041 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1042 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1043 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1044 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1045
1046 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001048
1049 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1050
1051
Jeff Johnson295189b2012-06-20 16:38:30 -07001052 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1053
1054
1055 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1056 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1057 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1058 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1059 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1060 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1061 uHTInfoField.infoField3.reserved = 0;
1062
Jeff Johnson295189b2012-06-20 16:38:30 -07001063
1064 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1065 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1066 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1067 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1068 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1069
Jeff Johnson295189b2012-06-20 16:38:30 -07001070 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1071 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1072 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1073 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1074
Jeff Johnson295189b2012-06-20 16:38:30 -07001075
Jeff Johnson295189b2012-06-20 16:38:30 -07001076 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1077 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1078 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1079 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1080 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1081 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1082 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1084 pDot11f->basicMCSSet, nCfgLen,
1085 SIZE_OF_BASIC_MCS_SET );
1086
1087 pDot11f->present = 1;
1088
1089 return eSIR_SUCCESS;
1090
1091} // End PopulateDot11fHTInfo.
1092
1093void
1094PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1095 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1096{
1097 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1098 {
1099 pDot11f->present = 1;
1100 // ATIM duration is always set to 0
1101 pDot11f->atim = 0;
1102 }
1103
1104} // End PopulateDot11fIBSSParams.
1105
1106
1107#ifdef ANI_SUPPORT_11H
1108tSirRetStatus
1109PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1110 tpSirMacMeasReqActionFrame pReq,
1111 tDot11fIEMeasurementReport *pDot11f)
1112{
1113 pDot11f->token = pReq->measReqIE.measToken;
1114 pDot11f->late = 0;
1115 pDot11f->incapable = 0;
1116 pDot11f->refused = 1;
1117 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1118
1119 pDot11f->present = 1;
1120
1121 return eSIR_SUCCESS;
1122
1123} // End PopulatedDot11fMeasurementReport0.
1124
1125tSirRetStatus
1126PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1127 tpSirMacMeasReqActionFrame pReq,
1128 tDot11fIEMeasurementReport *pDot11f)
1129{
1130 pDot11f->token = pReq->measReqIE.measToken;
1131 pDot11f->late = 0;
1132 pDot11f->incapable = 0;
1133 pDot11f->refused = 1;
1134 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1135
1136 pDot11f->present = 1;
1137
1138 return eSIR_SUCCESS;
1139
1140} // End PopulatedDot11fMeasurementReport1.
1141
1142tSirRetStatus
1143PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1144 tpSirMacMeasReqActionFrame pReq,
1145 tDot11fIEMeasurementReport *pDot11f)
1146{
1147 pDot11f->token = pReq->measReqIE.measToken;
1148 pDot11f->late = 0;
1149 pDot11f->incapable = 0;
1150 pDot11f->refused = 1;
1151 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1152
1153 pDot11f->present = 1;
1154
1155 return eSIR_SUCCESS;
1156
1157} // End PopulatedDot11fMeasurementReport2.
1158#endif
1159
1160void
1161PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1162 tDot11fIEPowerCaps *pCaps,
1163 tANI_U8 nAssocType,
1164 tpPESession psessionEntry)
1165{
1166 if (nAssocType == LIM_REASSOC)
1167 {
1168 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1169 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1170 }else
1171 {
1172 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1173 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1174
1175 }
1176
1177 pCaps->present = 1;
1178} // End PopulateDot11fPowerCaps.
1179
1180tSirRetStatus
1181PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1182 tDot11fIEPowerConstraints *pDot11f)
1183{
1184 tANI_U32 cfg;
1185 tSirRetStatus nSirStatus;
1186
1187 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1188
1189 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1190 pDot11f->present = 1;
1191
1192 return eSIR_SUCCESS;
1193} // End PopulateDot11fPowerConstraints.
1194
1195void
1196PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1197 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1198{
1199 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1200 pDot11f->reserved = 0;
1201 pDot11f->txopreq = 0;
1202 pDot11f->qreq = 0;
1203 pDot11f->qack = 0;
1204 pDot11f->present = 1;
1205} // End PopulatedDot11fQOSCaps.
1206
1207void
1208PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1209 tDot11fIEQOSCapsStation *pDot11f)
1210{
1211 tANI_U32 val = 0;
1212
1213 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1214 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1215
1216 pDot11f->more_data_ack = 0;
1217 pDot11f->max_sp_length = (tANI_U8)val;
1218 pDot11f->qack = 0;
1219
1220 if (pMac->lim.gUapsdEnable)
1221 {
1222 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1223 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1224 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1225 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1226 }
1227 pDot11f->present = 1;
1228} // End PopulatedDot11fQOSCaps.
1229
1230tSirRetStatus
1231PopulateDot11fRSN(tpAniSirGlobal pMac,
1232 tpSirRSNie pRsnIe,
1233 tDot11fIERSN *pDot11f)
1234{
1235 tANI_U32 status;
1236 int idx;
1237
1238 if ( pRsnIe->length )
1239 {
1240 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1241 {
1242 status = dot11fUnpackIeRSN( pMac,
1243 pRsnIe->rsnIEdata + idx + 2, //EID, length
1244 pRsnIe->rsnIEdata[ idx + 1 ],
1245 pDot11f );
1246 if ( DOT11F_FAILED( status ) )
1247 {
1248 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1249 "N (0x%08x).\n"),
1250 status );
1251 return eSIR_FAILURE;
1252 }
1253 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1254 "PopulateDot11fRSN.\n"), status );
1255 }
1256
1257 }
1258
1259 return eSIR_SUCCESS;
1260} // End PopulateDot11fRSN.
1261
1262tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1263 tpSirRSNie pRsnIe,
1264 tDot11fIERSNOpaque *pDot11f )
1265{
1266 int idx;
1267
1268 if ( pRsnIe->length )
1269 {
1270 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1271 {
1272 pDot11f->present = 1;
1273 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301274 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001275 pRsnIe->rsnIEdata + idx + 2, // EID, len
1276 pRsnIe->rsnIEdata[ idx + 1 ] );
1277 }
1278 }
1279
1280 return eSIR_SUCCESS;
1281
1282} // End PopulateDot11fRSNOpaque.
1283
1284
1285
1286#if defined(FEATURE_WLAN_WAPI)
1287
1288tSirRetStatus
1289PopulateDot11fWAPI(tpAniSirGlobal pMac,
1290 tpSirRSNie pRsnIe,
1291 tDot11fIEWAPI *pDot11f)
1292 {
1293 tANI_U32 status;
1294 int idx;
1295
1296 if ( pRsnIe->length )
1297 {
1298 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1299 {
1300 status = dot11fUnpackIeWAPI( pMac,
1301 pRsnIe->rsnIEdata + idx + 2, //EID, length
1302 pRsnIe->rsnIEdata[ idx + 1 ],
1303 pDot11f );
1304 if ( DOT11F_FAILED( status ) )
1305 {
1306 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1307 status );
1308 return eSIR_FAILURE;
1309 }
1310 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1311 "PopulateDot11fWAPI.\n"), status );
1312 }
1313 }
1314
1315 return eSIR_SUCCESS;
1316} // End PopulateDot11fWAPI.
1317
1318tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1319 tpSirRSNie pRsnIe,
1320 tDot11fIEWAPIOpaque *pDot11f )
1321{
1322 int idx;
1323
1324 if ( pRsnIe->length )
1325 {
1326 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1327 {
1328 pDot11f->present = 1;
1329 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301330 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 pRsnIe->rsnIEdata + idx + 2, // EID, len
1332 pRsnIe->rsnIEdata[ idx + 1 ] );
1333 }
1334 }
1335
1336 return eSIR_SUCCESS;
1337
1338} // End PopulateDot11fWAPIOpaque.
1339
1340
1341#endif //defined(FEATURE_WLAN_WAPI)
1342
1343void
1344PopulateDot11fSSID(tpAniSirGlobal pMac,
1345 tSirMacSSid *pInternal,
1346 tDot11fIESSID *pDot11f)
1347{
1348 pDot11f->present = 1;
1349 pDot11f->num_ssid = pInternal->length;
1350 if ( pInternal->length )
1351 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301352 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 pInternal->length );
1354 }
1355} // End PopulateDot11fSSID.
1356
1357tSirRetStatus
1358PopulateDot11fSSID2(tpAniSirGlobal pMac,
1359 tDot11fIESSID *pDot11f)
1360{
1361 tANI_U32 nCfg;
1362 tSirRetStatus nSirStatus;
1363
1364 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1365 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1366 pDot11f->present = 1;
1367 return eSIR_SUCCESS;
1368} // End PopulateDot11fSSID2.
1369
1370void
1371PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1372 tDot11fIESchedule *pDot11f)
1373{
1374 pDot11f->aggregation = pSchedule->info.aggregation;
1375 pDot11f->tsid = pSchedule->info.tsid;
1376 pDot11f->direction = pSchedule->info.direction;
1377 pDot11f->reserved = pSchedule->info.rsvd;
1378 pDot11f->service_start_time = pSchedule->svcStartTime;
1379 pDot11f->service_interval = pSchedule->svcInterval;
1380 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1381 pDot11f->spec_interval = pSchedule->specInterval;
1382
1383 pDot11f->present = 1;
1384} // End PopulateDot11fSchedule.
1385
1386void
1387PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1388 tDot11fIESuppChannels *pDot11f,
1389 tANI_U8 nAssocType,
1390 tpPESession psessionEntry)
1391{
1392 tANI_U8 i;
1393 tANI_U8 *p;
1394
1395 if (nAssocType == LIM_REASSOC)
1396 {
1397 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1398 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1399 }else
1400 {
1401 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1402 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1403 }
1404 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1405 {
1406 pDot11f->bands[i][0] = *p;
1407 pDot11f->bands[i][1] = 1;
1408 }
1409
1410 pDot11f->present = 1;
1411
1412} // End PopulateDot11fSuppChannels.
1413
1414tSirRetStatus
1415PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1416 tANI_U8 nChannelNum,
1417 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1418{
1419 tSirRetStatus nSirStatus;
1420 tANI_U32 nRates;
1421 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1422
1423 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1424 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1425 sending mgmt frames (lile probe req) which need to go out before any session is present.
1426 */
1427 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1428 {
1429 #if 0
1430 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1431 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1432 #endif //TO SUPPORT BT-AMP
1433 if(psessionEntry != NULL)
1434 {
1435 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301436 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 nRates);
1438 }
1439 else
1440 {
1441 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1442 nRates = 0;
1443 }
1444 }
1445 else if ( 14 >= nChannelNum )
1446 {
1447 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1448 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1449 }
1450 else
1451 {
1452 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1453 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1454 }
1455
1456 if ( 0 != nRates )
1457 {
1458 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301459 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 pDot11f->present = 1;
1461 }
1462
1463 return eSIR_SUCCESS;
1464
1465} // End PopulateDot11fSuppRates.
1466
1467tSirRetStatus
1468PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1469 tDot11fIETPCReport *pDot11f,
1470 tpPESession psessionEntry)
1471{
1472 tANI_U16 staid, txPower;
1473 tSirRetStatus nSirStatus;
1474
1475 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1476 if ( eSIR_SUCCESS != nSirStatus )
1477 {
1478 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1479 "eDot11fTPCReport; limGetMgmtStaid "
1480 "returned status %d.\n"),
1481 nSirStatus );
1482 return eSIR_FAILURE;
1483 }
1484
1485 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1486 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1487 txPower = 0;
1488 pDot11f->tx_power = ( tANI_U8 )txPower;
1489 pDot11f->link_margin = 0;
1490 pDot11f->present = 1;
1491
1492 return eSIR_SUCCESS;
1493} // End PopulateDot11fTPCReport.
1494
1495
1496void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1497 tDot11fFfTSInfo *pDot11f)
1498{
1499 pDot11f->traffic_type = pInfo->traffic.trafficType;
1500 pDot11f->tsid = pInfo->traffic.tsid;
1501 pDot11f->direction = pInfo->traffic.direction;
1502 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1503 pDot11f->aggregation = pInfo->traffic.aggregation;
1504 pDot11f->psb = pInfo->traffic.psb;
1505 pDot11f->user_priority = pInfo->traffic.userPrio;
1506 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1507 pDot11f->schedule = pInfo->schedule.schedule;
1508} // End PopulatedDot11fTSInfo.
1509
1510void PopulateDot11fWMM(tpAniSirGlobal pMac,
1511 tDot11fIEWMMInfoAp *pInfo,
1512 tDot11fIEWMMParams *pParams,
1513 tDot11fIEWMMCaps *pCaps,
1514 tpPESession psessionEntry)
1515{
1516 if ( psessionEntry->limWmeEnabled )
1517 {
1518 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1519 {
1520 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1521 {
1522 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1523 }
1524 }
1525 else
1526 {
1527 {
1528 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1529 }
1530
1531 if ( psessionEntry->limWsmEnabled )
1532 {
1533 PopulateDot11fWMMCaps( pCaps );
1534 }
1535 }
1536 }
1537} // End PopulateDot11fWMM.
1538
1539void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1540{
1541 pCaps->version = SIR_MAC_OUI_VERSION_1;
1542 pCaps->qack = 0;
1543 pCaps->queue_request = 1;
1544 pCaps->txop_request = 0;
1545 pCaps->more_ack = 0;
1546 pCaps->present = 1;
1547} // End PopulateDot11fWmmCaps.
1548
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001549#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001550void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1551{
1552 tANI_U8 numTspecs = 0, idx;
1553 tTspecInfo *pTspec = NULL;
1554
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001555 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1556 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001557 pReassoc->num_WMMTSPEC = numTspecs;
1558 if (numTspecs) {
1559 for (idx=0; idx<numTspecs; idx++) {
1560 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
1561 pTspec++;
1562 }
1563 }
1564}
1565#endif
1566
1567void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1568 tpPESession psessionEntry)
1569{
1570 pInfo->version = SIR_MAC_OUI_VERSION_1;
1571
1572 /* WMM Specification 3.1.3, 3.2.3
1573 * An IBSS staion shall always use its default WMM parameters.
1574 */
1575 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1576 {
1577 pInfo->param_set_count = 0;
1578 pInfo->uapsd = 0;
1579 }
1580 else
1581 {
1582 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1584 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1585 }
1586 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1588 }
1589 pInfo->present = 1;
1590}
1591
1592void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1593{
1594 tANI_U32 val = 0;
1595
1596 pInfo->version = SIR_MAC_OUI_VERSION_1;
1597 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1598 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1599 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1600 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1601
1602 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1603 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1604
1605 pInfo->max_sp_length = (tANI_U8)val;
1606 pInfo->present = 1;
1607}
1608
Jeff Johnson295189b2012-06-20 16:38:30 -07001609void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1610 tDot11fIEWMMParams *pParams,
1611 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001612{
1613 pParams->version = SIR_MAC_OUI_VERSION_1;
1614
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1616 pParams->qosInfo =
1617 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1618 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 pParams->qosInfo =
1620 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1621
1622 // Fill each EDCA parameter set in order: be, bk, vi, vo
1623 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1624 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1625 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1626 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1627 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1628 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1629
1630 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1631 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1632 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1633 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1634 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1635 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1636
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1638 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1639 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1641
1642
1643
1644 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1645 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1646 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1647 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1648 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1649
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1651 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1652 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1654
1655 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1656 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1657 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1658 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1659 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1660
1661 pParams->present = 1;
1662
1663} // End PopulateDot11fWMMParams.
1664
1665void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1666 tDot11fIEWMMSchedule *pDot11f)
1667{
1668 pDot11f->version = 1;
1669 pDot11f->aggregation = pSchedule->info.aggregation;
1670 pDot11f->tsid = pSchedule->info.tsid;
1671 pDot11f->direction = pSchedule->info.direction;
1672 pDot11f->reserved = pSchedule->info.rsvd;
1673 pDot11f->service_start_time = pSchedule->svcStartTime;
1674 pDot11f->service_interval = pSchedule->svcInterval;
1675 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1676 pDot11f->spec_interval = pSchedule->specInterval;
1677
1678 pDot11f->present = 1;
1679} // End PopulateDot11fWMMSchedule.
1680
1681tSirRetStatus
1682PopulateDot11fWPA(tpAniSirGlobal pMac,
1683 tpSirRSNie pRsnIe,
1684 tDot11fIEWPA *pDot11f)
1685{
1686 tANI_U32 status;
1687 int idx;
1688
1689 if ( pRsnIe->length )
1690 {
1691 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1692 {
1693 status = dot11fUnpackIeWPA( pMac,
1694 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1695 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1696 pDot11f );
1697 if ( DOT11F_FAILED( status ) )
1698 {
1699 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1700 "A (0x%08x).\n"),
1701 status );
1702 return eSIR_FAILURE;
1703 }
1704 }
1705 }
1706
1707 return eSIR_SUCCESS;
1708} // End PopulateDot11fWPA.
1709
1710
1711
1712tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1713 tpSirRSNie pRsnIe,
1714 tDot11fIEWPAOpaque *pDot11f )
1715{
1716 int idx;
1717
1718 if ( pRsnIe->length )
1719 {
1720 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1721 {
1722 pDot11f->present = 1;
1723 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301724 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1726 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1727 }
1728 }
1729
1730 return eSIR_SUCCESS;
1731
1732} // End PopulateDot11fWPAOpaque.
1733
1734////////////////////////////////////////////////////////////////////////
1735
1736tSirRetStatus
1737sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1738{
1739#if 0
1740 tANI_U32 val;
1741
1742 *caps = 0;
1743 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1744 != eSIR_SUCCESS)
1745 {
1746 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1747 return eSIR_FAILURE;
1748 }
1749 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1750 {
1751 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1752 return eSIR_FAILURE;
1753 }
1754
1755 *caps = (tANI_U16) val;
1756#endif
1757 return eSIR_SUCCESS;
1758}
1759
1760tSirRetStatus
1761sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1762 tANI_U8 *pFrame,
1763 tANI_U32 nFrame,
1764 tpSirProbeReq pProbeReq)
1765{
1766 tANI_U32 status;
1767 tDot11fProbeRequest pr;
1768
1769 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301770 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001771
1772 // delegate to the framesc-generated code,
1773 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1774 if ( DOT11F_FAILED( status ) )
1775 {
1776 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1777 status, nFrame);
1778 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1779 return eSIR_FAILURE;
1780 }
1781 else if ( DOT11F_WARNED( status ) )
1782 {
1783 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1784 status, nFrame );
1785 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1786 }
1787
1788 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1789 if ( ! pr.SSID.present )
1790 {
1791 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1792 }
1793 else
1794 {
1795 pProbeReq->ssidPresent = 1;
1796 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
1797 }
1798
1799 if ( ! pr.SuppRates.present )
1800 {
1801 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1802 return eSIR_FAILURE;
1803 }
1804 else
1805 {
1806 pProbeReq->suppRatesPresent = 1;
1807 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
1808 }
1809
1810 if ( pr.ExtSuppRates.present )
1811 {
1812 pProbeReq->extendedRatesPresent = 1;
1813 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
1814 }
1815
1816 if ( pr.HTCaps.present )
1817 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301818 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 }
1820
1821 if ( pr.WscProbeReq.present )
1822 {
1823 pProbeReq->wscIePresent = 1;
1824 memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
1825 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001826#ifdef WLAN_FEATURE_11AC
1827 if ( pr.VHTCaps.present )
1828 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301829 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07001830 }
1831#endif
1832
Jeff Johnson295189b2012-06-20 16:38:30 -07001833
1834 if ( pr.P2PProbeReq.present )
1835 {
1836 pProbeReq->p2pIePresent = 1;
1837 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001838
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 return eSIR_SUCCESS;
1840
1841} // End sirConvertProbeReqFrame2Struct.
1842
1843tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
1844 tANI_U8 *pFrame,
1845 tANI_U32 nFrame,
1846 tpSirProbeRespBeacon pProbeResp)
1847{
1848 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001849 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07001850
1851 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301852 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001853
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301854 pr = vos_mem_malloc(sizeof(tDot11fProbeResponse));
1855 if ( NULL == pr )
1856 status = eHAL_STATUS_FAILURE;
1857 else
1858 status = eHAL_STATUS_SUCCESS;
1859 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07001860 {
1861 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
1862 return eSIR_FAILURE;
1863 }
1864
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301865 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07001866
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07001868 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 if ( DOT11F_FAILED( status ) )
1870 {
1871 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
1872 status, nFrame);
1873 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301874 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 return eSIR_FAILURE;
1876 }
1877 else if ( DOT11F_WARNED( status ) )
1878 {
1879 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
1880 status, nFrame );
1881 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1882 }
1883
1884 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
1885
1886 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301887 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
1888 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001889
1890 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07001891 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07001892
1893 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07001894 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
1895 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
1896 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
1897 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
1898 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
1899 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
1900 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
1901 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
1902 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
1903 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
1904 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
1905 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
1906 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
1907 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
1908 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
1909 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07001910
Jeff Johnson32d95a32012-09-10 13:15:23 -07001911 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 {
1913 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1914 }
1915 else
1916 {
1917 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001918 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07001919 }
1920
Jeff Johnson32d95a32012-09-10 13:15:23 -07001921 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001922 {
1923 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1924 }
1925 else
1926 {
1927 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001928 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 }
1930
Jeff Johnson32d95a32012-09-10 13:15:23 -07001931 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 {
1933 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001934 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 }
1936
1937
Jeff Johnson32d95a32012-09-10 13:15:23 -07001938 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 {
1940 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001941 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 }
1943
Jeff Johnson32d95a32012-09-10 13:15:23 -07001944 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 {
1946 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001947 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 }
1949
Jeff Johnson32d95a32012-09-10 13:15:23 -07001950 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 {
1952 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07001953 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 }
1955
Jeff Johnson32d95a32012-09-10 13:15:23 -07001956 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001957 {
1958 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301959 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07001960 sizeof(tDot11fIEExtChanSwitchAnn) );
1961 }
1962
Jeff Johnson32d95a32012-09-10 13:15:23 -07001963 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 {
1965 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301966 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07001967 sizeof(tDot11fIEExtChanSwitchAnn) );
1968 }
1969
Jeff Johnson32d95a32012-09-10 13:15:23 -07001970 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07001971 {
1972 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301973 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 }
1975
Jeff Johnson32d95a32012-09-10 13:15:23 -07001976 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 {
1978 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301979 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
1980 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07001981 }
1982
Jeff Johnson32d95a32012-09-10 13:15:23 -07001983 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001984 {
1985 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301986 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 }
1988
Jeff Johnson32d95a32012-09-10 13:15:23 -07001989 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001990 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301991 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 }
1993
Jeff Johnson32d95a32012-09-10 13:15:23 -07001994 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07001995 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301996 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 }
1998
Jeff Johnson32d95a32012-09-10 13:15:23 -07001999 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002000 {
2001 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002002 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002004 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002006 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 }
2008
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002009 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 {
2011 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002012 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 }
2014
Jeff Johnson32d95a32012-09-10 13:15:23 -07002015 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 {
2017 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002018 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 }
2020
Jeff Johnson32d95a32012-09-10 13:15:23 -07002021 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002022 {
2023 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002024 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002026 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 }
2028
Jeff Johnson32d95a32012-09-10 13:15:23 -07002029 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002030 {
2031 pProbeResp->wmeInfoPresent = 1;
2032 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2033 }
2034
Jeff Johnson32d95a32012-09-10 13:15:23 -07002035 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 {
2037 pProbeResp->wsmCapablePresent = 1;
2038 }
2039
2040
Jeff Johnson32d95a32012-09-10 13:15:23 -07002041 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 {
2043 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002044 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 }
2046
2047#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002048 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 {
2050 // MobilityDomain
2051 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302052 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2053 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002054 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002055#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002056 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2058#endif
2059 }
2060#endif
2061
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002062#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002063 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302065 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 }
2067#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002068 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302070 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002071 sizeof(tDot11fIEP2PProbeRes) );
2072 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002073#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002074 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002075 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302076 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002077 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002078 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002079 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302080 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002081 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002082 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002083 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302084 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002085 }
2086#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302087 vos_mem_free(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 return eSIR_SUCCESS;
2089
2090} // End sirConvertProbeFrame2Struct.
2091
2092tSirRetStatus
2093sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2094 tANI_U8 *pFrame,
2095 tANI_U32 nFrame,
2096 tpSirAssocReq pAssocReq)
2097{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002098 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 tANI_U32 status;
2100
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302101 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2102 if ( NULL == ar )
2103 status = eHAL_STATUS_FAILURE;
2104 else
2105 status = eHAL_STATUS_SUCCESS;
2106 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002107 {
2108 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2109 return eSIR_FAILURE;
2110 }
2111 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302112 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2113 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002114
2115 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002116 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 if ( DOT11F_FAILED( status ) )
2118 {
2119 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2120 status, nFrame);
2121 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302122 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 return eSIR_FAILURE;
2124 }
2125 else if ( DOT11F_WARNED( status ) )
2126 {
2127 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2128 status, nFrame );
2129 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2130 }
2131
2132 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2133
2134 // make sure this is seen as an assoc request
2135 pAssocReq->reassocRequest = 0;
2136
2137 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002138 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2139 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2140 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2141 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2142 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2143 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2144 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2145 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2146 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2147 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2148 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2149 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2150 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2151 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2152 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2153 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002154
2155 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002156 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002157
2158 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002159 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 {
2161 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002162 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 }
2164
2165 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002166 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 {
2168 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002169 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 }
2171
2172 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002173 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 {
2175 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002176 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 }
2178
2179 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002180 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 {
2182 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002183 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 }
2185
2186 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002187 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 {
2189 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002190 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 }
2192
2193 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002194 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 {
2196 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002197 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 }
2199
2200 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002201 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 {
2203 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002204 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 }
2206
2207
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002208 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 {
2210 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002211 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002213#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002214 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002215 {
2216 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002217 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002218 }
2219#endif
2220
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002222 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 {
2224 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002225 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 }
2227
2228 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002229 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 {
2231 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002232 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 }
2234
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002235 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302237 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 }
2239
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002240 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 {
2242 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302243 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2244 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002245
2246 }
2247
2248
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002249 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002250
2251 if ( ! pAssocReq->ssidPresent )
2252 {
2253 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302254 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 return eSIR_FAILURE;
2256 }
2257
2258 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2259 {
2260 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302261 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 return eSIR_FAILURE;
2263 }
2264
Jeff Johnsone7245742012-09-05 17:12:55 -07002265#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002266 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002267 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302268 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002269 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2270 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2271 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002272 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002273 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302274 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002275 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2276 limLogOperatingMode( pMac, &pAssocReq->operMode);
2277 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002278#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302279 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 return eSIR_SUCCESS;
2281
2282} // End sirConvertAssocReqFrame2Struct.
2283
2284tSirRetStatus
2285sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2286 tANI_U8 *pFrame,
2287 tANI_U32 nFrame,
2288 tpSirAssocRsp pAssocRsp)
2289{
2290 static tDot11fAssocResponse ar;
2291 tANI_U32 status;
2292 tANI_U8 cnt =0;
2293
2294 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302295 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002296
2297 // delegate to the framesc-generated code,
2298 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2299 if ( DOT11F_FAILED( status ) )
2300 {
2301 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2302 status, nFrame);
2303 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2304 return eSIR_FAILURE;
2305 }
2306 else if ( DOT11F_WARNED( status ) )
2307 {
2308 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2309 status, nFrame );
2310 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2311 }
2312
2313 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2314
2315 // Capabilities
2316 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2317 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2318 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2319 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2320 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2321 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2322 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2323 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2324 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2325 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2326 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2327 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2328 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2329 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2330 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2331 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2332
2333 pAssocRsp->statusCode = ar.Status.status;
2334 pAssocRsp->aid = ar.AID.associd;
2335
2336 if ( ! ar.SuppRates.present )
2337 {
2338 pAssocRsp->suppRatesPresent = 0;
2339 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2340 }
2341 else
2342 {
2343 pAssocRsp->suppRatesPresent = 1;
2344 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2345 }
2346
2347 if ( ar.ExtSuppRates.present )
2348 {
2349 pAssocRsp->extendedRatesPresent = 1;
2350 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2351 }
2352
2353 if ( ar.EDCAParamSet.present )
2354 {
2355 pAssocRsp->edcaPresent = 1;
2356 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2357 }
2358
2359
2360 if ( ar.WMMParams.present )
2361 {
2362 pAssocRsp->wmeEdcaPresent = 1;
2363 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002364 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002365 __printWMMParams(pMac, &ar.WMMParams);
2366 }
2367
2368 if ( ar.HTCaps.present )
2369 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302370 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002371 }
2372
2373 if ( ar.HTInfo.present )
2374 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302375 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 }
2377
2378#ifdef WLAN_FEATURE_VOWIFI_11R
2379 if (ar.MobilityDomain.present)
2380 {
2381 // MobilityDomain
2382 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302383 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2384 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2386#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002387 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2389#endif
2390 }
2391
2392 if ( ar.FTInfo.present )
2393 {
2394#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002395 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 -07002396 ar.FTInfo.R0KH_ID.present,
2397 ar.FTInfo.R1KH_ID.present);
2398#endif
2399 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302400 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 }
2402#endif
2403
2404#ifdef WLAN_FEATURE_VOWIFI_11R
2405 if (ar.num_RICDataDesc) {
2406 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2407 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302408 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2409 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 }
2411 }
2412 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2413 pAssocRsp->ricPresent = TRUE;
2414 }
2415#endif
2416
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002417#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 if (ar.num_WMMTSPEC) {
2419 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2420 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302421 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2422 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002423 }
2424 pAssocRsp->tspecPresent = TRUE;
2425 }
2426
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002427 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002428 {
2429 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302430 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002431 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 }
2433#endif
2434
Jeff Johnsone7245742012-09-05 17:12:55 -07002435#ifdef WLAN_FEATURE_11AC
2436 if ( ar.VHTCaps.present )
2437 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302438 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002439 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002440 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2441 }
2442 if ( ar.VHTOperation.present )
2443 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302444 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002445 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002446 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2447 }
2448#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302449 if(ar.OBSSScanParameters.present)
2450 {
2451 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2452 sizeof( tDot11fIEOBSSScanParameters));
2453 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002454 return eSIR_SUCCESS;
2455
2456} // End sirConvertAssocRespFrame2Struct.
2457
2458tSirRetStatus
2459sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2460 tANI_U8 *pFrame,
2461 tANI_U32 nFrame,
2462 tpSirAssocReq pAssocReq)
2463{
2464 static tDot11fReAssocRequest ar;
2465 tANI_U32 status;
2466
2467 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302468 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002469
2470 // delegate to the framesc-generated code,
2471 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2472 if ( DOT11F_FAILED( status ) )
2473 {
2474 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2475 status, nFrame);
2476 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2477 return eSIR_FAILURE;
2478 }
2479 else if ( DOT11F_WARNED( status ) )
2480 {
2481 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2482 status, nFrame );
2483 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2484 }
2485
2486 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2487
2488 // make sure this is seen as a re-assoc request
2489 pAssocReq->reassocRequest = 1;
2490
2491 // Capabilities
2492 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2493 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2494 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2495 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2496 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2497 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2498 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2499 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2500 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2501 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2502 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2503 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2504 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2505 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2506 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2507 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2508
2509 // Listen Interval
2510 pAssocReq->listenInterval = ar.ListenInterval.interval;
2511
2512 // SSID
2513 if ( ar.SSID.present )
2514 {
2515 pAssocReq->ssidPresent = 1;
2516 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2517 }
2518
2519 // Supported Rates
2520 if ( ar.SuppRates.present )
2521 {
2522 pAssocReq->suppRatesPresent = 1;
2523 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2524 }
2525
2526 // Extended Supported Rates
2527 if ( ar.ExtSuppRates.present )
2528 {
2529 pAssocReq->extendedRatesPresent = 1;
2530 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2531 &ar.ExtSuppRates );
2532 }
2533
2534 // QOS Capabilities:
2535 if ( ar.QOSCapsStation.present )
2536 {
2537 pAssocReq->qosCapabilityPresent = 1;
2538 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2539 }
2540
2541 // WPA
2542 if ( ar.WPAOpaque.present )
2543 {
2544 pAssocReq->wpaPresent = 1;
2545 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2546 }
2547
2548 // RSN
2549 if ( ar.RSNOpaque.present )
2550 {
2551 pAssocReq->rsnPresent = 1;
2552 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2553 }
2554
2555
2556 // Power Capabilities
2557 if ( ar.PowerCaps.present )
2558 {
2559 pAssocReq->powerCapabilityPresent = 1;
2560 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2561 }
2562
2563 // Supported Channels
2564 if ( ar.SuppChannels.present )
2565 {
2566 pAssocReq->supportedChannelsPresent = 1;
2567 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2568 }
2569
2570 if ( ar.HTCaps.present )
2571 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302572 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 }
2574
2575 if ( ar.WMMInfoStation.present )
2576 {
2577 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302578 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2579 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581 }
2582
2583 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2584
2585 if ( ! pAssocReq->ssidPresent )
2586 {
2587 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2588 return eSIR_FAILURE;
2589 }
2590
2591 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2592 {
2593 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2594 return eSIR_FAILURE;
2595 }
2596
2597 // Why no call to 'updateAssocReqFromPropCapability' here, like
2598 // there is in 'sirConvertAssocReqFrame2Struct'?
2599
2600 // WSC IE
2601 if (ar.WscIEOpaque.present)
2602 {
2603 pAssocReq->addIEPresent = 1;
2604 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2605 }
2606
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 if(ar.P2PIEOpaque.present)
2608 {
2609 pAssocReq->addIEPresent = 1;
2610 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2611 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002612
Jeff Johnsone7245742012-09-05 17:12:55 -07002613#ifdef WLAN_FEATURE_WFD
2614 if(ar.WFDIEOpaque.present)
2615 {
2616 pAssocReq->addIEPresent = 1;
2617 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2618 }
2619#endif
2620
2621#ifdef WLAN_FEATURE_11AC
2622 if ( ar.VHTCaps.present )
2623 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302624 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002625 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002626 if ( ar.OperatingMode.present )
2627 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302628 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002629 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2630 limLogOperatingMode( pMac, &pAssocReq->operMode);
2631 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002632#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002633 return eSIR_SUCCESS;
2634
2635} // End sirConvertReassocReqFrame2Struct.
2636
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002637
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002638#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002639tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002640sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002641 tANI_U8 *pPayload,
2642 const tANI_U32 nPayload,
2643 tANI_U8 **outIeBuf,
2644 tANI_U32 *pOutIeLen)
2645{
2646 tDot11fBeaconIEs *pBies = NULL;
2647 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002648 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002649 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002650
2651 /* To store how many bytes are required to be allocated
2652 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002653 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002654 tANI_U8 *pos = NULL;
2655
2656 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002657 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002658 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2659 if ( NULL == pBies )
2660 status = eHAL_STATUS_FAILURE;
2661 else
2662 status = eHAL_STATUS_SUCCESS;
2663 if (!HAL_STATUS_SUCCESS(status))
2664 {
2665 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2666 return eSIR_FAILURE;
2667 }
2668 // delegate to the framesc-generated code,
2669 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2670
2671 if ( DOT11F_FAILED( status ) )
2672 {
2673 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2674 status, nPayload);
2675 vos_mem_free(pBies);
2676 return eSIR_FAILURE;
2677 }
2678 else if ( DOT11F_WARNED( status ) )
2679 {
2680 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2681 status, nPayload );
2682 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2683 }
2684
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002685 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002686 if ( !pBies->SSID.present )
2687 {
2688 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2689 }
2690 else
2691 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002692 eseBcnReportMandatoryIe.ssidPresent = 1;
2693 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002694 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002695 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002696 }
2697
2698 if ( !pBies->SuppRates.present )
2699 {
2700 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2701 }
2702 else
2703 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002704 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2705 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2706 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002707 }
2708
2709 if ( pBies->FHParamSet.present)
2710 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002711 eseBcnReportMandatoryIe.fhParamPresent = 1;
2712 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002713 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2714 }
2715
2716 if ( pBies->DSParams.present )
2717 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002718 eseBcnReportMandatoryIe.dsParamsPresent = 1;
2719 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002720 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2721 }
2722
2723 if ( pBies->CFParams.present )
2724 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002725 eseBcnReportMandatoryIe.cfPresent = 1;
2726 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002727 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
2728 }
2729
2730 if ( pBies->IBSSParams.present )
2731 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002732 eseBcnReportMandatoryIe.ibssParamPresent = 1;
2733 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002734 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2735 }
2736
2737 if ( pBies->TIM.present )
2738 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002739 eseBcnReportMandatoryIe.timPresent = 1;
2740 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
2741 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
2742 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
2743 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002744 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
2745 }
2746
2747 if ( pBies->RRMEnabledCap.present )
2748 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002749 eseBcnReportMandatoryIe.rrmPresent = 1;
2750 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002751 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2752 }
2753
2754 *outIeBuf = vos_mem_malloc(numBytes);
2755 if (NULL == *outIeBuf)
2756 {
2757 limLog(pMac, LOGP, FL("Memory Allocation failure"));
2758 vos_mem_free(pBies);
2759 return eSIR_FAILURE;
2760 }
2761 pos = *outIeBuf;
2762 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002763 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002764
2765 /* Start filling the output Ie with Mandatory IE information */
2766 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002767 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002768 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002769 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002770 {
2771 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
2772 retStatus = eSIR_FAILURE;
2773 goto err_bcnrep;
2774 }
2775 *pos = SIR_MAC_SSID_EID;
2776 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002777 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002778 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002779 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
2780 eseBcnReportMandatoryIe.ssId.length);
2781 pos += eseBcnReportMandatoryIe.ssId.length;
2782 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002783 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002784
2785 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002786 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002787 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002788 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002789 {
2790 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
2791 retStatus = eSIR_FAILURE;
2792 goto err_bcnrep;
2793 }
2794 *pos = SIR_MAC_RATESET_EID;
2795 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002796 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002797 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002798 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
2799 eseBcnReportMandatoryIe.supportedRates.numRates);
2800 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
2801 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002802 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002803
2804 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002805 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002806 {
2807 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
2808 {
2809 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
2810 retStatus = eSIR_FAILURE;
2811 goto err_bcnrep;
2812 }
2813 *pos = SIR_MAC_FH_PARAM_SET_EID;
2814 pos++;
2815 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
2816 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002817 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002818 SIR_MAC_FH_PARAM_SET_EID_MAX);
2819 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
2820 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
2821 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002822
2823 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002824 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002825 {
2826 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
2827 {
2828 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
2829 retStatus = eSIR_FAILURE;
2830 goto err_bcnrep;
2831 }
2832 *pos = SIR_MAC_DS_PARAM_SET_EID;
2833 pos++;
2834 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
2835 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002836 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002837 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
2838 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
2839 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002840
2841 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002842 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002843 {
2844 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
2845 {
2846 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
2847 retStatus = eSIR_FAILURE;
2848 goto err_bcnrep;
2849 }
2850 *pos = SIR_MAC_CF_PARAM_SET_EID;
2851 pos++;
2852 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
2853 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002854 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002855 SIR_MAC_CF_PARAM_SET_EID_MAX);
2856 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
2857 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
2858 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002859
2860 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002861 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002862 {
2863 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
2864 {
2865 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
2866 retStatus = eSIR_FAILURE;
2867 goto err_bcnrep;
2868 }
2869 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
2870 pos++;
2871 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2872 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002873 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002874 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2875 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
2876 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
2877 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002878
2879 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002880 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002881 {
2882 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
2883 {
2884 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
2885 retStatus = eSIR_FAILURE;
2886 goto err_bcnrep;
2887 }
2888 *pos = SIR_MAC_TIM_EID;
2889 pos++;
2890 *pos = SIR_MAC_TIM_EID_MIN;
2891 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002892 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002893 SIR_MAC_TIM_EID_MIN);
2894 pos += SIR_MAC_TIM_EID_MIN;
2895 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
2896 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002897
2898 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002899 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002900 {
2901 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
2902 {
2903 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
2904 retStatus = eSIR_FAILURE;
2905 goto err_bcnrep;
2906 }
2907 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
2908 pos++;
2909 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
2910 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002911 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002912 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2913 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
2914 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002915
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002916 if (freeBytes != 0)
2917 {
2918 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
2919 retStatus = eSIR_FAILURE;
2920 }
2921
2922err_bcnrep:
2923 /* The message counter would not be incremented in case of
2924 * returning failure and hence next time, this function gets
2925 * called, it would be using the same msg ctr for a different
2926 * BSS.So, it is good to clear the memory allocated for a BSS
2927 * that is returning failure.On success, the caller would take
2928 * care of freeing up the memory*/
2929 if (retStatus == eSIR_FAILURE)
2930 {
2931 vos_mem_free(*outIeBuf);
2932 *outIeBuf = NULL;
2933 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002934 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002935 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002936}
2937
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002938#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002939
Jeff Johnson295189b2012-06-20 16:38:30 -07002940tSirRetStatus
2941sirParseBeaconIE(tpAniSirGlobal pMac,
2942 tpSirProbeRespBeacon pBeaconStruct,
2943 tANI_U8 *pPayload,
2944 tANI_U32 nPayload)
2945{
2946 tDot11fBeaconIEs *pBies;
2947 tANI_U32 status;
2948
2949 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302950 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002951
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302952 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2953 if ( NULL == pBies )
2954 status = eHAL_STATUS_FAILURE;
2955 else
2956 status = eHAL_STATUS_SUCCESS;
2957 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07002958 {
2959 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2960 return eSIR_FAILURE;
2961 }
2962 // delegate to the framesc-generated code,
2963 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2964
2965 if ( DOT11F_FAILED( status ) )
2966 {
2967 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2968 status, nPayload);
2969 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302970 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07002971 return eSIR_FAILURE;
2972 }
2973 else if ( DOT11F_WARNED( status ) )
2974 {
2975 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2976 status, nPayload );
2977 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2978 }
2979
2980 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
2981 if ( ! pBies->SSID.present )
2982 {
2983 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2984 }
2985 else
2986 {
2987 pBeaconStruct->ssidPresent = 1;
2988 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
2989 }
2990
2991 if ( ! pBies->SuppRates.present )
2992 {
2993 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2994 }
2995 else
2996 {
2997 pBeaconStruct->suppRatesPresent = 1;
2998 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
2999 }
3000
3001 if ( pBies->ExtSuppRates.present )
3002 {
3003 pBeaconStruct->extendedRatesPresent = 1;
3004 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3005 }
3006
3007 if ( pBies->CFParams.present )
3008 {
3009 pBeaconStruct->cfPresent = 1;
3010 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3011 }
3012
3013 if ( pBies->TIM.present )
3014 {
3015 pBeaconStruct->timPresent = 1;
3016 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3017 }
3018
3019 if ( pBies->Country.present )
3020 {
3021 pBeaconStruct->countryInfoPresent = 1;
3022 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3023 }
3024
3025 // 11h IEs
3026 if(pBies->TPCReport.present)
3027 {
3028 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303029 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 &pBies->TPCReport,
3031 sizeof( tDot11fIETPCReport));
3032 }
3033
3034 if(pBies->PowerConstraints.present)
3035 {
3036 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303037 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003038 &pBies->PowerConstraints,
3039 sizeof(tDot11fIEPowerConstraints));
3040 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003041#ifdef FEATURE_WLAN_ESE
3042 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003043 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003044 pBeaconStruct->eseTxPwr.present = 1;
3045 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003046 }
3047 if (pBies->QBSSLoad.present)
3048 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303049 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 }
3051#endif
3052
3053 if ( pBies->EDCAParamSet.present )
3054 {
3055 pBeaconStruct->edcaPresent = 1;
3056 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3057 }
3058
3059 // QOS Capabilities:
3060 if ( pBies->QOSCapsAp.present )
3061 {
3062 pBeaconStruct->qosCapabilityPresent = 1;
3063 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3064 }
3065
3066
3067
3068 if ( pBies->ChanSwitchAnn.present )
3069 {
3070 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303071 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003072 sizeof(tDot11fIEChanSwitchAnn));
3073 }
3074
3075 if ( pBies->ExtChanSwitchAnn.present)
3076 {
3077 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303078 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003079 sizeof(tDot11fIEExtChanSwitchAnn));
3080 }
3081
3082 if ( pBies->Quiet.present )
3083 {
3084 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303085 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003086 }
3087
3088 if ( pBies->HTCaps.present )
3089 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303090 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003091 }
3092
3093 if ( pBies->HTInfo.present )
3094 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303095 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003096 }
3097
3098 if ( pBies->DSParams.present )
3099 {
3100 pBeaconStruct->dsParamsPresent = 1;
3101 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3102 }
3103 else if(pBies->HTInfo.present)
3104 {
3105 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3106 }
3107
3108 if ( pBies->RSN.present )
3109 {
3110 pBeaconStruct->rsnPresent = 1;
3111 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3112 }
3113
3114 if ( pBies->WPA.present )
3115 {
3116 pBeaconStruct->wpaPresent = 1;
3117 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3118 }
3119
3120 if ( pBies->WMMParams.present )
3121 {
3122 pBeaconStruct->wmeEdcaPresent = 1;
3123 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3124 }
3125
3126 if ( pBies->WMMInfoAp.present )
3127 {
3128 pBeaconStruct->wmeInfoPresent = 1;
3129 }
3130
3131 if ( pBies->WMMCaps.present )
3132 {
3133 pBeaconStruct->wsmCapablePresent = 1;
3134 }
3135
3136
3137 if ( pBies->ERPInfo.present )
3138 {
3139 pBeaconStruct->erpPresent = 1;
3140 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3141 }
3142
Jeff Johnsone7245742012-09-05 17:12:55 -07003143#ifdef WLAN_FEATURE_11AC
3144 if ( pBies->VHTCaps.present )
3145 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303146 pBeaconStruct->VHTCaps.present = 1;
3147 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003148 }
3149 if ( pBies->VHTOperation.present )
3150 {
3151 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303152 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3153 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003154 }
3155 if ( pBies->VHTExtBssLoad.present )
3156 {
3157 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303158 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3159 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003160 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003161 if( pBies->OperatingMode.present)
3162 {
3163 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303164 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3165 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003166 }
3167
Jeff Johnsone7245742012-09-05 17:12:55 -07003168#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303169 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003170
Jeff Johnsone7245742012-09-05 17:12:55 -07003171
Jeff Johnson295189b2012-06-20 16:38:30 -07003172 return eSIR_SUCCESS;
3173
3174} // End sirParseBeaconIE.
3175
3176tSirRetStatus
3177sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3178 tANI_U8 *pFrame,
3179 tpSirProbeRespBeacon pBeaconStruct)
3180{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003181 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003182 tANI_U32 status, nPayload;
3183 tANI_U8 *pPayload;
3184 tpSirMacMgmtHdr pHdr;
3185 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003186 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003187
3188 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3189 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3190 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3191 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003192 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003193
3194 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303195 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3196
3197 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
3198 if ( NULL == pBeacon )
3199 status = eHAL_STATUS_FAILURE;
3200 else
3201 status = eHAL_STATUS_SUCCESS;
3202 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003203 {
3204 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3205 return eSIR_FAILURE;
3206 }
3207
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303208 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003209
3210 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303211 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003212
3213 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003214 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003215 if ( DOT11F_FAILED( status ) )
3216 {
3217 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3218 status, nPayload);
3219 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303220 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003221 return eSIR_FAILURE;
3222 }
3223 else if ( DOT11F_WARNED( status ) )
3224 {
3225 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3226 status, nPayload );
3227 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3228 }
3229
3230 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3231 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303232 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3233 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003234
3235 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003236 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003237
3238 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003239 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3240 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3241 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3242 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3243 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3244 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3245 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3246 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3247 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3248 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3249 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3250 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3251 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3252 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3253 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3254 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003255
Jeff Johnson32d95a32012-09-10 13:15:23 -07003256 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003257 {
3258 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3259 }
3260 else
3261 {
3262 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003263 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 }
3265
Jeff Johnson32d95a32012-09-10 13:15:23 -07003266 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 {
3268 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3269 }
3270 else
3271 {
3272 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003273 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 }
3275
Jeff Johnson32d95a32012-09-10 13:15:23 -07003276 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003277 {
3278 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003279 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 }
3281
3282
Jeff Johnson32d95a32012-09-10 13:15:23 -07003283 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 {
3285 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003286 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 }
3288
Jeff Johnson32d95a32012-09-10 13:15:23 -07003289 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 {
3291 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003292 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003293 }
3294
Jeff Johnson32d95a32012-09-10 13:15:23 -07003295 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003296 {
3297 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003298 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003299 }
3300
3301 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003302 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 {
3304 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003305 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 }
3307
Jeff Johnson32d95a32012-09-10 13:15:23 -07003308 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003309 {
3310 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003311 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 }
3313
Jeff Johnson32d95a32012-09-10 13:15:23 -07003314 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 {
3316 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303317 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003318 sizeof(tDot11fIEChanSwitchAnn) );
3319 }
3320
Jeff Johnson32d95a32012-09-10 13:15:23 -07003321 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 {
3323 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303324 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 sizeof(tDot11fIEExtChanSwitchAnn) );
3326 }
3327
Jeff Johnson32d95a32012-09-10 13:15:23 -07003328 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 {
3330 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303331 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003332 sizeof(tDot11fIETPCReport));
3333 }
3334
Jeff Johnson32d95a32012-09-10 13:15:23 -07003335 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 {
3337 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303338 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 sizeof(tDot11fIEPowerConstraints));
3340 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003341
3342 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 {
3344 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303345 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003346 }
3347
Jeff Johnson32d95a32012-09-10 13:15:23 -07003348 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303350 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 }
3352
Jeff Johnson32d95a32012-09-10 13:15:23 -07003353 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303355 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003356
3357 }
3358
Jeff Johnson32d95a32012-09-10 13:15:23 -07003359 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 {
3361 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003362 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003364 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003366 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003367 }
3368 else
3369 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003370 if ((!rfBand) || IS_5G_BAND(rfBand))
3371 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3372 else if (IS_24G_BAND(rfBand))
3373 pBeaconStruct->channelNumber = mappedRXCh;
3374 else
3375 {
3376 /*Only 0, 1, 2 are expected values for RF band from FW
3377 * if FW fixes are not present then rf band value will
3378 * be 0, else either 1 or 2 are expected from FW, 3 is
3379 * not expected from FW */
3380 PELOGE(limLog(pMac, LOGE,
3381 FL("Channel info is not present in Beacon and"
3382 " mapping is not done correctly"));)
3383 pBeaconStruct->channelNumber = mappedRXCh;
3384 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 }
3386
Jeff Johnson32d95a32012-09-10 13:15:23 -07003387 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003388 {
3389 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003390 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 }
3392
Jeff Johnson32d95a32012-09-10 13:15:23 -07003393 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 {
3395 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003396 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 }
3398
Jeff Johnson32d95a32012-09-10 13:15:23 -07003399 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 {
3401 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003402 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003404 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003405 }
3406
Jeff Johnson32d95a32012-09-10 13:15:23 -07003407 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 {
3409 pBeaconStruct->wmeInfoPresent = 1;
3410 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3411 }
3412
Jeff Johnson32d95a32012-09-10 13:15:23 -07003413 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 {
3415 pBeaconStruct->wsmCapablePresent = 1;
3416 }
3417
Jeff Johnson32d95a32012-09-10 13:15:23 -07003418 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 {
3420 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003421 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 }
3423
3424#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003425 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 {
3427 // MobilityDomain
3428 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303429 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3430 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003431 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003432
3433 }
3434#endif
3435
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003436#ifdef FEATURE_WLAN_ESE
3437 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303438 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003439 //ESE Tx Power
3440 pBeaconStruct->eseTxPwr.present = 1;
3441 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3442 &pBeacon->ESETxmitPower,
3443 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303444 }
3445#endif
3446
Jeff Johnsone7245742012-09-05 17:12:55 -07003447#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003448 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003449 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303450 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003451 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003452 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003453 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303454 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3455 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003456 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003457 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003458 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303459 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3460 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003461 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003462 if(pBeacon->OperatingMode.present)
3463 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303464 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3465 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003466 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003467 if(pBeacon->WiderBWChanSwitchAnn.present)
3468 {
3469 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303470 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3471 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003472 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003473#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303474 if(pBeacon->OBSSScanParameters.present)
3475 {
3476 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3477 &pBeacon->OBSSScanParameters,
3478 sizeof( tDot11fIEOBSSScanParameters));
3479 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303480 vos_mem_free(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003481 return eSIR_SUCCESS;
3482
3483} // End sirConvertBeaconFrame2Struct.
3484
3485tSirRetStatus
3486sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3487 tANI_U8 *pFrame,
3488 tANI_U32 nFrame,
3489 tpSirMacAuthFrameBody pAuth)
3490{
3491 static tDot11fAuthentication auth;
3492 tANI_U32 status;
3493
3494 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303495 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003496
3497 // delegate to the framesc-generated code,
3498 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3499 if ( DOT11F_FAILED( status ) )
3500 {
3501 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3502 status, nFrame);
3503 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3504 return eSIR_FAILURE;
3505 }
3506 else if ( DOT11F_WARNED( status ) )
3507 {
3508 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3509 status, nFrame );
3510 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3511 }
3512
3513 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3514 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3515 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3516 pAuth->authStatusCode = auth.Status.status;
3517
3518 if ( auth.ChallengeText.present )
3519 {
3520 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3521 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303522 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003523 }
3524
3525 return eSIR_SUCCESS;
3526
3527} // End sirConvertAuthFrame2Struct.
3528
3529tSirRetStatus
3530sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3531 tANI_U8 *pFrame,
3532 tANI_U32 nFrame,
3533 tSirAddtsReqInfo *pAddTs)
3534{
3535 tDot11fAddTSRequest addts = {{0}};
3536 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3537 tANI_U8 j;
3538 tANI_U16 i;
3539 tANI_U32 status;
3540
3541 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3542 {
3543 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3544 "with an Action of %d; this is not "
3545 "supported & is probably an error."),
3546 *( pFrame + 1 ) );
3547 return eSIR_FAILURE;
3548 }
3549
3550 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303551 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003552
3553 // delegate to the framesc-generated code,
3554 switch ( *pFrame )
3555 {
3556 case SIR_MAC_ACTION_QOS_MGMT:
3557 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3558 break;
3559 case SIR_MAC_ACTION_WME:
3560 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3561 break;
3562 default:
3563 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3564 "with a Category of %d; this is not"
3565 " supported & is probably an error."),
3566 *pFrame );
3567 return eSIR_FAILURE;
3568 }
3569
3570 if ( DOT11F_FAILED( status ) )
3571 {
3572 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3573 "rame (0x%08x, %d bytes):\n"),
3574 status, nFrame);
3575 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3576 return eSIR_FAILURE;
3577 }
3578 else if ( DOT11F_WARNED( status ) )
3579 {
3580 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3581 "g an Add TS Request frame (0x%08x,"
3582 "%d bytes):\n"),
3583 status, nFrame );
3584 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3585 }
3586
3587 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3588 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3589 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3590 {
3591 pAddTs->dialogToken = addts.DialogToken.token;
3592
3593 if ( addts.TSPEC.present )
3594 {
3595 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3596 }
3597 else
3598 {
3599 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3600 return eSIR_FAILURE;
3601 }
3602
3603 if ( addts.num_TCLAS )
3604 {
3605 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3606
3607 for ( i = 0U; i < addts.num_TCLAS; ++i )
3608 {
3609 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3610 {
3611 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3612 return eSIR_FAILURE;
3613 }
3614 }
3615 }
3616
3617 if ( addts.TCLASSPROC.present )
3618 {
3619 pAddTs->tclasProcPresent = 1;
3620 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3621 }
3622
3623 if ( addts.WMMTSPEC.present )
3624 {
3625 pAddTs->wsmTspecPresent = 1;
3626 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3627 }
3628
3629 if ( addts.num_WMMTCLAS )
3630 {
3631 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3632 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3633
3634 for ( i = pAddTs->numTclas; i < j; ++i )
3635 {
3636 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3637 {
3638 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3639 return eSIR_FAILURE;
3640 }
3641 }
3642 }
3643
3644 if ( addts.WMMTCLASPROC.present )
3645 {
3646 pAddTs->tclasProcPresent = 1;
3647 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3648 }
3649
3650 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3651 {
3652 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3653 pAddTs->numTclas );
3654 return eSIR_FAILURE;
3655 }
3656 }
3657 else
3658 {
3659 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3660
3661 if ( wmmaddts.WMMTSPEC.present )
3662 {
3663 pAddTs->wmeTspecPresent = 1;
3664 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3665 }
3666 else
3667 {
3668 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3669 return eSIR_FAILURE;
3670 }
3671 }
3672
3673 return eSIR_SUCCESS;
3674
3675} // End sirConvertAddtsReq2Struct.
3676
3677tSirRetStatus
3678sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3679 tANI_U8 *pFrame,
3680 tANI_U32 nFrame,
3681 tSirAddtsRspInfo *pAddTs)
3682{
3683 tDot11fAddTSResponse addts = {{0}};
3684 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3685 tANI_U8 j;
3686 tANI_U16 i;
3687 tANI_U32 status;
3688
3689 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3690 {
3691 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3692 "with an Action of %d; this is not "
3693 "supported & is probably an error."),
3694 *( pFrame + 1 ) );
3695 return eSIR_FAILURE;
3696 }
3697
3698 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303699 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3700 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3701 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003702
3703
3704 // delegate to the framesc-generated code,
3705 switch ( *pFrame )
3706 {
3707 case SIR_MAC_ACTION_QOS_MGMT:
3708 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3709 break;
3710 case SIR_MAC_ACTION_WME:
3711 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3712 break;
3713 default:
3714 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3715 "with a Category of %d; this is not"
3716 " supported & is probably an error."),
3717 *pFrame );
3718 return eSIR_FAILURE;
3719 }
3720
3721 if ( DOT11F_FAILED( status ) )
3722 {
3723 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
3724 "rame (0x%08x, %d bytes):\n"),
3725 status, nFrame);
3726 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3727 return eSIR_FAILURE;
3728 }
3729 else if ( DOT11F_WARNED( status ) )
3730 {
3731 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3732 "g an Add TS Response frame (0x%08x,"
3733 "%d bytes):\n"),
3734 status, nFrame );
3735 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3736 }
3737
3738 // & "transliterate" from a 'tDot11fAddTSResponse' or a
3739 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
3740 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3741 {
3742 pAddTs->dialogToken = addts.DialogToken.token;
3743 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
3744
3745 if ( addts.TSDelay.present )
3746 {
3747 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
3748 }
3749
3750 // TS Delay is present iff status indicates its presence
3751 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
3752 {
3753 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
3754 }
3755
3756 if ( addts.TSPEC.present )
3757 {
3758 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3759 }
3760 else
3761 {
3762 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
3763 return eSIR_FAILURE;
3764 }
3765
3766 if ( addts.num_TCLAS )
3767 {
3768 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3769
3770 for ( i = 0U; i < addts.num_TCLAS; ++i )
3771 {
3772 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3773 {
3774 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3775 return eSIR_FAILURE;
3776 }
3777 }
3778 }
3779
3780 if ( addts.TCLASSPROC.present )
3781 {
3782 pAddTs->tclasProcPresent = 1;
3783 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3784 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003785#ifdef FEATURE_WLAN_ESE
3786 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 {
3788 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303789 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003790 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003791 }
3792#endif
3793 if ( addts.Schedule.present )
3794 {
3795 pAddTs->schedulePresent = 1;
3796 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
3797 }
3798
3799 if ( addts.WMMSchedule.present )
3800 {
3801 pAddTs->schedulePresent = 1;
3802 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
3803 }
3804
3805 if ( addts.WMMTSPEC.present )
3806 {
3807 pAddTs->wsmTspecPresent = 1;
3808 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3809 }
3810
3811 if ( addts.num_WMMTCLAS )
3812 {
3813 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3814 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3815
3816 for ( i = pAddTs->numTclas; i < j; ++i )
3817 {
3818 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3819 {
3820 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3821 return eSIR_FAILURE;
3822 }
3823 }
3824 }
3825
3826 if ( addts.WMMTCLASPROC.present )
3827 {
3828 pAddTs->tclasProcPresent = 1;
3829 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3830 }
3831
3832 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3833 {
3834 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3835 pAddTs->numTclas );
3836 return eSIR_FAILURE;
3837 }
3838 }
3839 else
3840 {
3841 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3842 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
3843
3844 if ( wmmaddts.WMMTSPEC.present )
3845 {
3846 pAddTs->wmeTspecPresent = 1;
3847 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3848 }
3849 else
3850 {
3851 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3852 return eSIR_FAILURE;
3853 }
3854
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003855#ifdef FEATURE_WLAN_ESE
3856 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003857 {
3858 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303859 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003860 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 }
3862#endif
3863
3864 }
3865
3866 return eSIR_SUCCESS;
3867
3868} // End sirConvertAddtsRsp2Struct.
3869
3870tSirRetStatus
3871sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
3872 tANI_U8 *pFrame,
3873 tANI_U32 nFrame,
3874 tSirDeltsReqInfo *pDelTs)
3875{
3876 tDot11fDelTS delts = {{0}};
3877 tDot11fWMMDelTS wmmdelts = {{0}};
3878 tANI_U32 status;
3879
3880 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
3881 {
3882 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3883 "with an Action of %d; this is not "
3884 "supported & is probably an error."),
3885 *( pFrame + 1 ) );
3886 return eSIR_FAILURE;
3887 }
3888
3889 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303890 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003891
3892 // delegate to the framesc-generated code,
3893 switch ( *pFrame )
3894 {
3895 case SIR_MAC_ACTION_QOS_MGMT:
3896 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
3897 break;
3898 case SIR_MAC_ACTION_WME:
3899 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
3900 break;
3901 default:
3902 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3903 "with a Category of %d; this is not"
3904 " supported & is probably an error."),
3905 *pFrame );
3906 return eSIR_FAILURE;
3907 }
3908
3909 if ( DOT11F_FAILED( status ) )
3910 {
3911 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
3912 "rame (0x%08x, %d bytes):\n"),
3913 status, nFrame);
3914 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3915 return eSIR_FAILURE;
3916 }
3917 else if ( DOT11F_WARNED( status ) )
3918 {
3919 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
3920 "g an Del TS Request frame (0x%08x,"
3921 "%d bytes):\n"),
3922 status, nFrame );
3923 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3924 }
3925
3926 // & "transliterate" from a 'tDot11fDelTSResponse' or a
3927 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
3928 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3929 {
3930 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
3931 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
3932 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
3933 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
3934 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
3935 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
3936 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
3937 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
3938
3939 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
3940 }
3941 else
3942 {
3943 if ( wmmdelts.WMMTSPEC.present )
3944 {
3945 pDelTs->wmeTspecPresent = 1;
3946 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
3947 }
3948 else
3949 {
3950 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3951 return eSIR_FAILURE;
3952 }
3953 }
3954
3955 return eSIR_SUCCESS;
3956
3957} // End sirConvertDeltsReq2Struct.
3958
3959
3960#ifdef ANI_SUPPORT_11H
3961tSirRetStatus
3962sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
3963 tANI_U8 *pFrame,
3964 tpSirMacTpcReqActionFrame pTpcReqFrame,
3965 tANI_U32 nFrame)
3966{
3967 tDot11fTPCRequest req;
3968 tANI_U32 status;
3969
3970 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303971 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003972
3973 // delegate to the framesc-generated code,
3974 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
3975 if ( DOT11F_FAILED( status ) )
3976 {
3977 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
3978 status, nFrame);
3979 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3980 return eSIR_FAILURE;
3981 }
3982 else if ( DOT11F_WARNED( status ) )
3983 {
3984 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
3985 status, nFrame );
3986 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3987 }
3988
3989 // & "transliterate" from a 'tDot11fTPCRequest' to a
3990 // 'tSirMacTpcReqActionFrame'...
3991 pTpcReqFrame->actionHeader.category = req.Category.category;
3992 pTpcReqFrame->actionHeader.actionID = req.Action.action;
3993 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
3994 if ( req.TPCRequest.present )
3995 {
3996 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
3997 pTpcReqFrame->length = 0;
3998 }
3999 else
4000 {
4001 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
4002 return eSIR_FAILURE;
4003 }
4004
4005 return eSIR_SUCCESS;
4006
4007} // End sirConvertTpcReqFrame2Struct.
4008
4009
4010tSirRetStatus
4011sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4012 tANI_U8 *pFrame,
4013 tpSirMacMeasReqActionFrame pMeasReqFrame,
4014 tANI_U32 nFrame)
4015{
4016 tDot11fMeasurementRequest mr;
4017 tANI_U32 status;
4018
4019 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304020 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004021
4022 // delegate to the framesc-generated code,
4023 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4024 if ( DOT11F_FAILED( status ) )
4025 {
4026 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4027 status, nFrame);
4028 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4029 return eSIR_FAILURE;
4030 }
4031 else if ( DOT11F_WARNED( status ) )
4032 {
4033 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4034 status, nFrame );
4035 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4036 }
4037
4038 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4039 // 'tpSirMacMeasReqActionFrame'...
4040 pMeasReqFrame->actionHeader.category = mr.Category.category;
4041 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4042 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4043
4044 if ( 0 == mr.num_MeasurementRequest )
4045 {
4046 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4047 return eSIR_FAILURE;
4048 }
4049 else if ( 1 < mr.num_MeasurementRequest )
4050 {
4051 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4052 }
4053
4054 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4055 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4056 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4057 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4058 ( mr.MeasurementRequest[0].enable << 2 ) |
4059 ( mr.MeasurementRequest[0].request << 1 ) |
4060 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4061 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4062
4063 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4064
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304065 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 mr.MeasurementRequest[0].meas_start_time, 8 );
4067
4068 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4069
4070 return eSIR_SUCCESS;
4071
4072} // End sirConvertMeasReqFrame2Struct.
4073#endif
4074
4075
4076void
4077PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4078 tDot11fIETSPEC *pDot11f)
4079{
4080 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4081 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4082 pDot11f->direction = pOld->tsinfo.traffic.direction;
4083 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4084 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4085 pDot11f->psb = pOld->tsinfo.traffic.psb;
4086 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4087 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4088 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4089 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4090 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4091 */
4092 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4093 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4094 pDot11f->max_msdu_size = pOld->maxMsduSz;
4095 pDot11f->min_service_int = pOld->minSvcInterval;
4096 pDot11f->max_service_int = pOld->maxSvcInterval;
4097 pDot11f->inactivity_int = pOld->inactInterval;
4098 pDot11f->suspension_int = pOld->suspendInterval;
4099 pDot11f->service_start_time = pOld->svcStartTime;
4100 pDot11f->min_data_rate = pOld->minDataRate;
4101 pDot11f->mean_data_rate = pOld->meanDataRate;
4102 pDot11f->peak_data_rate = pOld->peakDataRate;
4103 pDot11f->burst_size = pOld->maxBurstSz;
4104 pDot11f->delay_bound = pOld->delayBound;
4105 pDot11f->min_phy_rate = pOld->minPhyRate;
4106 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4107 pDot11f->medium_time = pOld->mediumTime;
4108
4109 pDot11f->present = 1;
4110
4111} // End PopulateDot11fTSPEC.
4112
4113void
4114PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4115 tDot11fIEWMMTSPEC *pDot11f)
4116{
4117 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4118 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4119 pDot11f->direction = pOld->tsinfo.traffic.direction;
4120 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4121 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4122 pDot11f->psb = pOld->tsinfo.traffic.psb;
4123 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4124 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4125 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4126 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4127 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4128 */
4129 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4130 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4131 pDot11f->max_msdu_size = pOld->maxMsduSz;
4132 pDot11f->min_service_int = pOld->minSvcInterval;
4133 pDot11f->max_service_int = pOld->maxSvcInterval;
4134 pDot11f->inactivity_int = pOld->inactInterval;
4135 pDot11f->suspension_int = pOld->suspendInterval;
4136 pDot11f->service_start_time = pOld->svcStartTime;
4137 pDot11f->min_data_rate = pOld->minDataRate;
4138 pDot11f->mean_data_rate = pOld->meanDataRate;
4139 pDot11f->peak_data_rate = pOld->peakDataRate;
4140 pDot11f->burst_size = pOld->maxBurstSz;
4141 pDot11f->delay_bound = pOld->delayBound;
4142 pDot11f->min_phy_rate = pOld->minPhyRate;
4143 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4144 pDot11f->medium_time = pOld->mediumTime;
4145
4146 pDot11f->version = 1;
4147 pDot11f->present = 1;
4148
4149} // End PopulateDot11fWMMTSPEC.
4150
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004151#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004152
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004153// Fill the ESE version currently supported
4154void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004155{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004156 pESEVersion->present = 1;
4157 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004158}
4159
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004160// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004161// The State is Normal (1)
4162// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004163void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004164{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004165 pESERadMgmtCap->present = 1;
4166 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4167 pESERadMgmtCap->mbssid_mask = 0;
4168 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004169}
4170
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004171tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004172 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004173 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004174{
4175 int idx;
4176
4177 if ( pCCKMie->length )
4178 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004179 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004180 {
4181 pDot11f->present = 1;
4182 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004183 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004184 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4185 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4186 }
4187 }
4188
4189 return eSIR_SUCCESS;
4190
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004191} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004192
Jeff Johnson295189b2012-06-20 16:38:30 -07004193void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004194 tSirMacESETSRSIE *pOld,
4195 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004196 tANI_U8 rate_length)
4197{
4198 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304199 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004200 pDot11f->num_tsrates = rate_length;
4201 pDot11f->present = 1;
4202}
4203#endif
4204
4205
4206tSirRetStatus
4207PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4208 tSirTclasInfo *pOld,
4209 tDot11fIETCLAS *pDot11f)
4210{
4211 pDot11f->user_priority = pOld->tclas.userPrio;
4212 pDot11f->classifier_type = pOld->tclas.classifierType;
4213 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4214
4215 switch ( pDot11f->classifier_type )
4216 {
4217 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304218 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4219 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4220 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4221 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4223 break;
4224 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4225 pDot11f->info.IpParams.version = pOld->version;
4226 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4227 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304228 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304229 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304230 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4231 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304232 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304233 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004234 pDot11f->info.IpParams.params.IpV4Params.src_port =
4235 pOld->tclasParams.ipv4.srcPort;
4236 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4237 pOld->tclasParams.ipv4.dstPort;
4238 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4239 pOld->tclasParams.ipv4.dscp;
4240 pDot11f->info.IpParams.params.IpV4Params.proto =
4241 pOld->tclasParams.ipv4.protocol;
4242 pDot11f->info.IpParams.params.IpV4Params.reserved =
4243 pOld->tclasParams.ipv4.rsvd;
4244 }
4245 else
4246 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304247 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004248 IpV6Params.source,
4249 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304250 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 IpV6Params.dest,
4252 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4253 pDot11f->info.IpParams.params.IpV6Params.src_port =
4254 pOld->tclasParams.ipv6.srcPort;
4255 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4256 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304257 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 IpV6Params.flow_label,
4259 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4260 }
4261 break;
4262 case SIR_MAC_TCLASTYPE_8021DQ:
4263 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4264 break;
4265 default:
4266 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4267 pDot11f->classifier_type );
4268 return eSIR_FAILURE;
4269 }
4270
4271 pDot11f->present = 1;
4272
4273 return eSIR_SUCCESS;
4274
4275} // End PopulateDot11fTCLAS.
4276
4277tSirRetStatus
4278PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4279 tSirTclasInfo *pOld,
4280 tDot11fIEWMMTCLAS *pDot11f)
4281{
4282 pDot11f->version = 1;
4283 pDot11f->user_priority = pOld->tclas.userPrio;
4284 pDot11f->classifier_type = pOld->tclas.classifierType;
4285 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4286
4287 switch ( pDot11f->classifier_type )
4288 {
4289 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304290 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304292 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004293 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4294 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4295 break;
4296 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4297 pDot11f->info.IpParams.version = pOld->version;
4298 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
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 IpV4Params.source,
4302 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
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 IpV4Params.dest,
4305 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4306 pDot11f->info.IpParams.params.IpV4Params.src_port =
4307 pOld->tclasParams.ipv4.srcPort;
4308 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4309 pOld->tclasParams.ipv4.dstPort;
4310 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4311 pOld->tclasParams.ipv4.dscp;
4312 pDot11f->info.IpParams.params.IpV4Params.proto =
4313 pOld->tclasParams.ipv4.protocol;
4314 pDot11f->info.IpParams.params.IpV4Params.reserved =
4315 pOld->tclasParams.ipv4.rsvd;
4316 }
4317 else
4318 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304319 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 IpV6Params.source,
4321 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304322 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004323 IpV6Params.dest,
4324 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4325 pDot11f->info.IpParams.params.IpV6Params.src_port =
4326 pOld->tclasParams.ipv6.srcPort;
4327 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4328 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304329 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004330 IpV6Params.flow_label,
4331 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4332 }
4333 break;
4334 case SIR_MAC_TCLASTYPE_8021DQ:
4335 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4336 break;
4337 default:
4338 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4339 pDot11f->classifier_type );
4340 return eSIR_FAILURE;
4341 }
4342
4343 pDot11f->present = 1;
4344
4345 return eSIR_SUCCESS;
4346
4347} // End PopulateDot11fWMMTCLAS.
4348
Jeff Johnson295189b2012-06-20 16:38:30 -07004349
4350tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4351 tDot11fIEWscBeacon *pDot11f)
4352{
4353
4354 tANI_U32 wpsState;
4355
4356 pDot11f->Version.present = 1;
4357 pDot11f->Version.major = 0x01;
4358 pDot11f->Version.minor = 0x00;
4359
4360 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4361 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4362
4363 pDot11f->WPSState.present = 1;
4364 pDot11f->WPSState.state = (tANI_U8) wpsState;
4365
4366 pDot11f->APSetupLocked.present = 0;
4367
4368 pDot11f->SelectedRegistrar.present = 0;
4369
4370 pDot11f->DevicePasswordID.present = 0;
4371
4372 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4373
4374 pDot11f->UUID_E.present = 0;
4375
4376 pDot11f->RFBands.present = 0;
4377
4378 pDot11f->present = 1;
4379 return eSIR_SUCCESS;
4380}
4381
4382tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4383 tDot11fIEWscBeacon *pDot11f)
4384{
4385 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4386 tANI_U32 devicepasswdId;
4387
4388
4389 pDot11f->APSetupLocked.present = 1;
4390 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4391
4392 pDot11f->SelectedRegistrar.present = 1;
4393 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4394
4395 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4396 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4397
4398 pDot11f->DevicePasswordID.present = 1;
4399 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4400
4401 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4402 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4403
4404 // UUID_E and RF Bands are applicable only for dual band AP
4405
4406 return eSIR_SUCCESS;
4407}
4408
4409tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4410 tDot11fIEWscBeacon *pDot11f)
4411{
4412 pDot11f->APSetupLocked.present = 0;
4413 pDot11f->SelectedRegistrar.present = 0;
4414 pDot11f->DevicePasswordID.present = 0;
4415 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4416
4417 return eSIR_SUCCESS;
4418}
Jeff Johnson295189b2012-06-20 16:38:30 -07004419tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4420{
4421
4422 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4423
4424 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4425
4426
4427 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4428 {
4429 pDot11f->present = 1;
4430 pDot11f->Version.present = 1;
4431 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4432 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4433 }
4434 else
4435 {
4436 pDot11f->present = 0;
4437 pDot11f->Version.present = 0;
4438 }
4439
4440 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4441 {
4442
4443 pDot11f->WPSState.present = 1;
4444 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4445 }
4446 else
4447 pDot11f->WPSState.present = 0;
4448
4449 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4450 {
4451 pDot11f->APSetupLocked.present = 1;
4452 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4453 }
4454 else
4455 pDot11f->APSetupLocked.present = 0;
4456
4457 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4458 {
4459 pDot11f->SelectedRegistrar.present = 1;
4460 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4461 }
4462 else
4463 pDot11f->SelectedRegistrar.present = 0;
4464
4465 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4466 {
4467 pDot11f->DevicePasswordID.present = 1;
4468 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4469 }
4470 else
4471 pDot11f->DevicePasswordID.present = 0;
4472
4473 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4474 {
4475 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4476 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4477 }
4478 else
4479 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4480
4481 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4482 {
4483 pDot11f->ResponseType.present = 1;
4484 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4485 }
4486 else
4487 pDot11f->ResponseType.present = 0;
4488
4489 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4490 {
4491 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304492 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 }
4494 else
4495 pDot11f->UUID_E.present = 0;
4496
4497 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4498 {
4499 pDot11f->Manufacturer.present = 1;
4500 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304501 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4502 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 }
4504 else
4505 pDot11f->Manufacturer.present = 0;
4506
4507 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4508 {
4509 pDot11f->ModelName.present = 1;
4510 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304511 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4512 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004513 }
4514 else
4515 pDot11f->ModelName.present = 0;
4516
4517 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4518 {
4519 pDot11f->ModelNumber.present = 1;
4520 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304521 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4522 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004523 }
4524 else
4525 pDot11f->ModelNumber.present = 0;
4526
4527 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4528 {
4529 pDot11f->SerialNumber.present = 1;
4530 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304531 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4532 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004533 }
4534 else
4535 pDot11f->SerialNumber.present = 0;
4536
4537 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4538 {
4539 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304540 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4541 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004542 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4543 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4544 }
4545 else
4546 pDot11f->PrimaryDeviceType.present = 0;
4547
4548 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4549 {
4550 pDot11f->DeviceName.present = 1;
4551 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304552 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4553 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 }
4555 else
4556 pDot11f->DeviceName.present = 0;
4557
4558 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4559 {
4560 pDot11f->ConfigMethods.present = 1;
4561 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4562 }
4563 else
4564 pDot11f->ConfigMethods.present = 0;
4565
4566
4567 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4568 {
4569 pDot11f->RFBands.present = 1;
4570 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4571 }
4572 else
4573 pDot11f->RFBands.present = 0;
4574
4575 return eSIR_SUCCESS;
4576}
4577tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4578{
4579 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4580
4581 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4582
4583 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4584 {
4585 pDot11f->present = 1;
4586 pDot11f->Version.present = 1;
4587 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4588 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4589 }
4590 else
4591 {
4592 pDot11f->present = 0;
4593 pDot11f->Version.present = 0;
4594 }
4595
4596 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4597 {
4598 pDot11f->ResponseType.present = 1;
4599 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4600 }
4601 else
4602 pDot11f->ResponseType.present = 0;
4603
4604 return eSIR_SUCCESS;
4605}
4606
4607tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4608{
4609
4610 tSirWPSBeaconIE *pSirWPSBeaconIE;
4611
4612 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4613
4614
4615 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4616 {
4617 pDot11f->present = 1;
4618 pDot11f->Version.present = 1;
4619 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4620 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4621 }
4622 else
4623 {
4624 pDot11f->present = 0;
4625 pDot11f->Version.present = 0;
4626 }
4627
4628 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4629 {
4630
4631 pDot11f->WPSState.present = 1;
4632 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4633 }
4634 else
4635 pDot11f->WPSState.present = 0;
4636
4637 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4638 {
4639 pDot11f->APSetupLocked.present = 1;
4640 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4641 }
4642 else
4643 pDot11f->APSetupLocked.present = 0;
4644
4645 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4646 {
4647 pDot11f->SelectedRegistrar.present = 1;
4648 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4649 }
4650 else
4651 pDot11f->SelectedRegistrar.present = 0;
4652
4653 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4654 {
4655 pDot11f->DevicePasswordID.present = 1;
4656 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4657 }
4658 else
4659 pDot11f->DevicePasswordID.present = 0;
4660
4661 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4662 {
4663 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4664 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4665 }
4666 else
4667 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4668
4669 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4670 {
4671 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304672 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004673 }
4674 else
4675 pDot11f->UUID_E.present = 0;
4676
4677
4678 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4679 {
4680 pDot11f->RFBands.present = 1;
4681 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4682 }
4683 else
4684 pDot11f->RFBands.present = 0;
4685
4686 return eSIR_SUCCESS;
4687}
Jeff Johnson295189b2012-06-20 16:38:30 -07004688tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4689 tDot11fIEWscProbeRes *pDot11f)
4690{
4691 tANI_U32 cfgMethods;
4692 tANI_U32 cfgStrLen;
4693 tANI_U32 val;
4694 tANI_U32 wpsVersion, wpsState;
4695
4696
4697 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
4698 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
4699
4700 pDot11f->Version.present = 1;
4701 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
4702 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
4703
4704 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4705 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4706
4707 pDot11f->WPSState.present = 1;
4708 pDot11f->WPSState.state = (tANI_U8) wpsState;
4709
4710 pDot11f->APSetupLocked.present = 0;
4711
4712 pDot11f->SelectedRegistrar.present = 0;
4713
4714 pDot11f->DevicePasswordID.present = 0;
4715
4716 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4717
4718 pDot11f->ResponseType.present = 1;
4719 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
4720 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
4721 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4722 }
4723 else{
4724 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4725 }
4726
4727 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
4728 pDot11f->UUID_E.present = 1;
4729 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
4730 if (wlan_cfgGetStr(pMac,
4731 WNI_CFG_WPS_UUID,
4732 pDot11f->UUID_E.uuid,
4733 &cfgStrLen) != eSIR_SUCCESS)
4734 {
4735 *(pDot11f->UUID_E.uuid) = '\0';
4736 }
4737
4738 pDot11f->Manufacturer.present = 1;
4739 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
4740 if (wlan_cfgGetStr(pMac,
4741 WNI_CFG_MANUFACTURER_NAME,
4742 pDot11f->Manufacturer.name,
4743 &cfgStrLen) != eSIR_SUCCESS)
4744 {
4745 pDot11f->Manufacturer.num_name = 0;
4746 *(pDot11f->Manufacturer.name) = '\0';
4747 }
4748 else
4749 {
4750 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
4751 pDot11f->Manufacturer.name[cfgStrLen] = '\0';
4752 }
4753
4754 pDot11f->ModelName.present = 1;
4755 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
4756 if (wlan_cfgGetStr(pMac,
4757 WNI_CFG_MODEL_NAME,
4758 pDot11f->ModelName.text,
4759 &cfgStrLen) != eSIR_SUCCESS)
4760 {
4761 pDot11f->ModelName.num_text = 0;
4762 *(pDot11f->ModelName.text) = '\0';
4763 }
4764 else
4765 {
4766 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4767 pDot11f->ModelName.text[cfgStrLen] = '\0';
4768 }
4769
4770 pDot11f->ModelNumber.present = 1;
4771 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
4772 if (wlan_cfgGetStr(pMac,
4773 WNI_CFG_MODEL_NUMBER,
4774 pDot11f->ModelNumber.text,
4775 &cfgStrLen) != eSIR_SUCCESS)
4776 {
4777 pDot11f->ModelNumber.num_text = 0;
4778 *(pDot11f->ModelNumber.text) = '\0';
4779 }
4780 else
4781 {
4782 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4783 pDot11f->ModelNumber.text[cfgStrLen] = '\0';
4784 }
4785
4786 pDot11f->SerialNumber.present = 1;
4787 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
4788 if (wlan_cfgGetStr(pMac,
4789 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
4790 pDot11f->SerialNumber.text,
4791 &cfgStrLen) != eSIR_SUCCESS)
4792 {
4793 pDot11f->SerialNumber.num_text = 0;
4794 *(pDot11f->SerialNumber.text) = '\0';
4795 }
4796 else
4797 {
4798 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4799 pDot11f->SerialNumber.text[cfgStrLen] = '\0';
4800 }
4801
4802 pDot11f->PrimaryDeviceType.present = 1;
4803
4804 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
4805 {
4806 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
4807 }
4808 else
4809 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
4810
4811 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
4812 {
4813 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
4814 }
4815 else
4816 {
4817 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
4818 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
4819 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
4820 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
4821 }
4822
4823 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
4824 {
4825 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
4826 }
4827 else
4828 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
4829
4830 pDot11f->DeviceName.present = 1;
4831 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
4832 if (wlan_cfgGetStr(pMac,
4833 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
4834 pDot11f->DeviceName.text,
4835 &cfgStrLen) != eSIR_SUCCESS)
4836 {
4837 pDot11f->DeviceName.num_text = 0;
4838 *(pDot11f->DeviceName.text) = '\0';
4839 }
4840 else
4841 {
4842 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4843 pDot11f->DeviceName.text[cfgStrLen] = '\0';
4844 }
4845
4846 if (wlan_cfgGetInt(pMac,
4847 WNI_CFG_WPS_CFG_METHOD,
4848 &cfgMethods) != eSIR_SUCCESS)
4849 {
4850 pDot11f->ConfigMethods.present = 0;
4851 pDot11f->ConfigMethods.methods = 0;
4852 }
4853 else
4854 {
4855 pDot11f->ConfigMethods.present = 1;
4856 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
4857 }
4858
4859 pDot11f->RFBands.present = 0;
4860
4861 pDot11f->present = 1;
4862 return eSIR_SUCCESS;
4863}
4864
4865tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4866 tDot11fIEWscProbeRes *pDot11f)
4867{
4868 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4869 tANI_U32 devicepasswdId;
4870
4871 pDot11f->APSetupLocked.present = 1;
4872 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4873
4874 pDot11f->SelectedRegistrar.present = 1;
4875 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4876
4877 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4878 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4879
4880 pDot11f->DevicePasswordID.present = 1;
4881 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4882
4883 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4884 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4885
4886 // UUID_E and RF Bands are applicable only for dual band AP
4887
4888 return eSIR_SUCCESS;
4889}
4890
4891tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4892 tDot11fIEWscProbeRes *pDot11f)
4893{
4894 pDot11f->APSetupLocked.present = 0;
4895 pDot11f->SelectedRegistrar.present = 0;
4896 pDot11f->DevicePasswordID.present = 0;
4897 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4898
4899 return eSIR_SUCCESS;
4900}
4901
4902tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
4903 tDot11fIEWscAssocRes *pDot11f,
4904 tpSirAssocReq pRcvdAssocReq)
4905{
4906 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
4907 tANI_U8 *wscIe;
4908
4909
4910 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
4911 if(wscIe != NULL)
4912 {
4913 // retreive WSC IE from given AssocReq
4914 dot11fUnpackIeWscAssocReq( pMac,
4915 wscIe + 2 + 4, // EID, length, OUI
4916 wscIe[ 1 ] - 4, // length without OUI
4917 &parsedWscAssocReq );
4918 pDot11f->present = 1;
4919 // version has to be 0x10
4920 pDot11f->Version.present = 1;
4921 pDot11f->Version.major = 0x1;
4922 pDot11f->Version.minor = 0x0;
4923
4924 pDot11f->ResponseType.present = 1;
4925
4926 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
4927 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
4928 {
4929 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4930 }
4931 else
4932 {
4933 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4934 }
4935 // Version infomration should be taken from our capability as well as peers
4936 // TODO: currently it takes from peers only
4937 if(parsedWscAssocReq.VendorExtension.present &&
4938 parsedWscAssocReq.VendorExtension.Version2.present)
4939 {
4940 pDot11f->VendorExtension.present = 1;
4941 pDot11f->VendorExtension.vendorId[0] = 0x00;
4942 pDot11f->VendorExtension.vendorId[1] = 0x37;
4943 pDot11f->VendorExtension.vendorId[2] = 0x2A;
4944 pDot11f->VendorExtension.Version2.present = 1;
4945 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
4946 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
4947 }
4948 }
4949 return eSIR_SUCCESS;
4950}
4951
Jeff Johnson295189b2012-06-20 16:38:30 -07004952tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
4953 tDot11fIEP2PAssocRes *pDot11f,
4954 tpSirAssocReq pRcvdAssocReq)
4955{
4956 tANI_U8 *p2pIe;
4957
4958 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
4959 if(p2pIe != NULL)
4960 {
4961 pDot11f->present = 1;
4962 pDot11f->P2PStatus.present = 1;
4963 pDot11f->P2PStatus.status = eSIR_SUCCESS;
4964 pDot11f->ExtendedListenTiming.present = 0;
4965 }
4966 return eSIR_SUCCESS;
4967}
Jeff Johnson295189b2012-06-20 16:38:30 -07004968
4969#if defined WLAN_FEATURE_VOWIFI
4970
4971tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
4972 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
4973{
4974 pDot11f->txPower = txPower;
4975 pDot11f->linkMargin = linkMargin;
4976 pDot11f->present = 1;
4977
4978 return eSIR_SUCCESS;
4979}
4980
4981tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
4982{
4983
4984 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
4985 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304986 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
4987 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004988 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
4989 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
4990 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
4991 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
4992 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304993 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004994 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
4995 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
4996
4997 if( pBeaconReport->numIes )
4998 {
4999 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305000 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5001 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005002 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5003 }
5004
5005 return eSIR_SUCCESS;
5006
5007}
5008
5009tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5010{
5011 tpRRMCaps pRrmCaps;
5012
5013 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5014
5015 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5016 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5017 pDot11f->parallel = pRrmCaps->parallel ;
5018 pDot11f->repeated = pRrmCaps->repeated ;
5019 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5020 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5021 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5022 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5023 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5024 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5025 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5026 pDot11f->statistics = pRrmCaps->statistics ;
5027 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5028 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5029 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5030 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5031 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5032 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5033 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5034 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5035 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5036 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5037 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5038 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5039 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5040 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5041 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5042 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5043
5044 pDot11f->present = 1;
5045 return eSIR_SUCCESS;
5046}
5047#endif
5048
5049#if defined WLAN_FEATURE_VOWIFI_11R
5050void PopulateMDIE( tpAniSirGlobal pMac,
5051 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5052{
5053 pDot11f->present = 1;
5054 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5055
5056 // Plugfest fix
5057 pDot11f->overDSCap = (mdie[2] & 0x01);
5058 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5059
5060}
5061
5062void PopulateFTInfo( tpAniSirGlobal pMac,
5063 tDot11fIEFTInfo *pDot11f )
5064{
5065 pDot11f->present = 1;
5066 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5067 //All other info is zero.
5068
5069}
5070#endif
5071
5072void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5073 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5074{
5075 tANI_U8 num_supp = 0, num_ext = 0;
5076 tANI_U8 i,j;
5077
5078 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5079 {
5080 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5081 }
5082 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5083 {
5084 if( num_supp < 8 )
5085 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5086 else
5087 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5088 }
5089
5090 if( num_supp )
5091 {
5092 pSupp->num_rates = num_supp;
5093 pSupp->present = 1;
5094 }
5095 if( num_ext )
5096 {
5097 pExt->num_rates = num_ext;
5098 pExt->present = 1;
5099 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005100}
5101
5102void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5103 tDot11fIETimeoutInterval *pDot11f,
5104 tANI_U8 type, tANI_U32 value )
5105{
5106 pDot11f->present = 1;
5107 pDot11f->timeoutType = type;
5108 pDot11f->timeoutValue = value;
5109}
Jeff Johnson295189b2012-06-20 16:38:30 -07005110// parserApi.c ends here.