blob: 106fa555e2643bdffd8ed5d92a24dd58c46e6df4 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
2 * Copyright (c) 2012, Code Aurora Forum. 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 */
21
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file parserApi.cc contains the code for parsing
25 * 802.11 messages.
26 * Author: Pierre Vandwalle
27 * Date: 03/18/02
28 * History:-
29 * Date Modified by Modification Information
30 * --------------------------------------------------------------------
31 *
32 */
33
34#include "sirApi.h"
35#include "aniGlobal.h"
36#include "parserApi.h"
37#include "cfgApi.h"
38#include "limUtils.h"
39#include "utilsParser.h"
40#include "limSerDesUtils.h"
41#include "schApi.h"
42#include "palApi.h"
43#include "wmmApsd.h"
44#if defined WLAN_FEATURE_VOWIFI
45#include "rrmApi.h"
46#endif
47
48
49
50////////////////////////////////////////////////////////////////////////
51void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
52{
53#ifdef WLAN_DEBUG
54 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
55 {
56 return;
57 }
58 else
59 {
60 va_list marker;
61
62 va_start( marker, pString ); /* Initialize variable arguments. */
63
64 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
65
66 va_end( marker ); /* Reset variable arguments. */
67 }
68#endif
69}
70
71void
72swapBitField16(tANI_U16 in, tANI_U16 *out)
73{
74# ifdef ANI_LITTLE_BIT_ENDIAN
75 *out = in;
76# else // Big-Endian...
77 *out = ( ( in & 0x8000 ) >> 15 ) |
78 ( ( in & 0x4000 ) >> 13 ) |
79 ( ( in & 0x2000 ) >> 11 ) |
80 ( ( in & 0x1000 ) >> 9 ) |
81 ( ( in & 0x0800 ) >> 7 ) |
82 ( ( in & 0x0400 ) >> 5 ) |
83 ( ( in & 0x0200 ) >> 3 ) |
84 ( ( in & 0x0100 ) >> 1 ) |
85 ( ( in & 0x0080 ) << 1 ) |
86 ( ( in & 0x0040 ) << 3 ) |
87 ( ( in & 0x0020 ) << 5 ) |
88 ( ( in & 0x0010 ) << 7 ) |
89 ( ( in & 0x0008 ) << 9 ) |
90 ( ( in & 0x0004 ) << 11 ) |
91 ( ( in & 0x0002 ) << 13 ) |
92 ( ( in & 0x0001 ) << 15 );
93# endif // ANI_LITTLE_BIT_ENDIAN
94}
95
96void
97swapBitField32(tANI_U32 in, tANI_U32 *out)
98{
99# ifdef ANI_LITTLE_BIT_ENDIAN
100 *out = in;
101# else // Big-Endian...
102 *out = ( ( in & 0x80000000 ) >> 31 ) |
103 ( ( in & 0x40000000 ) >> 29 ) |
104 ( ( in & 0x20000000 ) >> 27 ) |
105 ( ( in & 0x10000000 ) >> 25 ) |
106 ( ( in & 0x08000000 ) >> 23 ) |
107 ( ( in & 0x04000000 ) >> 21 ) |
108 ( ( in & 0x02000000 ) >> 19 ) |
109 ( ( in & 0x01000000 ) >> 17 ) |
110 ( ( in & 0x00800000 ) >> 15 ) |
111 ( ( in & 0x00400000 ) >> 13 ) |
112 ( ( in & 0x00200000 ) >> 11 ) |
113 ( ( in & 0x00100000 ) >> 9 ) |
114 ( ( in & 0x00080000 ) >> 7 ) |
115 ( ( in & 0x00040000 ) >> 5 ) |
116 ( ( in & 0x00020000 ) >> 3 ) |
117 ( ( in & 0x00010000 ) >> 1 ) |
118 ( ( in & 0x00008000 ) << 1 ) |
119 ( ( in & 0x00004000 ) << 3 ) |
120 ( ( in & 0x00002000 ) << 5 ) |
121 ( ( in & 0x00001000 ) << 7 ) |
122 ( ( in & 0x00000800 ) << 9 ) |
123 ( ( in & 0x00000400 ) << 11 ) |
124 ( ( in & 0x00000200 ) << 13 ) |
125 ( ( in & 0x00000100 ) << 15 ) |
126 ( ( in & 0x00000080 ) << 17 ) |
127 ( ( in & 0x00000040 ) << 19 ) |
128 ( ( in & 0x00000020 ) << 21 ) |
129 ( ( in & 0x00000010 ) << 23 ) |
130 ( ( in & 0x00000008 ) << 25 ) |
131 ( ( in & 0x00000004 ) << 27 ) |
132 ( ( in & 0x00000002 ) << 29 ) |
133 ( ( in & 0x00000001 ) << 31 );
134# endif // ANI_LITTLE_BIT_ENDIAN
135}
136
137inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
138{
139 limLog(pMac, LOG1, FL("WMM Parameters Received: \n"));
140 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
141 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
142
143 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
144 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
145
146 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
147 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
148
149 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
150 pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
151
152 return;
153}
154
155////////////////////////////////////////////////////////////////////////
156// Functions for populating "dot11f" style IEs
157
158
159// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
160// < 0, cannot find
161int FindIELocation( tpAniSirGlobal pMac,
162 tpSirRSNie pRsnIe,
163 tANI_U8 EID)
164{
165 int idx, ieLen, bytesLeft;
166
167 // Here's what's going on: 'rsnIe' looks like this:
168
169 // typedef struct sSirRSNie
170 // {
171 // tANI_U16 length;
172 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
173 // } tSirRSNie, *tpSirRSNie;
174
175 // other code records both the WPA & RSN IEs (including their EIDs &
176 // lengths) into the array 'rsnIEdata'. We may have:
177
178 // With WAPI support, there may be 3 IEs here
179 // It can be only WPA IE, or only RSN IE or only WAPI IE
180 // Or two or all three of them with no particular ordering
181
182 // The if/then/else statements that follow are here to figure out
183 // whether we have the WPA IE, and where it is if we *do* have it.
184
185 //Save the first IE length
186 ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
187 idx = 0;
188 bytesLeft = pRsnIe->length;
189
190 while( 1 )
191 {
192 if ( EID == pRsnIe->rsnIEdata[ idx ] )
193 {
194 //Found it
195 return (idx);
196 }
197 else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
198 // & if no more IE,
199 bytesLeft <= (tANI_U16)( ieLen ) )
200 {
201 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
202 return (-1);
203 }
204 bytesLeft -= ieLen;
205 ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
206 idx += ieLen;
207 }
208
209 return (-1);
210}
211
212
213tSirRetStatus
214PopulateDot11fCapabilities(tpAniSirGlobal pMac,
215 tDot11fFfCapabilities *pDot11f,
216 tpPESession psessionEntry)
217{
218 tANI_U16 cfg;
219 tSirRetStatus nSirStatus;
220
221 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
222 if ( eSIR_SUCCESS != nSirStatus )
223 {
224 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
225 "itfield from CFG (%d).\n"), nSirStatus );
226 return nSirStatus;
227 }
228
229#if 0
230 if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
231 {
232 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
233 }
234#endif
235 swapBitField16( cfg, ( tANI_U16* )pDot11f );
236
237 return eSIR_SUCCESS;
238} // End PopulateDot11fCapabilities.
239
240tSirRetStatus
241PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
242 tDot11fFfCapabilities *pDot11f,
243 tpDphHashNode pSta,
244 tpPESession psessionEntry)
245{
246 tANI_U16 cfg;
247 tSirRetStatus nSirStatus;
248 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
249 if ( eSIR_SUCCESS != nSirStatus )
250 {
251 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
252 "itfield from CFG (%d).\n"), nSirStatus );
253 return nSirStatus;
254 }
255
256 if ( ( NULL != pSta ) && pSta->aniPeer &&
257 PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
258 {
259 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
260 }
261
262 swapBitField16( cfg, ( tANI_U16* )pDot11f );
263
264 return eSIR_SUCCESS;
265
266} // End PopulateDot11fCapabilities2.
267
268void
269PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700270 tDot11fIEChanSwitchAnn *pDot11f,
271 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700272{
Jeff Johnsone7245742012-09-05 17:12:55 -0700273 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
274 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
275 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700276
277 pDot11f->present = 1;
278} // End PopulateDot11fChanSwitchAnn.
279
280void
281PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700282 tDot11fIEExtChanSwitchAnn *pDot11f,
283 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700284{
285 //Has to be updated on the cb state basis
286 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700287 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700288
289 pDot11f->present = 1;
290}
291
292tSirRetStatus
293PopulateDot11fCountry(tpAniSirGlobal pMac,
294 tDot11fIECountry *pDot11f,
295 tpPESession psessionEntry)
296{
297 tANI_U32 len, maxlen, codelen;
298 tANI_U16 item;
299 tSirRetStatus nSirStatus;
300 tSirRFBand rfBand;
301 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
302
303 if (psessionEntry->lim11dEnabled )
304 {
305 limGetRfBand(pMac, &rfBand, psessionEntry);
306 if (rfBand == SIR_BAND_5_GHZ)
307 {
308 item = WNI_CFG_MAX_TX_POWER_5;
309 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
310 }
311 else
312 {
313 item = WNI_CFG_MAX_TX_POWER_2_4;
314 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
315 }
316
317 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
318
319 if ( 3 > len )
320 {
321 // no limit on tx power, cannot include the IE because at least
322 // one (channel,num,tx power) must be present
323 return eSIR_SUCCESS;
324 }
325
326 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
327 code, codelen, 3 );
328
329 palCopyMemory( pMac->hHdd, pDot11f->country, code, codelen );
330
331 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
332 {
333 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting.\n"), len);
334 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
335 }
336
337 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
338 palCopyMemory( pMac->hHdd, ( tANI_U8* )pDot11f->triplets, temp, len );
339
340 pDot11f->present = 1;
341 }
342
343 return eSIR_SUCCESS;
344} // End PopulateDot11fCountry.
345
346tSirRetStatus
347PopulateDot11fDSParams(tpAniSirGlobal pMac,
348 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
349 tpPESession psessionEntry)
350{
351// tSirRetStatus nSirStatus;
352 tANI_U32 nPhyMode;
353
354 // Get PHY mode and based on that add DS Parameter Set IE
355 limGetPhyMode(pMac, &nPhyMode, psessionEntry);
356
357 if ( WNI_CFG_PHY_MODE_11A != nPhyMode )
358 {
359 // .11b/g mode PHY => Include the DS Parameter Set IE:
360 #if 0
361 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, cfg );
362 #endif //TO SUPPORT BT-AMP
363 pDot11f->curr_channel = channel;
364 pDot11f->present = 1;
365 }
366
367 return eSIR_SUCCESS;
368} // End PopulateDot11fDSParams.
369
370#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
371
372
373void
374PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
375 tDot11fIEEDCAParamSet *pDot11f,
376 tpPESession psessionEntry)
377{
378
379 if ( psessionEntry->limQosEnabled )
380 {
381 //change to bitwise operation, after this is fixed in frames.
382 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
383
384 // Fill each EDCA parameter set in order: be, bk, vi, vo
385 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
386 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
387 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
388 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
389 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
390 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
391
392 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
393 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
394 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
395 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
396 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
397 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
398
399 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
400 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
401 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
402 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
403 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
404 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
405
406 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
407 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
408 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
409 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
410 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
411 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
412
413 pDot11f->present = 1;
414 }
415
416} // End PopluateDot11fEDCAParamSet.
417
418tSirRetStatus
419PopulateDot11fERPInfo(tpAniSirGlobal pMac,
420 tDot11fIEERPInfo *pDot11f,
421 tpPESession psessionEntry)
422{
423 tSirRetStatus nSirStatus;
424 tANI_U32 val;
425 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
426
427 limGetRfBand(pMac, &rfBand, psessionEntry);
428 if(SIR_BAND_2_4_GHZ == rfBand)
429 {
430 pDot11f->present = 1;
431
432 val = psessionEntry->cfgProtection.fromllb;
433 if(!val ){
434 dot11fLog( pMac, LOGE, FL("11B protection not enabled. Not populating ERP IE %d\n" ),val );
435 return eSIR_SUCCESS;
436 }
437
438 if (psessionEntry->gLim11bParams.protectionEnabled)
439 {
440 pDot11f->non_erp_present = 1;
441 pDot11f->use_prot = 1;
442 }
443
444 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
445 {
446 //FIXME_PROTECTION: we should be setting non_erp present also.
447 //check the test plan first.
448 pDot11f->use_prot = 1;
449 }
450
451
452 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
453 || !psessionEntry->beaconParams.fShortPreamble){
454 pDot11f->barker_preamble = 1;
455
456 }
457 // if protection always flag is set, advertise protection enabled
458 // regardless of legacy stations presence
459 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
460
461 if ( val )
462 {
463 pDot11f->use_prot = 1;
464 }
465 }
466
467 return eSIR_SUCCESS;
468} // End PopulateDot11fERPInfo.
469
470tSirRetStatus
471PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
472 tDot11fIEExtSuppRates *pDot11f,
473 tpPESession psessionEntry)
474{
475 tSirRetStatus nSirStatus;
476 tANI_U32 nRates = 0;
477 tANI_U8 rates[WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN];
478
479 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
480 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
481 sending mgmt frames (lile probe req) which need to go out before any session is present.
482 */
483 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
484 {
485 if(psessionEntry != NULL)
486 {
487 nRates = psessionEntry->extRateSet.numRates;
488 palCopyMemory(pMac->hHdd, rates, psessionEntry->extRateSet.rate,
489 nRates);
490 }
491 else
492 {
493 dot11fLog( pMac, LOGE, FL("no session context exists while"
494 " populating Operational Rate Set\n"));
495 }
496 }
497 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
498 {
499 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
500 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
501 }
502
503 if ( 0 != nRates )
504 {
505 pDot11f->num_rates = ( tANI_U8 )nRates;
506 palCopyMemory( pMac->hHdd, pDot11f->rates, rates, nRates );
507 pDot11f->present = 1;
508 }
509
510 return eSIR_SUCCESS;
511
512} // End PopulateDot11fExtSuppRates.
513
514tSirRetStatus
515PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
516 tANI_U8 nChannelNum,
517 tDot11fIEExtSuppRates *pDot11f)
518{
519 tANI_U32 nRates;
520 tSirRetStatus nSirStatus;
521 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
522
523 if ( 14 < nChannelNum )
524 {
525 pDot11f->present = 0;
526 return eSIR_SUCCESS;
527 }
528
529 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
530 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
531 // previously & I'm afraid to change it!
532 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
533 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
534
535 if ( 0 != nRates )
536 {
537 pDot11f->num_rates = ( tANI_U8 ) nRates;
538 palCopyMemory( pMac->hHdd, pDot11f->rates, rates, nRates );
539 pDot11f->present = 1;
540 }
541
542 return eSIR_SUCCESS;
543} // PopulateDot11fExtSuppRates1.
544
545tSirRetStatus
546PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700547 tpPESession psessionEntry,
548 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700549{
550 tANI_U32 nCfgValue, nCfgLen;
551 tANI_U8 nCfgValue8;
552 tSirRetStatus nSirStatus;
553 tSirMacHTParametersInfo *pHTParametersInfo;
554#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
555 union {
556 tANI_U16 nCfgValue16;
557 tSirMacHTCapabilityInfo htCapInfo;
558 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
559 } uHTCapabilityInfo;
560#else
561 tANI_U16 nCfgValue16;
562 tSirMacHTCapabilityInfo *pHTCapabilityInfo;
563 tSirMacExtendedHTCapabilityInfo *pExtendedHTCapabilityInfo;
564#endif
565
566 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
567 tSirMacASCapabilityInfo *pASCapabilityInfo;
568
569 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
570
571#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
572 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
573#else
574 nCfgValue16 = ( tANI_U16 ) nCfgValue;
575 pHTCapabilityInfo = ( tSirMacHTCapabilityInfo* ) &nCfgValue16;
576#endif
577
Jeff Johnson295189b2012-06-20 16:38:30 -0700578#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
579 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
581 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
582 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
583 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
584 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
585 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
586 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
587 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
588 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
589 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
590 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
591 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
592#else
593 pDot11f->advCodingCap = pHTCapabilityInfo->advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 pDot11f->mimoPowerSave = pHTCapabilityInfo->mimoPowerSave;
595 pDot11f->greenField = pHTCapabilityInfo->greenField;
596 pDot11f->shortGI20MHz = pHTCapabilityInfo->shortGI20MHz;
597 pDot11f->shortGI40MHz = pHTCapabilityInfo->shortGI40MHz;
598 pDot11f->txSTBC = pHTCapabilityInfo->txSTBC;
599 pDot11f->rxSTBC = pHTCapabilityInfo->rxSTBC;
600 pDot11f->delayedBA = pHTCapabilityInfo->delayedBA;
601 pDot11f->maximalAMSDUsize = pHTCapabilityInfo->maximalAMSDUsize;
602 pDot11f->dsssCckMode40MHz = pHTCapabilityInfo->dsssCckMode40MHz;
603 pDot11f->psmp = pHTCapabilityInfo->psmp;
604 pDot11f->stbcControlFrame = pHTCapabilityInfo->stbcControlFrame;
605 pDot11f->lsigTXOPProtection = pHTCapabilityInfo->lsigTXOPProtection;
606#endif
607
Jeff Johnsone7245742012-09-05 17:12:55 -0700608 // All sessionized entries will need the check below
609 if (psessionEntry == NULL) // Only in case of NO session
610 {
611 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
612 }
613 else
614 {
615 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
616 }
617
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
619 eHT_CHANNEL_WIDTH_20MHZ */
620 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
621 {
622 pDot11f->shortGI40MHz = 0;
623 }
624
625 dot11fLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d, shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
626 pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave, pDot11f->greenField,
627 pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
628
629
630 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
631
632 nCfgValue8 = ( tANI_U8 ) nCfgValue;
633 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
634
635 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
636 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
637 pDot11f->reserved1 = pHTParametersInfo->reserved;
638
639 dot11fLog( pMac, LOG1, FL( "AMPDU Param: %x\n" ), nCfgValue);
640
641
642 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
643 pDot11f->supportedMCSSet, nCfgLen,
644 SIZE_OF_SUPPORTED_MCS_SET );
645
646
647 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
648
649#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
650 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
651
652 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
653 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
654 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
655
656#else
657 nCfgValue16 = ( tANI_U16 ) nCfgValue ;
658 pExtendedHTCapabilityInfo = ( tSirMacExtendedHTCapabilityInfo* ) &nCfgValue16;
659 pDot11f->pco = pExtendedHTCapabilityInfo->pco;
660 pDot11f->transitionTime = pExtendedHTCapabilityInfo->transitionTime;
661 pDot11f->mcsFeedback = pExtendedHTCapabilityInfo->mcsFeedback;
662#endif
663
664 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
665
666 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
667 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
668 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
669 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
670 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
671 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
672 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
673 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
674 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
675 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
676 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
677 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
678 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
679 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
680 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
681 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
682
683 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
684
685 nCfgValue8 = ( tANI_U8 ) nCfgValue;
686
687 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
688 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
689 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
690 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
691 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
692 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
693 pDot11f->rxAS = pASCapabilityInfo->rxAS;
694 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
695
696 pDot11f->present = 1;
697
698 return eSIR_SUCCESS;
699
700} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700701#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700702
Jeff Johnsone7245742012-09-05 17:12:55 -0700703void limLogVHTCap(tpAniSirGlobal pMac,
704 tDot11fIEVHTCaps *pDot11f)
705{
706
707 limLog(pMac, LOGW, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
708 limLog(pMac, LOGW, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
709 limLog(pMac, LOGW, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
710 limLog(pMac, LOGW, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
711 limLog(pMac, LOGW, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
712 limLog(pMac, LOGW, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
713 limLog(pMac, LOGW, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
714 limLog(pMac, LOGW, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
715 limLog(pMac, LOGW, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
716 limLog(pMac, LOGW, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
717 limLog(pMac, LOGW, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
718 limLog(pMac, LOGW, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
719 limLog(pMac, LOGW, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
720 limLog(pMac, LOGW, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
721 limLog(pMac, LOGW, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
722 limLog(pMac, LOGW, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
723 limLog(pMac, LOGW, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
724 limLog(pMac, LOGW, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
725 limLog(pMac, LOGW, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
726 limLog(pMac, LOGW, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
727 limLog(pMac, LOGW, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
728 limLog(pMac, LOGW, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
729 limLog(pMac, LOGW, FL("reserve (3): %d\n"), pDot11f->reserved2);
730 limLog(pMac, LOGW, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
731 limLog(pMac, LOGW, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
732 limLog(pMac, LOGW, FL("reserv (3): %d\n"), pDot11f->reserved3);
733}
734
735void limLogVHTOperation(tpAniSirGlobal pMac,
736 tDot11fIEVHTOperation *pDot11f)
737{
738
739 limLog(pMac, LOGW, FL("chanWidth : %d\n"), pDot11f->chanWidth);
740 limLog(pMac, LOGW, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
741 limLog(pMac, LOGW, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
742 limLog(pMac, LOGW, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
743}
744
745void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
746 tDot11fIEVHTExtBssLoad *pDot11f)
747{
748 limLog(pMac, LOGW, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
749 limLog(pMac, LOGW, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
750 limLog(pMac, LOGW, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
751 limLog(pMac, LOGW, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
752 limLog(pMac, LOGW, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
753}
754
755
756tSirRetStatus
757PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
758 tDot11fIEVHTCaps *pDot11f)
759{
760 tSirRetStatus nStatus;
761 tANI_U32 nCfgValue=0;
762
763 pDot11f->present = 1;
764
765 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
766 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
767
768 nCfgValue = 0;
769 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
770 nCfgValue );
771 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
772
773 nCfgValue = 0;
774 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
775 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
776
777 nCfgValue = 0;
778 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
779 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
780
781 nCfgValue = 0;
782 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
783 nCfgValue );
784 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
785
786 nCfgValue = 0;
787 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
788 pDot11f->txSTBC = (nCfgValue & 0x0001);
789
790 nCfgValue = 0;
791 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
792 pDot11f->rxSTBC = (nCfgValue & 0x0007);
793
794 nCfgValue = 0;
795 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
796 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
797
798 nCfgValue = 0;
799 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
800 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
801
802 nCfgValue = 0;
803 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
804 nCfgValue );
805 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
806
807 nCfgValue = 0;
808 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
809 nCfgValue );
810 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
811
812 nCfgValue = 0;
813 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
814 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
815
816 nCfgValue = 0;
817 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
818 pDot11f->muBeamformeeCap = (nCfgValue & 0x0001);
819
820 nCfgValue = 0;
821 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
822 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
823
824 nCfgValue = 0;
825 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
826 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
827
828 nCfgValue = 0;
829 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
830 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
831
832 nCfgValue = 0;
833 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
834 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
835
836 nCfgValue = 0;
837 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
838 pDot11f->rxAntPattern = nCfgValue;
839
840 nCfgValue = 0;
841 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
842 pDot11f->txAntPattern = nCfgValue;
843
844 pDot11f->reserved1= 0;
845
846 nCfgValue = 0;
847 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
848 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
849
850 nCfgValue = 0;
851 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
852 nCfgValue );
853 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
854
855 pDot11f->reserved2= 0;
856
857 nCfgValue = 0;
858 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
859 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
860
861 nCfgValue = 0;
862 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
863 nCfgValue );
864 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
865
866 pDot11f->reserved3= 0;
867
868 limLogVHTCap(pMac, pDot11f);
869
870 return eSIR_SUCCESS;
871
872}
873
874tSirRetStatus
875PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
876 tDot11fIEVHTOperation *pDot11f)
877{
878 tSirRetStatus nStatus;
879 tANI_U32 nCfgValue=0;
880
881 pDot11f->present = 1;
882
883 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
884 pDot11f->chanWidth = (tANI_U8)nCfgValue;
885
886 nCfgValue = 0;
887 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
888 nCfgValue );
889 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
890
891 nCfgValue = 0;
892 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
893 nCfgValue );
894 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
895
896 nCfgValue = 0;
897 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
898 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
899
900 limLogVHTOperation(pMac,pDot11f);
901
902 return eSIR_SUCCESS;
903
904}
905
906tSirRetStatus
907PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
908 tDot11fIEVHTExtBssLoad *pDot11f)
909{
910 tSirRetStatus nStatus;
911 tANI_U32 nCfgValue=0;
912
913 pDot11f->present = 1;
914
915 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
916 nCfgValue );
917 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
918
919 nCfgValue = 0;
920 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
921 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
922
923 nCfgValue=0;
924 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
925 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
926
927 nCfgValue=0;
928 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
929 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
930
931 nCfgValue=0;
932 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
933 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
934
935 limLogVHTExtBssLoad(pMac,pDot11f);
936
937 return eSIR_SUCCESS;
938}
939
940
941#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700942#ifdef WLAN_SOFTAP_FEATURE
943tSirRetStatus
944PopulateDot11fHTInfo(tpAniSirGlobal pMac,
945 tDot11fIEHTInfo *pDot11f,
946 tpPESession psessionEntry )
947#else
948tSirRetStatus
949PopulateDot11fHTInfo(tpAniSirGlobal pMac,
950 tDot11fIEHTInfo *pDot11f)
951#endif
952{
953 tANI_U32 nCfgValue, nCfgLen;
954 tANI_U8 htInfoField1;
955 tANI_U16 htInfoField2;
956 tSirRetStatus nSirStatus;
957 tSirMacHTInfoField1 *pHTInfoField1;
958 tSirMacHTInfoField2 *pHTInfoField2;
959#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
960 union {
961 tANI_U16 nCfgValue16;
962 tSirMacHTInfoField3 infoField3;
963 }uHTInfoField;
964 union {
965 tANI_U16 nCfgValue16;
966 tSirMacHTInfoField2 infoField2;
967 }uHTInfoField2={0};
968#else
969 tANI_U16 htInfoField3;
970 tSirMacHTInfoField3 *pHTInfoField3;
971#endif
972
973#ifndef WLAN_SOFTAP_FEATURE
974 tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
975#endif
976
977 #if 0
978 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
979 #endif // TO SUPPORT BT-AMP
980
981 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
982
983 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
984
985 htInfoField1 = ( tANI_U8 ) nCfgValue;
986
987 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
989 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
990
Jeff Johnsone7245742012-09-05 17:12:55 -0700991 if (psessionEntry == NULL)
992 {
993 PELOGE(limLog(pMac, LOG1,
994 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
995 }
996 else
997 {
998 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
999 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1000 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001001
1002#ifdef WLAN_SOFTAP_FEATURE
1003 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1004 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1005
1006 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1007
1008 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1009 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1010 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1011
1012 uHTInfoField2.infoField2.reserved = 0;
1013
1014 }else{
1015#endif
1016 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1017
1018 htInfoField2 = ( tANI_U16 ) nCfgValue;
1019
1020 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1021 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1022 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1023 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1024
1025 pHTInfoField2->reserved = 0;
1026#ifdef WLAN_SOFTAP_FEATURE
1027 }
1028#endif
1029
1030 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1031
1032
1033#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
1034 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1035
1036
1037 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1038 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1039 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1040 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1041 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1042 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1043 uHTInfoField.infoField3.reserved = 0;
1044
1045#else
1046 htInfoField3 = (tANI_U16) nCfgValue;
1047
1048 pHTInfoField3 = ( tSirMacHTInfoField3* ) &htInfoField3;
1049 pHTInfoField3->basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1050 pHTInfoField3->dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1051 pHTInfoField3->secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1052 pHTInfoField3->lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1053 pHTInfoField3->pcoActive = pMac->lim.gHTPCOActive;
1054 pHTInfoField3->pcoPhase = pMac->lim.gHTPCOPhase;
1055 pHTInfoField3->reserved = 0;
1056#endif
1057
1058 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1059 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1060 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1061 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1062 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1063
1064#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
1065 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1066 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1067 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1068 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1069
1070#else
1071 pDot11f->opMode = pHTInfoField2->opMode;
1072 pDot11f->nonGFDevicesPresent = pHTInfoField2->nonGFDevicesPresent;
1073 pDot11f->obssNonHTStaPresent = pHTInfoField2->obssNonHTStaPresent;
1074 pDot11f->reserved = pHTInfoField2->reserved;
1075#endif
1076
1077#ifdef WLAN_SOFTAP_FEATURE // this is added for fixing CRs on MDM9K platform - 257951, 259577
1078 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1079 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1080 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1081 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1082 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1083 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1084 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
1085#else
1086 pDot11f->basicSTBCMCS = pHTInfoField3->basicSTBCMCS;
1087 pDot11f->dualCTSProtection = pHTInfoField3->dualCTSProtection;
1088 pDot11f->secondaryBeacon = pHTInfoField3->secondaryBeacon;
1089 pDot11f->lsigTXOPProtectionFullSupport = pHTInfoField3->lsigTXOPProtectionFullSupport;
1090 pDot11f->pcoActive = pHTInfoField3->pcoActive;
1091 pDot11f->pcoPhase = pHTInfoField3->pcoPhase;
1092 pDot11f->reserved2 = pHTInfoField3->reserved;
1093#endif
1094 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1095 pDot11f->basicMCSSet, nCfgLen,
1096 SIZE_OF_BASIC_MCS_SET );
1097
1098 pDot11f->present = 1;
1099
1100 return eSIR_SUCCESS;
1101
1102} // End PopulateDot11fHTInfo.
1103
1104void
1105PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1106 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1107{
1108 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1109 {
1110 pDot11f->present = 1;
1111 // ATIM duration is always set to 0
1112 pDot11f->atim = 0;
1113 }
1114
1115} // End PopulateDot11fIBSSParams.
1116
1117
1118#ifdef ANI_SUPPORT_11H
1119tSirRetStatus
1120PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1121 tpSirMacMeasReqActionFrame pReq,
1122 tDot11fIEMeasurementReport *pDot11f)
1123{
1124 pDot11f->token = pReq->measReqIE.measToken;
1125 pDot11f->late = 0;
1126 pDot11f->incapable = 0;
1127 pDot11f->refused = 1;
1128 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1129
1130 pDot11f->present = 1;
1131
1132 return eSIR_SUCCESS;
1133
1134} // End PopulatedDot11fMeasurementReport0.
1135
1136tSirRetStatus
1137PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1138 tpSirMacMeasReqActionFrame pReq,
1139 tDot11fIEMeasurementReport *pDot11f)
1140{
1141 pDot11f->token = pReq->measReqIE.measToken;
1142 pDot11f->late = 0;
1143 pDot11f->incapable = 0;
1144 pDot11f->refused = 1;
1145 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1146
1147 pDot11f->present = 1;
1148
1149 return eSIR_SUCCESS;
1150
1151} // End PopulatedDot11fMeasurementReport1.
1152
1153tSirRetStatus
1154PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1155 tpSirMacMeasReqActionFrame pReq,
1156 tDot11fIEMeasurementReport *pDot11f)
1157{
1158 pDot11f->token = pReq->measReqIE.measToken;
1159 pDot11f->late = 0;
1160 pDot11f->incapable = 0;
1161 pDot11f->refused = 1;
1162 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1163
1164 pDot11f->present = 1;
1165
1166 return eSIR_SUCCESS;
1167
1168} // End PopulatedDot11fMeasurementReport2.
1169#endif
1170
1171void
1172PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1173 tDot11fIEPowerCaps *pCaps,
1174 tANI_U8 nAssocType,
1175 tpPESession psessionEntry)
1176{
1177 if (nAssocType == LIM_REASSOC)
1178 {
1179 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1180 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1181 }else
1182 {
1183 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1184 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1185
1186 }
1187
1188 pCaps->present = 1;
1189} // End PopulateDot11fPowerCaps.
1190
1191tSirRetStatus
1192PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1193 tDot11fIEPowerConstraints *pDot11f)
1194{
1195 tANI_U32 cfg;
1196 tSirRetStatus nSirStatus;
1197
1198 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1199
1200 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1201 pDot11f->present = 1;
1202
1203 return eSIR_SUCCESS;
1204} // End PopulateDot11fPowerConstraints.
1205
1206void
1207PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1208 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1209{
1210 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1211 pDot11f->reserved = 0;
1212 pDot11f->txopreq = 0;
1213 pDot11f->qreq = 0;
1214 pDot11f->qack = 0;
1215 pDot11f->present = 1;
1216} // End PopulatedDot11fQOSCaps.
1217
1218void
1219PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1220 tDot11fIEQOSCapsStation *pDot11f)
1221{
1222 tANI_U32 val = 0;
1223
1224 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1225 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1226
1227 pDot11f->more_data_ack = 0;
1228 pDot11f->max_sp_length = (tANI_U8)val;
1229 pDot11f->qack = 0;
1230
1231 if (pMac->lim.gUapsdEnable)
1232 {
1233 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1234 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1235 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1236 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1237 }
1238 pDot11f->present = 1;
1239} // End PopulatedDot11fQOSCaps.
1240
1241tSirRetStatus
1242PopulateDot11fRSN(tpAniSirGlobal pMac,
1243 tpSirRSNie pRsnIe,
1244 tDot11fIERSN *pDot11f)
1245{
1246 tANI_U32 status;
1247 int idx;
1248
1249 if ( pRsnIe->length )
1250 {
1251 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1252 {
1253 status = dot11fUnpackIeRSN( pMac,
1254 pRsnIe->rsnIEdata + idx + 2, //EID, length
1255 pRsnIe->rsnIEdata[ idx + 1 ],
1256 pDot11f );
1257 if ( DOT11F_FAILED( status ) )
1258 {
1259 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1260 "N (0x%08x).\n"),
1261 status );
1262 return eSIR_FAILURE;
1263 }
1264 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1265 "PopulateDot11fRSN.\n"), status );
1266 }
1267
1268 }
1269
1270 return eSIR_SUCCESS;
1271} // End PopulateDot11fRSN.
1272
1273tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1274 tpSirRSNie pRsnIe,
1275 tDot11fIERSNOpaque *pDot11f )
1276{
1277 int idx;
1278
1279 if ( pRsnIe->length )
1280 {
1281 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1282 {
1283 pDot11f->present = 1;
1284 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
1285 palCopyMemory( pMac->hHdd, pDot11f->data,
1286 pRsnIe->rsnIEdata + idx + 2, // EID, len
1287 pRsnIe->rsnIEdata[ idx + 1 ] );
1288 }
1289 }
1290
1291 return eSIR_SUCCESS;
1292
1293} // End PopulateDot11fRSNOpaque.
1294
1295
1296
1297#if defined(FEATURE_WLAN_WAPI)
1298
1299tSirRetStatus
1300PopulateDot11fWAPI(tpAniSirGlobal pMac,
1301 tpSirRSNie pRsnIe,
1302 tDot11fIEWAPI *pDot11f)
1303 {
1304 tANI_U32 status;
1305 int idx;
1306
1307 if ( pRsnIe->length )
1308 {
1309 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1310 {
1311 status = dot11fUnpackIeWAPI( pMac,
1312 pRsnIe->rsnIEdata + idx + 2, //EID, length
1313 pRsnIe->rsnIEdata[ idx + 1 ],
1314 pDot11f );
1315 if ( DOT11F_FAILED( status ) )
1316 {
1317 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1318 status );
1319 return eSIR_FAILURE;
1320 }
1321 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1322 "PopulateDot11fWAPI.\n"), status );
1323 }
1324 }
1325
1326 return eSIR_SUCCESS;
1327} // End PopulateDot11fWAPI.
1328
1329tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1330 tpSirRSNie pRsnIe,
1331 tDot11fIEWAPIOpaque *pDot11f )
1332{
1333 int idx;
1334
1335 if ( pRsnIe->length )
1336 {
1337 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1338 {
1339 pDot11f->present = 1;
1340 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
1341 palCopyMemory( pMac->hHdd, pDot11f->data,
1342 pRsnIe->rsnIEdata + idx + 2, // EID, len
1343 pRsnIe->rsnIEdata[ idx + 1 ] );
1344 }
1345 }
1346
1347 return eSIR_SUCCESS;
1348
1349} // End PopulateDot11fWAPIOpaque.
1350
1351
1352#endif //defined(FEATURE_WLAN_WAPI)
1353
1354void
1355PopulateDot11fSSID(tpAniSirGlobal pMac,
1356 tSirMacSSid *pInternal,
1357 tDot11fIESSID *pDot11f)
1358{
1359 pDot11f->present = 1;
1360 pDot11f->num_ssid = pInternal->length;
1361 if ( pInternal->length )
1362 {
1363 palCopyMemory( pMac->hHdd, ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
1364 pInternal->length );
1365 }
1366} // End PopulateDot11fSSID.
1367
1368tSirRetStatus
1369PopulateDot11fSSID2(tpAniSirGlobal pMac,
1370 tDot11fIESSID *pDot11f)
1371{
1372 tANI_U32 nCfg;
1373 tSirRetStatus nSirStatus;
1374
1375 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1376 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1377 pDot11f->present = 1;
1378 return eSIR_SUCCESS;
1379} // End PopulateDot11fSSID2.
1380
1381void
1382PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1383 tDot11fIESchedule *pDot11f)
1384{
1385 pDot11f->aggregation = pSchedule->info.aggregation;
1386 pDot11f->tsid = pSchedule->info.tsid;
1387 pDot11f->direction = pSchedule->info.direction;
1388 pDot11f->reserved = pSchedule->info.rsvd;
1389 pDot11f->service_start_time = pSchedule->svcStartTime;
1390 pDot11f->service_interval = pSchedule->svcInterval;
1391 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1392 pDot11f->spec_interval = pSchedule->specInterval;
1393
1394 pDot11f->present = 1;
1395} // End PopulateDot11fSchedule.
1396
1397void
1398PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1399 tDot11fIESuppChannels *pDot11f,
1400 tANI_U8 nAssocType,
1401 tpPESession psessionEntry)
1402{
1403 tANI_U8 i;
1404 tANI_U8 *p;
1405
1406 if (nAssocType == LIM_REASSOC)
1407 {
1408 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1409 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1410 }else
1411 {
1412 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1413 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1414 }
1415 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1416 {
1417 pDot11f->bands[i][0] = *p;
1418 pDot11f->bands[i][1] = 1;
1419 }
1420
1421 pDot11f->present = 1;
1422
1423} // End PopulateDot11fSuppChannels.
1424
1425tSirRetStatus
1426PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1427 tANI_U8 nChannelNum,
1428 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1429{
1430 tSirRetStatus nSirStatus;
1431 tANI_U32 nRates;
1432 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1433
1434 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1435 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1436 sending mgmt frames (lile probe req) which need to go out before any session is present.
1437 */
1438 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1439 {
1440 #if 0
1441 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1442 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1443 #endif //TO SUPPORT BT-AMP
1444 if(psessionEntry != NULL)
1445 {
1446 nRates = psessionEntry->rateSet.numRates;
1447 palCopyMemory(pMac->hHdd, rates, psessionEntry->rateSet.rate,
1448 nRates);
1449 }
1450 else
1451 {
1452 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1453 nRates = 0;
1454 }
1455 }
1456 else if ( 14 >= nChannelNum )
1457 {
1458 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1459 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1460 }
1461 else
1462 {
1463 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1464 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1465 }
1466
1467 if ( 0 != nRates )
1468 {
1469 pDot11f->num_rates = ( tANI_U8 )nRates;
1470 palCopyMemory( pMac->hHdd, pDot11f->rates, rates, nRates );
1471 pDot11f->present = 1;
1472 }
1473
1474 return eSIR_SUCCESS;
1475
1476} // End PopulateDot11fSuppRates.
1477
1478tSirRetStatus
1479PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1480 tDot11fIETPCReport *pDot11f,
1481 tpPESession psessionEntry)
1482{
1483 tANI_U16 staid, txPower;
1484 tSirRetStatus nSirStatus;
1485
1486 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1487 if ( eSIR_SUCCESS != nSirStatus )
1488 {
1489 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1490 "eDot11fTPCReport; limGetMgmtStaid "
1491 "returned status %d.\n"),
1492 nSirStatus );
1493 return eSIR_FAILURE;
1494 }
1495
1496 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1497 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1498 txPower = 0;
1499 pDot11f->tx_power = ( tANI_U8 )txPower;
1500 pDot11f->link_margin = 0;
1501 pDot11f->present = 1;
1502
1503 return eSIR_SUCCESS;
1504} // End PopulateDot11fTPCReport.
1505
1506
1507void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1508 tDot11fFfTSInfo *pDot11f)
1509{
1510 pDot11f->traffic_type = pInfo->traffic.trafficType;
1511 pDot11f->tsid = pInfo->traffic.tsid;
1512 pDot11f->direction = pInfo->traffic.direction;
1513 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1514 pDot11f->aggregation = pInfo->traffic.aggregation;
1515 pDot11f->psb = pInfo->traffic.psb;
1516 pDot11f->user_priority = pInfo->traffic.userPrio;
1517 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1518 pDot11f->schedule = pInfo->schedule.schedule;
1519} // End PopulatedDot11fTSInfo.
1520
1521void PopulateDot11fWMM(tpAniSirGlobal pMac,
1522 tDot11fIEWMMInfoAp *pInfo,
1523 tDot11fIEWMMParams *pParams,
1524 tDot11fIEWMMCaps *pCaps,
1525 tpPESession psessionEntry)
1526{
1527 if ( psessionEntry->limWmeEnabled )
1528 {
1529 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1530 {
1531 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1532 {
1533 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1534 }
1535 }
1536 else
1537 {
1538 {
1539 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1540 }
1541
1542 if ( psessionEntry->limWsmEnabled )
1543 {
1544 PopulateDot11fWMMCaps( pCaps );
1545 }
1546 }
1547 }
1548} // End PopulateDot11fWMM.
1549
1550void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1551{
1552 pCaps->version = SIR_MAC_OUI_VERSION_1;
1553 pCaps->qack = 0;
1554 pCaps->queue_request = 1;
1555 pCaps->txop_request = 0;
1556 pCaps->more_ack = 0;
1557 pCaps->present = 1;
1558} // End PopulateDot11fWmmCaps.
1559
1560#ifdef FEATURE_WLAN_CCX
1561void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1562{
1563 tANI_U8 numTspecs = 0, idx;
1564 tTspecInfo *pTspec = NULL;
1565
1566 numTspecs = psessionEntry->pLimReAssocReq->ccxTspecInfo.numTspecs;
1567 pTspec = &psessionEntry->pLimReAssocReq->ccxTspecInfo.tspec[0];
1568 pReassoc->num_WMMTSPEC = numTspecs;
1569 if (numTspecs) {
1570 for (idx=0; idx<numTspecs; idx++) {
1571 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
1572 pTspec++;
1573 }
1574 }
1575}
1576#endif
1577
1578void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1579 tpPESession psessionEntry)
1580{
1581 pInfo->version = SIR_MAC_OUI_VERSION_1;
1582
1583 /* WMM Specification 3.1.3, 3.2.3
1584 * An IBSS staion shall always use its default WMM parameters.
1585 */
1586 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1587 {
1588 pInfo->param_set_count = 0;
1589 pInfo->uapsd = 0;
1590 }
1591 else
1592 {
1593 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
1594#ifdef WLAN_SOFTAP_FEATURE
1595 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1596 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1597 }
1598 else
1599#endif
1600 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1601 }
1602 pInfo->present = 1;
1603}
1604
1605void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1606{
1607 tANI_U32 val = 0;
1608
1609 pInfo->version = SIR_MAC_OUI_VERSION_1;
1610 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1611 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1612 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1613 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1614
1615 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1616 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1617
1618 pInfo->max_sp_length = (tANI_U8)val;
1619 pInfo->present = 1;
1620}
1621
1622#ifdef WLAN_SOFTAP_FEATURE
1623void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1624 tDot11fIEWMMParams *pParams,
1625 tpPESession psessionEntry)
1626#else
1627void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1628 tDot11fIEWMMParams *pParams)
1629#endif
1630{
1631 pParams->version = SIR_MAC_OUI_VERSION_1;
1632
1633#ifdef WLAN_SOFTAP_FEATURE
1634 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1635 pParams->qosInfo =
1636 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1637 else
1638#endif
1639 pParams->qosInfo =
1640 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1641
1642 // Fill each EDCA parameter set in order: be, bk, vi, vo
1643 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1644 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1645 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1646 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1647 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1648 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1649
1650 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1651 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1652 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1653 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1654 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1655 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1656
1657#ifdef WLAN_SOFTAP_FEATURE
1658 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1659 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1660 else
1661#endif
1662 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1663
1664
1665
1666 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1667 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1668 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1669 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1670 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1671
1672#ifdef WLAN_SOFTAP_FEATURE
1673 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1674 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1675 else
1676#endif
1677 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1678
1679 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1680 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1681 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1682 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1683 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1684
1685 pParams->present = 1;
1686
1687} // End PopulateDot11fWMMParams.
1688
1689void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1690 tDot11fIEWMMSchedule *pDot11f)
1691{
1692 pDot11f->version = 1;
1693 pDot11f->aggregation = pSchedule->info.aggregation;
1694 pDot11f->tsid = pSchedule->info.tsid;
1695 pDot11f->direction = pSchedule->info.direction;
1696 pDot11f->reserved = pSchedule->info.rsvd;
1697 pDot11f->service_start_time = pSchedule->svcStartTime;
1698 pDot11f->service_interval = pSchedule->svcInterval;
1699 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1700 pDot11f->spec_interval = pSchedule->specInterval;
1701
1702 pDot11f->present = 1;
1703} // End PopulateDot11fWMMSchedule.
1704
1705tSirRetStatus
1706PopulateDot11fWPA(tpAniSirGlobal pMac,
1707 tpSirRSNie pRsnIe,
1708 tDot11fIEWPA *pDot11f)
1709{
1710 tANI_U32 status;
1711 int idx;
1712
1713 if ( pRsnIe->length )
1714 {
1715 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1716 {
1717 status = dot11fUnpackIeWPA( pMac,
1718 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1719 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1720 pDot11f );
1721 if ( DOT11F_FAILED( status ) )
1722 {
1723 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1724 "A (0x%08x).\n"),
1725 status );
1726 return eSIR_FAILURE;
1727 }
1728 }
1729 }
1730
1731 return eSIR_SUCCESS;
1732} // End PopulateDot11fWPA.
1733
1734
1735
1736tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1737 tpSirRSNie pRsnIe,
1738 tDot11fIEWPAOpaque *pDot11f )
1739{
1740 int idx;
1741
1742 if ( pRsnIe->length )
1743 {
1744 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1745 {
1746 pDot11f->present = 1;
1747 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
1748 palCopyMemory( pMac->hHdd, pDot11f->data,
1749 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1750 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1751 }
1752 }
1753
1754 return eSIR_SUCCESS;
1755
1756} // End PopulateDot11fWPAOpaque.
1757
1758////////////////////////////////////////////////////////////////////////
1759
1760tSirRetStatus
1761sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1762{
1763#if 0
1764 tANI_U32 val;
1765
1766 *caps = 0;
1767 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1768 != eSIR_SUCCESS)
1769 {
1770 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1771 return eSIR_FAILURE;
1772 }
1773 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1774 {
1775 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1776 return eSIR_FAILURE;
1777 }
1778
1779 *caps = (tANI_U16) val;
1780#endif
1781 return eSIR_SUCCESS;
1782}
1783
1784tSirRetStatus
1785sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1786 tANI_U8 *pFrame,
1787 tANI_U32 nFrame,
1788 tpSirProbeReq pProbeReq)
1789{
1790 tANI_U32 status;
1791 tDot11fProbeRequest pr;
1792
1793 // Ok, zero-init our [out] parameter,
1794 palZeroMemory( pMac->hHdd, (tANI_U8*)pProbeReq, sizeof(tSirProbeReq));
1795
1796 // delegate to the framesc-generated code,
1797 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1798 if ( DOT11F_FAILED( status ) )
1799 {
1800 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1801 status, nFrame);
1802 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1803 return eSIR_FAILURE;
1804 }
1805 else if ( DOT11F_WARNED( status ) )
1806 {
1807 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1808 status, nFrame );
1809 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1810 }
1811
1812 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1813 if ( ! pr.SSID.present )
1814 {
1815 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1816 }
1817 else
1818 {
1819 pProbeReq->ssidPresent = 1;
1820 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
1821 }
1822
1823 if ( ! pr.SuppRates.present )
1824 {
1825 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1826 return eSIR_FAILURE;
1827 }
1828 else
1829 {
1830 pProbeReq->suppRatesPresent = 1;
1831 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
1832 }
1833
1834 if ( pr.ExtSuppRates.present )
1835 {
1836 pProbeReq->extendedRatesPresent = 1;
1837 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
1838 }
1839
1840 if ( pr.HTCaps.present )
1841 {
1842 palCopyMemory( pMac, &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
1843 }
1844
1845 if ( pr.WscProbeReq.present )
1846 {
1847 pProbeReq->wscIePresent = 1;
1848 memcpy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
1849 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001850#ifdef WLAN_FEATURE_11AC
1851 if ( pr.VHTCaps.present )
1852 {
1853 palCopyMemory( pMac, &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
1854 }
1855#endif
1856
Jeff Johnson295189b2012-06-20 16:38:30 -07001857
1858 if ( pr.P2PProbeReq.present )
1859 {
1860 pProbeReq->p2pIePresent = 1;
1861 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001862
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 return eSIR_SUCCESS;
1864
1865} // End sirConvertProbeReqFrame2Struct.
1866
1867tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
1868 tANI_U8 *pFrame,
1869 tANI_U32 nFrame,
1870 tpSirProbeRespBeacon pProbeResp)
1871{
1872 tANI_U32 status;
1873 tDot11fProbeResponse pr;
1874
1875 // Ok, zero-init our [out] parameter,
1876 palZeroMemory( pMac->hHdd, ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon) );
1877 palZeroMemory( pMac->hHdd, ( tANI_U8* )&pr, sizeof(tDot11fProbeResponse) );
1878
1879
1880 // delegate to the framesc-generated code,
1881 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, &pr );
1882 if ( DOT11F_FAILED( status ) )
1883 {
1884 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
1885 status, nFrame);
1886 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1887 return eSIR_FAILURE;
1888 }
1889 else if ( DOT11F_WARNED( status ) )
1890 {
1891 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
1892 status, nFrame );
1893 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1894 }
1895
1896 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
1897
1898 // Timestamp
1899 palCopyMemory( pMac->hHdd, ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr.TimeStamp, sizeof(tSirMacTimeStamp) );
1900
1901 // Beacon Interval
1902 pProbeResp->beaconInterval = pr.BeaconInterval.interval;
1903
1904 // Capabilities
1905 pProbeResp->capabilityInfo.ess = pr.Capabilities.ess;
1906 pProbeResp->capabilityInfo.ibss = pr.Capabilities.ibss;
1907 pProbeResp->capabilityInfo.cfPollable = pr.Capabilities.cfPollable;
1908 pProbeResp->capabilityInfo.cfPollReq = pr.Capabilities.cfPollReq;
1909 pProbeResp->capabilityInfo.privacy = pr.Capabilities.privacy;
1910 pProbeResp->capabilityInfo.shortPreamble = pr.Capabilities.shortPreamble;
1911 pProbeResp->capabilityInfo.pbcc = pr.Capabilities.pbcc;
1912 pProbeResp->capabilityInfo.channelAgility = pr.Capabilities.channelAgility;
1913 pProbeResp->capabilityInfo.spectrumMgt = pr.Capabilities.spectrumMgt;
1914 pProbeResp->capabilityInfo.qos = pr.Capabilities.qos;
1915 pProbeResp->capabilityInfo.shortSlotTime = pr.Capabilities.shortSlotTime;
1916 pProbeResp->capabilityInfo.apsd = pr.Capabilities.apsd;
1917 pProbeResp->capabilityInfo.rrm = pr.Capabilities.rrm;
1918 pProbeResp->capabilityInfo.dsssOfdm = pr.Capabilities.dsssOfdm;
1919 pProbeResp->capabilityInfo.delayedBA = pr.Capabilities.delayedBA;
1920 pProbeResp->capabilityInfo.immediateBA = pr.Capabilities.immediateBA;
1921
1922 if ( ! pr.SSID.present )
1923 {
1924 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
1925 }
1926 else
1927 {
1928 pProbeResp->ssidPresent = 1;
1929 ConvertSSID( pMac, &pProbeResp->ssId, &pr.SSID );
1930 }
1931
1932 if ( ! pr.SuppRates.present )
1933 {
1934 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
1935 }
1936 else
1937 {
1938 pProbeResp->suppRatesPresent = 1;
1939 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr.SuppRates );
1940 }
1941
1942 if ( pr.ExtSuppRates.present )
1943 {
1944 pProbeResp->extendedRatesPresent = 1;
1945 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr.ExtSuppRates );
1946 }
1947
1948
1949 if ( pr.CFParams.present )
1950 {
1951 pProbeResp->cfPresent = 1;
1952 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr.CFParams );
1953 }
1954
1955 if ( pr.Country.present )
1956 {
1957 pProbeResp->countryInfoPresent = 1;
1958 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr.Country );
1959 }
1960
1961 if ( pr.EDCAParamSet.present )
1962 {
1963 pProbeResp->edcaPresent = 1;
1964 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr.EDCAParamSet );
1965 }
1966
1967 if ( pr.ChanSwitchAnn.present )
1968 {
1969 pProbeResp->channelSwitchPresent = 1;
1970 palCopyMemory( pMac, &pProbeResp->channelSwitchIE, &pr.ChanSwitchAnn,
1971 sizeof(tDot11fIEExtChanSwitchAnn) );
1972 }
1973
1974 if ( pr.ExtChanSwitchAnn.present )
1975 {
1976 pProbeResp->extChannelSwitchPresent = 1;
1977 palCopyMemory( pMac, &pProbeResp->extChannelSwitchIE, &pr.ExtChanSwitchAnn,
1978 sizeof(tDot11fIEExtChanSwitchAnn) );
1979 }
1980
1981 if( pr.TPCReport.present)
1982 {
1983 pProbeResp->tpcReportPresent = 1;
1984 palCopyMemory(pMac->hHdd, &pProbeResp->tpcReport, &pr.TPCReport, sizeof(tDot11fIETPCReport));
1985 }
1986
1987 if( pr.PowerConstraints.present)
1988 {
1989 pProbeResp->powerConstraintPresent = 1;
1990 palCopyMemory(pMac->hHdd, &pProbeResp->localPowerConstraint, &pr.PowerConstraints, sizeof(tDot11fIEPowerConstraints));
1991 }
1992
1993 if ( pr.Quiet.present )
1994 {
1995 pProbeResp->quietIEPresent = 1;
1996 palCopyMemory( pMac, &pProbeResp->quietIE, &pr.Quiet, sizeof(tDot11fIEQuiet) );
1997 }
1998
1999 if ( pr.HTCaps.present )
2000 {
2001 palCopyMemory( pMac, &pProbeResp->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
2002 }
2003
2004 if ( pr.HTInfo.present )
2005 {
2006 palCopyMemory( pMac, &pProbeResp->HTInfo, &pr.HTInfo, sizeof( tDot11fIEHTInfo ) );
2007 }
2008
2009 if ( pr.DSParams.present )
2010 {
2011 pProbeResp->dsParamsPresent = 1;
2012 pProbeResp->channelNumber = pr.DSParams.curr_channel;
2013 }
2014 else if(pr.HTInfo.present)
2015 {
2016 pProbeResp->channelNumber = pr.HTInfo.primaryChannel;
2017 }
2018
2019 if ( pr.RSN.present )
2020 {
2021 pProbeResp->rsnPresent = 1;
2022 ConvertRSN( pMac, &pProbeResp->rsn, &pr.RSN );
2023 }
2024
2025 if ( pr.WPA.present )
2026 {
2027 pProbeResp->wpaPresent = 1;
2028 ConvertWPA( pMac, &pProbeResp->wpa, &pr.WPA );
2029 }
2030
2031 if ( pr.WMMParams.present )
2032 {
2033 pProbeResp->wmeEdcaPresent = 1;
2034 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr.WMMParams );
2035 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
2036 __printWMMParams(pMac, &pr.WMMParams);)
2037 }
2038
2039 if ( pr.WMMInfoAp.present )
2040 {
2041 pProbeResp->wmeInfoPresent = 1;
2042 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2043 }
2044
2045 if ( pr.WMMCaps.present )
2046 {
2047 pProbeResp->wsmCapablePresent = 1;
2048 }
2049
2050
2051 if ( pr.ERPInfo.present )
2052 {
2053 pProbeResp->erpPresent = 1;
2054 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr.ERPInfo );
2055 }
2056
2057#ifdef WLAN_FEATURE_VOWIFI_11R
2058 if (pr.MobilityDomain.present)
2059 {
2060 // MobilityDomain
2061 pProbeResp->mdiePresent = 1;
2062 palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr.MobilityDomain.MDID), sizeof(tANI_U16) );
2063 pProbeResp->mdie[2] = ((pr.MobilityDomain.overDSCap << 0) | (pr.MobilityDomain.resourceReqCap << 1));
2064#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2065 limLog(pMac, LOGE, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
2066 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2067#endif
2068 }
2069#endif
2070
2071#if defined FEATURE_WLAN_CCX
2072 if (pr.QBSSLoad.present)
2073 {
2074 palCopyMemory(pMac->hHdd, &pProbeResp->QBSSLoad, &pr.QBSSLoad, sizeof(tDot11fIEQBSSLoad));
2075 }
2076#endif
2077#ifdef WLAN_FEATURE_P2P
2078 if (pr.P2PProbeRes.present)
2079 {
2080 palCopyMemory( pMac, &pProbeResp->P2PProbeRes, &pr.P2PProbeRes,
2081 sizeof(tDot11fIEP2PProbeRes) );
2082 }
2083#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002084#ifdef WLAN_FEATURE_11AC
2085 if ( pr.VHTCaps.present )
2086 {
2087 palCopyMemory( pMac, &pProbeResp->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
2088 }
2089 if ( pr.VHTOperation.present )
2090 {
2091 palCopyMemory( pMac, &pProbeResp->VHTOperation, &pr.VHTOperation, sizeof( tDot11fIEVHTOperation) );
2092 }
2093 if ( pr.VHTExtBssLoad.present )
2094 {
2095 palCopyMemory( pMac, &pProbeResp->VHTExtBssLoad, &pr.VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
2096 }
2097#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 return eSIR_SUCCESS;
2099
2100} // End sirConvertProbeFrame2Struct.
2101
2102tSirRetStatus
2103sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2104 tANI_U8 *pFrame,
2105 tANI_U32 nFrame,
2106 tpSirAssocReq pAssocReq)
2107{
2108 tDot11fAssocRequest ar;
2109 tANI_U32 status;
2110
2111 // Zero-init our [out] parameter,
2112 palZeroMemory( pMac->hHdd, ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq) );
2113 palZeroMemory( pMac->hHdd, ( tANI_U8* )&ar, sizeof( tDot11fAssocRequest ) );
2114
2115 // delegate to the framesc-generated code,
2116 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, &ar );
2117 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);)
2122 return eSIR_FAILURE;
2123 }
2124 else if ( DOT11F_WARNED( status ) )
2125 {
2126 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2127 status, nFrame );
2128 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2129 }
2130
2131 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2132
2133 // make sure this is seen as an assoc request
2134 pAssocReq->reassocRequest = 0;
2135
2136 // Capabilities
2137 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2138 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2139 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2140 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2141 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2142 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2143 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2144 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2145 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2146 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2147 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2148 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2149 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2150 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2151 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2152 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2153
2154 // Listen Interval
2155 pAssocReq->listenInterval = ar.ListenInterval.interval;
2156
2157 // SSID
2158 if ( ar.SSID.present )
2159 {
2160 pAssocReq->ssidPresent = 1;
2161 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2162 }
2163
2164 // Supported Rates
2165 if ( ar.SuppRates.present )
2166 {
2167 pAssocReq->suppRatesPresent = 1;
2168 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2169 }
2170
2171 // Extended Supported Rates
2172 if ( ar.ExtSuppRates.present )
2173 {
2174 pAssocReq->extendedRatesPresent = 1;
2175 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar.ExtSuppRates );
2176 }
2177
2178 // QOS Capabilities:
2179 if ( ar.QOSCapsStation.present )
2180 {
2181 pAssocReq->qosCapabilityPresent = 1;
2182 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2183 }
2184
2185 // WPA
2186 if ( ar.WPAOpaque.present )
2187 {
2188 pAssocReq->wpaPresent = 1;
2189 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2190 }
2191
2192 // RSN
2193 if ( ar.RSNOpaque.present )
2194 {
2195 pAssocReq->rsnPresent = 1;
2196 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2197 }
2198
2199 // WSC IE
2200 if (ar.WscIEOpaque.present)
2201 {
2202 pAssocReq->addIEPresent = 1;
2203 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2204 }
2205
2206
2207#ifdef WLAN_FEATURE_P2P
2208 if(ar.P2PIEOpaque.present)
2209 {
2210 pAssocReq->addIEPresent = 1;
2211 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2212 }
2213#endif
2214
Jeff Johnsone7245742012-09-05 17:12:55 -07002215#ifdef WLAN_FEATURE_WFD
2216 if(ar.WFDIEOpaque.present)
2217 {
2218 pAssocReq->addIEPresent = 1;
2219 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2220 }
2221#endif
2222
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 // Power Capabilities
2224 if ( ar.PowerCaps.present )
2225 {
2226 pAssocReq->powerCapabilityPresent = 1;
2227 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2228 }
2229
2230 // Supported Channels
2231 if ( ar.SuppChannels.present )
2232 {
2233 pAssocReq->supportedChannelsPresent = 1;
2234 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2235 }
2236
2237 if ( ar.HTCaps.present )
2238 {
2239 palCopyMemory( pMac, &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
2240 }
2241
2242 if ( ar.WMMInfoStation.present )
2243 {
2244 pAssocReq->wmeInfoPresent = 1;
2245#ifdef WLAN_SOFTAP_FEATURE
2246 palCopyMemory( pMac, &pAssocReq->WMMInfoStation, &ar.WMMInfoStation, sizeof( tDot11fIEWMMInfoStation ) );
2247#endif
2248
2249 }
2250
2251
2252 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2253
2254 if ( ! pAssocReq->ssidPresent )
2255 {
2256 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2257 return eSIR_FAILURE;
2258 }
2259
2260 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2261 {
2262 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2263 return eSIR_FAILURE;
2264 }
2265
Jeff Johnsone7245742012-09-05 17:12:55 -07002266#ifdef WLAN_FEATURE_11AC
2267 if ( ar.VHTCaps.present )
2268 {
2269 palCopyMemory( pMac, &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
2270 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2271 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2272 }
2273#endif
2274
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 return eSIR_SUCCESS;
2276
2277} // End sirConvertAssocReqFrame2Struct.
2278
2279tSirRetStatus
2280sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2281 tANI_U8 *pFrame,
2282 tANI_U32 nFrame,
2283 tpSirAssocRsp pAssocRsp)
2284{
2285 static tDot11fAssocResponse ar;
2286 tANI_U32 status;
2287 tANI_U8 cnt =0;
2288
2289 // Zero-init our [out] parameter,
2290 palZeroMemory( pMac->hHdd, ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp) );
2291
2292 // delegate to the framesc-generated code,
2293 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2294 if ( DOT11F_FAILED( status ) )
2295 {
2296 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2297 status, nFrame);
2298 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2299 return eSIR_FAILURE;
2300 }
2301 else if ( DOT11F_WARNED( status ) )
2302 {
2303 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2304 status, nFrame );
2305 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2306 }
2307
2308 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2309
2310 // Capabilities
2311 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2312 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2313 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2314 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2315 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2316 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2317 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2318 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2319 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2320 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2321 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2322 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2323 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2324 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2325 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2326 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2327
2328 pAssocRsp->statusCode = ar.Status.status;
2329 pAssocRsp->aid = ar.AID.associd;
2330
2331 if ( ! ar.SuppRates.present )
2332 {
2333 pAssocRsp->suppRatesPresent = 0;
2334 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2335 }
2336 else
2337 {
2338 pAssocRsp->suppRatesPresent = 1;
2339 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2340 }
2341
2342 if ( ar.ExtSuppRates.present )
2343 {
2344 pAssocRsp->extendedRatesPresent = 1;
2345 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2346 }
2347
2348 if ( ar.EDCAParamSet.present )
2349 {
2350 pAssocRsp->edcaPresent = 1;
2351 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2352 }
2353
2354
2355 if ( ar.WMMParams.present )
2356 {
2357 pAssocRsp->wmeEdcaPresent = 1;
2358 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
2359 limLog(pMac, LOGE, FL("WMM Parameter Element present in Association Response Frame!\n"));
2360 __printWMMParams(pMac, &ar.WMMParams);
2361 }
2362
2363 if ( ar.HTCaps.present )
2364 {
2365 palCopyMemory( pMac, &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
2366 }
2367
2368 if ( ar.HTInfo.present )
2369 {
2370 palCopyMemory( pMac, &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
2371 }
2372
2373#ifdef WLAN_FEATURE_VOWIFI_11R
2374 if (ar.MobilityDomain.present)
2375 {
2376 // MobilityDomain
2377 pAssocRsp->mdiePresent = 1;
2378 palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID), sizeof(tANI_U16) );
2379 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2380#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2381 limLog(pMac, LOGE, FL("new mdie=%02x%02x%02x\n"), (unsigned int)pAssocRsp->mdie[0],
2382 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2383#endif
2384 }
2385
2386 if ( ar.FTInfo.present )
2387 {
2388#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2389 limLog(pMac, LOGE, FL("FT Info present %d %d %d\n"), ar.FTInfo.R0KH_ID.num_PMK_R0_ID,
2390 ar.FTInfo.R0KH_ID.present,
2391 ar.FTInfo.R1KH_ID.present);
2392#endif
2393 pAssocRsp->ftinfoPresent = 1;
2394 palCopyMemory( pMac, &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
2395 }
2396#endif
2397
2398#ifdef WLAN_FEATURE_VOWIFI_11R
2399 if (ar.num_RICDataDesc) {
2400 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2401 if (ar.RICDataDesc[cnt].present) {
2402 palCopyMemory(pMac, &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt], sizeof(tDot11fIERICDataDesc));
2403 }
2404 }
2405 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2406 pAssocRsp->ricPresent = TRUE;
2407 }
2408#endif
2409
2410#ifdef FEATURE_WLAN_CCX
2411 if (ar.num_WMMTSPEC) {
2412 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2413 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
2414 palCopyMemory(pMac, &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt], (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
2415 }
2416 pAssocRsp->tspecPresent = TRUE;
2417 }
2418
2419 if(ar.CCXTrafStrmMet.present)
2420 {
2421 pAssocRsp->tsmPresent = 1;
2422 palCopyMemory(pMac->hHdd,&pAssocRsp->tsmIE.tsid,
2423 &ar.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
2424 }
2425#endif
2426
Jeff Johnsone7245742012-09-05 17:12:55 -07002427#ifdef WLAN_FEATURE_11AC
2428 if ( ar.VHTCaps.present )
2429 {
2430 palCopyMemory( pMac, &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
2431 limLog( pMac, LOGW, FL("Received Assoc Response with VHT Cap\n"));
2432 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2433 }
2434 if ( ar.VHTOperation.present )
2435 {
2436 palCopyMemory( pMac, &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
2437 limLog( pMac, LOGW, FL("Received Assoc Response with VHT Operation\n"));
2438 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2439 }
2440#endif
2441
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 return eSIR_SUCCESS;
2443
2444} // End sirConvertAssocRespFrame2Struct.
2445
2446tSirRetStatus
2447sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2448 tANI_U8 *pFrame,
2449 tANI_U32 nFrame,
2450 tpSirAssocReq pAssocReq)
2451{
2452 static tDot11fReAssocRequest ar;
2453 tANI_U32 status;
2454
2455 // Zero-init our [out] parameter,
2456 palZeroMemory( pMac->hHdd, ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq) );
2457
2458 // delegate to the framesc-generated code,
2459 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2460 if ( DOT11F_FAILED( status ) )
2461 {
2462 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2463 status, nFrame);
2464 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2465 return eSIR_FAILURE;
2466 }
2467 else if ( DOT11F_WARNED( status ) )
2468 {
2469 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2470 status, nFrame );
2471 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2472 }
2473
2474 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2475
2476 // make sure this is seen as a re-assoc request
2477 pAssocReq->reassocRequest = 1;
2478
2479 // Capabilities
2480 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2481 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2482 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2483 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2484 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2485 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2486 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2487 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2488 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2489 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2490 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2491 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2492 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2493 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2494 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2495 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2496
2497 // Listen Interval
2498 pAssocReq->listenInterval = ar.ListenInterval.interval;
2499
2500 // SSID
2501 if ( ar.SSID.present )
2502 {
2503 pAssocReq->ssidPresent = 1;
2504 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2505 }
2506
2507 // Supported Rates
2508 if ( ar.SuppRates.present )
2509 {
2510 pAssocReq->suppRatesPresent = 1;
2511 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2512 }
2513
2514 // Extended Supported Rates
2515 if ( ar.ExtSuppRates.present )
2516 {
2517 pAssocReq->extendedRatesPresent = 1;
2518 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2519 &ar.ExtSuppRates );
2520 }
2521
2522 // QOS Capabilities:
2523 if ( ar.QOSCapsStation.present )
2524 {
2525 pAssocReq->qosCapabilityPresent = 1;
2526 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2527 }
2528
2529 // WPA
2530 if ( ar.WPAOpaque.present )
2531 {
2532 pAssocReq->wpaPresent = 1;
2533 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2534 }
2535
2536 // RSN
2537 if ( ar.RSNOpaque.present )
2538 {
2539 pAssocReq->rsnPresent = 1;
2540 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2541 }
2542
2543
2544 // Power Capabilities
2545 if ( ar.PowerCaps.present )
2546 {
2547 pAssocReq->powerCapabilityPresent = 1;
2548 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2549 }
2550
2551 // Supported Channels
2552 if ( ar.SuppChannels.present )
2553 {
2554 pAssocReq->supportedChannelsPresent = 1;
2555 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2556 }
2557
2558 if ( ar.HTCaps.present )
2559 {
2560 palCopyMemory( pMac, &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
2561 }
2562
2563 if ( ar.WMMInfoStation.present )
2564 {
2565 pAssocReq->wmeInfoPresent = 1;
2566#ifdef WLAN_SOFTAP_FEATURE
2567 palCopyMemory( pMac, &pAssocReq->WMMInfoStation, &ar.WMMInfoStation, sizeof( tDot11fIEWMMInfoStation ) );
2568#endif
2569
2570 }
2571
2572 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2573
2574 if ( ! pAssocReq->ssidPresent )
2575 {
2576 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2577 return eSIR_FAILURE;
2578 }
2579
2580 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2581 {
2582 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2583 return eSIR_FAILURE;
2584 }
2585
2586 // Why no call to 'updateAssocReqFromPropCapability' here, like
2587 // there is in 'sirConvertAssocReqFrame2Struct'?
2588
2589 // WSC IE
2590 if (ar.WscIEOpaque.present)
2591 {
2592 pAssocReq->addIEPresent = 1;
2593 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2594 }
2595
2596#ifdef WLAN_FEATURE_P2P
2597 if(ar.P2PIEOpaque.present)
2598 {
2599 pAssocReq->addIEPresent = 1;
2600 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2601 }
2602#endif
2603
Jeff Johnsone7245742012-09-05 17:12:55 -07002604#ifdef WLAN_FEATURE_WFD
2605 if(ar.WFDIEOpaque.present)
2606 {
2607 pAssocReq->addIEPresent = 1;
2608 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2609 }
2610#endif
2611
2612#ifdef WLAN_FEATURE_11AC
2613 if ( ar.VHTCaps.present )
2614 {
2615 palCopyMemory( pMac, &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
2616 }
2617#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 return eSIR_SUCCESS;
2619
2620} // End sirConvertReassocReqFrame2Struct.
2621
2622tSirRetStatus
2623sirParseBeaconIE(tpAniSirGlobal pMac,
2624 tpSirProbeRespBeacon pBeaconStruct,
2625 tANI_U8 *pPayload,
2626 tANI_U32 nPayload)
2627{
2628 tDot11fBeaconIEs *pBies;
2629 tANI_U32 status;
2630
2631 // Zero-init our [out] parameter,
2632 palZeroMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon) );
2633
2634 status = palAllocateMemory(pMac->hHdd, (void **)&pBies, sizeof(tDot11fBeaconIEs));
2635 if(!HAL_STATUS_SUCCESS(status))
2636 {
2637 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2638 return eSIR_FAILURE;
2639 }
2640 // delegate to the framesc-generated code,
2641 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2642
2643 if ( DOT11F_FAILED( status ) )
2644 {
2645 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2646 status, nPayload);
2647 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2648 palFreeMemory(pMac->hHdd, pBies);
2649 return eSIR_FAILURE;
2650 }
2651 else if ( DOT11F_WARNED( status ) )
2652 {
2653 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2654 status, nPayload );
2655 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2656 }
2657
2658 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
2659 if ( ! pBies->SSID.present )
2660 {
2661 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2662 }
2663 else
2664 {
2665 pBeaconStruct->ssidPresent = 1;
2666 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
2667 }
2668
2669 if ( ! pBies->SuppRates.present )
2670 {
2671 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2672 }
2673 else
2674 {
2675 pBeaconStruct->suppRatesPresent = 1;
2676 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
2677 }
2678
2679 if ( pBies->ExtSuppRates.present )
2680 {
2681 pBeaconStruct->extendedRatesPresent = 1;
2682 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
2683 }
2684
2685 if ( pBies->CFParams.present )
2686 {
2687 pBeaconStruct->cfPresent = 1;
2688 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
2689 }
2690
2691 if ( pBies->TIM.present )
2692 {
2693 pBeaconStruct->timPresent = 1;
2694 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
2695 }
2696
2697 if ( pBies->Country.present )
2698 {
2699 pBeaconStruct->countryInfoPresent = 1;
2700 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
2701 }
2702
2703 // 11h IEs
2704 if(pBies->TPCReport.present)
2705 {
2706 pBeaconStruct->tpcReportPresent = 1;
2707 palCopyMemory(pMac,
2708 &pBeaconStruct->tpcReport,
2709 &pBies->TPCReport,
2710 sizeof( tDot11fIETPCReport));
2711 }
2712
2713 if(pBies->PowerConstraints.present)
2714 {
2715 pBeaconStruct->powerConstraintPresent = 1;
2716 palCopyMemory(pMac,
2717 &pBeaconStruct->localPowerConstraint,
2718 &pBies->PowerConstraints,
2719 sizeof(tDot11fIEPowerConstraints));
2720 }
2721#ifdef FEATURE_WLAN_CCX
2722 if(pBies->CCXTxmitPower.present)
2723 {
2724 pBeaconStruct->ccxTxPwr.present = 1;
2725 pBeaconStruct->ccxTxPwr.power_limit = pBies->CCXTxmitPower.power_limit;
2726 }
2727 if (pBies->QBSSLoad.present)
2728 {
2729 palCopyMemory(pMac->hHdd, &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
2730 }
2731#endif
2732
2733 if ( pBies->EDCAParamSet.present )
2734 {
2735 pBeaconStruct->edcaPresent = 1;
2736 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
2737 }
2738
2739 // QOS Capabilities:
2740 if ( pBies->QOSCapsAp.present )
2741 {
2742 pBeaconStruct->qosCapabilityPresent = 1;
2743 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
2744 }
2745
2746
2747
2748 if ( pBies->ChanSwitchAnn.present )
2749 {
2750 pBeaconStruct->channelSwitchPresent = 1;
2751 palCopyMemory(pMac->hHdd, &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
2752 sizeof(tDot11fIEChanSwitchAnn));
2753 }
2754
2755 if ( pBies->ExtChanSwitchAnn.present)
2756 {
2757 pBeaconStruct->extChannelSwitchPresent= 1;
2758 palCopyMemory(pMac->hHdd, &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
2759 sizeof(tDot11fIEExtChanSwitchAnn));
2760 }
2761
2762 if ( pBies->Quiet.present )
2763 {
2764 pBeaconStruct->quietIEPresent = 1;
2765 palCopyMemory( pMac, &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
2766 }
2767
2768 if ( pBies->HTCaps.present )
2769 {
2770 palCopyMemory( pMac, &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
2771 }
2772
2773 if ( pBies->HTInfo.present )
2774 {
2775 palCopyMemory( pMac, &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
2776 }
2777
2778 if ( pBies->DSParams.present )
2779 {
2780 pBeaconStruct->dsParamsPresent = 1;
2781 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
2782 }
2783 else if(pBies->HTInfo.present)
2784 {
2785 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
2786 }
2787
2788 if ( pBies->RSN.present )
2789 {
2790 pBeaconStruct->rsnPresent = 1;
2791 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
2792 }
2793
2794 if ( pBies->WPA.present )
2795 {
2796 pBeaconStruct->wpaPresent = 1;
2797 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
2798 }
2799
2800 if ( pBies->WMMParams.present )
2801 {
2802 pBeaconStruct->wmeEdcaPresent = 1;
2803 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
2804 }
2805
2806 if ( pBies->WMMInfoAp.present )
2807 {
2808 pBeaconStruct->wmeInfoPresent = 1;
2809 }
2810
2811 if ( pBies->WMMCaps.present )
2812 {
2813 pBeaconStruct->wsmCapablePresent = 1;
2814 }
2815
2816
2817 if ( pBies->ERPInfo.present )
2818 {
2819 pBeaconStruct->erpPresent = 1;
2820 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
2821 }
2822
Jeff Johnsone7245742012-09-05 17:12:55 -07002823#ifdef WLAN_FEATURE_11AC
2824 if ( pBies->VHTCaps.present )
2825 {
2826 pBeaconStruct->VHTCaps.present = 1;
2827 palCopyMemory( pMac, &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
2828 }
2829 if ( pBies->VHTOperation.present )
2830 {
2831 pBeaconStruct->VHTOperation.present = 1;
2832 palCopyMemory( pMac, &pBeaconStruct->VHTOperation, &pBies->VHTOperation, sizeof( tDot11fIEVHTOperation) );
2833 }
2834 if ( pBies->VHTExtBssLoad.present )
2835 {
2836 pBeaconStruct->VHTExtBssLoad.present = 1;
2837 palCopyMemory( pMac, &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
2838 }
2839#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002840 palFreeMemory(pMac->hHdd, pBies);
2841
Jeff Johnsone7245742012-09-05 17:12:55 -07002842
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 return eSIR_SUCCESS;
2844
2845} // End sirParseBeaconIE.
2846
2847tSirRetStatus
2848sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
2849 tANI_U8 *pFrame,
2850 tpSirProbeRespBeacon pBeaconStruct)
2851{
2852 tDot11fBeacon beacon;
2853 tANI_U32 status, nPayload;
2854 tANI_U8 *pPayload;
2855 tpSirMacMgmtHdr pHdr;
2856 tANI_U8 mappedRXCh;
2857
2858 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
2859 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
2860 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
2861 mappedRXCh = WDA_GET_RX_CH( pFrame );
2862
2863 // Zero-init our [out] parameter,
2864 palZeroMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon) );
2865 palZeroMemory( pMac->hHdd, ( tANI_U8* )&beacon, sizeof(tDot11fBeacon) );
2866
2867 // get the MAC address out of the BD,
2868 palCopyMemory( pMac->hHdd, pBeaconStruct->bssid, pHdr->sa, 6 );
2869
2870 // delegate to the framesc-generated code,
2871 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, &beacon );
2872 if ( DOT11F_FAILED( status ) )
2873 {
2874 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2875 status, nPayload);
2876 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2877 return eSIR_FAILURE;
2878 }
2879 else if ( DOT11F_WARNED( status ) )
2880 {
2881 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2882 status, nPayload );
2883 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2884 }
2885
2886 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
2887 // Timestamp
2888 palCopyMemory( pMac->hHdd, ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&beacon.TimeStamp, sizeof(tSirMacTimeStamp) );
2889
2890 // Beacon Interval
2891 pBeaconStruct->beaconInterval = beacon.BeaconInterval.interval;
2892
2893 // Capabilities
2894 pBeaconStruct->capabilityInfo.ess = beacon.Capabilities.ess;
2895 pBeaconStruct->capabilityInfo.ibss = beacon.Capabilities.ibss;
2896 pBeaconStruct->capabilityInfo.cfPollable = beacon.Capabilities.cfPollable;
2897 pBeaconStruct->capabilityInfo.cfPollReq = beacon.Capabilities.cfPollReq;
2898 pBeaconStruct->capabilityInfo.privacy = beacon.Capabilities.privacy;
2899 pBeaconStruct->capabilityInfo.shortPreamble = beacon.Capabilities.shortPreamble;
2900 pBeaconStruct->capabilityInfo.pbcc = beacon.Capabilities.pbcc;
2901 pBeaconStruct->capabilityInfo.channelAgility = beacon.Capabilities.channelAgility;
2902 pBeaconStruct->capabilityInfo.spectrumMgt = beacon.Capabilities.spectrumMgt;
2903 pBeaconStruct->capabilityInfo.qos = beacon.Capabilities.qos;
2904 pBeaconStruct->capabilityInfo.shortSlotTime = beacon.Capabilities.shortSlotTime;
2905 pBeaconStruct->capabilityInfo.apsd = beacon.Capabilities.apsd;
2906 pBeaconStruct->capabilityInfo.rrm = beacon.Capabilities.rrm;
2907 pBeaconStruct->capabilityInfo.dsssOfdm = beacon.Capabilities.dsssOfdm;
2908 pBeaconStruct->capabilityInfo.delayedBA = beacon.Capabilities.delayedBA;
2909 pBeaconStruct->capabilityInfo.immediateBA = beacon.Capabilities.immediateBA;
2910
2911 if ( ! beacon.SSID.present )
2912 {
2913 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2914 }
2915 else
2916 {
2917 pBeaconStruct->ssidPresent = 1;
2918 ConvertSSID( pMac, &pBeaconStruct->ssId, &beacon.SSID );
2919 }
2920
2921 if ( ! beacon.SuppRates.present )
2922 {
2923 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2924 }
2925 else
2926 {
2927 pBeaconStruct->suppRatesPresent = 1;
2928 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &beacon.SuppRates );
2929 }
2930
2931 if ( beacon.ExtSuppRates.present )
2932 {
2933 pBeaconStruct->extendedRatesPresent = 1;
2934 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &beacon.ExtSuppRates );
2935 }
2936
2937
2938 if ( beacon.CFParams.present )
2939 {
2940 pBeaconStruct->cfPresent = 1;
2941 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &beacon.CFParams );
2942 }
2943
2944 if ( beacon.TIM.present )
2945 {
2946 pBeaconStruct->timPresent = 1;
2947 ConvertTIM( pMac, &pBeaconStruct->tim, &beacon.TIM );
2948 }
2949
2950 if ( beacon.Country.present )
2951 {
2952 pBeaconStruct->countryInfoPresent = 1;
2953 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &beacon.Country );
2954 }
2955
2956 // QOS Capabilities:
2957 if ( beacon.QOSCapsAp.present )
2958 {
2959 pBeaconStruct->qosCapabilityPresent = 1;
2960 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &beacon.QOSCapsAp );
2961 }
2962
2963 if ( beacon.EDCAParamSet.present )
2964 {
2965 pBeaconStruct->edcaPresent = 1;
2966 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &beacon.EDCAParamSet );
2967 }
2968
2969 if ( beacon.ChanSwitchAnn.present )
2970 {
2971 pBeaconStruct->channelSwitchPresent = 1;
2972 palCopyMemory( pMac, &pBeaconStruct->channelSwitchIE, &beacon.ChanSwitchAnn,
2973 sizeof(tDot11fIEChanSwitchAnn) );
2974 }
2975
2976 if ( beacon.ExtChanSwitchAnn.present )
2977 {
2978 pBeaconStruct->extChannelSwitchPresent = 1;
2979 palCopyMemory( pMac, &pBeaconStruct->extChannelSwitchIE, &beacon.ExtChanSwitchAnn,
2980 sizeof(tDot11fIEExtChanSwitchAnn) );
2981 }
2982
2983 if( beacon.TPCReport.present)
2984 {
2985 pBeaconStruct->tpcReportPresent = 1;
2986 palCopyMemory(pMac->hHdd, &pBeaconStruct->tpcReport, &beacon.TPCReport,
2987 sizeof(tDot11fIETPCReport));
2988 }
2989
2990 if( beacon.PowerConstraints.present)
2991 {
2992 pBeaconStruct->powerConstraintPresent = 1;
2993 palCopyMemory(pMac->hHdd, &pBeaconStruct->localPowerConstraint, &beacon.PowerConstraints,
2994 sizeof(tDot11fIEPowerConstraints));
2995 }
2996#if defined FEATURE_WLAN_CCX
2997 if (beacon.CCXTxmitPower.present)
2998 {
2999 palCopyMemory(pMac->hHdd, &pBeaconStruct->ccxTxPwr, &beacon.CCXTxmitPower,
3000 sizeof(tDot11fIECCXTxmitPower));
3001 }
3002 if (beacon.QBSSLoad.present)
3003 {
3004 palCopyMemory(pMac->hHdd, &pBeaconStruct->QBSSLoad, &beacon.QBSSLoad, sizeof(tDot11fIEQBSSLoad));
3005 }
3006#endif
3007 if ( beacon.Quiet.present )
3008 {
3009 pBeaconStruct->quietIEPresent = 1;
3010 palCopyMemory( pMac, &pBeaconStruct->quietIE, &beacon.Quiet, sizeof(tDot11fIEQuiet));
3011 }
3012
3013 if ( beacon.HTCaps.present )
3014 {
3015 palCopyMemory( pMac, &pBeaconStruct->HTCaps, &beacon.HTCaps, sizeof( tDot11fIEHTCaps ) );
3016 }
3017
3018 if ( beacon.HTInfo.present )
3019 {
3020 palCopyMemory( pMac, &pBeaconStruct->HTInfo, &beacon.HTInfo, sizeof( tDot11fIEHTInfo) );
3021
3022 }
3023
3024 if ( beacon.DSParams.present )
3025 {
3026 pBeaconStruct->dsParamsPresent = 1;
3027 pBeaconStruct->channelNumber = beacon.DSParams.curr_channel;
3028 }
3029 else if(beacon.HTInfo.present)
3030 {
3031 pBeaconStruct->channelNumber = beacon.HTInfo.primaryChannel;
3032 }
3033 else
3034 {
3035 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3036 }
3037
3038 if ( beacon.RSN.present )
3039 {
3040 pBeaconStruct->rsnPresent = 1;
3041 ConvertRSN( pMac, &pBeaconStruct->rsn, &beacon.RSN );
3042 }
3043
3044 if ( beacon.WPA.present )
3045 {
3046 pBeaconStruct->wpaPresent = 1;
3047 ConvertWPA( pMac, &pBeaconStruct->wpa, &beacon.WPA );
3048 }
3049
3050 if ( beacon.WMMParams.present )
3051 {
3052 pBeaconStruct->wmeEdcaPresent = 1;
3053 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &beacon.WMMParams );
3054 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
3055 __printWMMParams(pMac, &beacon.WMMParams); )
3056 }
3057
3058 if ( beacon.WMMInfoAp.present )
3059 {
3060 pBeaconStruct->wmeInfoPresent = 1;
3061 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3062 }
3063
3064 if ( beacon.WMMCaps.present )
3065 {
3066 pBeaconStruct->wsmCapablePresent = 1;
3067 }
3068
3069 if ( beacon.ERPInfo.present )
3070 {
3071 pBeaconStruct->erpPresent = 1;
3072 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &beacon.ERPInfo );
3073 }
3074
3075#ifdef WLAN_FEATURE_VOWIFI_11R
3076 if (beacon.MobilityDomain.present)
3077 {
3078 // MobilityDomain
3079 pBeaconStruct->mdiePresent = 1;
3080 palCopyMemory( pMac->hHdd, (tANI_U8 *)&(pBeaconStruct->mdie[0]), (tANI_U8 *)&(beacon.MobilityDomain.MDID), sizeof(tANI_U16) );
3081 pBeaconStruct->mdie[2] = ((beacon.MobilityDomain.overDSCap << 0) | (beacon.MobilityDomain.resourceReqCap << 1));
3082
3083 }
3084#endif
3085
Jeff Johnsone7245742012-09-05 17:12:55 -07003086#ifdef WLAN_FEATURE_11AC
3087 if ( beacon.VHTCaps.present )
3088 {
3089 palCopyMemory( pMac, &pBeaconStruct->VHTCaps, &beacon.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
3090 }
3091 if ( beacon.VHTOperation.present )
3092 {
3093 palCopyMemory( pMac, &pBeaconStruct->VHTOperation, &beacon.VHTOperation, sizeof( tDot11fIEVHTOperation) );
3094 }
3095 if ( beacon.VHTExtBssLoad.present )
3096 {
3097 palCopyMemory( pMac, &pBeaconStruct->VHTExtBssLoad, &beacon.VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
3098 }
3099#endif
3100
Jeff Johnson295189b2012-06-20 16:38:30 -07003101 return eSIR_SUCCESS;
3102
3103} // End sirConvertBeaconFrame2Struct.
3104
3105tSirRetStatus
3106sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3107 tANI_U8 *pFrame,
3108 tANI_U32 nFrame,
3109 tpSirMacAuthFrameBody pAuth)
3110{
3111 static tDot11fAuthentication auth;
3112 tANI_U32 status;
3113
3114 // Zero-init our [out] parameter,
3115 palZeroMemory( pMac->hHdd, ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody) );
3116
3117 // delegate to the framesc-generated code,
3118 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3119 if ( DOT11F_FAILED( status ) )
3120 {
3121 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3122 status, nFrame);
3123 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3124 return eSIR_FAILURE;
3125 }
3126 else if ( DOT11F_WARNED( status ) )
3127 {
3128 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3129 status, nFrame );
3130 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3131 }
3132
3133 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3134 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3135 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3136 pAuth->authStatusCode = auth.Status.status;
3137
3138 if ( auth.ChallengeText.present )
3139 {
3140 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3141 pAuth->length = auth.ChallengeText.num_text;
3142 palCopyMemory( pMac->hHdd, pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
3143 }
3144
3145 return eSIR_SUCCESS;
3146
3147} // End sirConvertAuthFrame2Struct.
3148
3149tSirRetStatus
3150sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3151 tANI_U8 *pFrame,
3152 tANI_U32 nFrame,
3153 tSirAddtsReqInfo *pAddTs)
3154{
3155 tDot11fAddTSRequest addts = {{0}};
3156 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3157 tANI_U8 j;
3158 tANI_U16 i;
3159 tANI_U32 status;
3160
3161 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3162 {
3163 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3164 "with an Action of %d; this is not "
3165 "supported & is probably an error."),
3166 *( pFrame + 1 ) );
3167 return eSIR_FAILURE;
3168 }
3169
3170 // Zero-init our [out] parameter,
3171 palZeroMemory( pMac->hHdd, ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo) );
3172
3173 // delegate to the framesc-generated code,
3174 switch ( *pFrame )
3175 {
3176 case SIR_MAC_ACTION_QOS_MGMT:
3177 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3178 break;
3179 case SIR_MAC_ACTION_WME:
3180 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3181 break;
3182 default:
3183 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3184 "with a Category of %d; this is not"
3185 " supported & is probably an error."),
3186 *pFrame );
3187 return eSIR_FAILURE;
3188 }
3189
3190 if ( DOT11F_FAILED( status ) )
3191 {
3192 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3193 "rame (0x%08x, %d bytes):\n"),
3194 status, nFrame);
3195 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3196 return eSIR_FAILURE;
3197 }
3198 else if ( DOT11F_WARNED( status ) )
3199 {
3200 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3201 "g an Add TS Request frame (0x%08x,"
3202 "%d bytes):\n"),
3203 status, nFrame );
3204 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3205 }
3206
3207 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3208 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3209 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3210 {
3211 pAddTs->dialogToken = addts.DialogToken.token;
3212
3213 if ( addts.TSPEC.present )
3214 {
3215 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3216 }
3217 else
3218 {
3219 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3220 return eSIR_FAILURE;
3221 }
3222
3223 if ( addts.num_TCLAS )
3224 {
3225 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3226
3227 for ( i = 0U; i < addts.num_TCLAS; ++i )
3228 {
3229 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3230 {
3231 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3232 return eSIR_FAILURE;
3233 }
3234 }
3235 }
3236
3237 if ( addts.TCLASSPROC.present )
3238 {
3239 pAddTs->tclasProcPresent = 1;
3240 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3241 }
3242
3243 if ( addts.WMMTSPEC.present )
3244 {
3245 pAddTs->wsmTspecPresent = 1;
3246 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3247 }
3248
3249 if ( addts.num_WMMTCLAS )
3250 {
3251 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3252 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3253
3254 for ( i = pAddTs->numTclas; i < j; ++i )
3255 {
3256 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3257 {
3258 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3259 return eSIR_FAILURE;
3260 }
3261 }
3262 }
3263
3264 if ( addts.WMMTCLASPROC.present )
3265 {
3266 pAddTs->tclasProcPresent = 1;
3267 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3268 }
3269
3270 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3271 {
3272 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3273 pAddTs->numTclas );
3274 return eSIR_FAILURE;
3275 }
3276 }
3277 else
3278 {
3279 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3280
3281 if ( wmmaddts.WMMTSPEC.present )
3282 {
3283 pAddTs->wmeTspecPresent = 1;
3284 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3285 }
3286 else
3287 {
3288 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3289 return eSIR_FAILURE;
3290 }
3291 }
3292
3293 return eSIR_SUCCESS;
3294
3295} // End sirConvertAddtsReq2Struct.
3296
3297tSirRetStatus
3298sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3299 tANI_U8 *pFrame,
3300 tANI_U32 nFrame,
3301 tSirAddtsRspInfo *pAddTs)
3302{
3303 tDot11fAddTSResponse addts = {{0}};
3304 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3305 tANI_U8 j;
3306 tANI_U16 i;
3307 tANI_U32 status;
3308
3309 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3310 {
3311 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3312 "with an Action of %d; this is not "
3313 "supported & is probably an error."),
3314 *( pFrame + 1 ) );
3315 return eSIR_FAILURE;
3316 }
3317
3318 // Zero-init our [out] parameter,
3319 palZeroMemory( pMac->hHdd, ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo) );
3320 palZeroMemory( pMac->hHdd, ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse) );
3321 palZeroMemory( pMac->hHdd, ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse) );
3322
3323
3324 // delegate to the framesc-generated code,
3325 switch ( *pFrame )
3326 {
3327 case SIR_MAC_ACTION_QOS_MGMT:
3328 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3329 break;
3330 case SIR_MAC_ACTION_WME:
3331 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3332 break;
3333 default:
3334 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3335 "with a Category of %d; this is not"
3336 " supported & is probably an error."),
3337 *pFrame );
3338 return eSIR_FAILURE;
3339 }
3340
3341 if ( DOT11F_FAILED( status ) )
3342 {
3343 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
3344 "rame (0x%08x, %d bytes):\n"),
3345 status, nFrame);
3346 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3347 return eSIR_FAILURE;
3348 }
3349 else if ( DOT11F_WARNED( status ) )
3350 {
3351 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3352 "g an Add TS Response frame (0x%08x,"
3353 "%d bytes):\n"),
3354 status, nFrame );
3355 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3356 }
3357
3358 // & "transliterate" from a 'tDot11fAddTSResponse' or a
3359 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
3360 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3361 {
3362 pAddTs->dialogToken = addts.DialogToken.token;
3363 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
3364
3365 if ( addts.TSDelay.present )
3366 {
3367 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
3368 }
3369
3370 // TS Delay is present iff status indicates its presence
3371 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
3372 {
3373 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
3374 }
3375
3376 if ( addts.TSPEC.present )
3377 {
3378 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3379 }
3380 else
3381 {
3382 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
3383 return eSIR_FAILURE;
3384 }
3385
3386 if ( addts.num_TCLAS )
3387 {
3388 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3389
3390 for ( i = 0U; i < addts.num_TCLAS; ++i )
3391 {
3392 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3393 {
3394 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3395 return eSIR_FAILURE;
3396 }
3397 }
3398 }
3399
3400 if ( addts.TCLASSPROC.present )
3401 {
3402 pAddTs->tclasProcPresent = 1;
3403 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3404 }
3405#ifdef FEATURE_WLAN_CCX
3406 if(addts.CCXTrafStrmMet.present)
3407 {
3408 pAddTs->tsmPresent = 1;
3409 palCopyMemory(pMac->hHdd,&pAddTs->tsmIE.tsid,
3410 &addts.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
3411 }
3412#endif
3413 if ( addts.Schedule.present )
3414 {
3415 pAddTs->schedulePresent = 1;
3416 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
3417 }
3418
3419 if ( addts.WMMSchedule.present )
3420 {
3421 pAddTs->schedulePresent = 1;
3422 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
3423 }
3424
3425 if ( addts.WMMTSPEC.present )
3426 {
3427 pAddTs->wsmTspecPresent = 1;
3428 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3429 }
3430
3431 if ( addts.num_WMMTCLAS )
3432 {
3433 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3434 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3435
3436 for ( i = pAddTs->numTclas; i < j; ++i )
3437 {
3438 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3439 {
3440 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3441 return eSIR_FAILURE;
3442 }
3443 }
3444 }
3445
3446 if ( addts.WMMTCLASPROC.present )
3447 {
3448 pAddTs->tclasProcPresent = 1;
3449 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3450 }
3451
3452 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3453 {
3454 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3455 pAddTs->numTclas );
3456 return eSIR_FAILURE;
3457 }
3458 }
3459 else
3460 {
3461 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3462 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
3463
3464 if ( wmmaddts.WMMTSPEC.present )
3465 {
3466 pAddTs->wmeTspecPresent = 1;
3467 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3468 }
3469 else
3470 {
3471 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3472 return eSIR_FAILURE;
3473 }
3474
3475#ifdef FEATURE_WLAN_CCX
3476 if(wmmaddts.CCXTrafStrmMet.present)
3477 {
3478 pAddTs->tsmPresent = 1;
3479 palCopyMemory(pMac->hHdd,&pAddTs->tsmIE.tsid,
3480 &wmmaddts.CCXTrafStrmMet.tsid,sizeof(tSirMacCCXTSMIE));
3481 }
3482#endif
3483
3484 }
3485
3486 return eSIR_SUCCESS;
3487
3488} // End sirConvertAddtsRsp2Struct.
3489
3490tSirRetStatus
3491sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
3492 tANI_U8 *pFrame,
3493 tANI_U32 nFrame,
3494 tSirDeltsReqInfo *pDelTs)
3495{
3496 tDot11fDelTS delts = {{0}};
3497 tDot11fWMMDelTS wmmdelts = {{0}};
3498 tANI_U32 status;
3499
3500 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
3501 {
3502 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3503 "with an Action of %d; this is not "
3504 "supported & is probably an error."),
3505 *( pFrame + 1 ) );
3506 return eSIR_FAILURE;
3507 }
3508
3509 // Zero-init our [out] parameter,
3510 palZeroMemory( pMac->hHdd, ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo) );
3511
3512 // delegate to the framesc-generated code,
3513 switch ( *pFrame )
3514 {
3515 case SIR_MAC_ACTION_QOS_MGMT:
3516 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
3517 break;
3518 case SIR_MAC_ACTION_WME:
3519 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
3520 break;
3521 default:
3522 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
3523 "with a Category of %d; this is not"
3524 " supported & is probably an error."),
3525 *pFrame );
3526 return eSIR_FAILURE;
3527 }
3528
3529 if ( DOT11F_FAILED( status ) )
3530 {
3531 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
3532 "rame (0x%08x, %d bytes):\n"),
3533 status, nFrame);
3534 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3535 return eSIR_FAILURE;
3536 }
3537 else if ( DOT11F_WARNED( status ) )
3538 {
3539 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
3540 "g an Del TS Request frame (0x%08x,"
3541 "%d bytes):\n"),
3542 status, nFrame );
3543 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3544 }
3545
3546 // & "transliterate" from a 'tDot11fDelTSResponse' or a
3547 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
3548 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3549 {
3550 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
3551 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
3552 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
3553 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
3554 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
3555 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
3556 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
3557 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
3558
3559 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
3560 }
3561 else
3562 {
3563 if ( wmmdelts.WMMTSPEC.present )
3564 {
3565 pDelTs->wmeTspecPresent = 1;
3566 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
3567 }
3568 else
3569 {
3570 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3571 return eSIR_FAILURE;
3572 }
3573 }
3574
3575 return eSIR_SUCCESS;
3576
3577} // End sirConvertDeltsReq2Struct.
3578
3579
3580#ifdef ANI_SUPPORT_11H
3581tSirRetStatus
3582sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
3583 tANI_U8 *pFrame,
3584 tpSirMacTpcReqActionFrame pTpcReqFrame,
3585 tANI_U32 nFrame)
3586{
3587 tDot11fTPCRequest req;
3588 tANI_U32 status;
3589
3590 // Zero-init our [out] parameter,
3591 palZeroMemory( pMac->hHdd, ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame) );
3592
3593 // delegate to the framesc-generated code,
3594 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
3595 if ( DOT11F_FAILED( status ) )
3596 {
3597 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
3598 status, nFrame);
3599 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3600 return eSIR_FAILURE;
3601 }
3602 else if ( DOT11F_WARNED( status ) )
3603 {
3604 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
3605 status, nFrame );
3606 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3607 }
3608
3609 // & "transliterate" from a 'tDot11fTPCRequest' to a
3610 // 'tSirMacTpcReqActionFrame'...
3611 pTpcReqFrame->actionHeader.category = req.Category.category;
3612 pTpcReqFrame->actionHeader.actionID = req.Action.action;
3613 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
3614 if ( req.TPCRequest.present )
3615 {
3616 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
3617 pTpcReqFrame->length = 0;
3618 }
3619 else
3620 {
3621 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
3622 return eSIR_FAILURE;
3623 }
3624
3625 return eSIR_SUCCESS;
3626
3627} // End sirConvertTpcReqFrame2Struct.
3628
3629
3630tSirRetStatus
3631sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
3632 tANI_U8 *pFrame,
3633 tpSirMacMeasReqActionFrame pMeasReqFrame,
3634 tANI_U32 nFrame)
3635{
3636 tDot11fMeasurementRequest mr;
3637 tANI_U32 status;
3638
3639 // Zero-init our [out] parameter,
3640 palZeroMemory( pMac->hHdd, ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame) );
3641
3642 // delegate to the framesc-generated code,
3643 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
3644 if ( DOT11F_FAILED( status ) )
3645 {
3646 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
3647 status, nFrame);
3648 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3649 return eSIR_FAILURE;
3650 }
3651 else if ( DOT11F_WARNED( status ) )
3652 {
3653 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
3654 status, nFrame );
3655 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3656 }
3657
3658 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
3659 // 'tpSirMacMeasReqActionFrame'...
3660 pMeasReqFrame->actionHeader.category = mr.Category.category;
3661 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
3662 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
3663
3664 if ( 0 == mr.num_MeasurementRequest )
3665 {
3666 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
3667 return eSIR_FAILURE;
3668 }
3669 else if ( 1 < mr.num_MeasurementRequest )
3670 {
3671 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
3672 }
3673
3674 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
3675 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
3676 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
3677 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
3678 ( mr.MeasurementRequest[0].enable << 2 ) |
3679 ( mr.MeasurementRequest[0].request << 1 ) |
3680 ( mr.MeasurementRequest[0].report /*<< 0*/ );
3681 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
3682
3683 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
3684
3685 palCopyMemory( pMac->hHdd, pMeasReqFrame->measReqIE.measReqField.measStartTime,
3686 mr.MeasurementRequest[0].meas_start_time, 8 );
3687
3688 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
3689
3690 return eSIR_SUCCESS;
3691
3692} // End sirConvertMeasReqFrame2Struct.
3693#endif
3694
3695
3696void
3697PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
3698 tDot11fIETSPEC *pDot11f)
3699{
3700 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
3701 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
3702 pDot11f->direction = pOld->tsinfo.traffic.direction;
3703 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
3704 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
3705 pDot11f->psb = pOld->tsinfo.traffic.psb;
3706 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
3707 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
3708 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
3709 /* As defined in IEEE 802.11-2007, section 7.3.2.30
3710 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
3711 */
3712 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
3713 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
3714 pDot11f->max_msdu_size = pOld->maxMsduSz;
3715 pDot11f->min_service_int = pOld->minSvcInterval;
3716 pDot11f->max_service_int = pOld->maxSvcInterval;
3717 pDot11f->inactivity_int = pOld->inactInterval;
3718 pDot11f->suspension_int = pOld->suspendInterval;
3719 pDot11f->service_start_time = pOld->svcStartTime;
3720 pDot11f->min_data_rate = pOld->minDataRate;
3721 pDot11f->mean_data_rate = pOld->meanDataRate;
3722 pDot11f->peak_data_rate = pOld->peakDataRate;
3723 pDot11f->burst_size = pOld->maxBurstSz;
3724 pDot11f->delay_bound = pOld->delayBound;
3725 pDot11f->min_phy_rate = pOld->minPhyRate;
3726 pDot11f->surplus_bw_allowance = pOld->surplusBw;
3727 pDot11f->medium_time = pOld->mediumTime;
3728
3729 pDot11f->present = 1;
3730
3731} // End PopulateDot11fTSPEC.
3732
3733void
3734PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
3735 tDot11fIEWMMTSPEC *pDot11f)
3736{
3737 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
3738 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
3739 pDot11f->direction = pOld->tsinfo.traffic.direction;
3740 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
3741 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
3742 pDot11f->psb = pOld->tsinfo.traffic.psb;
3743 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
3744 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
3745 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
3746 /* As defined in IEEE 802.11-2007, section 7.3.2.30
3747 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
3748 */
3749 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
3750 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
3751 pDot11f->max_msdu_size = pOld->maxMsduSz;
3752 pDot11f->min_service_int = pOld->minSvcInterval;
3753 pDot11f->max_service_int = pOld->maxSvcInterval;
3754 pDot11f->inactivity_int = pOld->inactInterval;
3755 pDot11f->suspension_int = pOld->suspendInterval;
3756 pDot11f->service_start_time = pOld->svcStartTime;
3757 pDot11f->min_data_rate = pOld->minDataRate;
3758 pDot11f->mean_data_rate = pOld->meanDataRate;
3759 pDot11f->peak_data_rate = pOld->peakDataRate;
3760 pDot11f->burst_size = pOld->maxBurstSz;
3761 pDot11f->delay_bound = pOld->delayBound;
3762 pDot11f->min_phy_rate = pOld->minPhyRate;
3763 pDot11f->surplus_bw_allowance = pOld->surplusBw;
3764 pDot11f->medium_time = pOld->mediumTime;
3765
3766 pDot11f->version = 1;
3767 pDot11f->present = 1;
3768
3769} // End PopulateDot11fWMMTSPEC.
3770
3771#ifdef FEATURE_WLAN_CCX
3772void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
3773 tSirMacCCXTSRSIE *pOld,
3774 tDot11fIECCXTrafStrmRateSet *pDot11f,
3775 tANI_U8 rate_length)
3776{
3777 pDot11f->tsid = pOld->tsid;
3778 palCopyMemory(pMac->hHdd,pDot11f->tsrates, pOld->rates,rate_length);
3779 pDot11f->num_tsrates = rate_length;
3780 pDot11f->present = 1;
3781}
3782#endif
3783
3784
3785tSirRetStatus
3786PopulateDot11fTCLAS(tpAniSirGlobal pMac,
3787 tSirTclasInfo *pOld,
3788 tDot11fIETCLAS *pDot11f)
3789{
3790 pDot11f->user_priority = pOld->tclas.userPrio;
3791 pDot11f->classifier_type = pOld->tclas.classifierType;
3792 pDot11f->classifier_mask = pOld->tclas.classifierMask;
3793
3794 switch ( pDot11f->classifier_type )
3795 {
3796 case SIR_MAC_TCLASTYPE_ETHERNET:
3797 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.source,
3798 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
3799 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.dest,
3800 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
3801 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
3802 break;
3803 case SIR_MAC_TCLASTYPE_TCPUDPIP:
3804 pDot11f->info.IpParams.version = pOld->version;
3805 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
3806 {
3807 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3808 IpV4Params.source,
3809 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
3810 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3811 IpV4Params.dest,
3812 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
3813 pDot11f->info.IpParams.params.IpV4Params.src_port =
3814 pOld->tclasParams.ipv4.srcPort;
3815 pDot11f->info.IpParams.params.IpV4Params.dest_port =
3816 pOld->tclasParams.ipv4.dstPort;
3817 pDot11f->info.IpParams.params.IpV4Params.DSCP =
3818 pOld->tclasParams.ipv4.dscp;
3819 pDot11f->info.IpParams.params.IpV4Params.proto =
3820 pOld->tclasParams.ipv4.protocol;
3821 pDot11f->info.IpParams.params.IpV4Params.reserved =
3822 pOld->tclasParams.ipv4.rsvd;
3823 }
3824 else
3825 {
3826 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3827 IpV6Params.source,
3828 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
3829 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3830 IpV6Params.dest,
3831 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
3832 pDot11f->info.IpParams.params.IpV6Params.src_port =
3833 pOld->tclasParams.ipv6.srcPort;
3834 pDot11f->info.IpParams.params.IpV6Params.dest_port =
3835 pOld->tclasParams.ipv6.dstPort;
3836 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3837 IpV6Params.flow_label,
3838 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
3839 }
3840 break;
3841 case SIR_MAC_TCLASTYPE_8021DQ:
3842 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
3843 break;
3844 default:
3845 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
3846 pDot11f->classifier_type );
3847 return eSIR_FAILURE;
3848 }
3849
3850 pDot11f->present = 1;
3851
3852 return eSIR_SUCCESS;
3853
3854} // End PopulateDot11fTCLAS.
3855
3856tSirRetStatus
3857PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
3858 tSirTclasInfo *pOld,
3859 tDot11fIEWMMTCLAS *pDot11f)
3860{
3861 pDot11f->version = 1;
3862 pDot11f->user_priority = pOld->tclas.userPrio;
3863 pDot11f->classifier_type = pOld->tclas.classifierType;
3864 pDot11f->classifier_mask = pOld->tclas.classifierMask;
3865
3866 switch ( pDot11f->classifier_type )
3867 {
3868 case SIR_MAC_TCLASTYPE_ETHERNET:
3869 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.source,
3870 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
3871 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.EthParams.dest,
3872 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
3873 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
3874 break;
3875 case SIR_MAC_TCLASTYPE_TCPUDPIP:
3876 pDot11f->info.IpParams.version = pOld->version;
3877 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
3878 {
3879 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3880 IpV4Params.source,
3881 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
3882 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3883 IpV4Params.dest,
3884 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
3885 pDot11f->info.IpParams.params.IpV4Params.src_port =
3886 pOld->tclasParams.ipv4.srcPort;
3887 pDot11f->info.IpParams.params.IpV4Params.dest_port =
3888 pOld->tclasParams.ipv4.dstPort;
3889 pDot11f->info.IpParams.params.IpV4Params.DSCP =
3890 pOld->tclasParams.ipv4.dscp;
3891 pDot11f->info.IpParams.params.IpV4Params.proto =
3892 pOld->tclasParams.ipv4.protocol;
3893 pDot11f->info.IpParams.params.IpV4Params.reserved =
3894 pOld->tclasParams.ipv4.rsvd;
3895 }
3896 else
3897 {
3898 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3899 IpV6Params.source,
3900 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
3901 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3902 IpV6Params.dest,
3903 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
3904 pDot11f->info.IpParams.params.IpV6Params.src_port =
3905 pOld->tclasParams.ipv6.srcPort;
3906 pDot11f->info.IpParams.params.IpV6Params.dest_port =
3907 pOld->tclasParams.ipv6.dstPort;
3908 palCopyMemory( pMac->hHdd, ( tANI_U8* )&pDot11f->info.IpParams.params.
3909 IpV6Params.flow_label,
3910 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
3911 }
3912 break;
3913 case SIR_MAC_TCLASTYPE_8021DQ:
3914 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
3915 break;
3916 default:
3917 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
3918 pDot11f->classifier_type );
3919 return eSIR_FAILURE;
3920 }
3921
3922 pDot11f->present = 1;
3923
3924 return eSIR_SUCCESS;
3925
3926} // End PopulateDot11fWMMTCLAS.
3927
3928#if ( WNI_POLARIS_FW_PRODUCT == AP )
3929
3930tSirRetStatus
3931PopulateDot11fCFParams(tpAniSirGlobal pMac,
3932 tDot11fFfCapabilities *pCaps,
3933 tDot11fIECFParams *pDot11f)
3934{
3935 tANI_U32 cfg;
3936 tSirRetStatus nSirStatus;
3937
3938 if ( pCaps->cfPollable || pCaps->cfPollReq )
3939 {
3940 pDot11f->cfp_count = schGetCFPCount( pMac );
3941
3942 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CFP_PERIOD, cfg );
3943 pDot11f->cfp_period = ( cfg & 0x000000ff );
3944
3945 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CFP_MAX_DURATION, cfg );
3946 pDot11f->cfp_maxduration = ( cfg & 0x0000ffff );
3947
3948 pDot11f->cfp_durremaining = schGetCFPDurRemaining( pMac );
3949
3950 pDot11f->present = 1;
3951 }
3952
3953 return eSIR_SUCCESS;
3954} // End PopulateDot11fCFParams.
3955
3956void
3957PopulateDot11fQuiet(tpAniSirGlobal pMac,
3958 tDot11fIEQuiet *pDot11f)
3959{
3960 // Quiet Count - Num TBTTs until start of quiet interval
3961 pDot11f->count = (tANI_U8) pMac->lim.gLimSpecMgmt.quietCount;
3962 // Quiet Period
3963 pDot11f->period = 0;
3964 // Quiet Duration (in TU's)
3965 pDot11f->duration = ( tANI_U16 ) pMac->lim.gLimSpecMgmt.quietDuration_TU;
3966 // Quiet Offset
3967 pDot11f->offset = 0;
3968
3969 dot11fLog( pMac, LOG2,
3970 FL("Filling QuietBSS IE: %d, Len %d, QC %1d, QP 0, QD "
3971 "%2d(TU)/%2d(TICKS), QO 0\n"),
3972 SIR_MAC_QUIET_EID, DOT11F_IE_QUIET_MIN_LEN,
3973 pMac->lim.gLimSpecMgmt.quietCount,
3974 pMac->lim.gLimSpecMgmt.quietDuration_TU,
3975 pMac->lim.gLimSpecMgmt.quietDuration );
3976
3977 pDot11f->present = 1;
3978
3979} // End PopulateDot11fQuiet.
3980
3981tSirRetStatus
3982PopulateDot11fAPName(tpAniSirGlobal pMac,
3983 tANI_U32 capEnable,
3984 tDot11fIEAPName *pDot11f)
3985{
3986 tANI_U32 nName;
3987 tSirRetStatus nSirStatus;
3988
3989 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_AP_NODE_NAME, pDot11f->name,
3990 nName, SIR_MAC_MAX_SSID_LENGTH );
3991 pDot11f->num_name = ( tANI_U8 ) nName;
3992 pDot11f->present = 1;
3993
3994 return eSIR_SUCCESS;
3995} // End PopulateDot11fAPName.
3996
3997void
3998PopulateDot11fPropQuietBSS(tpAniSirGlobal pMac,
3999 tANI_U32 capsEnable,
4000 tDot11fIEPropQuietBSS *pDot11f)
4001{
4002 // Populate Proprietary Quiet BSS IE, ONLY IF 11H is NOT enabled! If 11H
4003 // IS enabled, then the Quiet IE will be appropriately sent as per the
4004 // 11H spec and hence need NOT be sent in the Proprietary IE as well
4005 if ( ( eLIM_QUIET_RUNNING == pMac->lim.gLimSpecMgmt.quietState ) &&
4006 !pMac->lim.gLim11hEnable &&
4007 PROP_CAPABILITY_GET( TITAN, capsEnable ) )
4008 {
4009 // Quiet Count - Num TBTTs until start of quiet interval
4010 pDot11f->quiet_count = pMac->lim.gLimSpecMgmt.quietCount;
4011 // Quiet Period
4012 pDot11f->quiet_period = 0;
4013 // Quiet Duration (in TU's)
4014 pDot11f->quiet_duration = ( tANI_U16 ) pMac->lim.gLimSpecMgmt.quietDuration_TU;
4015 // Quiet Offset
4016 pDot11f->quiet_offset = 0;
4017
4018 pDot11f->present = 1;
4019 }
4020} // End PopulateDot11fPropQuietBSS.
4021
4022void
4023PopulateDot11fTrigStaBkScan(tpAniSirGlobal pMac,
4024 tANI_U32 capsEnable,
4025 tDot11fIETriggerStaBgScan *pDot11f)
4026{
4027 if ( PROP_CAPABILITY_GET( TITAN, capsEnable ) )
4028 {
4029 pDot11f->enable = pMac->lim.gLimTriggerBackgroundScanDuringQuietBss;
4030 pDot11f->present = 1;
4031 }
4032} // End PopulateDot11fTrigStaBkScan.
4033
4034#if (WNI_POLARIS_FW_PACKAGE == ADVANCED)
4035
4036tSirRetStatus
4037PopulateDot11fWDS(tpAniSirGlobal pMac,
4038 tANI_U32 capEnable,
4039 tDot11fIEWDS *pDot11f )
4040{
4041 tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry?????
4042
4043 if ( psessionEntry->pLimStartBssReq->wdsInfo.wdsLength )
4044 {
4045 if ( psessionEntry->pLimStartBssReq->wdsInfo.wdsLength > 64)
4046 {
4047 limLog( pMac, LOG3, FL("WDS Length overflow in PopulateDot11fWDS.") );
4048 return eSIR_FAILURE;
4049 }
4050
4051 pDot11f->num_wdsData = psessionEntry->pLimStartBssReq->wdsInfo.wdsLength;
4052 palCopyMemory( pMac->hHdd, pDot11f->wdsData,
4053 psessionEntry->pLimStartBssReq->wdsInfo.wdsBytes,
4054 pDot11f->num_wdsData );
4055 pDot11f->present = 1;
4056 }
4057
4058 return eSIR_SUCCESS;
4059} // End PopulateDot11fWDS.
4060
4061#endif // WNI_POLARIS_FW_PACKAGE == ADVANCED
4062
4063#endif // WNI_POLARIS_FW_PRODUCT == AP
4064
4065tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4066 tDot11fIEWscBeacon *pDot11f)
4067{
4068
4069 tANI_U32 wpsState;
4070
4071 pDot11f->Version.present = 1;
4072 pDot11f->Version.major = 0x01;
4073 pDot11f->Version.minor = 0x00;
4074
4075 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4076 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4077
4078 pDot11f->WPSState.present = 1;
4079 pDot11f->WPSState.state = (tANI_U8) wpsState;
4080
4081 pDot11f->APSetupLocked.present = 0;
4082
4083 pDot11f->SelectedRegistrar.present = 0;
4084
4085 pDot11f->DevicePasswordID.present = 0;
4086
4087 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4088
4089 pDot11f->UUID_E.present = 0;
4090
4091 pDot11f->RFBands.present = 0;
4092
4093 pDot11f->present = 1;
4094 return eSIR_SUCCESS;
4095}
4096
4097tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4098 tDot11fIEWscBeacon *pDot11f)
4099{
4100 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4101 tANI_U32 devicepasswdId;
4102
4103
4104 pDot11f->APSetupLocked.present = 1;
4105 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4106
4107 pDot11f->SelectedRegistrar.present = 1;
4108 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4109
4110 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4111 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4112
4113 pDot11f->DevicePasswordID.present = 1;
4114 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4115
4116 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4117 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4118
4119 // UUID_E and RF Bands are applicable only for dual band AP
4120
4121 return eSIR_SUCCESS;
4122}
4123
4124tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4125 tDot11fIEWscBeacon *pDot11f)
4126{
4127 pDot11f->APSetupLocked.present = 0;
4128 pDot11f->SelectedRegistrar.present = 0;
4129 pDot11f->DevicePasswordID.present = 0;
4130 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4131
4132 return eSIR_SUCCESS;
4133}
4134#ifdef WLAN_SOFTAP_FEATURE
4135tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4136{
4137
4138 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4139
4140 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4141
4142
4143 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4144 {
4145 pDot11f->present = 1;
4146 pDot11f->Version.present = 1;
4147 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4148 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4149 }
4150 else
4151 {
4152 pDot11f->present = 0;
4153 pDot11f->Version.present = 0;
4154 }
4155
4156 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4157 {
4158
4159 pDot11f->WPSState.present = 1;
4160 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4161 }
4162 else
4163 pDot11f->WPSState.present = 0;
4164
4165 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4166 {
4167 pDot11f->APSetupLocked.present = 1;
4168 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4169 }
4170 else
4171 pDot11f->APSetupLocked.present = 0;
4172
4173 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4174 {
4175 pDot11f->SelectedRegistrar.present = 1;
4176 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4177 }
4178 else
4179 pDot11f->SelectedRegistrar.present = 0;
4180
4181 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4182 {
4183 pDot11f->DevicePasswordID.present = 1;
4184 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4185 }
4186 else
4187 pDot11f->DevicePasswordID.present = 0;
4188
4189 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4190 {
4191 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4192 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4193 }
4194 else
4195 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4196
4197 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4198 {
4199 pDot11f->ResponseType.present = 1;
4200 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4201 }
4202 else
4203 pDot11f->ResponseType.present = 0;
4204
4205 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4206 {
4207 pDot11f->UUID_E.present = 1;
4208 palCopyMemory(pMac->hHdd, pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
4209 }
4210 else
4211 pDot11f->UUID_E.present = 0;
4212
4213 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4214 {
4215 pDot11f->Manufacturer.present = 1;
4216 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
4217 palCopyMemory(pMac->hHdd, pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name, pSirWPSProbeRspIE->Manufacture.num_name);
4218 }
4219 else
4220 pDot11f->Manufacturer.present = 0;
4221
4222 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4223 {
4224 pDot11f->ModelName.present = 1;
4225 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
4226 palCopyMemory(pMac->hHdd, pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text, pDot11f->ModelName.num_text);
4227 }
4228 else
4229 pDot11f->ModelName.present = 0;
4230
4231 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4232 {
4233 pDot11f->ModelNumber.present = 1;
4234 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
4235 palCopyMemory(pMac->hHdd, pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text, pDot11f->ModelNumber.num_text);
4236 }
4237 else
4238 pDot11f->ModelNumber.present = 0;
4239
4240 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4241 {
4242 pDot11f->SerialNumber.present = 1;
4243 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
4244 palCopyMemory(pMac->hHdd, pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text, pDot11f->SerialNumber.num_text);
4245 }
4246 else
4247 pDot11f->SerialNumber.present = 0;
4248
4249 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4250 {
4251 pDot11f->PrimaryDeviceType.present = 1;
4252 palCopyMemory(pMac->hHdd, pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI, sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
4253 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4254 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4255 }
4256 else
4257 pDot11f->PrimaryDeviceType.present = 0;
4258
4259 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4260 {
4261 pDot11f->DeviceName.present = 1;
4262 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
4263 palCopyMemory(pMac->hHdd, pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text, pDot11f->DeviceName.num_text);
4264 }
4265 else
4266 pDot11f->DeviceName.present = 0;
4267
4268 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4269 {
4270 pDot11f->ConfigMethods.present = 1;
4271 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4272 }
4273 else
4274 pDot11f->ConfigMethods.present = 0;
4275
4276
4277 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4278 {
4279 pDot11f->RFBands.present = 1;
4280 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4281 }
4282 else
4283 pDot11f->RFBands.present = 0;
4284
4285 return eSIR_SUCCESS;
4286}
4287tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4288{
4289 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4290
4291 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4292
4293 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4294 {
4295 pDot11f->present = 1;
4296 pDot11f->Version.present = 1;
4297 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4298 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4299 }
4300 else
4301 {
4302 pDot11f->present = 0;
4303 pDot11f->Version.present = 0;
4304 }
4305
4306 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4307 {
4308 pDot11f->ResponseType.present = 1;
4309 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4310 }
4311 else
4312 pDot11f->ResponseType.present = 0;
4313
4314 return eSIR_SUCCESS;
4315}
4316
4317tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4318{
4319
4320 tSirWPSBeaconIE *pSirWPSBeaconIE;
4321
4322 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4323
4324
4325 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4326 {
4327 pDot11f->present = 1;
4328 pDot11f->Version.present = 1;
4329 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4330 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4331 }
4332 else
4333 {
4334 pDot11f->present = 0;
4335 pDot11f->Version.present = 0;
4336 }
4337
4338 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4339 {
4340
4341 pDot11f->WPSState.present = 1;
4342 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4343 }
4344 else
4345 pDot11f->WPSState.present = 0;
4346
4347 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4348 {
4349 pDot11f->APSetupLocked.present = 1;
4350 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4351 }
4352 else
4353 pDot11f->APSetupLocked.present = 0;
4354
4355 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4356 {
4357 pDot11f->SelectedRegistrar.present = 1;
4358 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4359 }
4360 else
4361 pDot11f->SelectedRegistrar.present = 0;
4362
4363 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4364 {
4365 pDot11f->DevicePasswordID.present = 1;
4366 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4367 }
4368 else
4369 pDot11f->DevicePasswordID.present = 0;
4370
4371 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4372 {
4373 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4374 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4375 }
4376 else
4377 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4378
4379 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4380 {
4381 pDot11f->UUID_E.present = 1;
4382 palCopyMemory(pMac->hHdd, pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
4383 }
4384 else
4385 pDot11f->UUID_E.present = 0;
4386
4387
4388 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4389 {
4390 pDot11f->RFBands.present = 1;
4391 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4392 }
4393 else
4394 pDot11f->RFBands.present = 0;
4395
4396 return eSIR_SUCCESS;
4397}
4398#endif
4399tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4400 tDot11fIEWscProbeRes *pDot11f)
4401{
4402 tANI_U32 cfgMethods;
4403 tANI_U32 cfgStrLen;
4404 tANI_U32 val;
4405 tANI_U32 wpsVersion, wpsState;
4406
4407
4408 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
4409 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
4410
4411 pDot11f->Version.present = 1;
4412 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
4413 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
4414
4415 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4416 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4417
4418 pDot11f->WPSState.present = 1;
4419 pDot11f->WPSState.state = (tANI_U8) wpsState;
4420
4421 pDot11f->APSetupLocked.present = 0;
4422
4423 pDot11f->SelectedRegistrar.present = 0;
4424
4425 pDot11f->DevicePasswordID.present = 0;
4426
4427 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4428
4429 pDot11f->ResponseType.present = 1;
4430 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
4431 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
4432 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4433 }
4434 else{
4435 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4436 }
4437
4438 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
4439 pDot11f->UUID_E.present = 1;
4440 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
4441 if (wlan_cfgGetStr(pMac,
4442 WNI_CFG_WPS_UUID,
4443 pDot11f->UUID_E.uuid,
4444 &cfgStrLen) != eSIR_SUCCESS)
4445 {
4446 *(pDot11f->UUID_E.uuid) = '\0';
4447 }
4448
4449 pDot11f->Manufacturer.present = 1;
4450 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
4451 if (wlan_cfgGetStr(pMac,
4452 WNI_CFG_MANUFACTURER_NAME,
4453 pDot11f->Manufacturer.name,
4454 &cfgStrLen) != eSIR_SUCCESS)
4455 {
4456 pDot11f->Manufacturer.num_name = 0;
4457 *(pDot11f->Manufacturer.name) = '\0';
4458 }
4459 else
4460 {
4461 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
4462 pDot11f->Manufacturer.name[cfgStrLen] = '\0';
4463 }
4464
4465 pDot11f->ModelName.present = 1;
4466 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
4467 if (wlan_cfgGetStr(pMac,
4468 WNI_CFG_MODEL_NAME,
4469 pDot11f->ModelName.text,
4470 &cfgStrLen) != eSIR_SUCCESS)
4471 {
4472 pDot11f->ModelName.num_text = 0;
4473 *(pDot11f->ModelName.text) = '\0';
4474 }
4475 else
4476 {
4477 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4478 pDot11f->ModelName.text[cfgStrLen] = '\0';
4479 }
4480
4481 pDot11f->ModelNumber.present = 1;
4482 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
4483 if (wlan_cfgGetStr(pMac,
4484 WNI_CFG_MODEL_NUMBER,
4485 pDot11f->ModelNumber.text,
4486 &cfgStrLen) != eSIR_SUCCESS)
4487 {
4488 pDot11f->ModelNumber.num_text = 0;
4489 *(pDot11f->ModelNumber.text) = '\0';
4490 }
4491 else
4492 {
4493 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4494 pDot11f->ModelNumber.text[cfgStrLen] = '\0';
4495 }
4496
4497 pDot11f->SerialNumber.present = 1;
4498 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
4499 if (wlan_cfgGetStr(pMac,
4500 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
4501 pDot11f->SerialNumber.text,
4502 &cfgStrLen) != eSIR_SUCCESS)
4503 {
4504 pDot11f->SerialNumber.num_text = 0;
4505 *(pDot11f->SerialNumber.text) = '\0';
4506 }
4507 else
4508 {
4509 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4510 pDot11f->SerialNumber.text[cfgStrLen] = '\0';
4511 }
4512
4513 pDot11f->PrimaryDeviceType.present = 1;
4514
4515 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
4516 {
4517 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
4518 }
4519 else
4520 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
4521
4522 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
4523 {
4524 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
4525 }
4526 else
4527 {
4528 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
4529 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
4530 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
4531 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
4532 }
4533
4534 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
4535 {
4536 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
4537 }
4538 else
4539 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
4540
4541 pDot11f->DeviceName.present = 1;
4542 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
4543 if (wlan_cfgGetStr(pMac,
4544 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
4545 pDot11f->DeviceName.text,
4546 &cfgStrLen) != eSIR_SUCCESS)
4547 {
4548 pDot11f->DeviceName.num_text = 0;
4549 *(pDot11f->DeviceName.text) = '\0';
4550 }
4551 else
4552 {
4553 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
4554 pDot11f->DeviceName.text[cfgStrLen] = '\0';
4555 }
4556
4557 if (wlan_cfgGetInt(pMac,
4558 WNI_CFG_WPS_CFG_METHOD,
4559 &cfgMethods) != eSIR_SUCCESS)
4560 {
4561 pDot11f->ConfigMethods.present = 0;
4562 pDot11f->ConfigMethods.methods = 0;
4563 }
4564 else
4565 {
4566 pDot11f->ConfigMethods.present = 1;
4567 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
4568 }
4569
4570 pDot11f->RFBands.present = 0;
4571
4572 pDot11f->present = 1;
4573 return eSIR_SUCCESS;
4574}
4575
4576tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4577 tDot11fIEWscProbeRes *pDot11f)
4578{
4579 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4580 tANI_U32 devicepasswdId;
4581
4582 pDot11f->APSetupLocked.present = 1;
4583 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4584
4585 pDot11f->SelectedRegistrar.present = 1;
4586 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4587
4588 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4589 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4590
4591 pDot11f->DevicePasswordID.present = 1;
4592 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4593
4594 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4595 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4596
4597 // UUID_E and RF Bands are applicable only for dual band AP
4598
4599 return eSIR_SUCCESS;
4600}
4601
4602tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
4603 tDot11fIEWscProbeRes *pDot11f)
4604{
4605 pDot11f->APSetupLocked.present = 0;
4606 pDot11f->SelectedRegistrar.present = 0;
4607 pDot11f->DevicePasswordID.present = 0;
4608 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4609
4610 return eSIR_SUCCESS;
4611}
4612
4613tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
4614 tDot11fIEWscAssocRes *pDot11f,
4615 tpSirAssocReq pRcvdAssocReq)
4616{
4617 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
4618 tANI_U8 *wscIe;
4619
4620
4621 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
4622 if(wscIe != NULL)
4623 {
4624 // retreive WSC IE from given AssocReq
4625 dot11fUnpackIeWscAssocReq( pMac,
4626 wscIe + 2 + 4, // EID, length, OUI
4627 wscIe[ 1 ] - 4, // length without OUI
4628 &parsedWscAssocReq );
4629 pDot11f->present = 1;
4630 // version has to be 0x10
4631 pDot11f->Version.present = 1;
4632 pDot11f->Version.major = 0x1;
4633 pDot11f->Version.minor = 0x0;
4634
4635 pDot11f->ResponseType.present = 1;
4636
4637 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
4638 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
4639 {
4640 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
4641 }
4642 else
4643 {
4644 pDot11f->ResponseType.resType = RESP_TYPE_AP;
4645 }
4646 // Version infomration should be taken from our capability as well as peers
4647 // TODO: currently it takes from peers only
4648 if(parsedWscAssocReq.VendorExtension.present &&
4649 parsedWscAssocReq.VendorExtension.Version2.present)
4650 {
4651 pDot11f->VendorExtension.present = 1;
4652 pDot11f->VendorExtension.vendorId[0] = 0x00;
4653 pDot11f->VendorExtension.vendorId[1] = 0x37;
4654 pDot11f->VendorExtension.vendorId[2] = 0x2A;
4655 pDot11f->VendorExtension.Version2.present = 1;
4656 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
4657 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
4658 }
4659 }
4660 return eSIR_SUCCESS;
4661}
4662
4663#ifdef WLAN_FEATURE_P2P
4664tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
4665 tDot11fIEP2PAssocRes *pDot11f,
4666 tpSirAssocReq pRcvdAssocReq)
4667{
4668 tANI_U8 *p2pIe;
4669
4670 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
4671 if(p2pIe != NULL)
4672 {
4673 pDot11f->present = 1;
4674 pDot11f->P2PStatus.present = 1;
4675 pDot11f->P2PStatus.status = eSIR_SUCCESS;
4676 pDot11f->ExtendedListenTiming.present = 0;
4677 }
4678 return eSIR_SUCCESS;
4679}
4680#endif
4681
4682#if defined WLAN_FEATURE_VOWIFI
4683
4684tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
4685 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
4686{
4687 pDot11f->txPower = txPower;
4688 pDot11f->linkMargin = linkMargin;
4689 pDot11f->present = 1;
4690
4691 return eSIR_SUCCESS;
4692}
4693
4694tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
4695{
4696
4697 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
4698 pDot11f->report.Beacon.channel = pBeaconReport->channel;
4699 palCopyMemory( pMac->hHdd, pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime, sizeof(pDot11f->report.Beacon.meas_start_time) );
4700 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
4701 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
4702 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
4703 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
4704 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
4705 palCopyMemory( pMac->hHdd, pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
4706 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
4707 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
4708
4709 if( pBeaconReport->numIes )
4710 {
4711 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
4712 palCopyMemory( pMac->hHdd, pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields, pBeaconReport->Ies, pBeaconReport->numIes );
4713 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
4714 }
4715
4716 return eSIR_SUCCESS;
4717
4718}
4719
4720tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
4721{
4722 tpRRMCaps pRrmCaps;
4723
4724 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
4725
4726 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
4727 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
4728 pDot11f->parallel = pRrmCaps->parallel ;
4729 pDot11f->repeated = pRrmCaps->repeated ;
4730 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
4731 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
4732 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
4733 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
4734 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
4735 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
4736 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
4737 pDot11f->statistics = pRrmCaps->statistics ;
4738 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
4739 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
4740 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
4741 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
4742 pDot11f->APChanReport = pRrmCaps->APChanReport ;
4743 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
4744 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
4745 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
4746 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
4747 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
4748 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
4749 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
4750 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
4751 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
4752 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
4753 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
4754
4755 pDot11f->present = 1;
4756 return eSIR_SUCCESS;
4757}
4758#endif
4759
4760#if defined WLAN_FEATURE_VOWIFI_11R
4761void PopulateMDIE( tpAniSirGlobal pMac,
4762 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
4763{
4764 pDot11f->present = 1;
4765 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
4766
4767 // Plugfest fix
4768 pDot11f->overDSCap = (mdie[2] & 0x01);
4769 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
4770
4771}
4772
4773void PopulateFTInfo( tpAniSirGlobal pMac,
4774 tDot11fIEFTInfo *pDot11f )
4775{
4776 pDot11f->present = 1;
4777 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
4778 //All other info is zero.
4779
4780}
4781#endif
4782
4783void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
4784 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
4785{
4786 tANI_U8 num_supp = 0, num_ext = 0;
4787 tANI_U8 i,j;
4788
4789 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
4790 {
4791 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
4792 }
4793 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
4794 {
4795 if( num_supp < 8 )
4796 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
4797 else
4798 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
4799 }
4800
4801 if( num_supp )
4802 {
4803 pSupp->num_rates = num_supp;
4804 pSupp->present = 1;
4805 }
4806 if( num_ext )
4807 {
4808 pExt->num_rates = num_ext;
4809 pExt->present = 1;
4810 }
4811}
4812// parserApi.c ends here.