blob: a448ea7dbe4a8c9119af283ff930076e2b4244ac [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singhc75726d2015-04-13 14:44:14 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
Kiet Lamaa8e15a2014-02-11 23:30:06 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file parserApi.cc contains the code for parsing
30 * 802.11 messages.
31 * Author: Pierre Vandwalle
32 * Date: 03/18/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38
39#include "sirApi.h"
40#include "aniGlobal.h"
41#include "parserApi.h"
42#include "cfgApi.h"
43#include "limUtils.h"
44#include "utilsParser.h"
45#include "limSerDesUtils.h"
46#include "schApi.h"
47#include "palApi.h"
48#include "wmmApsd.h"
49#if defined WLAN_FEATURE_VOWIFI
50#include "rrmApi.h"
51#endif
52
53
54
55////////////////////////////////////////////////////////////////////////
56void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
57{
58#ifdef WLAN_DEBUG
59 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
60 {
61 return;
62 }
63 else
64 {
65 va_list marker;
66
67 va_start( marker, pString ); /* Initialize variable arguments. */
68
69 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
70
71 va_end( marker ); /* Reset variable arguments. */
72 }
73#endif
74}
75
76void
77swapBitField16(tANI_U16 in, tANI_U16 *out)
78{
79# ifdef ANI_LITTLE_BIT_ENDIAN
80 *out = in;
81# else // Big-Endian...
82 *out = ( ( in & 0x8000 ) >> 15 ) |
83 ( ( in & 0x4000 ) >> 13 ) |
84 ( ( in & 0x2000 ) >> 11 ) |
85 ( ( in & 0x1000 ) >> 9 ) |
86 ( ( in & 0x0800 ) >> 7 ) |
87 ( ( in & 0x0400 ) >> 5 ) |
88 ( ( in & 0x0200 ) >> 3 ) |
89 ( ( in & 0x0100 ) >> 1 ) |
90 ( ( in & 0x0080 ) << 1 ) |
91 ( ( in & 0x0040 ) << 3 ) |
92 ( ( in & 0x0020 ) << 5 ) |
93 ( ( in & 0x0010 ) << 7 ) |
94 ( ( in & 0x0008 ) << 9 ) |
95 ( ( in & 0x0004 ) << 11 ) |
96 ( ( in & 0x0002 ) << 13 ) |
97 ( ( in & 0x0001 ) << 15 );
98# endif // ANI_LITTLE_BIT_ENDIAN
99}
100
101void
102swapBitField32(tANI_U32 in, tANI_U32 *out)
103{
104# ifdef ANI_LITTLE_BIT_ENDIAN
105 *out = in;
106# else // Big-Endian...
107 *out = ( ( in & 0x80000000 ) >> 31 ) |
108 ( ( in & 0x40000000 ) >> 29 ) |
109 ( ( in & 0x20000000 ) >> 27 ) |
110 ( ( in & 0x10000000 ) >> 25 ) |
111 ( ( in & 0x08000000 ) >> 23 ) |
112 ( ( in & 0x04000000 ) >> 21 ) |
113 ( ( in & 0x02000000 ) >> 19 ) |
114 ( ( in & 0x01000000 ) >> 17 ) |
115 ( ( in & 0x00800000 ) >> 15 ) |
116 ( ( in & 0x00400000 ) >> 13 ) |
117 ( ( in & 0x00200000 ) >> 11 ) |
118 ( ( in & 0x00100000 ) >> 9 ) |
119 ( ( in & 0x00080000 ) >> 7 ) |
120 ( ( in & 0x00040000 ) >> 5 ) |
121 ( ( in & 0x00020000 ) >> 3 ) |
122 ( ( in & 0x00010000 ) >> 1 ) |
123 ( ( in & 0x00008000 ) << 1 ) |
124 ( ( in & 0x00004000 ) << 3 ) |
125 ( ( in & 0x00002000 ) << 5 ) |
126 ( ( in & 0x00001000 ) << 7 ) |
127 ( ( in & 0x00000800 ) << 9 ) |
128 ( ( in & 0x00000400 ) << 11 ) |
129 ( ( in & 0x00000200 ) << 13 ) |
130 ( ( in & 0x00000100 ) << 15 ) |
131 ( ( in & 0x00000080 ) << 17 ) |
132 ( ( in & 0x00000040 ) << 19 ) |
133 ( ( in & 0x00000020 ) << 21 ) |
134 ( ( in & 0x00000010 ) << 23 ) |
135 ( ( in & 0x00000008 ) << 25 ) |
136 ( ( in & 0x00000004 ) << 27 ) |
137 ( ( in & 0x00000002 ) << 29 ) |
138 ( ( in & 0x00000001 ) << 31 );
139# endif // ANI_LITTLE_BIT_ENDIAN
140}
141
142inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
143{
144 limLog(pMac, LOG1, FL("WMM Parameters Received: \n"));
145 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
146 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
147
148 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
149 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
150
151 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
152 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
153
154 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d \n"),
155 pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
156
157 return;
158}
159
160////////////////////////////////////////////////////////////////////////
161// Functions for populating "dot11f" style IEs
162
163
164// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
165// < 0, cannot find
166int FindIELocation( tpAniSirGlobal pMac,
167 tpSirRSNie pRsnIe,
168 tANI_U8 EID)
169{
170 int idx, ieLen, bytesLeft;
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800171 int ret_val = -1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700172
173 // Here's what's going on: 'rsnIe' looks like this:
174
175 // typedef struct sSirRSNie
176 // {
177 // tANI_U16 length;
178 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
179 // } tSirRSNie, *tpSirRSNie;
180
181 // other code records both the WPA & RSN IEs (including their EIDs &
182 // lengths) into the array 'rsnIEdata'. We may have:
183
184 // With WAPI support, there may be 3 IEs here
185 // It can be only WPA IE, or only RSN IE or only WAPI IE
186 // Or two or all three of them with no particular ordering
187
188 // The if/then/else statements that follow are here to figure out
189 // whether we have the WPA IE, and where it is if we *do* have it.
190
191 //Save the first IE length
192 ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
193 idx = 0;
194 bytesLeft = pRsnIe->length;
195
196 while( 1 )
197 {
198 if ( EID == pRsnIe->rsnIEdata[ idx ] )
199 {
200 //Found it
201 return (idx);
202 }
203 else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
204 // & if no more IE,
205 bytesLeft <= (tANI_U16)( ieLen ) )
206 {
207 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation.\n"), EID );
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800208 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 }
210 bytesLeft -= ieLen;
211 ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
212 idx += ieLen;
213 }
214
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800215 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700216}
217
218
219tSirRetStatus
220PopulateDot11fCapabilities(tpAniSirGlobal pMac,
221 tDot11fFfCapabilities *pDot11f,
222 tpPESession psessionEntry)
223{
224 tANI_U16 cfg;
225 tSirRetStatus nSirStatus;
226
227 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
228 if ( eSIR_SUCCESS != nSirStatus )
229 {
230 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
231 "itfield from CFG (%d).\n"), nSirStatus );
232 return nSirStatus;
233 }
234
235#if 0
236 if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
237 {
238 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
239 }
240#endif
241 swapBitField16( cfg, ( tANI_U16* )pDot11f );
242
243 return eSIR_SUCCESS;
244} // End PopulateDot11fCapabilities.
245
246tSirRetStatus
247PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
248 tDot11fFfCapabilities *pDot11f,
249 tpDphHashNode pSta,
250 tpPESession psessionEntry)
251{
252 tANI_U16 cfg;
253 tSirRetStatus nSirStatus;
254 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
255 if ( eSIR_SUCCESS != nSirStatus )
256 {
257 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
258 "itfield from CFG (%d).\n"), nSirStatus );
259 return nSirStatus;
260 }
261
262 if ( ( NULL != pSta ) && pSta->aniPeer &&
263 PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
264 {
265 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
266 }
267
268 swapBitField16( cfg, ( tANI_U16* )pDot11f );
269
270 return eSIR_SUCCESS;
271
272} // End PopulateDot11fCapabilities2.
273
274void
275PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700276 tDot11fIEChanSwitchAnn *pDot11f,
277 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700278{
Jeff Johnsone7245742012-09-05 17:12:55 -0700279 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
280 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
281 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700282
283 pDot11f->present = 1;
284} // End PopulateDot11fChanSwitchAnn.
285
286void
287PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700288 tDot11fIEExtChanSwitchAnn *pDot11f,
289 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700290{
291 //Has to be updated on the cb state basis
292 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700293 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700294
295 pDot11f->present = 1;
296}
297
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700298#ifdef WLAN_FEATURE_11AC
299void
300PopulateDot11fWiderBWChanSwitchAnn(tpAniSirGlobal pMac,
301 tDot11fIEWiderBWChanSwitchAnn *pDot11f,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700302 tpPESession psessionEntry)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700303{
304 pDot11f->present = 1;
305 pDot11f->newChanWidth = psessionEntry->gLimWiderBWChannelSwitch.newChanWidth;
306 pDot11f->newCenterChanFreq0 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0;
307 pDot11f->newCenterChanFreq1 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1;
308}
309#endif
310
Jeff Johnson295189b2012-06-20 16:38:30 -0700311tSirRetStatus
312PopulateDot11fCountry(tpAniSirGlobal pMac,
313 tDot11fIECountry *pDot11f,
314 tpPESession psessionEntry)
315{
316 tANI_U32 len, maxlen, codelen;
317 tANI_U16 item;
318 tSirRetStatus nSirStatus;
319 tSirRFBand rfBand;
320 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
321
322 if (psessionEntry->lim11dEnabled )
323 {
324 limGetRfBand(pMac, &rfBand, psessionEntry);
325 if (rfBand == SIR_BAND_5_GHZ)
326 {
327 item = WNI_CFG_MAX_TX_POWER_5;
328 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
329 }
330 else
331 {
332 item = WNI_CFG_MAX_TX_POWER_2_4;
333 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
334 }
335
336 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
337
338 if ( 3 > len )
339 {
340 // no limit on tx power, cannot include the IE because at least
341 // one (channel,num,tx power) must be present
342 return eSIR_SUCCESS;
343 }
344
345 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
346 code, codelen, 3 );
347
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530348 vos_mem_copy( pDot11f->country, code, codelen );
Jeff Johnson295189b2012-06-20 16:38:30 -0700349
350 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
351 {
352 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting.\n"), len);
353 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
354 }
355
356 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530357 vos_mem_copy( ( tANI_U8* )pDot11f->triplets, temp, len );
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
359 pDot11f->present = 1;
360 }
361
362 return eSIR_SUCCESS;
363} // End PopulateDot11fCountry.
364
365tSirRetStatus
366PopulateDot11fDSParams(tpAniSirGlobal pMac,
367 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
368 tpPESession psessionEntry)
369{
Kiran Kumar Lokere27090372013-07-19 20:13:55 -0700370 if ((IS_24G_CH(channel)) || pMac->rrm.rrmPEContext.rrmEnable)
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 {
372 // .11b/g mode PHY => Include the DS Parameter Set IE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pDot11f->curr_channel = channel;
374 pDot11f->present = 1;
375 }
376
377 return eSIR_SUCCESS;
378} // End PopulateDot11fDSParams.
379
380#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
381
382
383void
384PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
385 tDot11fIEEDCAParamSet *pDot11f,
386 tpPESession psessionEntry)
387{
388
389 if ( psessionEntry->limQosEnabled )
390 {
391 //change to bitwise operation, after this is fixed in frames.
392 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
393
394 // Fill each EDCA parameter set in order: be, bk, vi, vo
395 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
396 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
397 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
398 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
399 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
400 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
401
402 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
403 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
404 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
405 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
406 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
407 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
408
409 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
410 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
411 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
412 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
413 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
414 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
415
416 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
417 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
418 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
419 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
420 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
421 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
422
423 pDot11f->present = 1;
424 }
425
426} // End PopluateDot11fEDCAParamSet.
427
428tSirRetStatus
429PopulateDot11fERPInfo(tpAniSirGlobal pMac,
430 tDot11fIEERPInfo *pDot11f,
431 tpPESession psessionEntry)
432{
433 tSirRetStatus nSirStatus;
434 tANI_U32 val;
435 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
436
437 limGetRfBand(pMac, &rfBand, psessionEntry);
438 if(SIR_BAND_2_4_GHZ == rfBand)
439 {
440 pDot11f->present = 1;
441
442 val = psessionEntry->cfgProtection.fromllb;
443 if(!val ){
444 dot11fLog( pMac, LOGE, FL("11B protection not enabled. Not populating ERP IE %d\n" ),val );
445 return eSIR_SUCCESS;
446 }
447
448 if (psessionEntry->gLim11bParams.protectionEnabled)
449 {
450 pDot11f->non_erp_present = 1;
451 pDot11f->use_prot = 1;
452 }
453
454 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
455 {
456 //FIXME_PROTECTION: we should be setting non_erp present also.
457 //check the test plan first.
458 pDot11f->use_prot = 1;
459 }
460
461
462 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
463 || !psessionEntry->beaconParams.fShortPreamble){
464 pDot11f->barker_preamble = 1;
465
466 }
467 // if protection always flag is set, advertise protection enabled
468 // regardless of legacy stations presence
469 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
470
471 if ( val )
472 {
473 pDot11f->use_prot = 1;
474 }
475 }
476
477 return eSIR_SUCCESS;
478} // End PopulateDot11fERPInfo.
479
480tSirRetStatus
481PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
482 tDot11fIEExtSuppRates *pDot11f,
483 tpPESession psessionEntry)
484{
485 tSirRetStatus nSirStatus;
486 tANI_U32 nRates = 0;
487 tANI_U8 rates[WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN];
488
489 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
490 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
491 sending mgmt frames (lile probe req) which need to go out before any session is present.
492 */
493 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
494 {
495 if(psessionEntry != NULL)
496 {
497 nRates = psessionEntry->extRateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530498 vos_mem_copy( rates, psessionEntry->extRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 nRates);
500 }
501 else
502 {
503 dot11fLog( pMac, LOGE, FL("no session context exists while"
504 " populating Operational Rate Set\n"));
505 }
506 }
507 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
508 {
509 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
510 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
511 }
512
513 if ( 0 != nRates )
514 {
515 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530516 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 pDot11f->present = 1;
518 }
519
520 return eSIR_SUCCESS;
521
522} // End PopulateDot11fExtSuppRates.
523
524tSirRetStatus
525PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
526 tANI_U8 nChannelNum,
527 tDot11fIEExtSuppRates *pDot11f)
528{
529 tANI_U32 nRates;
530 tSirRetStatus nSirStatus;
531 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
532
533 if ( 14 < nChannelNum )
534 {
535 pDot11f->present = 0;
536 return eSIR_SUCCESS;
537 }
538
539 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
540 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
541 // previously & I'm afraid to change it!
542 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
543 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
544
545 if ( 0 != nRates )
546 {
547 pDot11f->num_rates = ( tANI_U8 ) nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530548 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 pDot11f->present = 1;
550 }
551
552 return eSIR_SUCCESS;
553} // PopulateDot11fExtSuppRates1.
554
555tSirRetStatus
556PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700557 tpPESession psessionEntry,
558 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559{
560 tANI_U32 nCfgValue, nCfgLen;
561 tANI_U8 nCfgValue8;
562 tSirRetStatus nSirStatus;
563 tSirMacHTParametersInfo *pHTParametersInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 union {
565 tANI_U16 nCfgValue16;
566 tSirMacHTCapabilityInfo htCapInfo;
567 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
568 } uHTCapabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700569
570 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
571 tSirMacASCapabilityInfo *pASCapabilityInfo;
572
573 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
574
Jeff Johnson295189b2012-06-20 16:38:30 -0700575 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700576
Jeff Johnson295189b2012-06-20 16:38:30 -0700577 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
579 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
580 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
581 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
582 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
583 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
584 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
585 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
586 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
587 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
588 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
589 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700590
Jeff Johnsone7245742012-09-05 17:12:55 -0700591 // All sessionized entries will need the check below
592 if (psessionEntry == NULL) // Only in case of NO session
593 {
594 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
595 }
596 else
597 {
598 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
599 }
600
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
602 eHT_CHANNEL_WIDTH_20MHZ */
603 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
604 {
605 pDot11f->shortGI40MHz = 0;
606 }
607
Sushant Kaushik2a1fcc82015-01-22 19:32:44 +0530608 limLog(pMac, LOG1, FL("SupportedChnlWidth: %d, mimoPS: %d, GF: %d,"
609 "shortGI20:%d, shortGI40: %d, dsssCck: %d\n"),
610 pDot11f->supportedChannelWidthSet, pDot11f->mimoPowerSave, pDot11f->greenField,
611 pDot11f->shortGI20MHz, pDot11f->shortGI40MHz, pDot11f->dsssCckMode40MHz);
Jeff Johnson295189b2012-06-20 16:38:30 -0700612
613
614 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
615
616 nCfgValue8 = ( tANI_U8 ) nCfgValue;
617 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
618
619 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
620 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
621 pDot11f->reserved1 = pHTParametersInfo->reserved;
622
Sushant Kaushik2a1fcc82015-01-22 19:32:44 +0530623 limLog( pMac, LOG1, FL( "AMPDU Param: %x\n" ), nCfgValue);
Jeff Johnson295189b2012-06-20 16:38:30 -0700624
625
626 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
627 pDot11f->supportedMCSSet, nCfgLen,
628 SIZE_OF_SUPPORTED_MCS_SET );
629
630
631 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
632
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
634
635 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
636 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
637 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
638
Jeff Johnson295189b2012-06-20 16:38:30 -0700639
640 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
641
642 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
643 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
644 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
645 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
646 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
647 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
648 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
649 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
650 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
651 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
652 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
653 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
654 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
655 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
656 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
657 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
658
659 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
660
661 nCfgValue8 = ( tANI_U8 ) nCfgValue;
662
663 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
664 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
665 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
666 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
667 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
668 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
669 pDot11f->rxAS = pASCapabilityInfo->rxAS;
670 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
671
672 pDot11f->present = 1;
673
674 return eSIR_SUCCESS;
675
676} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700677#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700678
Jeff Johnsone7245742012-09-05 17:12:55 -0700679void limLogVHTCap(tpAniSirGlobal pMac,
680 tDot11fIEVHTCaps *pDot11f)
681{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700682#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700683 limLog(pMac, LOG1, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
684 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
685 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
686 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
687 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
688 limLog(pMac, LOG1, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
689 limLog(pMac, LOG1, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
690 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
691 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
692 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
693 limLog(pMac, LOG1, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
694 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
695 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
696 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
697 limLog(pMac, LOG1, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
698 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
699 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
700 limLog(pMac, LOG1, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
701 limLog(pMac, LOG1, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
702 limLog(pMac, LOG1, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
703 limLog(pMac, LOG1, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
704 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
705 limLog(pMac, LOG1, FL("reserve (3): %d\n"), pDot11f->reserved2);
706 limLog(pMac, LOG1, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
707 limLog(pMac, LOG1, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
708 limLog(pMac, LOG1, FL("reserv (3): %d\n"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700709#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700710}
711
712void limLogVHTOperation(tpAniSirGlobal pMac,
713 tDot11fIEVHTOperation *pDot11f)
714{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700715#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700716 limLog(pMac, LOG1, FL("chanWidth : %d\n"), pDot11f->chanWidth);
717 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
718 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
719 limLog(pMac, LOG1, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700720#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700721}
722
723void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
724 tDot11fIEVHTExtBssLoad *pDot11f)
725{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700726#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700727 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
728 limLog(pMac, LOG1, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
729 limLog(pMac, LOG1, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
730 limLog(pMac, LOG1, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
731 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700732#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700733}
734
735
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700736void limLogOperatingMode( tpAniSirGlobal pMac,
737 tDot11fIEOperatingMode *pDot11f)
738{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700739#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700740 limLog(pMac, LOG1, FL("ChanWidth : %d\n"), pDot11f->chanWidth);
741 limLog(pMac, LOG1, FL("reserved: %d\n"), pDot11f->reserved);
742 limLog(pMac, LOG1, FL("rxNSS: %d\n"), pDot11f->rxNSS);
743 limLog(pMac, LOG1, FL("rxNSS Type: %d\n"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700744#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700745}
746
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700747void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
748{
749 tANI_U8 i;
750 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
751 pQosMapSet->num_dscp_exceptions);
752 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
753 {
754 limLog(pMac, LOG1, FL("dscp value: %d"),
755 pQosMapSet->dscp_exceptions[i][0]);
756 limLog(pMac, LOG1, FL("User priority value: %d"),
757 pQosMapSet->dscp_exceptions[i][1]);
758 }
759 for (i=0;i<8;i++)
760 {
761 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
762 pQosMapSet->dscp_range[i][0]);
763 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
764 pQosMapSet->dscp_range[i][1]);
765 }
766}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700767
Jeff Johnsone7245742012-09-05 17:12:55 -0700768tSirRetStatus
769PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530770 tDot11fIEVHTCaps *pDot11f,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530771 tANI_U8 nChannelNum,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530772 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700773{
774 tSirRetStatus nStatus;
775 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530776 tAniBool disableMcs9 = eSIR_FALSE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700777
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530778 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530779 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
780 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530781 else
782 disableMcs9 =
783 pMac->roam.configParam.channelBondingMode5GHz?
784 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700785 pDot11f->present = 1;
786
787 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
788 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
789
790 nCfgValue = 0;
791 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
792 nCfgValue );
793 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
794
795 nCfgValue = 0;
796 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
797 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
798
799 nCfgValue = 0;
800 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
801 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
802
803 nCfgValue = 0;
804 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
805 nCfgValue );
806 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
807
Deepthi Gowri0c1e1682015-06-19 12:57:53 +0530808 if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
809 {
810 pDot11f->shortGI80MHz = 0;
811 pDot11f->shortGI160and80plus80MHz = 0;
812 }
813
Jeff Johnsone7245742012-09-05 17:12:55 -0700814 nCfgValue = 0;
815 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
816 pDot11f->txSTBC = (nCfgValue & 0x0001);
817
818 nCfgValue = 0;
819 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
820 pDot11f->rxSTBC = (nCfgValue & 0x0007);
821
822 nCfgValue = 0;
823 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
824 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
825
826 nCfgValue = 0;
827 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
828 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
829
830 nCfgValue = 0;
831 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
832 nCfgValue );
833 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
834
835 nCfgValue = 0;
836 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
837 nCfgValue );
838 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
839
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530840 /* muBeamformerCap should be 0 for non AP and
841 * muBeamformeeCap should be 0 for AP
842 */
843 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
844 {
845 nCfgValue = 0;
846 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
847 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
848 pDot11f->muBeamformeeCap = 0;
849 }
850 else
851 {
852 pDot11f->muBeamformerCap = 0;
853 nCfgValue = 0;
854 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
855 /* Enable only if FW and host both support the MU_MIMO feature
856 */
857 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
858 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700859
860 nCfgValue = 0;
861 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
862 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
863
864 nCfgValue = 0;
865 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
866 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
867
868 nCfgValue = 0;
869 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
870 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
871
872 nCfgValue = 0;
873 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
874 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
875
876 nCfgValue = 0;
877 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
878 pDot11f->rxAntPattern = nCfgValue;
879
880 nCfgValue = 0;
881 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
882 pDot11f->txAntPattern = nCfgValue;
883
884 pDot11f->reserved1= 0;
885
886 nCfgValue = 0;
887 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530888
889 if (eSIR_TRUE == disableMcs9)
890 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700891 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
892
893 nCfgValue = 0;
894 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
895 nCfgValue );
896 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
897
898 pDot11f->reserved2= 0;
899
900 nCfgValue = 0;
901 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530902
903 if (eSIR_TRUE == disableMcs9)
904 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700905 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
906
907 nCfgValue = 0;
908 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
909 nCfgValue );
910 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
911
912 pDot11f->reserved3= 0;
913
914 limLogVHTCap(pMac, pDot11f);
915
916 return eSIR_SUCCESS;
917
918}
919
920tSirRetStatus
921PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530922 tDot11fIEVHTOperation *pDot11f,
923 tANI_U8 nChannelNum)
Jeff Johnsone7245742012-09-05 17:12:55 -0700924{
925 tSirRetStatus nStatus;
926 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530927 tAniBool disableMcs9 = eSIR_FALSE;
928
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530929 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530930 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
931 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530932 else
933 disableMcs9 =
934 pMac->roam.configParam.channelBondingMode5GHz?
935 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700936
937 pDot11f->present = 1;
938
939 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
940 pDot11f->chanWidth = (tANI_U8)nCfgValue;
941
942 nCfgValue = 0;
943 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
944 nCfgValue );
945 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
946
947 nCfgValue = 0;
948 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
949 nCfgValue );
950 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
951
952 nCfgValue = 0;
953 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530954
955 if (eSIR_TRUE == disableMcs9)
956 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700957 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
958
959 limLogVHTOperation(pMac,pDot11f);
960
961 return eSIR_SUCCESS;
962
963}
964
965tSirRetStatus
966PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
967 tDot11fIEVHTExtBssLoad *pDot11f)
968{
969 tSirRetStatus nStatus;
970 tANI_U32 nCfgValue=0;
971
972 pDot11f->present = 1;
973
974 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
975 nCfgValue );
976 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
977
978 nCfgValue = 0;
979 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
980 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
981
982 nCfgValue=0;
983 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
984 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
985
986 nCfgValue=0;
987 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
988 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
989
990 nCfgValue=0;
991 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
992 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
993
994 limLogVHTExtBssLoad(pMac,pDot11f);
995
996 return eSIR_SUCCESS;
997}
998
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530999#ifdef WLAN_FEATURE_AP_HT40_24G
1000tSirRetStatus
1001PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
1002 tDot11fIEOBSSScanParameters *pDot11f,
1003 tpPESession psessionEntry)
1004{
1005 pDot11f->present = 1;
1006
1007 pDot11f->obssScanPassiveDwell =
1008 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
1009
1010 pDot11f->obssScanActiveDwell =
1011 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
1012
1013 pDot11f->bssChannelWidthTriggerScanInterval =
1014 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
1015
1016 pDot11f->obssScanPassiveTotalPerChannel =
1017 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
1018
1019 pDot11f->obssScanActiveTotalPerChannel =
1020 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
1021
1022 pDot11f->bssWidthChannelTransitionDelayFactor =
1023 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
1024
1025 pDot11f->obssScanActivityThreshold =
1026 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
1027
1028 return eSIR_SUCCESS;
1029}
1030#endif
1031
Mohit Khanna4a70d262012-09-11 16:30:12 -07001032tSirRetStatus
1033PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +05301034 tDot11fIEExtCap *pDot11f,
1035 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -07001036{
Sandeep Puligilla60342762014-01-30 21:05:37 +05301037
Sandeep Puligilla60342762014-01-30 21:05:37 +05301038#ifdef WLAN_FEATURE_11AC
1039 if (psessionEntry->vhtCapability)
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301040 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301041 pDot11f->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301042 pDot11f->present = 1;
1043 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301044#endif
1045 /* while operating in 2.4GHz only then STA need to advertize
1046 the bss co-ex capability*/
1047 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
1048 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301049#ifdef WLAN_FEATURE_AP_HT40_24G
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301050 if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1051 && pMac->roam.configParam.channelBondingMode24GHz)
1052 || pMac->roam.configParam.apHT40_24GEnabled)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301053#else
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301054 if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1055 && pMac->roam.configParam.channelBondingMode24GHz)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301056#endif
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301057 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301058 pDot11f->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301059 pDot11f->present = 1;
1060 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301061 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07001062 return eSIR_SUCCESS;
1063}
1064
1065tSirRetStatus
1066PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
1067 tDot11fIEOperatingMode *pDot11f,
1068 tpPESession psessionEntry)
1069{
1070 pDot11f->present = 1;
1071
1072 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1073 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1074 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1075
1076 return eSIR_SUCCESS;
1077}
Jeff Johnsone7245742012-09-05 17:12:55 -07001078
1079#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001080tSirRetStatus
1081PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1082 tDot11fIEHTInfo *pDot11f,
1083 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001084{
1085 tANI_U32 nCfgValue, nCfgLen;
1086 tANI_U8 htInfoField1;
1087 tANI_U16 htInfoField2;
1088 tSirRetStatus nSirStatus;
1089 tSirMacHTInfoField1 *pHTInfoField1;
1090 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 union {
1092 tANI_U16 nCfgValue16;
1093 tSirMacHTInfoField3 infoField3;
1094 }uHTInfoField;
1095 union {
1096 tANI_U16 nCfgValue16;
1097 tSirMacHTInfoField2 infoField2;
1098 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001099
Jeff Johnson295189b2012-06-20 16:38:30 -07001100
1101 #if 0
1102 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1103 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301104
1105 if (NULL == psessionEntry)
1106 {
1107 PELOGE(limLog(pMac, LOG1,
1108 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
1109 return eSIR_FAILURE;
1110 }
1111
Jeff Johnson295189b2012-06-20 16:38:30 -07001112 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1113
1114 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1115
1116 htInfoField1 = ( tANI_U8 ) nCfgValue;
1117
1118 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001119 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1120 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1121
Jeff Johnsone7245742012-09-05 17:12:55 -07001122 if (psessionEntry == NULL)
1123 {
1124 PELOGE(limLog(pMac, LOG1,
1125 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
1126 }
1127 else
1128 {
1129 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1130 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1131 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001132
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001133 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1135
1136 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1137
1138 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1139 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1140 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1141
1142 uHTInfoField2.infoField2.reserved = 0;
1143
1144 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1146
1147 htInfoField2 = ( tANI_U16 ) nCfgValue;
1148
1149 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1150 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1151 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1152 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1153
1154 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001155 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001156
1157 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1158
1159
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1161
1162
1163 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1164 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1165 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1166 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1167 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1168 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1169 uHTInfoField.infoField3.reserved = 0;
1170
Jeff Johnson295189b2012-06-20 16:38:30 -07001171
1172 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1173 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1174 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1175 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1176 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1177
Jeff Johnson295189b2012-06-20 16:38:30 -07001178 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1179 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1180 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1181 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1182
Jeff Johnson295189b2012-06-20 16:38:30 -07001183
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1185 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1186 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1187 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1188 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1189 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1190 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1192 pDot11f->basicMCSSet, nCfgLen,
1193 SIZE_OF_BASIC_MCS_SET );
1194
1195 pDot11f->present = 1;
1196
1197 return eSIR_SUCCESS;
1198
1199} // End PopulateDot11fHTInfo.
1200
1201void
1202PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1203 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1204{
1205 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1206 {
1207 pDot11f->present = 1;
1208 // ATIM duration is always set to 0
1209 pDot11f->atim = 0;
1210 }
1211
1212} // End PopulateDot11fIBSSParams.
1213
1214
1215#ifdef ANI_SUPPORT_11H
1216tSirRetStatus
1217PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1218 tpSirMacMeasReqActionFrame pReq,
1219 tDot11fIEMeasurementReport *pDot11f)
1220{
1221 pDot11f->token = pReq->measReqIE.measToken;
1222 pDot11f->late = 0;
1223 pDot11f->incapable = 0;
1224 pDot11f->refused = 1;
1225 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1226
1227 pDot11f->present = 1;
1228
1229 return eSIR_SUCCESS;
1230
1231} // End PopulatedDot11fMeasurementReport0.
1232
1233tSirRetStatus
1234PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1235 tpSirMacMeasReqActionFrame pReq,
1236 tDot11fIEMeasurementReport *pDot11f)
1237{
1238 pDot11f->token = pReq->measReqIE.measToken;
1239 pDot11f->late = 0;
1240 pDot11f->incapable = 0;
1241 pDot11f->refused = 1;
1242 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1243
1244 pDot11f->present = 1;
1245
1246 return eSIR_SUCCESS;
1247
1248} // End PopulatedDot11fMeasurementReport1.
1249
1250tSirRetStatus
1251PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1252 tpSirMacMeasReqActionFrame pReq,
1253 tDot11fIEMeasurementReport *pDot11f)
1254{
1255 pDot11f->token = pReq->measReqIE.measToken;
1256 pDot11f->late = 0;
1257 pDot11f->incapable = 0;
1258 pDot11f->refused = 1;
1259 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1260
1261 pDot11f->present = 1;
1262
1263 return eSIR_SUCCESS;
1264
1265} // End PopulatedDot11fMeasurementReport2.
1266#endif
1267
1268void
1269PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1270 tDot11fIEPowerCaps *pCaps,
1271 tANI_U8 nAssocType,
1272 tpPESession psessionEntry)
1273{
1274 if (nAssocType == LIM_REASSOC)
1275 {
1276 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1277 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1278 }else
1279 {
1280 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1281 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1282
1283 }
1284
1285 pCaps->present = 1;
1286} // End PopulateDot11fPowerCaps.
1287
1288tSirRetStatus
1289PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1290 tDot11fIEPowerConstraints *pDot11f)
1291{
1292 tANI_U32 cfg;
1293 tSirRetStatus nSirStatus;
1294
1295 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1296
1297 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1298 pDot11f->present = 1;
1299
1300 return eSIR_SUCCESS;
1301} // End PopulateDot11fPowerConstraints.
1302
1303void
1304PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1305 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1306{
1307 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1308 pDot11f->reserved = 0;
1309 pDot11f->txopreq = 0;
1310 pDot11f->qreq = 0;
1311 pDot11f->qack = 0;
1312 pDot11f->present = 1;
1313} // End PopulatedDot11fQOSCaps.
1314
1315void
1316PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1317 tDot11fIEQOSCapsStation *pDot11f)
1318{
1319 tANI_U32 val = 0;
1320
1321 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1322 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1323
1324 pDot11f->more_data_ack = 0;
1325 pDot11f->max_sp_length = (tANI_U8)val;
1326 pDot11f->qack = 0;
1327
1328 if (pMac->lim.gUapsdEnable)
1329 {
1330 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1331 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1332 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1333 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1334 }
1335 pDot11f->present = 1;
1336} // End PopulatedDot11fQOSCaps.
1337
1338tSirRetStatus
1339PopulateDot11fRSN(tpAniSirGlobal pMac,
1340 tpSirRSNie pRsnIe,
1341 tDot11fIERSN *pDot11f)
1342{
1343 tANI_U32 status;
1344 int idx;
1345
1346 if ( pRsnIe->length )
1347 {
1348 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1349 {
1350 status = dot11fUnpackIeRSN( pMac,
1351 pRsnIe->rsnIEdata + idx + 2, //EID, length
1352 pRsnIe->rsnIEdata[ idx + 1 ],
1353 pDot11f );
1354 if ( DOT11F_FAILED( status ) )
1355 {
1356 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1357 "N (0x%08x).\n"),
1358 status );
1359 return eSIR_FAILURE;
1360 }
1361 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1362 "PopulateDot11fRSN.\n"), status );
1363 }
1364
1365 }
1366
1367 return eSIR_SUCCESS;
1368} // End PopulateDot11fRSN.
1369
1370tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1371 tpSirRSNie pRsnIe,
1372 tDot11fIERSNOpaque *pDot11f )
1373{
1374 int idx;
1375
1376 if ( pRsnIe->length )
1377 {
1378 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1379 {
1380 pDot11f->present = 1;
1381 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301382 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 pRsnIe->rsnIEdata + idx + 2, // EID, len
1384 pRsnIe->rsnIEdata[ idx + 1 ] );
1385 }
1386 }
1387
1388 return eSIR_SUCCESS;
1389
1390} // End PopulateDot11fRSNOpaque.
1391
1392
1393
1394#if defined(FEATURE_WLAN_WAPI)
1395
1396tSirRetStatus
1397PopulateDot11fWAPI(tpAniSirGlobal pMac,
1398 tpSirRSNie pRsnIe,
1399 tDot11fIEWAPI *pDot11f)
1400 {
1401 tANI_U32 status;
1402 int idx;
1403
1404 if ( pRsnIe->length )
1405 {
1406 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1407 {
1408 status = dot11fUnpackIeWAPI( pMac,
1409 pRsnIe->rsnIEdata + idx + 2, //EID, length
1410 pRsnIe->rsnIEdata[ idx + 1 ],
1411 pDot11f );
1412 if ( DOT11F_FAILED( status ) )
1413 {
1414 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1415 status );
1416 return eSIR_FAILURE;
1417 }
1418 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1419 "PopulateDot11fWAPI.\n"), status );
1420 }
1421 }
1422
1423 return eSIR_SUCCESS;
1424} // End PopulateDot11fWAPI.
1425
1426tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1427 tpSirRSNie pRsnIe,
1428 tDot11fIEWAPIOpaque *pDot11f )
1429{
1430 int idx;
1431
1432 if ( pRsnIe->length )
1433 {
1434 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1435 {
1436 pDot11f->present = 1;
1437 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301438 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001439 pRsnIe->rsnIEdata + idx + 2, // EID, len
1440 pRsnIe->rsnIEdata[ idx + 1 ] );
1441 }
1442 }
1443
1444 return eSIR_SUCCESS;
1445
1446} // End PopulateDot11fWAPIOpaque.
1447
1448
1449#endif //defined(FEATURE_WLAN_WAPI)
1450
1451void
1452PopulateDot11fSSID(tpAniSirGlobal pMac,
1453 tSirMacSSid *pInternal,
1454 tDot11fIESSID *pDot11f)
1455{
1456 pDot11f->present = 1;
1457 pDot11f->num_ssid = pInternal->length;
1458 if ( pInternal->length )
1459 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301460 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001461 pInternal->length );
1462 }
1463} // End PopulateDot11fSSID.
1464
1465tSirRetStatus
1466PopulateDot11fSSID2(tpAniSirGlobal pMac,
1467 tDot11fIESSID *pDot11f)
1468{
1469 tANI_U32 nCfg;
1470 tSirRetStatus nSirStatus;
1471
1472 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1473 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1474 pDot11f->present = 1;
1475 return eSIR_SUCCESS;
1476} // End PopulateDot11fSSID2.
1477
1478void
1479PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1480 tDot11fIESchedule *pDot11f)
1481{
1482 pDot11f->aggregation = pSchedule->info.aggregation;
1483 pDot11f->tsid = pSchedule->info.tsid;
1484 pDot11f->direction = pSchedule->info.direction;
1485 pDot11f->reserved = pSchedule->info.rsvd;
1486 pDot11f->service_start_time = pSchedule->svcStartTime;
1487 pDot11f->service_interval = pSchedule->svcInterval;
1488 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1489 pDot11f->spec_interval = pSchedule->specInterval;
1490
1491 pDot11f->present = 1;
1492} // End PopulateDot11fSchedule.
1493
1494void
1495PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1496 tDot11fIESuppChannels *pDot11f,
1497 tANI_U8 nAssocType,
1498 tpPESession psessionEntry)
1499{
1500 tANI_U8 i;
1501 tANI_U8 *p;
1502
1503 if (nAssocType == LIM_REASSOC)
1504 {
1505 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1506 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1507 }else
1508 {
1509 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1510 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1511 }
1512 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1513 {
1514 pDot11f->bands[i][0] = *p;
1515 pDot11f->bands[i][1] = 1;
1516 }
1517
1518 pDot11f->present = 1;
1519
1520} // End PopulateDot11fSuppChannels.
1521
1522tSirRetStatus
1523PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1524 tANI_U8 nChannelNum,
1525 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1526{
1527 tSirRetStatus nSirStatus;
1528 tANI_U32 nRates;
1529 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1530
1531 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1532 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1533 sending mgmt frames (lile probe req) which need to go out before any session is present.
1534 */
1535 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1536 {
1537 #if 0
1538 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1539 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1540 #endif //TO SUPPORT BT-AMP
1541 if(psessionEntry != NULL)
1542 {
1543 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301544 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 nRates);
1546 }
1547 else
1548 {
1549 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1550 nRates = 0;
1551 }
1552 }
1553 else if ( 14 >= nChannelNum )
1554 {
1555 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1556 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1557 }
1558 else
1559 {
1560 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1561 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1562 }
1563
1564 if ( 0 != nRates )
1565 {
1566 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301567 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001568 pDot11f->present = 1;
1569 }
1570
1571 return eSIR_SUCCESS;
1572
1573} // End PopulateDot11fSuppRates.
1574
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301575/**
1576 * PopulateDot11fRatesTdls() - populate supported rates and
1577 * extended supported rates IE.
1578 * @p_mac gloabl - header.
1579 * @p_supp_rates - pointer to supported rates IE
1580 * @p_ext_supp_rates - pointer to extended supported rates IE
1581 *
1582 * This function populates the supported rates and extended supported
1583 * rates IE based in the STA capability. If the number of rates
1584 * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
1585 * IE is populated.
1586 *
1587 * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
1588 * on failure.
1589 */
1590
1591tSirRetStatus
1592PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
1593 tDot11fIESuppRates *p_supp_rates,
1594 tDot11fIEExtSuppRates *p_ext_supp_rates)
1595{
1596 tSirMacRateSet temp_rateset;
1597 tSirMacRateSet temp_rateset2;
1598 uint32_t val, i;
1599 uint32_t self_dot11mode = 0;
1600
1601 wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
1602
1603 /**
1604 * Include 11b rates only when the device configured in
1605 * auto, 11a/b/g or 11b_only
1606 */
1607 if ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
1608 (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1609 (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
1610 (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
1611 (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
1612 (self_dot11mode == WNI_CFG_DOT11_MODE_11B) )
1613 {
1614 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1615 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
1616 (tANI_U8 *)&temp_rateset.rate, &val);
1617 temp_rateset.numRates = (tANI_U8) val;
1618 }
1619 else
1620 {
1621 temp_rateset.numRates = 0;
1622 }
1623
1624 /* Include 11a rates when the device configured in non-11b mode */
1625 if (!IS_DOT11_MODE_11B(self_dot11mode))
1626 {
1627 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1628 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
1629 (tANI_U8 *)&temp_rateset2.rate, &val);
1630 temp_rateset2.numRates = (tANI_U8) val;
1631 }
1632 else
1633 {
1634 temp_rateset2.numRates = 0;
1635 }
1636
1637 if ((temp_rateset.numRates + temp_rateset2.numRates) >
1638 SIR_MAC_MAX_NUMBER_OF_RATES)
1639 {
1640 limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
1641 SIR_MAC_MAX_NUMBER_OF_RATES);
1642 return eSIR_FAILURE;
1643 }
1644
1645 /**
1646 * copy all rates in temp_rateset,
1647 * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
1648 */
1649 for (i = 0; i < temp_rateset2.numRates; i++)
1650 temp_rateset.rate[i + temp_rateset.numRates] =
1651 temp_rateset2.rate[i];
1652
1653 temp_rateset.numRates += temp_rateset2.numRates;
1654
1655 if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
1656 {
1657 p_supp_rates->num_rates = temp_rateset.numRates;
1658 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1659 p_supp_rates->num_rates);
1660 p_supp_rates->present = 1;
1661 }
1662 else /* Populate extended capability as well */
1663 {
1664 p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
1665 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1666 p_supp_rates->num_rates);
1667 p_supp_rates->present = 1;
1668 p_ext_supp_rates->num_rates = temp_rateset.numRates -
1669 MAX_NUM_SUPPORTED_RATES;
1670 vos_mem_copy(p_ext_supp_rates->rates,
1671 (tANI_U8 *)temp_rateset.rate +
1672 MAX_NUM_SUPPORTED_RATES,
1673 p_ext_supp_rates->num_rates);
1674 p_ext_supp_rates->present = 1;
1675 }
1676
1677 return eSIR_SUCCESS;
1678
1679} /* End PopulateDot11fRatesTdls */
1680
Jeff Johnson295189b2012-06-20 16:38:30 -07001681tSirRetStatus
1682PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1683 tDot11fIETPCReport *pDot11f,
1684 tpPESession psessionEntry)
1685{
1686 tANI_U16 staid, txPower;
1687 tSirRetStatus nSirStatus;
1688
1689 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1690 if ( eSIR_SUCCESS != nSirStatus )
1691 {
1692 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1693 "eDot11fTPCReport; limGetMgmtStaid "
1694 "returned status %d.\n"),
1695 nSirStatus );
1696 return eSIR_FAILURE;
1697 }
1698
1699 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1700 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1701 txPower = 0;
1702 pDot11f->tx_power = ( tANI_U8 )txPower;
1703 pDot11f->link_margin = 0;
1704 pDot11f->present = 1;
1705
1706 return eSIR_SUCCESS;
1707} // End PopulateDot11fTPCReport.
1708
1709
1710void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1711 tDot11fFfTSInfo *pDot11f)
1712{
1713 pDot11f->traffic_type = pInfo->traffic.trafficType;
1714 pDot11f->tsid = pInfo->traffic.tsid;
1715 pDot11f->direction = pInfo->traffic.direction;
1716 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1717 pDot11f->aggregation = pInfo->traffic.aggregation;
1718 pDot11f->psb = pInfo->traffic.psb;
1719 pDot11f->user_priority = pInfo->traffic.userPrio;
1720 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1721 pDot11f->schedule = pInfo->schedule.schedule;
1722} // End PopulatedDot11fTSInfo.
1723
1724void PopulateDot11fWMM(tpAniSirGlobal pMac,
1725 tDot11fIEWMMInfoAp *pInfo,
1726 tDot11fIEWMMParams *pParams,
1727 tDot11fIEWMMCaps *pCaps,
1728 tpPESession psessionEntry)
1729{
1730 if ( psessionEntry->limWmeEnabled )
1731 {
1732 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1733 {
1734 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1735 {
1736 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1737 }
1738 }
1739 else
1740 {
1741 {
1742 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1743 }
1744
1745 if ( psessionEntry->limWsmEnabled )
1746 {
1747 PopulateDot11fWMMCaps( pCaps );
1748 }
1749 }
1750 }
1751} // End PopulateDot11fWMM.
1752
1753void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1754{
1755 pCaps->version = SIR_MAC_OUI_VERSION_1;
1756 pCaps->qack = 0;
1757 pCaps->queue_request = 1;
1758 pCaps->txop_request = 0;
1759 pCaps->more_ack = 0;
1760 pCaps->present = 1;
1761} // End PopulateDot11fWmmCaps.
1762
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001763#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001764void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1765{
1766 tANI_U8 numTspecs = 0, idx;
1767 tTspecInfo *pTspec = NULL;
1768
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001769 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1770 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 pReassoc->num_WMMTSPEC = numTspecs;
1772 if (numTspecs) {
1773 for (idx=0; idx<numTspecs; idx++) {
1774 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301775 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 pTspec++;
1777 }
1778 }
1779}
1780#endif
1781
1782void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1783 tpPESession psessionEntry)
1784{
1785 pInfo->version = SIR_MAC_OUI_VERSION_1;
1786
1787 /* WMM Specification 3.1.3, 3.2.3
1788 * An IBSS staion shall always use its default WMM parameters.
1789 */
1790 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1791 {
1792 pInfo->param_set_count = 0;
1793 pInfo->uapsd = 0;
1794 }
1795 else
1796 {
1797 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1799 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1800 }
1801 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1803 }
1804 pInfo->present = 1;
1805}
1806
1807void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1808{
1809 tANI_U32 val = 0;
1810
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301811 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001812 pInfo->version = SIR_MAC_OUI_VERSION_1;
1813 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1814 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1815 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1816 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1817
1818 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1819 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 pInfo->max_sp_length = (tANI_U8)val;
1821 pInfo->present = 1;
1822}
1823
Jeff Johnson295189b2012-06-20 16:38:30 -07001824void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1825 tDot11fIEWMMParams *pParams,
1826 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001827{
1828 pParams->version = SIR_MAC_OUI_VERSION_1;
1829
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1831 pParams->qosInfo =
1832 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1833 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 pParams->qosInfo =
1835 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1836
1837 // Fill each EDCA parameter set in order: be, bk, vi, vo
1838 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1839 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1840 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1841 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1842 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1843 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1844
1845 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1846 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1847 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1848 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1849 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1850 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1851
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1853 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1854 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1856
1857
1858
1859 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1860 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1861 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1862 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1863 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1864
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1866 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1867 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1869
1870 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1871 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1872 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1873 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1874 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1875
1876 pParams->present = 1;
1877
1878} // End PopulateDot11fWMMParams.
1879
1880void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1881 tDot11fIEWMMSchedule *pDot11f)
1882{
1883 pDot11f->version = 1;
1884 pDot11f->aggregation = pSchedule->info.aggregation;
1885 pDot11f->tsid = pSchedule->info.tsid;
1886 pDot11f->direction = pSchedule->info.direction;
1887 pDot11f->reserved = pSchedule->info.rsvd;
1888 pDot11f->service_start_time = pSchedule->svcStartTime;
1889 pDot11f->service_interval = pSchedule->svcInterval;
1890 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1891 pDot11f->spec_interval = pSchedule->specInterval;
1892
1893 pDot11f->present = 1;
1894} // End PopulateDot11fWMMSchedule.
1895
1896tSirRetStatus
1897PopulateDot11fWPA(tpAniSirGlobal pMac,
1898 tpSirRSNie pRsnIe,
1899 tDot11fIEWPA *pDot11f)
1900{
1901 tANI_U32 status;
1902 int idx;
1903
1904 if ( pRsnIe->length )
1905 {
1906 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1907 {
1908 status = dot11fUnpackIeWPA( pMac,
1909 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1910 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1911 pDot11f );
1912 if ( DOT11F_FAILED( status ) )
1913 {
1914 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1915 "A (0x%08x).\n"),
1916 status );
1917 return eSIR_FAILURE;
1918 }
1919 }
1920 }
1921
1922 return eSIR_SUCCESS;
1923} // End PopulateDot11fWPA.
1924
1925
1926
1927tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1928 tpSirRSNie pRsnIe,
1929 tDot11fIEWPAOpaque *pDot11f )
1930{
1931 int idx;
1932
1933 if ( pRsnIe->length )
1934 {
1935 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1936 {
1937 pDot11f->present = 1;
1938 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301939 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1941 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1942 }
1943 }
1944
1945 return eSIR_SUCCESS;
1946
1947} // End PopulateDot11fWPAOpaque.
1948
1949////////////////////////////////////////////////////////////////////////
1950
1951tSirRetStatus
1952sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1953{
1954#if 0
1955 tANI_U32 val;
1956
1957 *caps = 0;
1958 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1959 != eSIR_SUCCESS)
1960 {
1961 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1962 return eSIR_FAILURE;
1963 }
1964 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1965 {
1966 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1967 return eSIR_FAILURE;
1968 }
1969
1970 *caps = (tANI_U16) val;
1971#endif
1972 return eSIR_SUCCESS;
1973}
1974
1975tSirRetStatus
1976sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1977 tANI_U8 *pFrame,
1978 tANI_U32 nFrame,
1979 tpSirProbeReq pProbeReq)
1980{
1981 tANI_U32 status;
1982 tDot11fProbeRequest pr;
1983
1984 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301985 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001986
1987 // delegate to the framesc-generated code,
1988 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1989 if ( DOT11F_FAILED( status ) )
1990 {
1991 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1992 status, nFrame);
1993 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1994 return eSIR_FAILURE;
1995 }
1996 else if ( DOT11F_WARNED( status ) )
1997 {
1998 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1999 status, nFrame );
2000 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2001 }
2002
2003 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
2004 if ( ! pr.SSID.present )
2005 {
2006 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2007 }
2008 else
2009 {
2010 pProbeReq->ssidPresent = 1;
2011 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
2012 }
2013
2014 if ( ! pr.SuppRates.present )
2015 {
2016 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2017 return eSIR_FAILURE;
2018 }
2019 else
2020 {
2021 pProbeReq->suppRatesPresent = 1;
2022 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
2023 }
2024
2025 if ( pr.ExtSuppRates.present )
2026 {
2027 pProbeReq->extendedRatesPresent = 1;
2028 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
2029 }
2030
2031 if ( pr.HTCaps.present )
2032 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302033 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 }
2035
2036 if ( pr.WscProbeReq.present )
2037 {
2038 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05302039 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002041#ifdef WLAN_FEATURE_11AC
2042 if ( pr.VHTCaps.present )
2043 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302044 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002045 }
2046#endif
2047
Jeff Johnson295189b2012-06-20 16:38:30 -07002048
2049 if ( pr.P2PProbeReq.present )
2050 {
2051 pProbeReq->p2pIePresent = 1;
2052 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002053
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 return eSIR_SUCCESS;
2055
2056} // End sirConvertProbeReqFrame2Struct.
2057
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302058/* function ValidateAndRectifyIEs checks for the malformed frame.
2059 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302060 * (Tagged elements).
2061 * Every Tagged IE has tag number, tag length and data. Tag length indicates
2062 * the size of data in bytes.
2063 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302064 * And also rectifies missing optional fields in IE.
2065 *
2066 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
2067 * extended to rectify other optional fields in other IEs.
2068 *
2069 */
2070tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
2071 tANI_U8 *pMgmtFrame,
2072 tANI_U32 nFrameBytes,
2073 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302074{
2075 tANI_U32 length = SIZE_OF_FIXED_PARAM;
2076 tANI_U8 *refFrame;
2077
2078 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302079 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302080 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302081 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302082 {
2083 /*refFrame points to next IE */
2084 refFrame = pMgmtFrame + length;
2085 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
2086 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
2087 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302088 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302089 {
2090 /* Workaround : Some APs may not include RSN Capability but
2091 * the length of which is included in RSN IE length.
2092 * this may cause in updating RSN Capability with junk value.
2093 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302094 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302095 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302096 if ((*refFrame == RSNIEID) &&
2097 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302098 {
2099 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302100 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302101 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302102 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302103 limLog(pMac, LOG1,
2104 FL("Added RSN Capability to the RSNIE as 0x00 0x00\n"));
2105
2106 return eHAL_STATUS_SUCCESS;
2107 }
2108 return eSIR_FAILURE;
2109 }
2110 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302111 return eHAL_STATUS_SUCCESS;
2112}
2113
Jeff Johnson295189b2012-06-20 16:38:30 -07002114tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
2115 tANI_U8 *pFrame,
2116 tANI_U32 nFrame,
2117 tpSirProbeRespBeacon pProbeResp)
2118{
2119 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002120 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002121
2122 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302123 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002124
Abhishek Singhc75726d2015-04-13 14:44:14 +05302125 pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302126 if ( NULL == pr )
2127 status = eHAL_STATUS_FAILURE;
2128 else
2129 status = eHAL_STATUS_SUCCESS;
2130 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07002131 {
2132 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2133 return eSIR_FAILURE;
2134 }
2135
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302136 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002137
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002139 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 if ( DOT11F_FAILED( status ) )
2141 {
2142 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
2143 status, nFrame);
2144 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05302145 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002146 return eSIR_FAILURE;
2147 }
2148 else if ( DOT11F_WARNED( status ) )
2149 {
2150 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
2151 status, nFrame );
2152 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2153 }
2154
2155 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
2156
2157 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302158 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
2159 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002160
2161 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07002162 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002163
2164 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07002165 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
2166 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
2167 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
2168 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
2169 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
2170 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
2171 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
2172 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
2173 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
2174 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
2175 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2176 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2177 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2178 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2179 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2180 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002181
Jeff Johnson32d95a32012-09-10 13:15:23 -07002182 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 {
2184 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2185 }
2186 else
2187 {
2188 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002189 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 }
2191
Jeff Johnson32d95a32012-09-10 13:15:23 -07002192 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 {
2194 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2195 }
2196 else
2197 {
2198 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002199 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 }
2201
Jeff Johnson32d95a32012-09-10 13:15:23 -07002202 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 {
2204 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002205 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 }
2207
2208
Jeff Johnson32d95a32012-09-10 13:15:23 -07002209 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 {
2211 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002212 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 }
2214
Jeff Johnson32d95a32012-09-10 13:15:23 -07002215 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 {
2217 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002218 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 }
2220
Jeff Johnson32d95a32012-09-10 13:15:23 -07002221 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 {
2223 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002224 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 }
2226
Jeff Johnson32d95a32012-09-10 13:15:23 -07002227 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 {
2229 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302230 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 sizeof(tDot11fIEExtChanSwitchAnn) );
2232 }
2233
Jeff Johnson32d95a32012-09-10 13:15:23 -07002234 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 {
2236 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302237 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 sizeof(tDot11fIEExtChanSwitchAnn) );
2239 }
2240
Jeff Johnson32d95a32012-09-10 13:15:23 -07002241 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 {
2243 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302244 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 }
2246
Jeff Johnson32d95a32012-09-10 13:15:23 -07002247 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
2249 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302250 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2251 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 }
2253
Jeff Johnson32d95a32012-09-10 13:15:23 -07002254 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 {
2256 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302257 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 }
2259
Jeff Johnson32d95a32012-09-10 13:15:23 -07002260 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302262 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 }
2264
Jeff Johnson32d95a32012-09-10 13:15:23 -07002265 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302267 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 }
2269
Jeff Johnson32d95a32012-09-10 13:15:23 -07002270 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 {
2272 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002273 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002275 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002277 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 }
2279
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002280 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 {
2282 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002283 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 }
2285
Jeff Johnson32d95a32012-09-10 13:15:23 -07002286 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 {
2288 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002289 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 }
2291
Jeff Johnson32d95a32012-09-10 13:15:23 -07002292 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 {
2294 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002295 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002297 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 }
2299
Jeff Johnson32d95a32012-09-10 13:15:23 -07002300 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 {
2302 pProbeResp->wmeInfoPresent = 1;
2303 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2304 }
2305
Jeff Johnson32d95a32012-09-10 13:15:23 -07002306 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 {
2308 pProbeResp->wsmCapablePresent = 1;
2309 }
2310
2311
Jeff Johnson32d95a32012-09-10 13:15:23 -07002312 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 {
2314 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002315 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 }
2317
2318#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002319 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 {
2321 // MobilityDomain
2322 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302323 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2324 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002325 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002326#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002327 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2329#endif
2330 }
2331#endif
2332
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002333#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002334 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302336 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 }
2338#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002339 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002340 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302341 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 sizeof(tDot11fIEP2PProbeRes) );
2343 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002344#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002345 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002346 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302347 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002348 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002349 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002350 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302351 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002352 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002353 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002354 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302355 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002356 }
2357#endif
Abhishek Singhc75726d2015-04-13 14:44:14 +05302358 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 return eSIR_SUCCESS;
2360
2361} // End sirConvertProbeFrame2Struct.
2362
2363tSirRetStatus
2364sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2365 tANI_U8 *pFrame,
2366 tANI_U32 nFrame,
2367 tpSirAssocReq pAssocReq)
2368{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002369 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002370 tANI_U32 status;
2371
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302372 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2373 if ( NULL == ar )
2374 status = eHAL_STATUS_FAILURE;
2375 else
2376 status = eHAL_STATUS_SUCCESS;
2377 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002378 {
2379 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2380 return eSIR_FAILURE;
2381 }
2382 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302383 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2384 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002385
2386 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002387 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 if ( DOT11F_FAILED( status ) )
2389 {
2390 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2391 status, nFrame);
2392 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302393 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002394 return eSIR_FAILURE;
2395 }
2396 else if ( DOT11F_WARNED( status ) )
2397 {
2398 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2399 status, nFrame );
2400 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2401 }
2402
2403 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2404
2405 // make sure this is seen as an assoc request
2406 pAssocReq->reassocRequest = 0;
2407
2408 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002409 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2410 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2411 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2412 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2413 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2414 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2415 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2416 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2417 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2418 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2419 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2420 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2421 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2422 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2423 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2424 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002425
2426 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002427 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002428
2429 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002430 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 {
2432 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002433 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 }
2435
2436 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002437 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 {
2439 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002440 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 }
2442
2443 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002444 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002445 {
2446 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002447 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 }
2449
2450 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002451 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 {
2453 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002454 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 }
2456
2457 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002458 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 {
2460 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002461 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002462 }
2463
2464 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002465 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 {
2467 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002468 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 }
2470
2471 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002472 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002473 {
2474 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002475 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002476 }
2477
2478
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002479 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 {
2481 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002482 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002484#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002485 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002486 {
2487 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002488 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002489 }
2490#endif
2491
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002493 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 {
2495 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002496 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 }
2498
2499 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002500 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 {
2502 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002503 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 }
2505
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002506 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002507 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302508 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002509 }
2510
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002511 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 {
2513 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302514 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2515 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002516
2517 }
2518
2519
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002520 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002521
2522 if ( ! pAssocReq->ssidPresent )
2523 {
2524 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302525 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002526 return eSIR_FAILURE;
2527 }
2528
2529 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2530 {
2531 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302532 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002533 return eSIR_FAILURE;
2534 }
2535
Jeff Johnsone7245742012-09-05 17:12:55 -07002536#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002537 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002538 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302539 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002540 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2541 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2542 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002543 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002544 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302545 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002546 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2547 limLogOperatingMode( pMac, &pAssocReq->operMode);
2548 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002549#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302550 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002551 return eSIR_SUCCESS;
2552
2553} // End sirConvertAssocReqFrame2Struct.
2554
2555tSirRetStatus
2556sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2557 tANI_U8 *pFrame,
2558 tANI_U32 nFrame,
2559 tpSirAssocRsp pAssocRsp)
2560{
2561 static tDot11fAssocResponse ar;
2562 tANI_U32 status;
2563 tANI_U8 cnt =0;
2564
2565 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302566 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002567
2568 // delegate to the framesc-generated code,
2569 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2570 if ( DOT11F_FAILED( status ) )
2571 {
2572 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2573 status, nFrame);
2574 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2575 return eSIR_FAILURE;
2576 }
2577 else if ( DOT11F_WARNED( status ) )
2578 {
2579 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2580 status, nFrame );
2581 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2582 }
2583
2584 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2585
2586 // Capabilities
2587 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2588 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2589 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2590 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2591 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2592 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2593 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2594 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2595 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2596 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2597 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2598 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2599 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2600 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2601 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2602 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2603
2604 pAssocRsp->statusCode = ar.Status.status;
2605 pAssocRsp->aid = ar.AID.associd;
2606
2607 if ( ! ar.SuppRates.present )
2608 {
2609 pAssocRsp->suppRatesPresent = 0;
2610 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2611 }
2612 else
2613 {
2614 pAssocRsp->suppRatesPresent = 1;
2615 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2616 }
2617
2618 if ( ar.ExtSuppRates.present )
2619 {
2620 pAssocRsp->extendedRatesPresent = 1;
2621 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2622 }
2623
2624 if ( ar.EDCAParamSet.present )
2625 {
2626 pAssocRsp->edcaPresent = 1;
2627 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2628 }
Atul Mittalbceb4a12014-11-27 18:50:19 +05302629 if (ar.ExtCap.present)
2630 {
2631 vos_mem_copy(&pAssocRsp->ExtCap, &ar.ExtCap, sizeof(tDot11fIEExtCap));
2632 limLog(pMac, LOG1,
2633 FL("ExtCap is present, TDLSChanSwitProhibited: %d"),
2634 ar.ExtCap.TDLSChanSwitProhibited);
2635 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002636 if ( ar.WMMParams.present )
2637 {
2638 pAssocRsp->wmeEdcaPresent = 1;
2639 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002640 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 __printWMMParams(pMac, &ar.WMMParams);
2642 }
2643
2644 if ( ar.HTCaps.present )
2645 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302646 limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302647 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 }
2649
2650 if ( ar.HTInfo.present )
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302651 { limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302652 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 }
2654
2655#ifdef WLAN_FEATURE_VOWIFI_11R
2656 if (ar.MobilityDomain.present)
2657 {
2658 // MobilityDomain
2659 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302660 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2661 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2663#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002664 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002665 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2666#endif
2667 }
2668
2669 if ( ar.FTInfo.present )
2670 {
2671#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002672 limLog(pMac, LOG1, FL("FT Info present %d %d %d"), ar.FTInfo.R0KH_ID.num_PMK_R0_ID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002673 ar.FTInfo.R0KH_ID.present,
2674 ar.FTInfo.R1KH_ID.present);
2675#endif
2676 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302677 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 }
2679#endif
2680
2681#ifdef WLAN_FEATURE_VOWIFI_11R
2682 if (ar.num_RICDataDesc) {
2683 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2684 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302685 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2686 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 }
2688 }
2689 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2690 pAssocRsp->ricPresent = TRUE;
2691 }
2692#endif
2693
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002694#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 if (ar.num_WMMTSPEC) {
2696 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2697 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302698 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2699 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 }
2701 pAssocRsp->tspecPresent = TRUE;
2702 }
2703
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002704 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 {
2706 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302707 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002708 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 }
2710#endif
2711
Jeff Johnsone7245742012-09-05 17:12:55 -07002712#ifdef WLAN_FEATURE_11AC
2713 if ( ar.VHTCaps.present )
2714 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302715 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002716 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002717 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2718 }
2719 if ( ar.VHTOperation.present )
2720 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302721 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002722 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002723 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2724 }
2725#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302726 if(ar.OBSSScanParameters.present)
2727 {
2728 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2729 sizeof( tDot11fIEOBSSScanParameters));
2730 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002731 if ( ar.QosMapSet.present )
2732 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002733 pAssocRsp->QosMapSet.present = 1;
2734 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002735 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002736 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002737 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002738 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002739} // End sirConvertAssocRespFrame2Struct.
2740
2741tSirRetStatus
2742sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2743 tANI_U8 *pFrame,
2744 tANI_U32 nFrame,
2745 tpSirAssocReq pAssocReq)
2746{
2747 static tDot11fReAssocRequest ar;
2748 tANI_U32 status;
2749
2750 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302751 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002752
2753 // delegate to the framesc-generated code,
2754 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2755 if ( DOT11F_FAILED( status ) )
2756 {
2757 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2758 status, nFrame);
2759 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2760 return eSIR_FAILURE;
2761 }
2762 else if ( DOT11F_WARNED( status ) )
2763 {
2764 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2765 status, nFrame );
2766 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2767 }
2768
2769 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2770
2771 // make sure this is seen as a re-assoc request
2772 pAssocReq->reassocRequest = 1;
2773
2774 // Capabilities
2775 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2776 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2777 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2778 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2779 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2780 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2781 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2782 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2783 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2784 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2785 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2786 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2787 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2788 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2789 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2790 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2791
2792 // Listen Interval
2793 pAssocReq->listenInterval = ar.ListenInterval.interval;
2794
2795 // SSID
2796 if ( ar.SSID.present )
2797 {
2798 pAssocReq->ssidPresent = 1;
2799 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2800 }
2801
2802 // Supported Rates
2803 if ( ar.SuppRates.present )
2804 {
2805 pAssocReq->suppRatesPresent = 1;
2806 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2807 }
2808
2809 // Extended Supported Rates
2810 if ( ar.ExtSuppRates.present )
2811 {
2812 pAssocReq->extendedRatesPresent = 1;
2813 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2814 &ar.ExtSuppRates );
2815 }
2816
2817 // QOS Capabilities:
2818 if ( ar.QOSCapsStation.present )
2819 {
2820 pAssocReq->qosCapabilityPresent = 1;
2821 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2822 }
2823
2824 // WPA
2825 if ( ar.WPAOpaque.present )
2826 {
2827 pAssocReq->wpaPresent = 1;
2828 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2829 }
2830
2831 // RSN
2832 if ( ar.RSNOpaque.present )
2833 {
2834 pAssocReq->rsnPresent = 1;
2835 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2836 }
2837
2838
2839 // Power Capabilities
2840 if ( ar.PowerCaps.present )
2841 {
2842 pAssocReq->powerCapabilityPresent = 1;
2843 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2844 }
2845
2846 // Supported Channels
2847 if ( ar.SuppChannels.present )
2848 {
2849 pAssocReq->supportedChannelsPresent = 1;
2850 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2851 }
2852
2853 if ( ar.HTCaps.present )
2854 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302855 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 }
2857
2858 if ( ar.WMMInfoStation.present )
2859 {
2860 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302861 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2862 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002863
2864 }
2865
2866 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2867
2868 if ( ! pAssocReq->ssidPresent )
2869 {
2870 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2871 return eSIR_FAILURE;
2872 }
2873
2874 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2875 {
2876 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2877 return eSIR_FAILURE;
2878 }
2879
2880 // Why no call to 'updateAssocReqFromPropCapability' here, like
2881 // there is in 'sirConvertAssocReqFrame2Struct'?
2882
2883 // WSC IE
2884 if (ar.WscIEOpaque.present)
2885 {
2886 pAssocReq->addIEPresent = 1;
2887 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2888 }
2889
Jeff Johnson295189b2012-06-20 16:38:30 -07002890 if(ar.P2PIEOpaque.present)
2891 {
2892 pAssocReq->addIEPresent = 1;
2893 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2894 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002895
Jeff Johnsone7245742012-09-05 17:12:55 -07002896#ifdef WLAN_FEATURE_WFD
2897 if(ar.WFDIEOpaque.present)
2898 {
2899 pAssocReq->addIEPresent = 1;
2900 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2901 }
2902#endif
2903
2904#ifdef WLAN_FEATURE_11AC
2905 if ( ar.VHTCaps.present )
2906 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302907 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002908 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002909 if ( ar.OperatingMode.present )
2910 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302911 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002912 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2913 limLogOperatingMode( pMac, &pAssocReq->operMode);
2914 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002915#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002916 return eSIR_SUCCESS;
2917
2918} // End sirConvertReassocReqFrame2Struct.
2919
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002920
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002921#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002922tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002923sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002924 tANI_U8 *pPayload,
2925 const tANI_U32 nPayload,
2926 tANI_U8 **outIeBuf,
2927 tANI_U32 *pOutIeLen)
2928{
2929 tDot11fBeaconIEs *pBies = NULL;
2930 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002931 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002932 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002933
2934 /* To store how many bytes are required to be allocated
2935 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002936 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002937 tANI_U8 *pos = NULL;
2938
2939 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002940 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002941 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2942 if ( NULL == pBies )
2943 status = eHAL_STATUS_FAILURE;
2944 else
2945 status = eHAL_STATUS_SUCCESS;
2946 if (!HAL_STATUS_SUCCESS(status))
2947 {
2948 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2949 return eSIR_FAILURE;
2950 }
2951 // delegate to the framesc-generated code,
2952 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2953
2954 if ( DOT11F_FAILED( status ) )
2955 {
2956 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2957 status, nPayload);
2958 vos_mem_free(pBies);
2959 return eSIR_FAILURE;
2960 }
2961 else if ( DOT11F_WARNED( status ) )
2962 {
2963 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2964 status, nPayload );
2965 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2966 }
2967
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002968 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002969 if ( !pBies->SSID.present )
2970 {
2971 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2972 }
2973 else
2974 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002975 eseBcnReportMandatoryIe.ssidPresent = 1;
2976 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002977 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002978 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002979 }
2980
2981 if ( !pBies->SuppRates.present )
2982 {
2983 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2984 }
2985 else
2986 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002987 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2988 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2989 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002990 }
2991
2992 if ( pBies->FHParamSet.present)
2993 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002994 eseBcnReportMandatoryIe.fhParamPresent = 1;
2995 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002996 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2997 }
2998
2999 if ( pBies->DSParams.present )
3000 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003001 eseBcnReportMandatoryIe.dsParamsPresent = 1;
3002 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003003 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
3004 }
3005
3006 if ( pBies->CFParams.present )
3007 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003008 eseBcnReportMandatoryIe.cfPresent = 1;
3009 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003010 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
3011 }
3012
3013 if ( pBies->IBSSParams.present )
3014 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003015 eseBcnReportMandatoryIe.ibssParamPresent = 1;
3016 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003017 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3018 }
3019
3020 if ( pBies->TIM.present )
3021 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003022 eseBcnReportMandatoryIe.timPresent = 1;
3023 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
3024 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
3025 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
3026 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003027 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
3028 }
3029
3030 if ( pBies->RRMEnabledCap.present )
3031 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003032 eseBcnReportMandatoryIe.rrmPresent = 1;
3033 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003034 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3035 }
3036
3037 *outIeBuf = vos_mem_malloc(numBytes);
3038 if (NULL == *outIeBuf)
3039 {
3040 limLog(pMac, LOGP, FL("Memory Allocation failure"));
3041 vos_mem_free(pBies);
3042 return eSIR_FAILURE;
3043 }
3044 pos = *outIeBuf;
3045 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003046 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003047
3048 /* Start filling the output Ie with Mandatory IE information */
3049 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003050 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003051 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003052 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003053 {
3054 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
3055 retStatus = eSIR_FAILURE;
3056 goto err_bcnrep;
3057 }
3058 *pos = SIR_MAC_SSID_EID;
3059 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003060 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003061 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003062 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
3063 eseBcnReportMandatoryIe.ssId.length);
3064 pos += eseBcnReportMandatoryIe.ssId.length;
3065 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003066 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003067
3068 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003069 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003070 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003071 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003072 {
3073 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
3074 retStatus = eSIR_FAILURE;
3075 goto err_bcnrep;
3076 }
3077 *pos = SIR_MAC_RATESET_EID;
3078 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003079 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003080 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003081 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
3082 eseBcnReportMandatoryIe.supportedRates.numRates);
3083 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
3084 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003085 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003086
3087 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003088 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003089 {
3090 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
3091 {
3092 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
3093 retStatus = eSIR_FAILURE;
3094 goto err_bcnrep;
3095 }
3096 *pos = SIR_MAC_FH_PARAM_SET_EID;
3097 pos++;
3098 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
3099 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003100 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003101 SIR_MAC_FH_PARAM_SET_EID_MAX);
3102 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
3103 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
3104 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003105
3106 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003107 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003108 {
3109 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
3110 {
3111 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
3112 retStatus = eSIR_FAILURE;
3113 goto err_bcnrep;
3114 }
3115 *pos = SIR_MAC_DS_PARAM_SET_EID;
3116 pos++;
3117 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
3118 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003119 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003120 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
3121 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
3122 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003123
3124 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003125 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003126 {
3127 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
3128 {
3129 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
3130 retStatus = eSIR_FAILURE;
3131 goto err_bcnrep;
3132 }
3133 *pos = SIR_MAC_CF_PARAM_SET_EID;
3134 pos++;
3135 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
3136 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003137 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003138 SIR_MAC_CF_PARAM_SET_EID_MAX);
3139 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
3140 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
3141 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003142
3143 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003144 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003145 {
3146 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
3147 {
3148 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
3149 retStatus = eSIR_FAILURE;
3150 goto err_bcnrep;
3151 }
3152 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
3153 pos++;
3154 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3155 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003156 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003157 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3158 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3159 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3160 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003161
3162 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003163 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003164 {
3165 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
3166 {
3167 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
3168 retStatus = eSIR_FAILURE;
3169 goto err_bcnrep;
3170 }
3171 *pos = SIR_MAC_TIM_EID;
3172 pos++;
3173 *pos = SIR_MAC_TIM_EID_MIN;
3174 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003175 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003176 SIR_MAC_TIM_EID_MIN);
3177 pos += SIR_MAC_TIM_EID_MIN;
3178 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
3179 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003180
3181 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003182 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003183 {
3184 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3185 {
3186 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3187 retStatus = eSIR_FAILURE;
3188 goto err_bcnrep;
3189 }
3190 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3191 pos++;
3192 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3193 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003194 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003195 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3196 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3197 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003198
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003199 if (freeBytes != 0)
3200 {
3201 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3202 retStatus = eSIR_FAILURE;
3203 }
3204
3205err_bcnrep:
3206 /* The message counter would not be incremented in case of
3207 * returning failure and hence next time, this function gets
3208 * called, it would be using the same msg ctr for a different
3209 * BSS.So, it is good to clear the memory allocated for a BSS
3210 * that is returning failure.On success, the caller would take
3211 * care of freeing up the memory*/
3212 if (retStatus == eSIR_FAILURE)
3213 {
3214 vos_mem_free(*outIeBuf);
3215 *outIeBuf = NULL;
3216 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003217 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003218 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003219}
3220
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003221#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003222
Jeff Johnson295189b2012-06-20 16:38:30 -07003223tSirRetStatus
3224sirParseBeaconIE(tpAniSirGlobal pMac,
3225 tpSirProbeRespBeacon pBeaconStruct,
3226 tANI_U8 *pPayload,
3227 tANI_U32 nPayload)
3228{
3229 tDot11fBeaconIEs *pBies;
3230 tANI_U32 status;
3231
3232 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303233 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003234
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303235 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3236 if ( NULL == pBies )
3237 status = eHAL_STATUS_FAILURE;
3238 else
3239 status = eHAL_STATUS_SUCCESS;
3240 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003241 {
3242 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3243 return eSIR_FAILURE;
3244 }
3245 // delegate to the framesc-generated code,
3246 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3247
3248 if ( DOT11F_FAILED( status ) )
3249 {
3250 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3251 status, nPayload);
3252 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303253 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003254 return eSIR_FAILURE;
3255 }
3256 else if ( DOT11F_WARNED( status ) )
3257 {
3258 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3259 status, nPayload );
3260 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3261 }
3262
3263 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3264 if ( ! pBies->SSID.present )
3265 {
3266 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3267 }
3268 else
3269 {
3270 pBeaconStruct->ssidPresent = 1;
3271 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3272 }
3273
3274 if ( ! pBies->SuppRates.present )
3275 {
3276 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3277 }
3278 else
3279 {
3280 pBeaconStruct->suppRatesPresent = 1;
3281 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3282 }
3283
3284 if ( pBies->ExtSuppRates.present )
3285 {
3286 pBeaconStruct->extendedRatesPresent = 1;
3287 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3288 }
3289
3290 if ( pBies->CFParams.present )
3291 {
3292 pBeaconStruct->cfPresent = 1;
3293 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3294 }
3295
3296 if ( pBies->TIM.present )
3297 {
3298 pBeaconStruct->timPresent = 1;
3299 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3300 }
3301
3302 if ( pBies->Country.present )
3303 {
3304 pBeaconStruct->countryInfoPresent = 1;
3305 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3306 }
3307
3308 // 11h IEs
3309 if(pBies->TPCReport.present)
3310 {
3311 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303312 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003313 &pBies->TPCReport,
3314 sizeof( tDot11fIETPCReport));
3315 }
3316
3317 if(pBies->PowerConstraints.present)
3318 {
3319 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303320 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 &pBies->PowerConstraints,
3322 sizeof(tDot11fIEPowerConstraints));
3323 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003324#ifdef FEATURE_WLAN_ESE
3325 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003327 pBeaconStruct->eseTxPwr.present = 1;
3328 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003329 }
3330 if (pBies->QBSSLoad.present)
3331 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303332 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003333 }
3334#endif
3335
3336 if ( pBies->EDCAParamSet.present )
3337 {
3338 pBeaconStruct->edcaPresent = 1;
3339 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3340 }
3341
3342 // QOS Capabilities:
3343 if ( pBies->QOSCapsAp.present )
3344 {
3345 pBeaconStruct->qosCapabilityPresent = 1;
3346 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3347 }
3348
3349
3350
3351 if ( pBies->ChanSwitchAnn.present )
3352 {
3353 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303354 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 sizeof(tDot11fIEChanSwitchAnn));
3356 }
3357
3358 if ( pBies->ExtChanSwitchAnn.present)
3359 {
3360 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303361 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 sizeof(tDot11fIEExtChanSwitchAnn));
3363 }
3364
3365 if ( pBies->Quiet.present )
3366 {
3367 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303368 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 }
3370
3371 if ( pBies->HTCaps.present )
3372 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303373 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003374 }
3375
3376 if ( pBies->HTInfo.present )
3377 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303378 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003379 }
3380
3381 if ( pBies->DSParams.present )
3382 {
3383 pBeaconStruct->dsParamsPresent = 1;
3384 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3385 }
3386 else if(pBies->HTInfo.present)
3387 {
3388 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3389 }
3390
3391 if ( pBies->RSN.present )
3392 {
3393 pBeaconStruct->rsnPresent = 1;
3394 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3395 }
3396
3397 if ( pBies->WPA.present )
3398 {
3399 pBeaconStruct->wpaPresent = 1;
3400 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3401 }
3402
3403 if ( pBies->WMMParams.present )
3404 {
3405 pBeaconStruct->wmeEdcaPresent = 1;
3406 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3407 }
3408
3409 if ( pBies->WMMInfoAp.present )
3410 {
3411 pBeaconStruct->wmeInfoPresent = 1;
3412 }
3413
3414 if ( pBies->WMMCaps.present )
3415 {
3416 pBeaconStruct->wsmCapablePresent = 1;
3417 }
3418
3419
3420 if ( pBies->ERPInfo.present )
3421 {
3422 pBeaconStruct->erpPresent = 1;
3423 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3424 }
3425
Jeff Johnsone7245742012-09-05 17:12:55 -07003426#ifdef WLAN_FEATURE_11AC
3427 if ( pBies->VHTCaps.present )
3428 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303429 pBeaconStruct->VHTCaps.present = 1;
3430 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003431 }
3432 if ( pBies->VHTOperation.present )
3433 {
3434 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303435 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3436 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003437 }
3438 if ( pBies->VHTExtBssLoad.present )
3439 {
3440 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303441 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3442 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003443 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003444 if( pBies->OperatingMode.present)
3445 {
3446 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303447 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3448 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003449 }
3450
Jeff Johnsone7245742012-09-05 17:12:55 -07003451#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303452 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003453
Jeff Johnsone7245742012-09-05 17:12:55 -07003454
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 return eSIR_SUCCESS;
3456
3457} // End sirParseBeaconIE.
3458
3459tSirRetStatus
3460sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3461 tANI_U8 *pFrame,
3462 tpSirProbeRespBeacon pBeaconStruct)
3463{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003464 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003465 tANI_U32 status, nPayload;
3466 tANI_U8 *pPayload;
3467 tpSirMacMgmtHdr pHdr;
3468 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003469 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003470
3471 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3472 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3473 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3474 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003475 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003476
3477 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303478 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3479
Abhishek Singhc75726d2015-04-13 14:44:14 +05303480 pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303481 if ( NULL == pBeacon )
3482 status = eHAL_STATUS_FAILURE;
3483 else
3484 status = eHAL_STATUS_SUCCESS;
3485 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003486 {
3487 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3488 return eSIR_FAILURE;
3489 }
3490
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303491 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003492
3493 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303494 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003495
3496 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003497 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 if ( DOT11F_FAILED( status ) )
3499 {
3500 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3501 status, nPayload);
3502 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05303503 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003504 return eSIR_FAILURE;
3505 }
3506 else if ( DOT11F_WARNED( status ) )
3507 {
3508 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3509 status, nPayload );
3510 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3511 }
3512
3513 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3514 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303515 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3516 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003517
3518 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003519 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003520
3521 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003522 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3523 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3524 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3525 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3526 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3527 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3528 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3529 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3530 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3531 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3532 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3533 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3534 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3535 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3536 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3537 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003538
Jeff Johnson32d95a32012-09-10 13:15:23 -07003539 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 {
3541 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3542 }
3543 else
3544 {
3545 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003546 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 }
3548
Jeff Johnson32d95a32012-09-10 13:15:23 -07003549 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003550 {
3551 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3552 }
3553 else
3554 {
3555 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003556 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 }
3558
Jeff Johnson32d95a32012-09-10 13:15:23 -07003559 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003560 {
3561 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003562 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 }
3564
3565
Jeff Johnson32d95a32012-09-10 13:15:23 -07003566 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003567 {
3568 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003569 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 }
3571
Jeff Johnson32d95a32012-09-10 13:15:23 -07003572 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003573 {
3574 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003575 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003576 }
3577
Jeff Johnson32d95a32012-09-10 13:15:23 -07003578 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 {
3580 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003581 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 }
3583
3584 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003585 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 {
3587 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003588 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003589 }
3590
Jeff Johnson32d95a32012-09-10 13:15:23 -07003591 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003592 {
3593 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003594 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003595 }
3596
Jeff Johnson32d95a32012-09-10 13:15:23 -07003597 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003598 {
3599 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303600 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003601 sizeof(tDot11fIEChanSwitchAnn) );
3602 }
3603
Jeff Johnson32d95a32012-09-10 13:15:23 -07003604 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 {
3606 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303607 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003608 sizeof(tDot11fIEExtChanSwitchAnn) );
3609 }
3610
Jeff Johnson32d95a32012-09-10 13:15:23 -07003611 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003612 {
3613 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303614 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 sizeof(tDot11fIETPCReport));
3616 }
3617
Jeff Johnson32d95a32012-09-10 13:15:23 -07003618 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003619 {
3620 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303621 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 sizeof(tDot11fIEPowerConstraints));
3623 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003624
3625 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003626 {
3627 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303628 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003629 }
3630
Jeff Johnson32d95a32012-09-10 13:15:23 -07003631 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003632 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303633 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003634 }
3635
Jeff Johnson32d95a32012-09-10 13:15:23 -07003636 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303638 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003639
3640 }
3641
Jeff Johnson32d95a32012-09-10 13:15:23 -07003642 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003643 {
3644 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003645 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003646 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003647 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003648 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003649 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 }
3651 else
3652 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003653 if ((!rfBand) || IS_5G_BAND(rfBand))
3654 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3655 else if (IS_24G_BAND(rfBand))
3656 pBeaconStruct->channelNumber = mappedRXCh;
3657 else
3658 {
3659 /*Only 0, 1, 2 are expected values for RF band from FW
3660 * if FW fixes are not present then rf band value will
3661 * be 0, else either 1 or 2 are expected from FW, 3 is
3662 * not expected from FW */
3663 PELOGE(limLog(pMac, LOGE,
3664 FL("Channel info is not present in Beacon and"
3665 " mapping is not done correctly"));)
3666 pBeaconStruct->channelNumber = mappedRXCh;
3667 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 }
3669
Jeff Johnson32d95a32012-09-10 13:15:23 -07003670 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 {
3672 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003673 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003674 }
3675
Jeff Johnson32d95a32012-09-10 13:15:23 -07003676 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003677 {
3678 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003679 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003680 }
3681
Jeff Johnson32d95a32012-09-10 13:15:23 -07003682 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 {
3684 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003685 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003687 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 }
3689
Jeff Johnson32d95a32012-09-10 13:15:23 -07003690 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003691 {
3692 pBeaconStruct->wmeInfoPresent = 1;
3693 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3694 }
3695
Jeff Johnson32d95a32012-09-10 13:15:23 -07003696 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003697 {
3698 pBeaconStruct->wsmCapablePresent = 1;
3699 }
3700
Jeff Johnson32d95a32012-09-10 13:15:23 -07003701 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003702 {
3703 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003704 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 }
3706
3707#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003708 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003709 {
3710 // MobilityDomain
3711 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303712 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3713 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003714 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003715
3716 }
3717#endif
3718
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003719#ifdef FEATURE_WLAN_ESE
3720 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303721 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003722 //ESE Tx Power
3723 pBeaconStruct->eseTxPwr.present = 1;
3724 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3725 &pBeacon->ESETxmitPower,
3726 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303727 }
3728#endif
3729
Jeff Johnsone7245742012-09-05 17:12:55 -07003730#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003731 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003732 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303733 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003734 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003735 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003736 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303737 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3738 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003739 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003740 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003741 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303742 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3743 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003744 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003745 if(pBeacon->OperatingMode.present)
3746 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303747 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3748 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003749 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003750 if(pBeacon->WiderBWChanSwitchAnn.present)
3751 {
3752 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303753 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3754 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003755 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003756#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303757 if(pBeacon->OBSSScanParameters.present)
3758 {
3759 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3760 &pBeacon->OBSSScanParameters,
3761 sizeof( tDot11fIEOBSSScanParameters));
3762 }
Abhishek Singhc75726d2015-04-13 14:44:14 +05303763 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003764 return eSIR_SUCCESS;
3765
3766} // End sirConvertBeaconFrame2Struct.
3767
3768tSirRetStatus
3769sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3770 tANI_U8 *pFrame,
3771 tANI_U32 nFrame,
3772 tpSirMacAuthFrameBody pAuth)
3773{
3774 static tDot11fAuthentication auth;
3775 tANI_U32 status;
3776
3777 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303778 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003779
3780 // delegate to the framesc-generated code,
3781 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3782 if ( DOT11F_FAILED( status ) )
3783 {
3784 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3785 status, nFrame);
3786 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3787 return eSIR_FAILURE;
3788 }
3789 else if ( DOT11F_WARNED( status ) )
3790 {
3791 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3792 status, nFrame );
3793 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3794 }
3795
3796 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3797 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3798 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3799 pAuth->authStatusCode = auth.Status.status;
3800
3801 if ( auth.ChallengeText.present )
3802 {
3803 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3804 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303805 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 }
3807
3808 return eSIR_SUCCESS;
3809
3810} // End sirConvertAuthFrame2Struct.
3811
3812tSirRetStatus
3813sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3814 tANI_U8 *pFrame,
3815 tANI_U32 nFrame,
3816 tSirAddtsReqInfo *pAddTs)
3817{
3818 tDot11fAddTSRequest addts = {{0}};
3819 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3820 tANI_U8 j;
3821 tANI_U16 i;
3822 tANI_U32 status;
3823
3824 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3825 {
3826 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3827 "with an Action of %d; this is not "
3828 "supported & is probably an error."),
3829 *( pFrame + 1 ) );
3830 return eSIR_FAILURE;
3831 }
3832
3833 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303834 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003835
3836 // delegate to the framesc-generated code,
3837 switch ( *pFrame )
3838 {
3839 case SIR_MAC_ACTION_QOS_MGMT:
3840 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3841 break;
3842 case SIR_MAC_ACTION_WME:
3843 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3844 break;
3845 default:
3846 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3847 "with a Category of %d; this is not"
3848 " supported & is probably an error."),
3849 *pFrame );
3850 return eSIR_FAILURE;
3851 }
3852
3853 if ( DOT11F_FAILED( status ) )
3854 {
3855 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3856 "rame (0x%08x, %d bytes):\n"),
3857 status, nFrame);
3858 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3859 return eSIR_FAILURE;
3860 }
3861 else if ( DOT11F_WARNED( status ) )
3862 {
3863 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3864 "g an Add TS Request frame (0x%08x,"
3865 "%d bytes):\n"),
3866 status, nFrame );
3867 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3868 }
3869
3870 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3871 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3872 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3873 {
3874 pAddTs->dialogToken = addts.DialogToken.token;
3875
3876 if ( addts.TSPEC.present )
3877 {
3878 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3879 }
3880 else
3881 {
3882 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3883 return eSIR_FAILURE;
3884 }
3885
3886 if ( addts.num_TCLAS )
3887 {
3888 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3889
3890 for ( i = 0U; i < addts.num_TCLAS; ++i )
3891 {
3892 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3893 {
3894 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3895 return eSIR_FAILURE;
3896 }
3897 }
3898 }
3899
3900 if ( addts.TCLASSPROC.present )
3901 {
3902 pAddTs->tclasProcPresent = 1;
3903 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3904 }
3905
3906 if ( addts.WMMTSPEC.present )
3907 {
3908 pAddTs->wsmTspecPresent = 1;
3909 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3910 }
3911
3912 if ( addts.num_WMMTCLAS )
3913 {
3914 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3915 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3916
3917 for ( i = pAddTs->numTclas; i < j; ++i )
3918 {
3919 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3920 {
3921 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3922 return eSIR_FAILURE;
3923 }
3924 }
3925 }
3926
3927 if ( addts.WMMTCLASPROC.present )
3928 {
3929 pAddTs->tclasProcPresent = 1;
3930 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3931 }
3932
3933 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3934 {
3935 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3936 pAddTs->numTclas );
3937 return eSIR_FAILURE;
3938 }
3939 }
3940 else
3941 {
3942 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3943
3944 if ( wmmaddts.WMMTSPEC.present )
3945 {
3946 pAddTs->wmeTspecPresent = 1;
3947 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3948 }
3949 else
3950 {
3951 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3952 return eSIR_FAILURE;
3953 }
3954 }
3955
3956 return eSIR_SUCCESS;
3957
3958} // End sirConvertAddtsReq2Struct.
3959
3960tSirRetStatus
3961sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3962 tANI_U8 *pFrame,
3963 tANI_U32 nFrame,
3964 tSirAddtsRspInfo *pAddTs)
3965{
3966 tDot11fAddTSResponse addts = {{0}};
3967 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3968 tANI_U8 j;
3969 tANI_U16 i;
3970 tANI_U32 status;
3971
3972 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3973 {
3974 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3975 "with an Action of %d; this is not "
3976 "supported & is probably an error."),
3977 *( pFrame + 1 ) );
3978 return eSIR_FAILURE;
3979 }
3980
3981 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303982 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3983 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3984 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003985
3986
3987 // delegate to the framesc-generated code,
3988 switch ( *pFrame )
3989 {
3990 case SIR_MAC_ACTION_QOS_MGMT:
3991 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3992 break;
3993 case SIR_MAC_ACTION_WME:
3994 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3995 break;
3996 default:
3997 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3998 "with a Category of %d; this is not"
3999 " supported & is probably an error."),
4000 *pFrame );
4001 return eSIR_FAILURE;
4002 }
4003
4004 if ( DOT11F_FAILED( status ) )
4005 {
4006 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
4007 "rame (0x%08x, %d bytes):\n"),
4008 status, nFrame);
4009 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4010 return eSIR_FAILURE;
4011 }
4012 else if ( DOT11F_WARNED( status ) )
4013 {
4014 limLog( pMac, LOGW, FL("There were warnings while unpackin"
4015 "g an Add TS Response frame (0x%08x,"
4016 "%d bytes):\n"),
4017 status, nFrame );
4018 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4019 }
4020
4021 // & "transliterate" from a 'tDot11fAddTSResponse' or a
4022 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
4023 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4024 {
4025 pAddTs->dialogToken = addts.DialogToken.token;
4026 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
4027
4028 if ( addts.TSDelay.present )
4029 {
4030 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
4031 }
4032
4033 // TS Delay is present iff status indicates its presence
4034 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
4035 {
4036 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
4037 }
4038
4039 if ( addts.TSPEC.present )
4040 {
4041 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
4042 }
4043 else
4044 {
4045 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
4046 return eSIR_FAILURE;
4047 }
4048
4049 if ( addts.num_TCLAS )
4050 {
4051 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4052
4053 for ( i = 0U; i < addts.num_TCLAS; ++i )
4054 {
4055 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4056 {
4057 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
4058 return eSIR_FAILURE;
4059 }
4060 }
4061 }
4062
4063 if ( addts.TCLASSPROC.present )
4064 {
4065 pAddTs->tclasProcPresent = 1;
4066 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4067 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004068#ifdef FEATURE_WLAN_ESE
4069 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 {
4071 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304072 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004073 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004074 }
4075#endif
4076 if ( addts.Schedule.present )
4077 {
4078 pAddTs->schedulePresent = 1;
4079 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
4080 }
4081
4082 if ( addts.WMMSchedule.present )
4083 {
4084 pAddTs->schedulePresent = 1;
4085 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
4086 }
4087
4088 if ( addts.WMMTSPEC.present )
4089 {
4090 pAddTs->wsmTspecPresent = 1;
4091 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4092 }
4093
4094 if ( addts.num_WMMTCLAS )
4095 {
4096 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
4097 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
4098
4099 for ( i = pAddTs->numTclas; i < j; ++i )
4100 {
4101 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4102 {
4103 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
4104 return eSIR_FAILURE;
4105 }
4106 }
4107 }
4108
4109 if ( addts.WMMTCLASPROC.present )
4110 {
4111 pAddTs->tclasProcPresent = 1;
4112 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4113 }
4114
4115 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4116 {
4117 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
4118 pAddTs->numTclas );
4119 return eSIR_FAILURE;
4120 }
4121 }
4122 else
4123 {
4124 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4125 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
4126
4127 if ( wmmaddts.WMMTSPEC.present )
4128 {
4129 pAddTs->wmeTspecPresent = 1;
4130 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4131 }
4132 else
4133 {
4134 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
4135 return eSIR_FAILURE;
4136 }
4137
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004138#ifdef FEATURE_WLAN_ESE
4139 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 {
4141 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304142 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004143 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004144 }
4145#endif
4146
4147 }
4148
4149 return eSIR_SUCCESS;
4150
4151} // End sirConvertAddtsRsp2Struct.
4152
4153tSirRetStatus
4154sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
4155 tANI_U8 *pFrame,
4156 tANI_U32 nFrame,
4157 tSirDeltsReqInfo *pDelTs)
4158{
4159 tDot11fDelTS delts = {{0}};
4160 tDot11fWMMDelTS wmmdelts = {{0}};
4161 tANI_U32 status;
4162
4163 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
4164 {
4165 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4166 "with an Action of %d; this is not "
4167 "supported & is probably an error."),
4168 *( pFrame + 1 ) );
4169 return eSIR_FAILURE;
4170 }
4171
4172 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304173 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004174
4175 // delegate to the framesc-generated code,
4176 switch ( *pFrame )
4177 {
4178 case SIR_MAC_ACTION_QOS_MGMT:
4179 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
4180 break;
4181 case SIR_MAC_ACTION_WME:
4182 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4183 break;
4184 default:
4185 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4186 "with a Category of %d; this is not"
4187 " supported & is probably an error."),
4188 *pFrame );
4189 return eSIR_FAILURE;
4190 }
4191
4192 if ( DOT11F_FAILED( status ) )
4193 {
4194 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
4195 "rame (0x%08x, %d bytes):\n"),
4196 status, nFrame);
4197 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4198 return eSIR_FAILURE;
4199 }
4200 else if ( DOT11F_WARNED( status ) )
4201 {
4202 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4203 "g an Del TS Request frame (0x%08x,"
4204 "%d bytes):\n"),
4205 status, nFrame );
4206 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4207 }
4208
4209 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4210 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4211 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4212 {
4213 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4214 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4215 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4216 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4217 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4218 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4219 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4220 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4221
4222 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4223 }
4224 else
4225 {
4226 if ( wmmdelts.WMMTSPEC.present )
4227 {
4228 pDelTs->wmeTspecPresent = 1;
4229 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4230 }
4231 else
4232 {
4233 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
4234 return eSIR_FAILURE;
4235 }
4236 }
4237
4238 return eSIR_SUCCESS;
4239
4240} // End sirConvertDeltsReq2Struct.
4241
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004242tSirRetStatus
4243sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4244 tANI_U8 *pFrame,
4245 tANI_U32 nFrame,
4246 tSirQosMapSet *pQosMapSet)
4247{
4248 tDot11fQosMapConfigure mapConfigure;
4249 tANI_U32 status;
4250 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
4251 if ( DOT11F_FAILED( status ) )
4252 {
4253 dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):\n"),
4254 status, nFrame);
4255 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4256 return eSIR_FAILURE;
4257 }
4258 else if ( DOT11F_WARNED( status ) )
4259 {
4260 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):\n"),
4261 status, nFrame );
4262 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4263 }
4264 pQosMapSet->present = mapConfigure.QosMapSet.present;
4265 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004266 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004267 return eSIR_SUCCESS;
4268}
Jeff Johnson295189b2012-06-20 16:38:30 -07004269
4270#ifdef ANI_SUPPORT_11H
4271tSirRetStatus
4272sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4273 tANI_U8 *pFrame,
4274 tpSirMacTpcReqActionFrame pTpcReqFrame,
4275 tANI_U32 nFrame)
4276{
4277 tDot11fTPCRequest req;
4278 tANI_U32 status;
4279
4280 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304281 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004282
4283 // delegate to the framesc-generated code,
4284 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4285 if ( DOT11F_FAILED( status ) )
4286 {
4287 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
4288 status, nFrame);
4289 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4290 return eSIR_FAILURE;
4291 }
4292 else if ( DOT11F_WARNED( status ) )
4293 {
4294 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
4295 status, nFrame );
4296 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4297 }
4298
4299 // & "transliterate" from a 'tDot11fTPCRequest' to a
4300 // 'tSirMacTpcReqActionFrame'...
4301 pTpcReqFrame->actionHeader.category = req.Category.category;
4302 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4303 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4304 if ( req.TPCRequest.present )
4305 {
4306 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4307 pTpcReqFrame->length = 0;
4308 }
4309 else
4310 {
4311 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
4312 return eSIR_FAILURE;
4313 }
4314
4315 return eSIR_SUCCESS;
4316
4317} // End sirConvertTpcReqFrame2Struct.
4318
4319
4320tSirRetStatus
4321sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4322 tANI_U8 *pFrame,
4323 tpSirMacMeasReqActionFrame pMeasReqFrame,
4324 tANI_U32 nFrame)
4325{
4326 tDot11fMeasurementRequest mr;
4327 tANI_U32 status;
4328
4329 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304330 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004331
4332 // delegate to the framesc-generated code,
4333 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4334 if ( DOT11F_FAILED( status ) )
4335 {
4336 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4337 status, nFrame);
4338 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4339 return eSIR_FAILURE;
4340 }
4341 else if ( DOT11F_WARNED( status ) )
4342 {
4343 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4344 status, nFrame );
4345 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4346 }
4347
4348 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4349 // 'tpSirMacMeasReqActionFrame'...
4350 pMeasReqFrame->actionHeader.category = mr.Category.category;
4351 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4352 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4353
4354 if ( 0 == mr.num_MeasurementRequest )
4355 {
4356 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4357 return eSIR_FAILURE;
4358 }
4359 else if ( 1 < mr.num_MeasurementRequest )
4360 {
4361 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4362 }
4363
4364 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4365 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4366 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4367 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4368 ( mr.MeasurementRequest[0].enable << 2 ) |
4369 ( mr.MeasurementRequest[0].request << 1 ) |
4370 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4371 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4372
4373 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4374
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304375 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 mr.MeasurementRequest[0].meas_start_time, 8 );
4377
4378 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4379
4380 return eSIR_SUCCESS;
4381
4382} // End sirConvertMeasReqFrame2Struct.
4383#endif
4384
4385
4386void
4387PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4388 tDot11fIETSPEC *pDot11f)
4389{
4390 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4391 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4392 pDot11f->direction = pOld->tsinfo.traffic.direction;
4393 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4394 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4395 pDot11f->psb = pOld->tsinfo.traffic.psb;
4396 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4397 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4398 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4399 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4400 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4401 */
4402 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4403 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4404 pDot11f->max_msdu_size = pOld->maxMsduSz;
4405 pDot11f->min_service_int = pOld->minSvcInterval;
4406 pDot11f->max_service_int = pOld->maxSvcInterval;
4407 pDot11f->inactivity_int = pOld->inactInterval;
4408 pDot11f->suspension_int = pOld->suspendInterval;
4409 pDot11f->service_start_time = pOld->svcStartTime;
4410 pDot11f->min_data_rate = pOld->minDataRate;
4411 pDot11f->mean_data_rate = pOld->meanDataRate;
4412 pDot11f->peak_data_rate = pOld->peakDataRate;
4413 pDot11f->burst_size = pOld->maxBurstSz;
4414 pDot11f->delay_bound = pOld->delayBound;
4415 pDot11f->min_phy_rate = pOld->minPhyRate;
4416 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4417 pDot11f->medium_time = pOld->mediumTime;
4418
4419 pDot11f->present = 1;
4420
4421} // End PopulateDot11fTSPEC.
4422
4423void
4424PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4425 tDot11fIEWMMTSPEC *pDot11f)
4426{
4427 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4428 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4429 pDot11f->direction = pOld->tsinfo.traffic.direction;
4430 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4431 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4432 pDot11f->psb = pOld->tsinfo.traffic.psb;
4433 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4434 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4435 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4436 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4437 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4438 */
4439 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4440 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4441 pDot11f->max_msdu_size = pOld->maxMsduSz;
4442 pDot11f->min_service_int = pOld->minSvcInterval;
4443 pDot11f->max_service_int = pOld->maxSvcInterval;
4444 pDot11f->inactivity_int = pOld->inactInterval;
4445 pDot11f->suspension_int = pOld->suspendInterval;
4446 pDot11f->service_start_time = pOld->svcStartTime;
4447 pDot11f->min_data_rate = pOld->minDataRate;
4448 pDot11f->mean_data_rate = pOld->meanDataRate;
4449 pDot11f->peak_data_rate = pOld->peakDataRate;
4450 pDot11f->burst_size = pOld->maxBurstSz;
4451 pDot11f->delay_bound = pOld->delayBound;
4452 pDot11f->min_phy_rate = pOld->minPhyRate;
4453 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4454 pDot11f->medium_time = pOld->mediumTime;
4455
4456 pDot11f->version = 1;
4457 pDot11f->present = 1;
4458
4459} // End PopulateDot11fWMMTSPEC.
4460
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004461#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004462
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004463// Fill the ESE version currently supported
4464void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004465{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004466 pESEVersion->present = 1;
4467 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004468}
4469
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004470// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004471// The State is Normal (1)
4472// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004473void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004474{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004475 pESERadMgmtCap->present = 1;
4476 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4477 pESERadMgmtCap->mbssid_mask = 0;
4478 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004479}
4480
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004481tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004482 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004483 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004484{
4485 int idx;
4486
4487 if ( pCCKMie->length )
4488 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004489 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004490 {
4491 pDot11f->present = 1;
4492 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004493 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004494 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4495 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4496 }
4497 }
4498
4499 return eSIR_SUCCESS;
4500
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004501} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004502
Jeff Johnson295189b2012-06-20 16:38:30 -07004503void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004504 tSirMacESETSRSIE *pOld,
4505 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 tANI_U8 rate_length)
4507{
4508 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304509 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004510 pDot11f->num_tsrates = rate_length;
4511 pDot11f->present = 1;
4512}
4513#endif
4514
4515
4516tSirRetStatus
4517PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4518 tSirTclasInfo *pOld,
4519 tDot11fIETCLAS *pDot11f)
4520{
4521 pDot11f->user_priority = pOld->tclas.userPrio;
4522 pDot11f->classifier_type = pOld->tclas.classifierType;
4523 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4524
4525 switch ( pDot11f->classifier_type )
4526 {
4527 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304528 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4529 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4530 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4531 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4533 break;
4534 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4535 pDot11f->info.IpParams.version = pOld->version;
4536 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4537 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304538 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304539 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304540 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4541 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304542 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304543 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004544 pDot11f->info.IpParams.params.IpV4Params.src_port =
4545 pOld->tclasParams.ipv4.srcPort;
4546 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4547 pOld->tclasParams.ipv4.dstPort;
4548 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4549 pOld->tclasParams.ipv4.dscp;
4550 pDot11f->info.IpParams.params.IpV4Params.proto =
4551 pOld->tclasParams.ipv4.protocol;
4552 pDot11f->info.IpParams.params.IpV4Params.reserved =
4553 pOld->tclasParams.ipv4.rsvd;
4554 }
4555 else
4556 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304557 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 IpV6Params.source,
4559 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304560 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 IpV6Params.dest,
4562 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4563 pDot11f->info.IpParams.params.IpV6Params.src_port =
4564 pOld->tclasParams.ipv6.srcPort;
4565 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4566 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304567 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004568 IpV6Params.flow_label,
4569 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4570 }
4571 break;
4572 case SIR_MAC_TCLASTYPE_8021DQ:
4573 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4574 break;
4575 default:
4576 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4577 pDot11f->classifier_type );
4578 return eSIR_FAILURE;
4579 }
4580
4581 pDot11f->present = 1;
4582
4583 return eSIR_SUCCESS;
4584
4585} // End PopulateDot11fTCLAS.
4586
4587tSirRetStatus
4588PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4589 tSirTclasInfo *pOld,
4590 tDot11fIEWMMTCLAS *pDot11f)
4591{
4592 pDot11f->version = 1;
4593 pDot11f->user_priority = pOld->tclas.userPrio;
4594 pDot11f->classifier_type = pOld->tclas.classifierType;
4595 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4596
4597 switch ( pDot11f->classifier_type )
4598 {
4599 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304600 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004601 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304602 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004603 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4604 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4605 break;
4606 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4607 pDot11f->info.IpParams.version = pOld->version;
4608 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4609 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304610 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 IpV4Params.source,
4612 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304613 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 IpV4Params.dest,
4615 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4616 pDot11f->info.IpParams.params.IpV4Params.src_port =
4617 pOld->tclasParams.ipv4.srcPort;
4618 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4619 pOld->tclasParams.ipv4.dstPort;
4620 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4621 pOld->tclasParams.ipv4.dscp;
4622 pDot11f->info.IpParams.params.IpV4Params.proto =
4623 pOld->tclasParams.ipv4.protocol;
4624 pDot11f->info.IpParams.params.IpV4Params.reserved =
4625 pOld->tclasParams.ipv4.rsvd;
4626 }
4627 else
4628 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304629 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 IpV6Params.source,
4631 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304632 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 IpV6Params.dest,
4634 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4635 pDot11f->info.IpParams.params.IpV6Params.src_port =
4636 pOld->tclasParams.ipv6.srcPort;
4637 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4638 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304639 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 IpV6Params.flow_label,
4641 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4642 }
4643 break;
4644 case SIR_MAC_TCLASTYPE_8021DQ:
4645 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4646 break;
4647 default:
4648 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4649 pDot11f->classifier_type );
4650 return eSIR_FAILURE;
4651 }
4652
4653 pDot11f->present = 1;
4654
4655 return eSIR_SUCCESS;
4656
4657} // End PopulateDot11fWMMTCLAS.
4658
Jeff Johnson295189b2012-06-20 16:38:30 -07004659
4660tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4661 tDot11fIEWscBeacon *pDot11f)
4662{
4663
4664 tANI_U32 wpsState;
4665
4666 pDot11f->Version.present = 1;
4667 pDot11f->Version.major = 0x01;
4668 pDot11f->Version.minor = 0x00;
4669
4670 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4671 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4672
4673 pDot11f->WPSState.present = 1;
4674 pDot11f->WPSState.state = (tANI_U8) wpsState;
4675
4676 pDot11f->APSetupLocked.present = 0;
4677
4678 pDot11f->SelectedRegistrar.present = 0;
4679
4680 pDot11f->DevicePasswordID.present = 0;
4681
4682 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4683
4684 pDot11f->UUID_E.present = 0;
4685
4686 pDot11f->RFBands.present = 0;
4687
4688 pDot11f->present = 1;
4689 return eSIR_SUCCESS;
4690}
4691
4692tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4693 tDot11fIEWscBeacon *pDot11f)
4694{
4695 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4696 tANI_U32 devicepasswdId;
4697
4698
4699 pDot11f->APSetupLocked.present = 1;
4700 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4701
4702 pDot11f->SelectedRegistrar.present = 1;
4703 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4704
4705 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4706 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4707
4708 pDot11f->DevicePasswordID.present = 1;
4709 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4710
4711 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4712 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4713
4714 // UUID_E and RF Bands are applicable only for dual band AP
4715
4716 return eSIR_SUCCESS;
4717}
4718
4719tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4720 tDot11fIEWscBeacon *pDot11f)
4721{
4722 pDot11f->APSetupLocked.present = 0;
4723 pDot11f->SelectedRegistrar.present = 0;
4724 pDot11f->DevicePasswordID.present = 0;
4725 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4726
4727 return eSIR_SUCCESS;
4728}
Jeff Johnson295189b2012-06-20 16:38:30 -07004729tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4730{
4731
4732 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4733
4734 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4735
4736
4737 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4738 {
4739 pDot11f->present = 1;
4740 pDot11f->Version.present = 1;
4741 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4742 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4743 }
4744 else
4745 {
4746 pDot11f->present = 0;
4747 pDot11f->Version.present = 0;
4748 }
4749
4750 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4751 {
4752
4753 pDot11f->WPSState.present = 1;
4754 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4755 }
4756 else
4757 pDot11f->WPSState.present = 0;
4758
4759 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4760 {
4761 pDot11f->APSetupLocked.present = 1;
4762 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4763 }
4764 else
4765 pDot11f->APSetupLocked.present = 0;
4766
4767 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4768 {
4769 pDot11f->SelectedRegistrar.present = 1;
4770 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4771 }
4772 else
4773 pDot11f->SelectedRegistrar.present = 0;
4774
4775 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4776 {
4777 pDot11f->DevicePasswordID.present = 1;
4778 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4779 }
4780 else
4781 pDot11f->DevicePasswordID.present = 0;
4782
4783 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4784 {
4785 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4786 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4787 }
4788 else
4789 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4790
4791 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4792 {
4793 pDot11f->ResponseType.present = 1;
4794 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4795 }
4796 else
4797 pDot11f->ResponseType.present = 0;
4798
4799 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4800 {
4801 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304802 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 }
4804 else
4805 pDot11f->UUID_E.present = 0;
4806
4807 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4808 {
4809 pDot11f->Manufacturer.present = 1;
4810 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304811 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4812 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004813 }
4814 else
4815 pDot11f->Manufacturer.present = 0;
4816
4817 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4818 {
4819 pDot11f->ModelName.present = 1;
4820 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304821 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4822 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004823 }
4824 else
4825 pDot11f->ModelName.present = 0;
4826
4827 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4828 {
4829 pDot11f->ModelNumber.present = 1;
4830 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304831 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4832 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004833 }
4834 else
4835 pDot11f->ModelNumber.present = 0;
4836
4837 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4838 {
4839 pDot11f->SerialNumber.present = 1;
4840 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304841 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4842 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004843 }
4844 else
4845 pDot11f->SerialNumber.present = 0;
4846
4847 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4848 {
4849 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304850 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4851 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4853 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4854 }
4855 else
4856 pDot11f->PrimaryDeviceType.present = 0;
4857
4858 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4859 {
4860 pDot11f->DeviceName.present = 1;
4861 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304862 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4863 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 }
4865 else
4866 pDot11f->DeviceName.present = 0;
4867
4868 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4869 {
4870 pDot11f->ConfigMethods.present = 1;
4871 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4872 }
4873 else
4874 pDot11f->ConfigMethods.present = 0;
4875
4876
4877 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4878 {
4879 pDot11f->RFBands.present = 1;
4880 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4881 }
4882 else
4883 pDot11f->RFBands.present = 0;
4884
4885 return eSIR_SUCCESS;
4886}
4887tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4888{
4889 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4890
4891 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4892
4893 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4894 {
4895 pDot11f->present = 1;
4896 pDot11f->Version.present = 1;
4897 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4898 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4899 }
4900 else
4901 {
4902 pDot11f->present = 0;
4903 pDot11f->Version.present = 0;
4904 }
4905
4906 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4907 {
4908 pDot11f->ResponseType.present = 1;
4909 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4910 }
4911 else
4912 pDot11f->ResponseType.present = 0;
4913
4914 return eSIR_SUCCESS;
4915}
4916
4917tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4918{
4919
4920 tSirWPSBeaconIE *pSirWPSBeaconIE;
4921
4922 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4923
4924
4925 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4926 {
4927 pDot11f->present = 1;
4928 pDot11f->Version.present = 1;
4929 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4930 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4931 }
4932 else
4933 {
4934 pDot11f->present = 0;
4935 pDot11f->Version.present = 0;
4936 }
4937
4938 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4939 {
4940
4941 pDot11f->WPSState.present = 1;
4942 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4943 }
4944 else
4945 pDot11f->WPSState.present = 0;
4946
4947 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4948 {
4949 pDot11f->APSetupLocked.present = 1;
4950 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4951 }
4952 else
4953 pDot11f->APSetupLocked.present = 0;
4954
4955 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4956 {
4957 pDot11f->SelectedRegistrar.present = 1;
4958 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4959 }
4960 else
4961 pDot11f->SelectedRegistrar.present = 0;
4962
4963 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4964 {
4965 pDot11f->DevicePasswordID.present = 1;
4966 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4967 }
4968 else
4969 pDot11f->DevicePasswordID.present = 0;
4970
4971 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4972 {
4973 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4974 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4975 }
4976 else
4977 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4978
4979 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4980 {
4981 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304982 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004983 }
4984 else
4985 pDot11f->UUID_E.present = 0;
4986
4987
4988 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4989 {
4990 pDot11f->RFBands.present = 1;
4991 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4992 }
4993 else
4994 pDot11f->RFBands.present = 0;
4995
4996 return eSIR_SUCCESS;
4997}
Jeff Johnson295189b2012-06-20 16:38:30 -07004998tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4999 tDot11fIEWscProbeRes *pDot11f)
5000{
5001 tANI_U32 cfgMethods;
5002 tANI_U32 cfgStrLen;
5003 tANI_U32 val;
5004 tANI_U32 wpsVersion, wpsState;
5005
5006
5007 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
5008 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
5009
5010 pDot11f->Version.present = 1;
5011 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
5012 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
5013
5014 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
5015 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
5016
5017 pDot11f->WPSState.present = 1;
5018 pDot11f->WPSState.state = (tANI_U8) wpsState;
5019
5020 pDot11f->APSetupLocked.present = 0;
5021
5022 pDot11f->SelectedRegistrar.present = 0;
5023
5024 pDot11f->DevicePasswordID.present = 0;
5025
5026 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5027
5028 pDot11f->ResponseType.present = 1;
5029 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
5030 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
5031 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5032 }
5033 else{
5034 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5035 }
5036
5037 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
5038 pDot11f->UUID_E.present = 1;
5039 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
5040 if (wlan_cfgGetStr(pMac,
5041 WNI_CFG_WPS_UUID,
5042 pDot11f->UUID_E.uuid,
5043 &cfgStrLen) != eSIR_SUCCESS)
5044 {
5045 *(pDot11f->UUID_E.uuid) = '\0';
5046 }
5047
5048 pDot11f->Manufacturer.present = 1;
5049 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
5050 if (wlan_cfgGetStr(pMac,
5051 WNI_CFG_MANUFACTURER_NAME,
5052 pDot11f->Manufacturer.name,
5053 &cfgStrLen) != eSIR_SUCCESS)
5054 {
5055 pDot11f->Manufacturer.num_name = 0;
5056 *(pDot11f->Manufacturer.name) = '\0';
5057 }
5058 else
5059 {
5060 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305061 pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005062 }
5063
5064 pDot11f->ModelName.present = 1;
5065 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
5066 if (wlan_cfgGetStr(pMac,
5067 WNI_CFG_MODEL_NAME,
5068 pDot11f->ModelName.text,
5069 &cfgStrLen) != eSIR_SUCCESS)
5070 {
5071 pDot11f->ModelName.num_text = 0;
5072 *(pDot11f->ModelName.text) = '\0';
5073 }
5074 else
5075 {
5076 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305077 pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005078 }
5079
5080 pDot11f->ModelNumber.present = 1;
5081 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
5082 if (wlan_cfgGetStr(pMac,
5083 WNI_CFG_MODEL_NUMBER,
5084 pDot11f->ModelNumber.text,
5085 &cfgStrLen) != eSIR_SUCCESS)
5086 {
5087 pDot11f->ModelNumber.num_text = 0;
5088 *(pDot11f->ModelNumber.text) = '\0';
5089 }
5090 else
5091 {
5092 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305093 pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005094 }
5095
5096 pDot11f->SerialNumber.present = 1;
5097 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
5098 if (wlan_cfgGetStr(pMac,
5099 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
5100 pDot11f->SerialNumber.text,
5101 &cfgStrLen) != eSIR_SUCCESS)
5102 {
5103 pDot11f->SerialNumber.num_text = 0;
5104 *(pDot11f->SerialNumber.text) = '\0';
5105 }
5106 else
5107 {
5108 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305109 pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005110 }
5111
5112 pDot11f->PrimaryDeviceType.present = 1;
5113
5114 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
5115 {
5116 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
5117 }
5118 else
5119 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
5120
5121 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
5122 {
5123 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
5124 }
5125 else
5126 {
5127 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
5128 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
5129 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
5130 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
5131 }
5132
5133 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
5134 {
5135 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
5136 }
5137 else
5138 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
5139
5140 pDot11f->DeviceName.present = 1;
5141 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
5142 if (wlan_cfgGetStr(pMac,
5143 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
5144 pDot11f->DeviceName.text,
5145 &cfgStrLen) != eSIR_SUCCESS)
5146 {
5147 pDot11f->DeviceName.num_text = 0;
5148 *(pDot11f->DeviceName.text) = '\0';
5149 }
5150 else
5151 {
5152 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305153 pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005154 }
5155
5156 if (wlan_cfgGetInt(pMac,
5157 WNI_CFG_WPS_CFG_METHOD,
5158 &cfgMethods) != eSIR_SUCCESS)
5159 {
5160 pDot11f->ConfigMethods.present = 0;
5161 pDot11f->ConfigMethods.methods = 0;
5162 }
5163 else
5164 {
5165 pDot11f->ConfigMethods.present = 1;
5166 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
5167 }
5168
5169 pDot11f->RFBands.present = 0;
5170
5171 pDot11f->present = 1;
5172 return eSIR_SUCCESS;
5173}
5174
5175tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5176 tDot11fIEWscProbeRes *pDot11f)
5177{
5178 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
5179 tANI_U32 devicepasswdId;
5180
5181 pDot11f->APSetupLocked.present = 1;
5182 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5183
5184 pDot11f->SelectedRegistrar.present = 1;
5185 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5186
5187 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
5188 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
5189
5190 pDot11f->DevicePasswordID.present = 1;
5191 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5192
5193 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5194 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5195
5196 // UUID_E and RF Bands are applicable only for dual band AP
5197
5198 return eSIR_SUCCESS;
5199}
5200
5201tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5202 tDot11fIEWscProbeRes *pDot11f)
5203{
5204 pDot11f->APSetupLocked.present = 0;
5205 pDot11f->SelectedRegistrar.present = 0;
5206 pDot11f->DevicePasswordID.present = 0;
5207 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5208
5209 return eSIR_SUCCESS;
5210}
5211
5212tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5213 tDot11fIEWscAssocRes *pDot11f,
5214 tpSirAssocReq pRcvdAssocReq)
5215{
5216 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5217 tANI_U8 *wscIe;
5218
5219
5220 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5221 if(wscIe != NULL)
5222 {
5223 // retreive WSC IE from given AssocReq
5224 dot11fUnpackIeWscAssocReq( pMac,
5225 wscIe + 2 + 4, // EID, length, OUI
5226 wscIe[ 1 ] - 4, // length without OUI
5227 &parsedWscAssocReq );
5228 pDot11f->present = 1;
5229 // version has to be 0x10
5230 pDot11f->Version.present = 1;
5231 pDot11f->Version.major = 0x1;
5232 pDot11f->Version.minor = 0x0;
5233
5234 pDot11f->ResponseType.present = 1;
5235
5236 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5237 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5238 {
5239 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5240 }
5241 else
5242 {
5243 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5244 }
5245 // Version infomration should be taken from our capability as well as peers
5246 // TODO: currently it takes from peers only
5247 if(parsedWscAssocReq.VendorExtension.present &&
5248 parsedWscAssocReq.VendorExtension.Version2.present)
5249 {
5250 pDot11f->VendorExtension.present = 1;
5251 pDot11f->VendorExtension.vendorId[0] = 0x00;
5252 pDot11f->VendorExtension.vendorId[1] = 0x37;
5253 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5254 pDot11f->VendorExtension.Version2.present = 1;
5255 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5256 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5257 }
5258 }
5259 return eSIR_SUCCESS;
5260}
5261
Jeff Johnson295189b2012-06-20 16:38:30 -07005262tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5263 tDot11fIEP2PAssocRes *pDot11f,
5264 tpSirAssocReq pRcvdAssocReq)
5265{
5266 tANI_U8 *p2pIe;
5267
5268 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5269 if(p2pIe != NULL)
5270 {
5271 pDot11f->present = 1;
5272 pDot11f->P2PStatus.present = 1;
5273 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5274 pDot11f->ExtendedListenTiming.present = 0;
5275 }
5276 return eSIR_SUCCESS;
5277}
Jeff Johnson295189b2012-06-20 16:38:30 -07005278
5279#if defined WLAN_FEATURE_VOWIFI
5280
5281tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5282 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5283{
5284 pDot11f->txPower = txPower;
5285 pDot11f->linkMargin = linkMargin;
5286 pDot11f->present = 1;
5287
5288 return eSIR_SUCCESS;
5289}
5290
5291tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5292{
5293
5294 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5295 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305296 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5297 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005298 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5299 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5300 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5301 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5302 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305303 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005304 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5305 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5306
5307 if( pBeaconReport->numIes )
5308 {
5309 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305310 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5311 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005312 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5313 }
5314
5315 return eSIR_SUCCESS;
5316
5317}
5318
5319tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5320{
5321 tpRRMCaps pRrmCaps;
5322
5323 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5324
5325 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5326 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5327 pDot11f->parallel = pRrmCaps->parallel ;
5328 pDot11f->repeated = pRrmCaps->repeated ;
5329 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5330 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5331 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5332 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5333 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5334 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5335 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5336 pDot11f->statistics = pRrmCaps->statistics ;
5337 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5338 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5339 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5340 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5341 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5342 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5343 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5344 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5345 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5346 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5347 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5348 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5349 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5350 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5351 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5352 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5353
5354 pDot11f->present = 1;
5355 return eSIR_SUCCESS;
5356}
5357#endif
5358
5359#if defined WLAN_FEATURE_VOWIFI_11R
5360void PopulateMDIE( tpAniSirGlobal pMac,
5361 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5362{
5363 pDot11f->present = 1;
5364 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5365
5366 // Plugfest fix
5367 pDot11f->overDSCap = (mdie[2] & 0x01);
5368 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5369
5370}
5371
5372void PopulateFTInfo( tpAniSirGlobal pMac,
5373 tDot11fIEFTInfo *pDot11f )
5374{
5375 pDot11f->present = 1;
5376 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5377 //All other info is zero.
5378
5379}
5380#endif
5381
5382void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5383 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5384{
5385 tANI_U8 num_supp = 0, num_ext = 0;
5386 tANI_U8 i,j;
5387
5388 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5389 {
5390 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5391 }
5392 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5393 {
5394 if( num_supp < 8 )
5395 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5396 else
5397 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5398 }
5399
5400 if( num_supp )
5401 {
5402 pSupp->num_rates = num_supp;
5403 pSupp->present = 1;
5404 }
5405 if( num_ext )
5406 {
5407 pExt->num_rates = num_ext;
5408 pExt->present = 1;
5409 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005410}
5411
5412void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5413 tDot11fIETimeoutInterval *pDot11f,
5414 tANI_U8 type, tANI_U32 value )
5415{
5416 pDot11f->present = 1;
5417 pDot11f->timeoutType = type;
5418 pDot11f->timeoutValue = value;
5419}
Jeff Johnson295189b2012-06-20 16:38:30 -07005420// parserApi.c ends here.