blob: 91880f1aaba04e23d149f2e503f7aad046d9f137 [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
Jeff Johnson295189b2012-06-20 16:38:30 -0700608
609
610 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
611
612 nCfgValue8 = ( tANI_U8 ) nCfgValue;
613 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
614
615 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
616 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
617 pDot11f->reserved1 = pHTParametersInfo->reserved;
618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
620 pDot11f->supportedMCSSet, nCfgLen,
621 SIZE_OF_SUPPORTED_MCS_SET );
622
623
624 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
625
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
627
628 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
629 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
630 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
631
Jeff Johnson295189b2012-06-20 16:38:30 -0700632
633 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
634
635 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
636 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
637 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
638 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
639 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
640 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
641 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
642 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
643 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
644 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
645 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
646 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
647 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
648 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
649 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
650 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
651
652 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
653
654 nCfgValue8 = ( tANI_U8 ) nCfgValue;
655
656 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
657 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
658 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
659 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
660 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
661 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
662 pDot11f->rxAS = pASCapabilityInfo->rxAS;
663 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
664
665 pDot11f->present = 1;
666
667 return eSIR_SUCCESS;
668
669} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700670#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700671
Jeff Johnsone7245742012-09-05 17:12:55 -0700672void limLogVHTCap(tpAniSirGlobal pMac,
673 tDot11fIEVHTCaps *pDot11f)
674{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700675#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700676 limLog(pMac, LOG1, FL("maxMPDULen (2): %d\n"), pDot11f->maxMPDULen);
677 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d\n"), pDot11f->supportedChannelWidthSet);
678 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d\n"), pDot11f->ldpcCodingCap);
679 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d\n"), pDot11f->shortGI80MHz);
680 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d\n"), pDot11f->shortGI160and80plus80MHz);
681 limLog(pMac, LOG1, FL("txSTBC (1): %d\n"), pDot11f->txSTBC);
682 limLog(pMac, LOG1, FL("rxSTBC (3): %d\n"), pDot11f->rxSTBC);
683 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d\n"), pDot11f->suBeamFormerCap);
684 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d\n"), pDot11f->suBeamformeeCap);
685 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d\n"), pDot11f->csnofBeamformerAntSup);
686 limLog(pMac, LOG1, FL("numSoundingDim (3): %d\n"), pDot11f->numSoundingDim);
687 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d\n"), pDot11f->muBeamformerCap);
688 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d\n"), pDot11f->muBeamformeeCap);
689 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d\n"), pDot11f->vhtTXOPPS);
690 limLog(pMac, LOG1, FL("htcVHTCap (1): %d\n"), pDot11f->htcVHTCap);
691 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d\n"), pDot11f->maxAMPDULenExp);
692 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d\n"), pDot11f->vhtLinkAdaptCap);
693 limLog(pMac, LOG1, FL("rxAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
694 limLog(pMac, LOG1, FL("txAntPattern (1): %d\n"), pDot11f->vhtLinkAdaptCap);
695 limLog(pMac, LOG1, FL("reserved1 (2): %d\n"), pDot11f->reserved1);
696 limLog(pMac, LOG1, FL("rxMCSMap (16): %d\n"), pDot11f->rxMCSMap);
697 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d\n"), pDot11f->rxHighSupDataRate);
698 limLog(pMac, LOG1, FL("reserve (3): %d\n"), pDot11f->reserved2);
699 limLog(pMac, LOG1, FL("txMCSMap (16): %d\n"), pDot11f->txMCSMap);
700 limLog(pMac, LOG1, FL("txSupDataRate (13): %d\n"), pDot11f->txSupDataRate);
701 limLog(pMac, LOG1, FL("reserv (3): %d\n"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700702#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700703}
704
705void limLogVHTOperation(tpAniSirGlobal pMac,
706 tDot11fIEVHTOperation *pDot11f)
707{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700708#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700709 limLog(pMac, LOG1, FL("chanWidth : %d\n"), pDot11f->chanWidth);
710 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d\n"), pDot11f->chanCenterFreqSeg1);
711 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d\n"), pDot11f->chanCenterFreqSeg2);
712 limLog(pMac, LOG1, FL("basicMCSSet: %d\n"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700713#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700714}
715
716void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
717 tDot11fIEVHTExtBssLoad *pDot11f)
718{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700719#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700720 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d\n"), pDot11f->muMIMOCapStaCount);
721 limLog(pMac, LOG1, FL("ssUnderUtil: %d\n"), pDot11f->ssUnderUtil);
722 limLog(pMac, LOG1, FL("FortyMHzUtil: %d\n"), pDot11f->FortyMHzUtil);
723 limLog(pMac, LOG1, FL("EightyMHzUtil: %d\n"), pDot11f->EightyMHzUtil);
724 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d\n"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700725#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700726}
727
728
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700729void limLogOperatingMode( tpAniSirGlobal pMac,
730 tDot11fIEOperatingMode *pDot11f)
731{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700732#ifdef DUMP_MGMT_CNTNTS
Madan Mohan Koyyalamudi3bd22cd2012-09-24 13:42:49 -0700733 limLog(pMac, LOG1, FL("ChanWidth : %d\n"), pDot11f->chanWidth);
734 limLog(pMac, LOG1, FL("reserved: %d\n"), pDot11f->reserved);
735 limLog(pMac, LOG1, FL("rxNSS: %d\n"), pDot11f->rxNSS);
736 limLog(pMac, LOG1, FL("rxNSS Type: %d\n"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700737#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700738}
739
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700740void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
741{
742 tANI_U8 i;
743 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
744 pQosMapSet->num_dscp_exceptions);
745 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
746 {
747 limLog(pMac, LOG1, FL("dscp value: %d"),
748 pQosMapSet->dscp_exceptions[i][0]);
749 limLog(pMac, LOG1, FL("User priority value: %d"),
750 pQosMapSet->dscp_exceptions[i][1]);
751 }
752 for (i=0;i<8;i++)
753 {
754 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
755 pQosMapSet->dscp_range[i][0]);
756 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
757 pQosMapSet->dscp_range[i][1]);
758 }
759}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700760
Jeff Johnsone7245742012-09-05 17:12:55 -0700761tSirRetStatus
762PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530763 tDot11fIEVHTCaps *pDot11f,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530764 tANI_U8 nChannelNum,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530765 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700766{
767 tSirRetStatus nStatus;
768 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530769 tAniBool disableMcs9 = eSIR_FALSE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700770
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530771 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530772 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
773 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530774 else
775 disableMcs9 =
776 pMac->roam.configParam.channelBondingMode5GHz?
777 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700778 pDot11f->present = 1;
779
780 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
781 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
782
783 nCfgValue = 0;
784 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
785 nCfgValue );
786 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
787
788 nCfgValue = 0;
789 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
790 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
791
792 nCfgValue = 0;
793 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
794 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
795
796 nCfgValue = 0;
797 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
798 nCfgValue );
799 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
800
Deepthi Gowri0c1e1682015-06-19 12:57:53 +0530801 if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
802 {
803 pDot11f->shortGI80MHz = 0;
804 pDot11f->shortGI160and80plus80MHz = 0;
805 }
806
Jeff Johnsone7245742012-09-05 17:12:55 -0700807 nCfgValue = 0;
808 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
809 pDot11f->txSTBC = (nCfgValue & 0x0001);
810
811 nCfgValue = 0;
812 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
813 pDot11f->rxSTBC = (nCfgValue & 0x0007);
814
815 nCfgValue = 0;
816 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
817 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
818
819 nCfgValue = 0;
820 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
821 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
822
823 nCfgValue = 0;
824 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
825 nCfgValue );
826 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
827
828 nCfgValue = 0;
829 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
830 nCfgValue );
831 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
832
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530833 /* muBeamformerCap should be 0 for non AP and
834 * muBeamformeeCap should be 0 for AP
835 */
836 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
837 {
838 nCfgValue = 0;
839 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
840 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
841 pDot11f->muBeamformeeCap = 0;
842 }
843 else
844 {
845 pDot11f->muBeamformerCap = 0;
846 nCfgValue = 0;
847 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
848 /* Enable only if FW and host both support the MU_MIMO feature
849 */
850 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
851 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700852
853 nCfgValue = 0;
854 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
855 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
856
857 nCfgValue = 0;
858 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
859 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
860
861 nCfgValue = 0;
862 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
863 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
864
865 nCfgValue = 0;
866 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
867 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
868
869 nCfgValue = 0;
870 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
871 pDot11f->rxAntPattern = nCfgValue;
872
873 nCfgValue = 0;
874 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
875 pDot11f->txAntPattern = nCfgValue;
876
877 pDot11f->reserved1= 0;
878
879 nCfgValue = 0;
880 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530881
882 if (eSIR_TRUE == disableMcs9)
883 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700884 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
885
886 nCfgValue = 0;
887 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
888 nCfgValue );
889 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
890
891 pDot11f->reserved2= 0;
892
893 nCfgValue = 0;
894 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530895
896 if (eSIR_TRUE == disableMcs9)
897 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700898 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
899
900 nCfgValue = 0;
901 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
902 nCfgValue );
903 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
904
905 pDot11f->reserved3= 0;
906
907 limLogVHTCap(pMac, pDot11f);
908
909 return eSIR_SUCCESS;
910
911}
912
913tSirRetStatus
914PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530915 tDot11fIEVHTOperation *pDot11f,
916 tANI_U8 nChannelNum)
Jeff Johnsone7245742012-09-05 17:12:55 -0700917{
918 tSirRetStatus nStatus;
919 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530920 tAniBool disableMcs9 = eSIR_FALSE;
921
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530922 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530923 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
924 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530925 else
926 disableMcs9 =
927 pMac->roam.configParam.channelBondingMode5GHz?
928 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700929
930 pDot11f->present = 1;
931
932 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
933 pDot11f->chanWidth = (tANI_U8)nCfgValue;
934
935 nCfgValue = 0;
936 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
937 nCfgValue );
938 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
939
940 nCfgValue = 0;
941 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
942 nCfgValue );
943 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
944
945 nCfgValue = 0;
946 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530947
948 if (eSIR_TRUE == disableMcs9)
949 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700950 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
951
952 limLogVHTOperation(pMac,pDot11f);
953
954 return eSIR_SUCCESS;
955
956}
957
958tSirRetStatus
959PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
960 tDot11fIEVHTExtBssLoad *pDot11f)
961{
962 tSirRetStatus nStatus;
963 tANI_U32 nCfgValue=0;
964
965 pDot11f->present = 1;
966
967 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
968 nCfgValue );
969 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
970
971 nCfgValue = 0;
972 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
973 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
974
975 nCfgValue=0;
976 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
977 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
978
979 nCfgValue=0;
980 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
981 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
982
983 nCfgValue=0;
984 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
985 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
986
987 limLogVHTExtBssLoad(pMac,pDot11f);
988
989 return eSIR_SUCCESS;
990}
991
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530992#ifdef WLAN_FEATURE_AP_HT40_24G
993tSirRetStatus
994PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
995 tDot11fIEOBSSScanParameters *pDot11f,
996 tpPESession psessionEntry)
997{
998 pDot11f->present = 1;
999
1000 pDot11f->obssScanPassiveDwell =
1001 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
1002
1003 pDot11f->obssScanActiveDwell =
1004 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
1005
1006 pDot11f->bssChannelWidthTriggerScanInterval =
1007 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
1008
1009 pDot11f->obssScanPassiveTotalPerChannel =
1010 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
1011
1012 pDot11f->obssScanActiveTotalPerChannel =
1013 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
1014
1015 pDot11f->bssWidthChannelTransitionDelayFactor =
1016 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
1017
1018 pDot11f->obssScanActivityThreshold =
1019 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
1020
1021 return eSIR_SUCCESS;
1022}
1023#endif
1024
Mohit Khanna4a70d262012-09-11 16:30:12 -07001025tSirRetStatus
1026PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +05301027 tDot11fIEExtCap *pDot11f,
1028 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -07001029{
Sandeep Puligilla60342762014-01-30 21:05:37 +05301030
Sandeep Puligilla60342762014-01-30 21:05:37 +05301031#ifdef WLAN_FEATURE_11AC
1032 if (psessionEntry->vhtCapability)
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301033 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301034 pDot11f->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301035 pDot11f->present = 1;
1036 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301037#endif
1038 /* while operating in 2.4GHz only then STA need to advertize
1039 the bss co-ex capability*/
1040 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
1041 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301042#ifdef WLAN_FEATURE_AP_HT40_24G
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301043 if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1044 && pMac->roam.configParam.channelBondingMode24GHz)
1045 || pMac->roam.configParam.apHT40_24GEnabled)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301046#else
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301047 if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1048 && pMac->roam.configParam.channelBondingMode24GHz)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301049#endif
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301050 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301051 pDot11f->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301052 pDot11f->present = 1;
1053 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301054 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07001055 return eSIR_SUCCESS;
1056}
1057
1058tSirRetStatus
1059PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
1060 tDot11fIEOperatingMode *pDot11f,
1061 tpPESession psessionEntry)
1062{
1063 pDot11f->present = 1;
1064
1065 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1066 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1067 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1068
1069 return eSIR_SUCCESS;
1070}
Jeff Johnsone7245742012-09-05 17:12:55 -07001071
1072#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001073tSirRetStatus
1074PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1075 tDot11fIEHTInfo *pDot11f,
1076 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001077{
1078 tANI_U32 nCfgValue, nCfgLen;
1079 tANI_U8 htInfoField1;
1080 tANI_U16 htInfoField2;
1081 tSirRetStatus nSirStatus;
1082 tSirMacHTInfoField1 *pHTInfoField1;
1083 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 union {
1085 tANI_U16 nCfgValue16;
1086 tSirMacHTInfoField3 infoField3;
1087 }uHTInfoField;
1088 union {
1089 tANI_U16 nCfgValue16;
1090 tSirMacHTInfoField2 infoField2;
1091 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001092
Jeff Johnson295189b2012-06-20 16:38:30 -07001093
1094 #if 0
1095 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1096 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301097
1098 if (NULL == psessionEntry)
1099 {
1100 PELOGE(limLog(pMac, LOG1,
1101 FL("Invalid session entry in PopulateDot11fHTInfo()\n"));)
1102 return eSIR_FAILURE;
1103 }
1104
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1106
1107 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1108
1109 htInfoField1 = ( tANI_U8 ) nCfgValue;
1110
1111 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001112 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1113 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1114
Jeff Johnsone7245742012-09-05 17:12:55 -07001115 if (psessionEntry == NULL)
1116 {
1117 PELOGE(limLog(pMac, LOG1,
1118 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set\n"));)
1119 }
1120 else
1121 {
1122 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1123 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1124 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001125
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001126 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001127 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1128
1129 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1130
1131 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1132 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1133 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1134
1135 uHTInfoField2.infoField2.reserved = 0;
1136
1137 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001138 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1139
1140 htInfoField2 = ( tANI_U16 ) nCfgValue;
1141
1142 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1143 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1144 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1145 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1146
1147 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001148 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001149
1150 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1151
1152
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1154
1155
1156 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1157 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1158 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1159 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1160 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1161 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1162 uHTInfoField.infoField3.reserved = 0;
1163
Jeff Johnson295189b2012-06-20 16:38:30 -07001164
1165 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1166 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1167 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1168 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1169 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1170
Jeff Johnson295189b2012-06-20 16:38:30 -07001171 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1172 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1173 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1174 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1175
Jeff Johnson295189b2012-06-20 16:38:30 -07001176
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1178 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1179 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1180 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1181 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1182 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1183 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1185 pDot11f->basicMCSSet, nCfgLen,
1186 SIZE_OF_BASIC_MCS_SET );
1187
1188 pDot11f->present = 1;
1189
1190 return eSIR_SUCCESS;
1191
1192} // End PopulateDot11fHTInfo.
1193
1194void
1195PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1196 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1197{
1198 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1199 {
1200 pDot11f->present = 1;
1201 // ATIM duration is always set to 0
1202 pDot11f->atim = 0;
1203 }
1204
1205} // End PopulateDot11fIBSSParams.
1206
1207
1208#ifdef ANI_SUPPORT_11H
1209tSirRetStatus
1210PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1211 tpSirMacMeasReqActionFrame pReq,
1212 tDot11fIEMeasurementReport *pDot11f)
1213{
1214 pDot11f->token = pReq->measReqIE.measToken;
1215 pDot11f->late = 0;
1216 pDot11f->incapable = 0;
1217 pDot11f->refused = 1;
1218 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1219
1220 pDot11f->present = 1;
1221
1222 return eSIR_SUCCESS;
1223
1224} // End PopulatedDot11fMeasurementReport0.
1225
1226tSirRetStatus
1227PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1228 tpSirMacMeasReqActionFrame pReq,
1229 tDot11fIEMeasurementReport *pDot11f)
1230{
1231 pDot11f->token = pReq->measReqIE.measToken;
1232 pDot11f->late = 0;
1233 pDot11f->incapable = 0;
1234 pDot11f->refused = 1;
1235 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1236
1237 pDot11f->present = 1;
1238
1239 return eSIR_SUCCESS;
1240
1241} // End PopulatedDot11fMeasurementReport1.
1242
1243tSirRetStatus
1244PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1245 tpSirMacMeasReqActionFrame pReq,
1246 tDot11fIEMeasurementReport *pDot11f)
1247{
1248 pDot11f->token = pReq->measReqIE.measToken;
1249 pDot11f->late = 0;
1250 pDot11f->incapable = 0;
1251 pDot11f->refused = 1;
1252 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1253
1254 pDot11f->present = 1;
1255
1256 return eSIR_SUCCESS;
1257
1258} // End PopulatedDot11fMeasurementReport2.
1259#endif
1260
1261void
1262PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1263 tDot11fIEPowerCaps *pCaps,
1264 tANI_U8 nAssocType,
1265 tpPESession psessionEntry)
1266{
1267 if (nAssocType == LIM_REASSOC)
1268 {
1269 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1270 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1271 }else
1272 {
1273 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1274 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1275
1276 }
1277
1278 pCaps->present = 1;
1279} // End PopulateDot11fPowerCaps.
1280
1281tSirRetStatus
1282PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1283 tDot11fIEPowerConstraints *pDot11f)
1284{
1285 tANI_U32 cfg;
1286 tSirRetStatus nSirStatus;
1287
1288 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1289
1290 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1291 pDot11f->present = 1;
1292
1293 return eSIR_SUCCESS;
1294} // End PopulateDot11fPowerConstraints.
1295
1296void
1297PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1298 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1299{
1300 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1301 pDot11f->reserved = 0;
1302 pDot11f->txopreq = 0;
1303 pDot11f->qreq = 0;
1304 pDot11f->qack = 0;
1305 pDot11f->present = 1;
1306} // End PopulatedDot11fQOSCaps.
1307
1308void
1309PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1310 tDot11fIEQOSCapsStation *pDot11f)
1311{
1312 tANI_U32 val = 0;
1313
1314 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1315 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
1316
1317 pDot11f->more_data_ack = 0;
1318 pDot11f->max_sp_length = (tANI_U8)val;
1319 pDot11f->qack = 0;
1320
1321 if (pMac->lim.gUapsdEnable)
1322 {
1323 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1324 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1325 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1326 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1327 }
1328 pDot11f->present = 1;
1329} // End PopulatedDot11fQOSCaps.
1330
1331tSirRetStatus
1332PopulateDot11fRSN(tpAniSirGlobal pMac,
1333 tpSirRSNie pRsnIe,
1334 tDot11fIERSN *pDot11f)
1335{
1336 tANI_U32 status;
1337 int idx;
1338
1339 if ( pRsnIe->length )
1340 {
1341 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1342 {
1343 status = dot11fUnpackIeRSN( pMac,
1344 pRsnIe->rsnIEdata + idx + 2, //EID, length
1345 pRsnIe->rsnIEdata[ idx + 1 ],
1346 pDot11f );
1347 if ( DOT11F_FAILED( status ) )
1348 {
1349 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
1350 "N (0x%08x).\n"),
1351 status );
1352 return eSIR_FAILURE;
1353 }
1354 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1355 "PopulateDot11fRSN.\n"), status );
1356 }
1357
1358 }
1359
1360 return eSIR_SUCCESS;
1361} // End PopulateDot11fRSN.
1362
1363tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1364 tpSirRSNie pRsnIe,
1365 tDot11fIERSNOpaque *pDot11f )
1366{
1367 int idx;
1368
1369 if ( pRsnIe->length )
1370 {
1371 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1372 {
1373 pDot11f->present = 1;
1374 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301375 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 pRsnIe->rsnIEdata + idx + 2, // EID, len
1377 pRsnIe->rsnIEdata[ idx + 1 ] );
1378 }
1379 }
1380
1381 return eSIR_SUCCESS;
1382
1383} // End PopulateDot11fRSNOpaque.
1384
1385
1386
1387#if defined(FEATURE_WLAN_WAPI)
1388
1389tSirRetStatus
1390PopulateDot11fWAPI(tpAniSirGlobal pMac,
1391 tpSirRSNie pRsnIe,
1392 tDot11fIEWAPI *pDot11f)
1393 {
1394 tANI_U32 status;
1395 int idx;
1396
1397 if ( pRsnIe->length )
1398 {
1399 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1400 {
1401 status = dot11fUnpackIeWAPI( pMac,
1402 pRsnIe->rsnIEdata + idx + 2, //EID, length
1403 pRsnIe->rsnIEdata[ idx + 1 ],
1404 pDot11f );
1405 if ( DOT11F_FAILED( status ) )
1406 {
1407 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x).\n"),
1408 status );
1409 return eSIR_FAILURE;
1410 }
1411 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
1412 "PopulateDot11fWAPI.\n"), status );
1413 }
1414 }
1415
1416 return eSIR_SUCCESS;
1417} // End PopulateDot11fWAPI.
1418
1419tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1420 tpSirRSNie pRsnIe,
1421 tDot11fIEWAPIOpaque *pDot11f )
1422{
1423 int idx;
1424
1425 if ( pRsnIe->length )
1426 {
1427 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1428 {
1429 pDot11f->present = 1;
1430 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301431 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 pRsnIe->rsnIEdata + idx + 2, // EID, len
1433 pRsnIe->rsnIEdata[ idx + 1 ] );
1434 }
1435 }
1436
1437 return eSIR_SUCCESS;
1438
1439} // End PopulateDot11fWAPIOpaque.
1440
1441
1442#endif //defined(FEATURE_WLAN_WAPI)
1443
1444void
1445PopulateDot11fSSID(tpAniSirGlobal pMac,
1446 tSirMacSSid *pInternal,
1447 tDot11fIESSID *pDot11f)
1448{
1449 pDot11f->present = 1;
1450 pDot11f->num_ssid = pInternal->length;
1451 if ( pInternal->length )
1452 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301453 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 pInternal->length );
1455 }
1456} // End PopulateDot11fSSID.
1457
1458tSirRetStatus
1459PopulateDot11fSSID2(tpAniSirGlobal pMac,
1460 tDot11fIESSID *pDot11f)
1461{
1462 tANI_U32 nCfg;
1463 tSirRetStatus nSirStatus;
1464
1465 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1466 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1467 pDot11f->present = 1;
1468 return eSIR_SUCCESS;
1469} // End PopulateDot11fSSID2.
1470
1471void
1472PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1473 tDot11fIESchedule *pDot11f)
1474{
1475 pDot11f->aggregation = pSchedule->info.aggregation;
1476 pDot11f->tsid = pSchedule->info.tsid;
1477 pDot11f->direction = pSchedule->info.direction;
1478 pDot11f->reserved = pSchedule->info.rsvd;
1479 pDot11f->service_start_time = pSchedule->svcStartTime;
1480 pDot11f->service_interval = pSchedule->svcInterval;
1481 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1482 pDot11f->spec_interval = pSchedule->specInterval;
1483
1484 pDot11f->present = 1;
1485} // End PopulateDot11fSchedule.
1486
1487void
1488PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1489 tDot11fIESuppChannels *pDot11f,
1490 tANI_U8 nAssocType,
1491 tpPESession psessionEntry)
1492{
1493 tANI_U8 i;
1494 tANI_U8 *p;
1495
1496 if (nAssocType == LIM_REASSOC)
1497 {
1498 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1499 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1500 }else
1501 {
1502 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1503 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1504 }
1505 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1506 {
1507 pDot11f->bands[i][0] = *p;
1508 pDot11f->bands[i][1] = 1;
1509 }
1510
1511 pDot11f->present = 1;
1512
1513} // End PopulateDot11fSuppChannels.
1514
1515tSirRetStatus
1516PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1517 tANI_U8 nChannelNum,
1518 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1519{
1520 tSirRetStatus nSirStatus;
1521 tANI_U32 nRates;
1522 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1523
1524 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1525 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1526 sending mgmt frames (lile probe req) which need to go out before any session is present.
1527 */
1528 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1529 {
1530 #if 0
1531 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1532 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1533 #endif //TO SUPPORT BT-AMP
1534 if(psessionEntry != NULL)
1535 {
1536 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301537 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001538 nRates);
1539 }
1540 else
1541 {
1542 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set\n"));
1543 nRates = 0;
1544 }
1545 }
1546 else if ( 14 >= nChannelNum )
1547 {
1548 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1549 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1550 }
1551 else
1552 {
1553 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1554 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1555 }
1556
1557 if ( 0 != nRates )
1558 {
1559 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301560 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 pDot11f->present = 1;
1562 }
1563
1564 return eSIR_SUCCESS;
1565
1566} // End PopulateDot11fSuppRates.
1567
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301568/**
1569 * PopulateDot11fRatesTdls() - populate supported rates and
1570 * extended supported rates IE.
1571 * @p_mac gloabl - header.
1572 * @p_supp_rates - pointer to supported rates IE
1573 * @p_ext_supp_rates - pointer to extended supported rates IE
1574 *
1575 * This function populates the supported rates and extended supported
1576 * rates IE based in the STA capability. If the number of rates
1577 * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
1578 * IE is populated.
1579 *
1580 * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
1581 * on failure.
1582 */
1583
1584tSirRetStatus
1585PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
1586 tDot11fIESuppRates *p_supp_rates,
1587 tDot11fIEExtSuppRates *p_ext_supp_rates)
1588{
1589 tSirMacRateSet temp_rateset;
1590 tSirMacRateSet temp_rateset2;
1591 uint32_t val, i;
1592 uint32_t self_dot11mode = 0;
1593
1594 wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
1595
1596 /**
1597 * Include 11b rates only when the device configured in
1598 * auto, 11a/b/g or 11b_only
1599 */
1600 if ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
1601 (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1602 (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
1603 (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
1604 (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
1605 (self_dot11mode == WNI_CFG_DOT11_MODE_11B) )
1606 {
1607 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1608 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
1609 (tANI_U8 *)&temp_rateset.rate, &val);
1610 temp_rateset.numRates = (tANI_U8) val;
1611 }
1612 else
1613 {
1614 temp_rateset.numRates = 0;
1615 }
1616
1617 /* Include 11a rates when the device configured in non-11b mode */
1618 if (!IS_DOT11_MODE_11B(self_dot11mode))
1619 {
1620 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1621 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
1622 (tANI_U8 *)&temp_rateset2.rate, &val);
1623 temp_rateset2.numRates = (tANI_U8) val;
1624 }
1625 else
1626 {
1627 temp_rateset2.numRates = 0;
1628 }
1629
1630 if ((temp_rateset.numRates + temp_rateset2.numRates) >
1631 SIR_MAC_MAX_NUMBER_OF_RATES)
1632 {
1633 limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
1634 SIR_MAC_MAX_NUMBER_OF_RATES);
1635 return eSIR_FAILURE;
1636 }
1637
1638 /**
1639 * copy all rates in temp_rateset,
1640 * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
1641 */
1642 for (i = 0; i < temp_rateset2.numRates; i++)
1643 temp_rateset.rate[i + temp_rateset.numRates] =
1644 temp_rateset2.rate[i];
1645
1646 temp_rateset.numRates += temp_rateset2.numRates;
1647
1648 if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
1649 {
1650 p_supp_rates->num_rates = temp_rateset.numRates;
1651 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1652 p_supp_rates->num_rates);
1653 p_supp_rates->present = 1;
1654 }
1655 else /* Populate extended capability as well */
1656 {
1657 p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
1658 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1659 p_supp_rates->num_rates);
1660 p_supp_rates->present = 1;
1661 p_ext_supp_rates->num_rates = temp_rateset.numRates -
1662 MAX_NUM_SUPPORTED_RATES;
1663 vos_mem_copy(p_ext_supp_rates->rates,
1664 (tANI_U8 *)temp_rateset.rate +
1665 MAX_NUM_SUPPORTED_RATES,
1666 p_ext_supp_rates->num_rates);
1667 p_ext_supp_rates->present = 1;
1668 }
1669
1670 return eSIR_SUCCESS;
1671
1672} /* End PopulateDot11fRatesTdls */
1673
Jeff Johnson295189b2012-06-20 16:38:30 -07001674tSirRetStatus
1675PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1676 tDot11fIETPCReport *pDot11f,
1677 tpPESession psessionEntry)
1678{
1679 tANI_U16 staid, txPower;
1680 tSirRetStatus nSirStatus;
1681
1682 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1683 if ( eSIR_SUCCESS != nSirStatus )
1684 {
1685 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1686 "eDot11fTPCReport; limGetMgmtStaid "
1687 "returned status %d.\n"),
1688 nSirStatus );
1689 return eSIR_FAILURE;
1690 }
1691
1692 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1693 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1694 txPower = 0;
1695 pDot11f->tx_power = ( tANI_U8 )txPower;
1696 pDot11f->link_margin = 0;
1697 pDot11f->present = 1;
1698
1699 return eSIR_SUCCESS;
1700} // End PopulateDot11fTPCReport.
1701
1702
1703void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1704 tDot11fFfTSInfo *pDot11f)
1705{
1706 pDot11f->traffic_type = pInfo->traffic.trafficType;
1707 pDot11f->tsid = pInfo->traffic.tsid;
1708 pDot11f->direction = pInfo->traffic.direction;
1709 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1710 pDot11f->aggregation = pInfo->traffic.aggregation;
1711 pDot11f->psb = pInfo->traffic.psb;
1712 pDot11f->user_priority = pInfo->traffic.userPrio;
1713 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1714 pDot11f->schedule = pInfo->schedule.schedule;
1715} // End PopulatedDot11fTSInfo.
1716
1717void PopulateDot11fWMM(tpAniSirGlobal pMac,
1718 tDot11fIEWMMInfoAp *pInfo,
1719 tDot11fIEWMMParams *pParams,
1720 tDot11fIEWMMCaps *pCaps,
1721 tpPESession psessionEntry)
1722{
1723 if ( psessionEntry->limWmeEnabled )
1724 {
1725 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1726 {
1727 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1728 {
1729 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1730 }
1731 }
1732 else
1733 {
1734 {
1735 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1736 }
1737
1738 if ( psessionEntry->limWsmEnabled )
1739 {
1740 PopulateDot11fWMMCaps( pCaps );
1741 }
1742 }
1743 }
1744} // End PopulateDot11fWMM.
1745
1746void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1747{
1748 pCaps->version = SIR_MAC_OUI_VERSION_1;
1749 pCaps->qack = 0;
1750 pCaps->queue_request = 1;
1751 pCaps->txop_request = 0;
1752 pCaps->more_ack = 0;
1753 pCaps->present = 1;
1754} // End PopulateDot11fWmmCaps.
1755
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001756#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001757void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1758{
1759 tANI_U8 numTspecs = 0, idx;
1760 tTspecInfo *pTspec = NULL;
1761
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001762 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1763 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 pReassoc->num_WMMTSPEC = numTspecs;
1765 if (numTspecs) {
1766 for (idx=0; idx<numTspecs; idx++) {
1767 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301768 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001769 pTspec++;
1770 }
1771 }
1772}
1773#endif
1774
1775void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1776 tpPESession psessionEntry)
1777{
1778 pInfo->version = SIR_MAC_OUI_VERSION_1;
1779
1780 /* WMM Specification 3.1.3, 3.2.3
1781 * An IBSS staion shall always use its default WMM parameters.
1782 */
1783 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1784 {
1785 pInfo->param_set_count = 0;
1786 pInfo->uapsd = 0;
1787 }
1788 else
1789 {
1790 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001791 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1792 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1793 }
1794 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001795 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1796 }
1797 pInfo->present = 1;
1798}
1799
1800void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1801{
1802 tANI_U32 val = 0;
1803
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301804 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001805 pInfo->version = SIR_MAC_OUI_VERSION_1;
1806 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1807 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1808 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1809 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1810
1811 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
1812 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length \n"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001813 pInfo->max_sp_length = (tANI_U8)val;
1814 pInfo->present = 1;
1815}
1816
Jeff Johnson295189b2012-06-20 16:38:30 -07001817void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1818 tDot11fIEWMMParams *pParams,
1819 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001820{
1821 pParams->version = SIR_MAC_OUI_VERSION_1;
1822
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1824 pParams->qosInfo =
1825 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1826 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 pParams->qosInfo =
1828 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1829
1830 // Fill each EDCA parameter set in order: be, bk, vi, vo
1831 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1832 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1833 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1834 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1835 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1836 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1837
1838 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1839 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1840 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1841 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1842 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1843 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1844
Jeff Johnson295189b2012-06-20 16:38:30 -07001845 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1846 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1847 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1849
1850
1851
1852 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1853 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1854 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1855 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1856 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1857
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1859 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1860 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1862
1863 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1864 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1865 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1866 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1867 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1868
1869 pParams->present = 1;
1870
1871} // End PopulateDot11fWMMParams.
1872
1873void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1874 tDot11fIEWMMSchedule *pDot11f)
1875{
1876 pDot11f->version = 1;
1877 pDot11f->aggregation = pSchedule->info.aggregation;
1878 pDot11f->tsid = pSchedule->info.tsid;
1879 pDot11f->direction = pSchedule->info.direction;
1880 pDot11f->reserved = pSchedule->info.rsvd;
1881 pDot11f->service_start_time = pSchedule->svcStartTime;
1882 pDot11f->service_interval = pSchedule->svcInterval;
1883 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1884 pDot11f->spec_interval = pSchedule->specInterval;
1885
1886 pDot11f->present = 1;
1887} // End PopulateDot11fWMMSchedule.
1888
1889tSirRetStatus
1890PopulateDot11fWPA(tpAniSirGlobal pMac,
1891 tpSirRSNie pRsnIe,
1892 tDot11fIEWPA *pDot11f)
1893{
1894 tANI_U32 status;
1895 int idx;
1896
1897 if ( pRsnIe->length )
1898 {
1899 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1900 {
1901 status = dot11fUnpackIeWPA( pMac,
1902 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1903 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1904 pDot11f );
1905 if ( DOT11F_FAILED( status ) )
1906 {
1907 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
1908 "A (0x%08x).\n"),
1909 status );
1910 return eSIR_FAILURE;
1911 }
1912 }
1913 }
1914
1915 return eSIR_SUCCESS;
1916} // End PopulateDot11fWPA.
1917
1918
1919
1920tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1921 tpSirRSNie pRsnIe,
1922 tDot11fIEWPAOpaque *pDot11f )
1923{
1924 int idx;
1925
1926 if ( pRsnIe->length )
1927 {
1928 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1929 {
1930 pDot11f->present = 1;
1931 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301932 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1934 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1935 }
1936 }
1937
1938 return eSIR_SUCCESS;
1939
1940} // End PopulateDot11fWPAOpaque.
1941
1942////////////////////////////////////////////////////////////////////////
1943
1944tSirRetStatus
1945sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1946{
1947#if 0
1948 tANI_U32 val;
1949
1950 *caps = 0;
1951 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1952 != eSIR_SUCCESS)
1953 {
1954 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag\n"));
1955 return eSIR_FAILURE;
1956 }
1957 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1958 {
1959 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag\n"));
1960 return eSIR_FAILURE;
1961 }
1962
1963 *caps = (tANI_U16) val;
1964#endif
1965 return eSIR_SUCCESS;
1966}
1967
1968tSirRetStatus
1969sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1970 tANI_U8 *pFrame,
1971 tANI_U32 nFrame,
1972 tpSirProbeReq pProbeReq)
1973{
1974 tANI_U32 status;
1975 tDot11fProbeRequest pr;
1976
1977 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301978 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001979
1980 // delegate to the framesc-generated code,
1981 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1982 if ( DOT11F_FAILED( status ) )
1983 {
1984 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes):\n"),
1985 status, nFrame);
1986 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1987 return eSIR_FAILURE;
1988 }
1989 else if ( DOT11F_WARNED( status ) )
1990 {
1991 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes):\n"),
1992 status, nFrame );
1993 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1994 }
1995
1996 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1997 if ( ! pr.SSID.present )
1998 {
1999 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2000 }
2001 else
2002 {
2003 pProbeReq->ssidPresent = 1;
2004 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
2005 }
2006
2007 if ( ! pr.SuppRates.present )
2008 {
2009 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2010 return eSIR_FAILURE;
2011 }
2012 else
2013 {
2014 pProbeReq->suppRatesPresent = 1;
2015 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
2016 }
2017
2018 if ( pr.ExtSuppRates.present )
2019 {
2020 pProbeReq->extendedRatesPresent = 1;
2021 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
2022 }
2023
2024 if ( pr.HTCaps.present )
2025 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302026 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002027 }
2028
2029 if ( pr.WscProbeReq.present )
2030 {
2031 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05302032 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002034#ifdef WLAN_FEATURE_11AC
2035 if ( pr.VHTCaps.present )
2036 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302037 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002038 }
2039#endif
2040
Jeff Johnson295189b2012-06-20 16:38:30 -07002041
2042 if ( pr.P2PProbeReq.present )
2043 {
2044 pProbeReq->p2pIePresent = 1;
2045 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002046
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 return eSIR_SUCCESS;
2048
2049} // End sirConvertProbeReqFrame2Struct.
2050
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302051/* function ValidateAndRectifyIEs checks for the malformed frame.
2052 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302053 * (Tagged elements).
2054 * Every Tagged IE has tag number, tag length and data. Tag length indicates
2055 * the size of data in bytes.
2056 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302057 * And also rectifies missing optional fields in IE.
2058 *
2059 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
2060 * extended to rectify other optional fields in other IEs.
2061 *
2062 */
2063tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
2064 tANI_U8 *pMgmtFrame,
2065 tANI_U32 nFrameBytes,
2066 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302067{
2068 tANI_U32 length = SIZE_OF_FIXED_PARAM;
2069 tANI_U8 *refFrame;
2070
2071 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302072 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302073 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302074 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302075 {
2076 /*refFrame points to next IE */
2077 refFrame = pMgmtFrame + length;
2078 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
2079 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
2080 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302081 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302082 {
2083 /* Workaround : Some APs may not include RSN Capability but
2084 * the length of which is included in RSN IE length.
2085 * this may cause in updating RSN Capability with junk value.
2086 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302087 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302088 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302089 if ((*refFrame == RSNIEID) &&
2090 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302091 {
2092 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302093 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302094 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302095 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302096 limLog(pMac, LOG1,
2097 FL("Added RSN Capability to the RSNIE as 0x00 0x00\n"));
2098
2099 return eHAL_STATUS_SUCCESS;
2100 }
2101 return eSIR_FAILURE;
2102 }
2103 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302104 return eHAL_STATUS_SUCCESS;
2105}
2106
Jeff Johnson295189b2012-06-20 16:38:30 -07002107tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
2108 tANI_U8 *pFrame,
2109 tANI_U32 nFrame,
2110 tpSirProbeRespBeacon pProbeResp)
2111{
2112 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002113 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002114
2115 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302116 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002117
Abhishek Singhc75726d2015-04-13 14:44:14 +05302118 pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302119 if ( NULL == pr )
2120 status = eHAL_STATUS_FAILURE;
2121 else
2122 status = eHAL_STATUS_SUCCESS;
2123 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07002124 {
2125 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2126 return eSIR_FAILURE;
2127 }
2128
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302129 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002130
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002132 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 if ( DOT11F_FAILED( status ) )
2134 {
2135 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes):\n"),
2136 status, nFrame);
2137 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05302138 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 return eSIR_FAILURE;
2140 }
2141 else if ( DOT11F_WARNED( status ) )
2142 {
2143 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes):\n"),
2144 status, nFrame );
2145 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2146 }
2147
2148 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
2149
2150 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302151 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
2152 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002153
2154 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07002155 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002156
2157 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07002158 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
2159 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
2160 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
2161 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
2162 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
2163 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
2164 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
2165 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
2166 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
2167 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
2168 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2169 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2170 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2171 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2172 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2173 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002174
Jeff Johnson32d95a32012-09-10 13:15:23 -07002175 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 {
2177 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2178 }
2179 else
2180 {
2181 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002182 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 }
2184
Jeff Johnson32d95a32012-09-10 13:15:23 -07002185 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 {
2187 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2188 }
2189 else
2190 {
2191 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002192 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 }
2194
Jeff Johnson32d95a32012-09-10 13:15:23 -07002195 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 {
2197 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002198 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 }
2200
2201
Jeff Johnson32d95a32012-09-10 13:15:23 -07002202 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 {
2204 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002205 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 }
2207
Jeff Johnson32d95a32012-09-10 13:15:23 -07002208 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 {
2210 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002211 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 }
2213
Jeff Johnson32d95a32012-09-10 13:15:23 -07002214 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 {
2216 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002217 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 }
2219
Jeff Johnson32d95a32012-09-10 13:15:23 -07002220 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 {
2222 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302223 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 sizeof(tDot11fIEExtChanSwitchAnn) );
2225 }
2226
Jeff Johnson32d95a32012-09-10 13:15:23 -07002227 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 {
2229 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302230 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 sizeof(tDot11fIEExtChanSwitchAnn) );
2232 }
2233
Jeff Johnson32d95a32012-09-10 13:15:23 -07002234 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 {
2236 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302237 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 }
2239
Jeff Johnson32d95a32012-09-10 13:15:23 -07002240 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 {
2242 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302243 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2244 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 }
2246
Jeff Johnson32d95a32012-09-10 13:15:23 -07002247 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002248 {
2249 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302250 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002251 }
2252
Jeff Johnson32d95a32012-09-10 13:15:23 -07002253 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302255 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 }
2257
Jeff Johnson32d95a32012-09-10 13:15:23 -07002258 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302260 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002261 }
2262
Jeff Johnson32d95a32012-09-10 13:15:23 -07002263 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 {
2265 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002266 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002268 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002270 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002271 }
2272
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002273 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 {
2275 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002276 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 }
2278
Jeff Johnson32d95a32012-09-10 13:15:23 -07002279 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 {
2281 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002282 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 }
2284
Jeff Johnson32d95a32012-09-10 13:15:23 -07002285 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 {
2287 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002288 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002289 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002290 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 }
2292
Jeff Johnson32d95a32012-09-10 13:15:23 -07002293 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 {
2295 pProbeResp->wmeInfoPresent = 1;
2296 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!\n"));)
2297 }
2298
Jeff Johnson32d95a32012-09-10 13:15:23 -07002299 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 {
2301 pProbeResp->wsmCapablePresent = 1;
2302 }
2303
2304
Jeff Johnson32d95a32012-09-10 13:15:23 -07002305 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 {
2307 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002308 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 }
2310
2311#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002312 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 {
2314 // MobilityDomain
2315 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302316 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2317 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002318 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002319#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002320 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x\n"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002321 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2322#endif
2323 }
2324#endif
2325
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002326#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002327 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302329 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 }
2331#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002332 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302334 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 sizeof(tDot11fIEP2PProbeRes) );
2336 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002337#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002338 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002339 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302340 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002341 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002342 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002343 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302344 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002345 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002346 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002347 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302348 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002349 }
2350#endif
Abhishek Singhc75726d2015-04-13 14:44:14 +05302351 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 return eSIR_SUCCESS;
2353
2354} // End sirConvertProbeFrame2Struct.
2355
2356tSirRetStatus
2357sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2358 tANI_U8 *pFrame,
2359 tANI_U32 nFrame,
2360 tpSirAssocReq pAssocReq)
2361{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002362 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 tANI_U32 status;
2364
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302365 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2366 if ( NULL == ar )
2367 status = eHAL_STATUS_FAILURE;
2368 else
2369 status = eHAL_STATUS_SUCCESS;
2370 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002371 {
2372 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2373 return eSIR_FAILURE;
2374 }
2375 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302376 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2377 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002378
2379 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002380 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 if ( DOT11F_FAILED( status ) )
2382 {
2383 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):\n"),
2384 status, nFrame);
2385 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302386 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 return eSIR_FAILURE;
2388 }
2389 else if ( DOT11F_WARNED( status ) )
2390 {
2391 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):\n"),
2392 status, nFrame );
2393 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2394 }
2395
2396 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2397
2398 // make sure this is seen as an assoc request
2399 pAssocReq->reassocRequest = 0;
2400
2401 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002402 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2403 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2404 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2405 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2406 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2407 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2408 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2409 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2410 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2411 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2412 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2413 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2414 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2415 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2416 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2417 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002418
2419 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002420 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002421
2422 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002423 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 {
2425 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002426 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 }
2428
2429 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002430 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 {
2432 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002433 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 }
2435
2436 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002437 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002438 {
2439 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002440 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 }
2442
2443 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002444 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002445 {
2446 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002447 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 }
2449
2450 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002451 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 {
2453 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002454 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 }
2456
2457 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002458 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 {
2460 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002461 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002462 }
2463
2464 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002465 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 {
2467 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002468 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 }
2470
2471
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002472 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002473 {
2474 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002475 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002476 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002477#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002478 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002479 {
2480 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002481 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002482 }
2483#endif
2484
Jeff Johnson295189b2012-06-20 16:38:30 -07002485 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002486 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002487 {
2488 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002489 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 }
2491
2492 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002493 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 {
2495 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002496 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 }
2498
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002499 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002500 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302501 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002502 }
2503
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002504 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 {
2506 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302507 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2508 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002509
2510 }
2511
2512
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002513 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002514
2515 if ( ! pAssocReq->ssidPresent )
2516 {
2517 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302518 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002519 return eSIR_FAILURE;
2520 }
2521
2522 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2523 {
2524 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate 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
Jeff Johnsone7245742012-09-05 17:12:55 -07002529#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002530 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002531 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302532 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002533 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap\n"));
2534 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2535 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002536 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002537 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302538 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002539 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2540 limLogOperatingMode( pMac, &pAssocReq->operMode);
2541 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002542#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302543 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 return eSIR_SUCCESS;
2545
2546} // End sirConvertAssocReqFrame2Struct.
2547
2548tSirRetStatus
2549sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2550 tANI_U8 *pFrame,
2551 tANI_U32 nFrame,
2552 tpSirAssocRsp pAssocRsp)
2553{
2554 static tDot11fAssocResponse ar;
2555 tANI_U32 status;
2556 tANI_U8 cnt =0;
2557
2558 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302559 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002560
2561 // delegate to the framesc-generated code,
2562 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2563 if ( DOT11F_FAILED( status ) )
2564 {
2565 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes):\n"),
2566 status, nFrame);
2567 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2568 return eSIR_FAILURE;
2569 }
2570 else if ( DOT11F_WARNED( status ) )
2571 {
2572 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes):\n"),
2573 status, nFrame );
2574 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2575 }
2576
2577 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2578
2579 // Capabilities
2580 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2581 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2582 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2583 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2584 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2585 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2586 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2587 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2588 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2589 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2590 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2591 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2592 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2593 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2594 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2595 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2596
2597 pAssocRsp->statusCode = ar.Status.status;
2598 pAssocRsp->aid = ar.AID.associd;
2599
2600 if ( ! ar.SuppRates.present )
2601 {
2602 pAssocRsp->suppRatesPresent = 0;
2603 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2604 }
2605 else
2606 {
2607 pAssocRsp->suppRatesPresent = 1;
2608 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2609 }
2610
2611 if ( ar.ExtSuppRates.present )
2612 {
2613 pAssocRsp->extendedRatesPresent = 1;
2614 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2615 }
2616
2617 if ( ar.EDCAParamSet.present )
2618 {
2619 pAssocRsp->edcaPresent = 1;
2620 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2621 }
Atul Mittalbceb4a12014-11-27 18:50:19 +05302622 if (ar.ExtCap.present)
2623 {
2624 vos_mem_copy(&pAssocRsp->ExtCap, &ar.ExtCap, sizeof(tDot11fIEExtCap));
2625 limLog(pMac, LOG1,
2626 FL("ExtCap is present, TDLSChanSwitProhibited: %d"),
2627 ar.ExtCap.TDLSChanSwitProhibited);
2628 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 if ( ar.WMMParams.present )
2630 {
2631 pAssocRsp->wmeEdcaPresent = 1;
2632 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002633 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 __printWMMParams(pMac, &ar.WMMParams);
2635 }
2636
2637 if ( ar.HTCaps.present )
2638 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302639 limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302640 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 }
2642
2643 if ( ar.HTInfo.present )
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302644 { limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302645 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002646 }
2647
2648#ifdef WLAN_FEATURE_VOWIFI_11R
2649 if (ar.MobilityDomain.present)
2650 {
2651 // MobilityDomain
2652 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302653 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2654 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002655 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2656#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002657 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2659#endif
2660 }
2661
2662 if ( ar.FTInfo.present )
2663 {
2664#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002665 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 -07002666 ar.FTInfo.R0KH_ID.present,
2667 ar.FTInfo.R1KH_ID.present);
2668#endif
2669 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302670 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 }
2672#endif
2673
2674#ifdef WLAN_FEATURE_VOWIFI_11R
2675 if (ar.num_RICDataDesc) {
2676 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2677 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302678 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2679 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 }
2681 }
2682 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2683 pAssocRsp->ricPresent = TRUE;
2684 }
2685#endif
2686
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002687#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 if (ar.num_WMMTSPEC) {
2689 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2690 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302691 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2692 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 }
2694 pAssocRsp->tspecPresent = TRUE;
2695 }
2696
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002697 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 {
2699 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302700 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002701 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 }
2703#endif
2704
Jeff Johnsone7245742012-09-05 17:12:55 -07002705#ifdef WLAN_FEATURE_11AC
2706 if ( ar.VHTCaps.present )
2707 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302708 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002709 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002710 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2711 }
2712 if ( ar.VHTOperation.present )
2713 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302714 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002715 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002716 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2717 }
2718#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302719 if(ar.OBSSScanParameters.present)
2720 {
2721 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2722 sizeof( tDot11fIEOBSSScanParameters));
2723 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002724 if ( ar.QosMapSet.present )
2725 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002726 pAssocRsp->QosMapSet.present = 1;
2727 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002728 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002729 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002730 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002732} // End sirConvertAssocRespFrame2Struct.
2733
2734tSirRetStatus
2735sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2736 tANI_U8 *pFrame,
2737 tANI_U32 nFrame,
2738 tpSirAssocReq pAssocReq)
2739{
2740 static tDot11fReAssocRequest ar;
2741 tANI_U32 status;
2742
2743 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302744 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002745
2746 // delegate to the framesc-generated code,
2747 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2748 if ( DOT11F_FAILED( status ) )
2749 {
2750 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes):\n"),
2751 status, nFrame);
2752 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2753 return eSIR_FAILURE;
2754 }
2755 else if ( DOT11F_WARNED( status ) )
2756 {
2757 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes):\n"),
2758 status, nFrame );
2759 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2760 }
2761
2762 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2763
2764 // make sure this is seen as a re-assoc request
2765 pAssocReq->reassocRequest = 1;
2766
2767 // Capabilities
2768 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2769 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2770 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2771 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2772 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2773 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2774 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2775 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2776 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2777 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2778 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2779 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2780 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2781 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2782 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2783 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2784
2785 // Listen Interval
2786 pAssocReq->listenInterval = ar.ListenInterval.interval;
2787
2788 // SSID
2789 if ( ar.SSID.present )
2790 {
2791 pAssocReq->ssidPresent = 1;
2792 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2793 }
2794
2795 // Supported Rates
2796 if ( ar.SuppRates.present )
2797 {
2798 pAssocReq->suppRatesPresent = 1;
2799 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2800 }
2801
2802 // Extended Supported Rates
2803 if ( ar.ExtSuppRates.present )
2804 {
2805 pAssocReq->extendedRatesPresent = 1;
2806 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2807 &ar.ExtSuppRates );
2808 }
2809
2810 // QOS Capabilities:
2811 if ( ar.QOSCapsStation.present )
2812 {
2813 pAssocReq->qosCapabilityPresent = 1;
2814 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2815 }
2816
2817 // WPA
2818 if ( ar.WPAOpaque.present )
2819 {
2820 pAssocReq->wpaPresent = 1;
2821 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2822 }
2823
2824 // RSN
2825 if ( ar.RSNOpaque.present )
2826 {
2827 pAssocReq->rsnPresent = 1;
2828 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2829 }
2830
2831
2832 // Power Capabilities
2833 if ( ar.PowerCaps.present )
2834 {
2835 pAssocReq->powerCapabilityPresent = 1;
2836 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2837 }
2838
2839 // Supported Channels
2840 if ( ar.SuppChannels.present )
2841 {
2842 pAssocReq->supportedChannelsPresent = 1;
2843 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2844 }
2845
2846 if ( ar.HTCaps.present )
2847 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302848 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002849 }
2850
2851 if ( ar.WMMInfoStation.present )
2852 {
2853 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302854 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2855 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002856
2857 }
2858
2859 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2860
2861 if ( ! pAssocReq->ssidPresent )
2862 {
2863 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE.\n"));)
2864 return eSIR_FAILURE;
2865 }
2866
2867 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2868 {
2869 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE.\n"));)
2870 return eSIR_FAILURE;
2871 }
2872
2873 // Why no call to 'updateAssocReqFromPropCapability' here, like
2874 // there is in 'sirConvertAssocReqFrame2Struct'?
2875
2876 // WSC IE
2877 if (ar.WscIEOpaque.present)
2878 {
2879 pAssocReq->addIEPresent = 1;
2880 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2881 }
2882
Jeff Johnson295189b2012-06-20 16:38:30 -07002883 if(ar.P2PIEOpaque.present)
2884 {
2885 pAssocReq->addIEPresent = 1;
2886 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2887 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002888
Jeff Johnsone7245742012-09-05 17:12:55 -07002889#ifdef WLAN_FEATURE_WFD
2890 if(ar.WFDIEOpaque.present)
2891 {
2892 pAssocReq->addIEPresent = 1;
2893 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2894 }
2895#endif
2896
2897#ifdef WLAN_FEATURE_11AC
2898 if ( ar.VHTCaps.present )
2899 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302900 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002901 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002902 if ( ar.OperatingMode.present )
2903 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302904 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002905 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE\n"));
2906 limLogOperatingMode( pMac, &pAssocReq->operMode);
2907 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002908#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002909 return eSIR_SUCCESS;
2910
2911} // End sirConvertReassocReqFrame2Struct.
2912
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002913
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002914#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002915tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002916sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002917 tANI_U8 *pPayload,
2918 const tANI_U32 nPayload,
2919 tANI_U8 **outIeBuf,
2920 tANI_U32 *pOutIeLen)
2921{
2922 tDot11fBeaconIEs *pBies = NULL;
2923 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002924 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002925 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002926
2927 /* To store how many bytes are required to be allocated
2928 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002929 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002930 tANI_U8 *pos = NULL;
2931
2932 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002933 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002934 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2935 if ( NULL == pBies )
2936 status = eHAL_STATUS_FAILURE;
2937 else
2938 status = eHAL_STATUS_SUCCESS;
2939 if (!HAL_STATUS_SUCCESS(status))
2940 {
2941 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
2942 return eSIR_FAILURE;
2943 }
2944 // delegate to the framesc-generated code,
2945 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2946
2947 if ( DOT11F_FAILED( status ) )
2948 {
2949 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
2950 status, nPayload);
2951 vos_mem_free(pBies);
2952 return eSIR_FAILURE;
2953 }
2954 else if ( DOT11F_WARNED( status ) )
2955 {
2956 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
2957 status, nPayload );
2958 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2959 }
2960
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002961 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002962 if ( !pBies->SSID.present )
2963 {
2964 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
2965 }
2966 else
2967 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002968 eseBcnReportMandatoryIe.ssidPresent = 1;
2969 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002970 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002971 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002972 }
2973
2974 if ( !pBies->SuppRates.present )
2975 {
2976 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
2977 }
2978 else
2979 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002980 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2981 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2982 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002983 }
2984
2985 if ( pBies->FHParamSet.present)
2986 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002987 eseBcnReportMandatoryIe.fhParamPresent = 1;
2988 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002989 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2990 }
2991
2992 if ( pBies->DSParams.present )
2993 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002994 eseBcnReportMandatoryIe.dsParamsPresent = 1;
2995 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002996 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2997 }
2998
2999 if ( pBies->CFParams.present )
3000 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003001 eseBcnReportMandatoryIe.cfPresent = 1;
3002 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003003 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
3004 }
3005
3006 if ( pBies->IBSSParams.present )
3007 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003008 eseBcnReportMandatoryIe.ibssParamPresent = 1;
3009 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003010 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3011 }
3012
3013 if ( pBies->TIM.present )
3014 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003015 eseBcnReportMandatoryIe.timPresent = 1;
3016 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
3017 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
3018 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
3019 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003020 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
3021 }
3022
3023 if ( pBies->RRMEnabledCap.present )
3024 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003025 eseBcnReportMandatoryIe.rrmPresent = 1;
3026 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003027 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3028 }
3029
3030 *outIeBuf = vos_mem_malloc(numBytes);
3031 if (NULL == *outIeBuf)
3032 {
3033 limLog(pMac, LOGP, FL("Memory Allocation failure"));
3034 vos_mem_free(pBies);
3035 return eSIR_FAILURE;
3036 }
3037 pos = *outIeBuf;
3038 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003039 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003040
3041 /* Start filling the output Ie with Mandatory IE information */
3042 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003043 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003044 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003045 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003046 {
3047 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
3048 retStatus = eSIR_FAILURE;
3049 goto err_bcnrep;
3050 }
3051 *pos = SIR_MAC_SSID_EID;
3052 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003053 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003054 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003055 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
3056 eseBcnReportMandatoryIe.ssId.length);
3057 pos += eseBcnReportMandatoryIe.ssId.length;
3058 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003059 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003060
3061 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003062 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003063 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003064 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003065 {
3066 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
3067 retStatus = eSIR_FAILURE;
3068 goto err_bcnrep;
3069 }
3070 *pos = SIR_MAC_RATESET_EID;
3071 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003072 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003073 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003074 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
3075 eseBcnReportMandatoryIe.supportedRates.numRates);
3076 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
3077 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003078 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003079
3080 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003081 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003082 {
3083 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
3084 {
3085 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
3086 retStatus = eSIR_FAILURE;
3087 goto err_bcnrep;
3088 }
3089 *pos = SIR_MAC_FH_PARAM_SET_EID;
3090 pos++;
3091 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
3092 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003093 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003094 SIR_MAC_FH_PARAM_SET_EID_MAX);
3095 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
3096 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
3097 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003098
3099 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003100 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003101 {
3102 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
3103 {
3104 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
3105 retStatus = eSIR_FAILURE;
3106 goto err_bcnrep;
3107 }
3108 *pos = SIR_MAC_DS_PARAM_SET_EID;
3109 pos++;
3110 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
3111 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003112 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003113 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
3114 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
3115 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003116
3117 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003118 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003119 {
3120 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
3121 {
3122 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
3123 retStatus = eSIR_FAILURE;
3124 goto err_bcnrep;
3125 }
3126 *pos = SIR_MAC_CF_PARAM_SET_EID;
3127 pos++;
3128 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
3129 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003130 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003131 SIR_MAC_CF_PARAM_SET_EID_MAX);
3132 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
3133 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
3134 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003135
3136 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003137 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003138 {
3139 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
3140 {
3141 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
3142 retStatus = eSIR_FAILURE;
3143 goto err_bcnrep;
3144 }
3145 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
3146 pos++;
3147 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3148 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003149 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003150 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3151 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3152 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3153 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003154
3155 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003156 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003157 {
3158 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
3159 {
3160 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
3161 retStatus = eSIR_FAILURE;
3162 goto err_bcnrep;
3163 }
3164 *pos = SIR_MAC_TIM_EID;
3165 pos++;
3166 *pos = SIR_MAC_TIM_EID_MIN;
3167 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003168 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003169 SIR_MAC_TIM_EID_MIN);
3170 pos += SIR_MAC_TIM_EID_MIN;
3171 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
3172 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003173
3174 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003175 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003176 {
3177 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3178 {
3179 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3180 retStatus = eSIR_FAILURE;
3181 goto err_bcnrep;
3182 }
3183 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3184 pos++;
3185 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3186 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003187 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003188 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3189 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3190 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003191
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003192 if (freeBytes != 0)
3193 {
3194 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3195 retStatus = eSIR_FAILURE;
3196 }
3197
3198err_bcnrep:
3199 /* The message counter would not be incremented in case of
3200 * returning failure and hence next time, this function gets
3201 * called, it would be using the same msg ctr for a different
3202 * BSS.So, it is good to clear the memory allocated for a BSS
3203 * that is returning failure.On success, the caller would take
3204 * care of freeing up the memory*/
3205 if (retStatus == eSIR_FAILURE)
3206 {
3207 vos_mem_free(*outIeBuf);
3208 *outIeBuf = NULL;
3209 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003210 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003211 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003212}
3213
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003214#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003215
Jeff Johnson295189b2012-06-20 16:38:30 -07003216tSirRetStatus
3217sirParseBeaconIE(tpAniSirGlobal pMac,
3218 tpSirProbeRespBeacon pBeaconStruct,
3219 tANI_U8 *pPayload,
3220 tANI_U32 nPayload)
3221{
3222 tDot11fBeaconIEs *pBies;
3223 tANI_U32 status;
3224
3225 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303226 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003227
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303228 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3229 if ( NULL == pBies )
3230 status = eHAL_STATUS_FAILURE;
3231 else
3232 status = eHAL_STATUS_SUCCESS;
3233 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003234 {
3235 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3236 return eSIR_FAILURE;
3237 }
3238 // delegate to the framesc-generated code,
3239 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3240
3241 if ( DOT11F_FAILED( status ) )
3242 {
3243 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3244 status, nPayload);
3245 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303246 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 return eSIR_FAILURE;
3248 }
3249 else if ( DOT11F_WARNED( status ) )
3250 {
3251 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3252 status, nPayload );
3253 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3254 }
3255
3256 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3257 if ( ! pBies->SSID.present )
3258 {
3259 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3260 }
3261 else
3262 {
3263 pBeaconStruct->ssidPresent = 1;
3264 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3265 }
3266
3267 if ( ! pBies->SuppRates.present )
3268 {
3269 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3270 }
3271 else
3272 {
3273 pBeaconStruct->suppRatesPresent = 1;
3274 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3275 }
3276
3277 if ( pBies->ExtSuppRates.present )
3278 {
3279 pBeaconStruct->extendedRatesPresent = 1;
3280 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3281 }
3282
3283 if ( pBies->CFParams.present )
3284 {
3285 pBeaconStruct->cfPresent = 1;
3286 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3287 }
3288
3289 if ( pBies->TIM.present )
3290 {
3291 pBeaconStruct->timPresent = 1;
3292 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3293 }
3294
3295 if ( pBies->Country.present )
3296 {
3297 pBeaconStruct->countryInfoPresent = 1;
3298 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3299 }
3300
3301 // 11h IEs
3302 if(pBies->TPCReport.present)
3303 {
3304 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303305 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 &pBies->TPCReport,
3307 sizeof( tDot11fIETPCReport));
3308 }
3309
3310 if(pBies->PowerConstraints.present)
3311 {
3312 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303313 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003314 &pBies->PowerConstraints,
3315 sizeof(tDot11fIEPowerConstraints));
3316 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003317#ifdef FEATURE_WLAN_ESE
3318 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003319 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003320 pBeaconStruct->eseTxPwr.present = 1;
3321 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 }
3323 if (pBies->QBSSLoad.present)
3324 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303325 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 }
3327#endif
3328
3329 if ( pBies->EDCAParamSet.present )
3330 {
3331 pBeaconStruct->edcaPresent = 1;
3332 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3333 }
3334
3335 // QOS Capabilities:
3336 if ( pBies->QOSCapsAp.present )
3337 {
3338 pBeaconStruct->qosCapabilityPresent = 1;
3339 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3340 }
3341
3342
3343
3344 if ( pBies->ChanSwitchAnn.present )
3345 {
3346 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303347 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 sizeof(tDot11fIEChanSwitchAnn));
3349 }
3350
3351 if ( pBies->ExtChanSwitchAnn.present)
3352 {
3353 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303354 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 sizeof(tDot11fIEExtChanSwitchAnn));
3356 }
3357
3358 if ( pBies->Quiet.present )
3359 {
3360 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303361 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 }
3363
3364 if ( pBies->HTCaps.present )
3365 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303366 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003367 }
3368
3369 if ( pBies->HTInfo.present )
3370 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303371 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 }
3373
3374 if ( pBies->DSParams.present )
3375 {
3376 pBeaconStruct->dsParamsPresent = 1;
3377 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3378 }
3379 else if(pBies->HTInfo.present)
3380 {
3381 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3382 }
3383
3384 if ( pBies->RSN.present )
3385 {
3386 pBeaconStruct->rsnPresent = 1;
3387 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3388 }
3389
3390 if ( pBies->WPA.present )
3391 {
3392 pBeaconStruct->wpaPresent = 1;
3393 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3394 }
3395
3396 if ( pBies->WMMParams.present )
3397 {
3398 pBeaconStruct->wmeEdcaPresent = 1;
3399 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3400 }
3401
3402 if ( pBies->WMMInfoAp.present )
3403 {
3404 pBeaconStruct->wmeInfoPresent = 1;
3405 }
3406
3407 if ( pBies->WMMCaps.present )
3408 {
3409 pBeaconStruct->wsmCapablePresent = 1;
3410 }
3411
3412
3413 if ( pBies->ERPInfo.present )
3414 {
3415 pBeaconStruct->erpPresent = 1;
3416 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3417 }
3418
Jeff Johnsone7245742012-09-05 17:12:55 -07003419#ifdef WLAN_FEATURE_11AC
3420 if ( pBies->VHTCaps.present )
3421 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303422 pBeaconStruct->VHTCaps.present = 1;
3423 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003424 }
3425 if ( pBies->VHTOperation.present )
3426 {
3427 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303428 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3429 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003430 }
3431 if ( pBies->VHTExtBssLoad.present )
3432 {
3433 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303434 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3435 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003436 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003437 if( pBies->OperatingMode.present)
3438 {
3439 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303440 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3441 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003442 }
3443
Jeff Johnsone7245742012-09-05 17:12:55 -07003444#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303445 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003446
Jeff Johnsone7245742012-09-05 17:12:55 -07003447
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 return eSIR_SUCCESS;
3449
3450} // End sirParseBeaconIE.
3451
3452tSirRetStatus
3453sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3454 tANI_U8 *pFrame,
3455 tpSirProbeRespBeacon pBeaconStruct)
3456{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003457 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003458 tANI_U32 status, nPayload;
3459 tANI_U8 *pPayload;
3460 tpSirMacMgmtHdr pHdr;
3461 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003462 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003463
3464 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3465 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3466 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3467 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003468 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003469
3470 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303471 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3472
Abhishek Singhc75726d2015-04-13 14:44:14 +05303473 pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303474 if ( NULL == pBeacon )
3475 status = eHAL_STATUS_FAILURE;
3476 else
3477 status = eHAL_STATUS_SUCCESS;
3478 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003479 {
3480 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
3481 return eSIR_FAILURE;
3482 }
3483
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303484 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003485
3486 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303487 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003488
3489 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003490 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 if ( DOT11F_FAILED( status ) )
3492 {
3493 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes):\n"),
3494 status, nPayload);
3495 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05303496 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003497 return eSIR_FAILURE;
3498 }
3499 else if ( DOT11F_WARNED( status ) )
3500 {
3501 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes):\n"),
3502 status, nPayload );
3503 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3504 }
3505
3506 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3507 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303508 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3509 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003510
3511 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003512 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003513
3514 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003515 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3516 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3517 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3518 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3519 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3520 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3521 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3522 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3523 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3524 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3525 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3526 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3527 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3528 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3529 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3530 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003531
Jeff Johnson32d95a32012-09-10 13:15:23 -07003532 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003533 {
3534 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!\n"));)
3535 }
3536 else
3537 {
3538 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003539 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 }
3541
Jeff Johnson32d95a32012-09-10 13:15:23 -07003542 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003543 {
3544 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!\n"));)
3545 }
3546 else
3547 {
3548 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003549 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003550 }
3551
Jeff Johnson32d95a32012-09-10 13:15:23 -07003552 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 {
3554 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003555 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003556 }
3557
3558
Jeff Johnson32d95a32012-09-10 13:15:23 -07003559 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003560 {
3561 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003562 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 }
3564
Jeff Johnson32d95a32012-09-10 13:15:23 -07003565 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003566 {
3567 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003568 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003569 }
3570
Jeff Johnson32d95a32012-09-10 13:15:23 -07003571 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003572 {
3573 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003574 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003575 }
3576
3577 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003578 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 {
3580 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003581 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 }
3583
Jeff Johnson32d95a32012-09-10 13:15:23 -07003584 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003585 {
3586 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003587 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003588 }
3589
Jeff Johnson32d95a32012-09-10 13:15:23 -07003590 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 {
3592 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303593 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003594 sizeof(tDot11fIEChanSwitchAnn) );
3595 }
3596
Jeff Johnson32d95a32012-09-10 13:15:23 -07003597 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003598 {
3599 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303600 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003601 sizeof(tDot11fIEExtChanSwitchAnn) );
3602 }
3603
Jeff Johnson32d95a32012-09-10 13:15:23 -07003604 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 {
3606 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303607 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003608 sizeof(tDot11fIETPCReport));
3609 }
3610
Jeff Johnson32d95a32012-09-10 13:15:23 -07003611 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003612 {
3613 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303614 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 sizeof(tDot11fIEPowerConstraints));
3616 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003617
3618 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003619 {
3620 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303621 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 }
3623
Jeff Johnson32d95a32012-09-10 13:15:23 -07003624 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303626 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 }
3628
Jeff Johnson32d95a32012-09-10 13:15:23 -07003629 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003630 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303631 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003632
3633 }
3634
Jeff Johnson32d95a32012-09-10 13:15:23 -07003635 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003636 {
3637 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003638 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003639 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003640 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003642 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003643 }
3644 else
3645 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003646 if ((!rfBand) || IS_5G_BAND(rfBand))
3647 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3648 else if (IS_24G_BAND(rfBand))
3649 pBeaconStruct->channelNumber = mappedRXCh;
3650 else
3651 {
3652 /*Only 0, 1, 2 are expected values for RF band from FW
3653 * if FW fixes are not present then rf band value will
3654 * be 0, else either 1 or 2 are expected from FW, 3 is
3655 * not expected from FW */
3656 PELOGE(limLog(pMac, LOGE,
3657 FL("Channel info is not present in Beacon and"
3658 " mapping is not done correctly"));)
3659 pBeaconStruct->channelNumber = mappedRXCh;
3660 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003661 }
3662
Jeff Johnson32d95a32012-09-10 13:15:23 -07003663 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003664 {
3665 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003666 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003667 }
3668
Jeff Johnson32d95a32012-09-10 13:15:23 -07003669 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 {
3671 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003672 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003673 }
3674
Jeff Johnson32d95a32012-09-10 13:15:23 -07003675 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003676 {
3677 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003678 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003679 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!\n"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003680 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003681 }
3682
Jeff Johnson32d95a32012-09-10 13:15:23 -07003683 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 {
3685 pBeaconStruct->wmeInfoPresent = 1;
3686 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!\n"));)
3687 }
3688
Jeff Johnson32d95a32012-09-10 13:15:23 -07003689 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 {
3691 pBeaconStruct->wsmCapablePresent = 1;
3692 }
3693
Jeff Johnson32d95a32012-09-10 13:15:23 -07003694 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 {
3696 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003697 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003698 }
3699
3700#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003701 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003702 {
3703 // MobilityDomain
3704 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303705 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3706 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003707 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003708
3709 }
3710#endif
3711
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003712#ifdef FEATURE_WLAN_ESE
3713 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303714 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003715 //ESE Tx Power
3716 pBeaconStruct->eseTxPwr.present = 1;
3717 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3718 &pBeacon->ESETxmitPower,
3719 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303720 }
3721#endif
3722
Jeff Johnsone7245742012-09-05 17:12:55 -07003723#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003724 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003725 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303726 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003727 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003728 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003729 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303730 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3731 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003732 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003733 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003734 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303735 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3736 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003737 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003738 if(pBeacon->OperatingMode.present)
3739 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303740 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3741 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003742 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003743 if(pBeacon->WiderBWChanSwitchAnn.present)
3744 {
3745 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303746 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3747 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003748 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003749#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303750 if(pBeacon->OBSSScanParameters.present)
3751 {
3752 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3753 &pBeacon->OBSSScanParameters,
3754 sizeof( tDot11fIEOBSSScanParameters));
3755 }
Abhishek Singhc75726d2015-04-13 14:44:14 +05303756 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003757 return eSIR_SUCCESS;
3758
3759} // End sirConvertBeaconFrame2Struct.
3760
3761tSirRetStatus
3762sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3763 tANI_U8 *pFrame,
3764 tANI_U32 nFrame,
3765 tpSirMacAuthFrameBody pAuth)
3766{
3767 static tDot11fAuthentication auth;
3768 tANI_U32 status;
3769
3770 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303771 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003772
3773 // delegate to the framesc-generated code,
3774 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3775 if ( DOT11F_FAILED( status ) )
3776 {
3777 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes):\n"),
3778 status, nFrame);
3779 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3780 return eSIR_FAILURE;
3781 }
3782 else if ( DOT11F_WARNED( status ) )
3783 {
3784 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes):\n"),
3785 status, nFrame );
3786 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3787 }
3788
3789 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3790 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3791 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3792 pAuth->authStatusCode = auth.Status.status;
3793
3794 if ( auth.ChallengeText.present )
3795 {
3796 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3797 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303798 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 }
3800
3801 return eSIR_SUCCESS;
3802
3803} // End sirConvertAuthFrame2Struct.
3804
3805tSirRetStatus
3806sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3807 tANI_U8 *pFrame,
3808 tANI_U32 nFrame,
3809 tSirAddtsReqInfo *pAddTs)
3810{
3811 tDot11fAddTSRequest addts = {{0}};
3812 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3813 tANI_U8 j;
3814 tANI_U16 i;
3815 tANI_U32 status;
3816
3817 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3818 {
3819 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3820 "with an Action of %d; this is not "
3821 "supported & is probably an error."),
3822 *( pFrame + 1 ) );
3823 return eSIR_FAILURE;
3824 }
3825
3826 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303827 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003828
3829 // delegate to the framesc-generated code,
3830 switch ( *pFrame )
3831 {
3832 case SIR_MAC_ACTION_QOS_MGMT:
3833 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3834 break;
3835 case SIR_MAC_ACTION_WME:
3836 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3837 break;
3838 default:
3839 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3840 "with a Category of %d; this is not"
3841 " supported & is probably an error."),
3842 *pFrame );
3843 return eSIR_FAILURE;
3844 }
3845
3846 if ( DOT11F_FAILED( status ) )
3847 {
3848 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
3849 "rame (0x%08x, %d bytes):\n"),
3850 status, nFrame);
3851 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3852 return eSIR_FAILURE;
3853 }
3854 else if ( DOT11F_WARNED( status ) )
3855 {
3856 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3857 "g an Add TS Request frame (0x%08x,"
3858 "%d bytes):\n"),
3859 status, nFrame );
3860 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3861 }
3862
3863 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3864 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3865 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3866 {
3867 pAddTs->dialogToken = addts.DialogToken.token;
3868
3869 if ( addts.TSPEC.present )
3870 {
3871 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3872 }
3873 else
3874 {
3875 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.\n") );
3876 return eSIR_FAILURE;
3877 }
3878
3879 if ( addts.num_TCLAS )
3880 {
3881 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3882
3883 for ( i = 0U; i < addts.num_TCLAS; ++i )
3884 {
3885 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3886 {
3887 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3888 return eSIR_FAILURE;
3889 }
3890 }
3891 }
3892
3893 if ( addts.TCLASSPROC.present )
3894 {
3895 pAddTs->tclasProcPresent = 1;
3896 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3897 }
3898
3899 if ( addts.WMMTSPEC.present )
3900 {
3901 pAddTs->wsmTspecPresent = 1;
3902 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3903 }
3904
3905 if ( addts.num_WMMTCLAS )
3906 {
3907 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3908 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3909
3910 for ( i = pAddTs->numTclas; i < j; ++i )
3911 {
3912 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3913 {
3914 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
3915 return eSIR_FAILURE;
3916 }
3917 }
3918 }
3919
3920 if ( addts.WMMTCLASPROC.present )
3921 {
3922 pAddTs->tclasProcPresent = 1;
3923 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3924 }
3925
3926 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3927 {
3928 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
3929 pAddTs->numTclas );
3930 return eSIR_FAILURE;
3931 }
3932 }
3933 else
3934 {
3935 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3936
3937 if ( wmmaddts.WMMTSPEC.present )
3938 {
3939 pAddTs->wmeTspecPresent = 1;
3940 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3941 }
3942 else
3943 {
3944 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
3945 return eSIR_FAILURE;
3946 }
3947 }
3948
3949 return eSIR_SUCCESS;
3950
3951} // End sirConvertAddtsReq2Struct.
3952
3953tSirRetStatus
3954sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3955 tANI_U8 *pFrame,
3956 tANI_U32 nFrame,
3957 tSirAddtsRspInfo *pAddTs)
3958{
3959 tDot11fAddTSResponse addts = {{0}};
3960 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3961 tANI_U8 j;
3962 tANI_U16 i;
3963 tANI_U32 status;
3964
3965 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3966 {
3967 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3968 "with an Action of %d; this is not "
3969 "supported & is probably an error."),
3970 *( pFrame + 1 ) );
3971 return eSIR_FAILURE;
3972 }
3973
3974 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303975 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3976 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3977 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003978
3979
3980 // delegate to the framesc-generated code,
3981 switch ( *pFrame )
3982 {
3983 case SIR_MAC_ACTION_QOS_MGMT:
3984 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3985 break;
3986 case SIR_MAC_ACTION_WME:
3987 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3988 break;
3989 default:
3990 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3991 "with a Category of %d; this is not"
3992 " supported & is probably an error."),
3993 *pFrame );
3994 return eSIR_FAILURE;
3995 }
3996
3997 if ( DOT11F_FAILED( status ) )
3998 {
3999 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
4000 "rame (0x%08x, %d bytes):\n"),
4001 status, nFrame);
4002 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4003 return eSIR_FAILURE;
4004 }
4005 else if ( DOT11F_WARNED( status ) )
4006 {
4007 limLog( pMac, LOGW, FL("There were warnings while unpackin"
4008 "g an Add TS Response frame (0x%08x,"
4009 "%d bytes):\n"),
4010 status, nFrame );
4011 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4012 }
4013
4014 // & "transliterate" from a 'tDot11fAddTSResponse' or a
4015 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
4016 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4017 {
4018 pAddTs->dialogToken = addts.DialogToken.token;
4019 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
4020
4021 if ( addts.TSDelay.present )
4022 {
4023 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
4024 }
4025
4026 // TS Delay is present iff status indicates its presence
4027 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
4028 {
4029 limLog( pMac, LOGW, FL("Missing TSDelay IE.\n") );
4030 }
4031
4032 if ( addts.TSPEC.present )
4033 {
4034 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
4035 }
4036 else
4037 {
4038 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.\n") );
4039 return eSIR_FAILURE;
4040 }
4041
4042 if ( addts.num_TCLAS )
4043 {
4044 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4045
4046 for ( i = 0U; i < addts.num_TCLAS; ++i )
4047 {
4048 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4049 {
4050 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
4051 return eSIR_FAILURE;
4052 }
4053 }
4054 }
4055
4056 if ( addts.TCLASSPROC.present )
4057 {
4058 pAddTs->tclasProcPresent = 1;
4059 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4060 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004061#ifdef FEATURE_WLAN_ESE
4062 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004063 {
4064 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304065 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004066 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004067 }
4068#endif
4069 if ( addts.Schedule.present )
4070 {
4071 pAddTs->schedulePresent = 1;
4072 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
4073 }
4074
4075 if ( addts.WMMSchedule.present )
4076 {
4077 pAddTs->schedulePresent = 1;
4078 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
4079 }
4080
4081 if ( addts.WMMTSPEC.present )
4082 {
4083 pAddTs->wsmTspecPresent = 1;
4084 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4085 }
4086
4087 if ( addts.num_WMMTCLAS )
4088 {
4089 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
4090 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
4091
4092 for ( i = pAddTs->numTclas; i < j; ++i )
4093 {
4094 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4095 {
4096 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.\n") );
4097 return eSIR_FAILURE;
4098 }
4099 }
4100 }
4101
4102 if ( addts.WMMTCLASPROC.present )
4103 {
4104 pAddTs->tclasProcPresent = 1;
4105 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4106 }
4107
4108 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4109 {
4110 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE.\n"),
4111 pAddTs->numTclas );
4112 return eSIR_FAILURE;
4113 }
4114 }
4115 else
4116 {
4117 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4118 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
4119
4120 if ( wmmaddts.WMMTSPEC.present )
4121 {
4122 pAddTs->wmeTspecPresent = 1;
4123 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4124 }
4125 else
4126 {
4127 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
4128 return eSIR_FAILURE;
4129 }
4130
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004131#ifdef FEATURE_WLAN_ESE
4132 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 {
4134 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304135 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004136 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004137 }
4138#endif
4139
4140 }
4141
4142 return eSIR_SUCCESS;
4143
4144} // End sirConvertAddtsRsp2Struct.
4145
4146tSirRetStatus
4147sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
4148 tANI_U8 *pFrame,
4149 tANI_U32 nFrame,
4150 tSirDeltsReqInfo *pDelTs)
4151{
4152 tDot11fDelTS delts = {{0}};
4153 tDot11fWMMDelTS wmmdelts = {{0}};
4154 tANI_U32 status;
4155
4156 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
4157 {
4158 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4159 "with an Action of %d; this is not "
4160 "supported & is probably an error."),
4161 *( pFrame + 1 ) );
4162 return eSIR_FAILURE;
4163 }
4164
4165 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304166 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004167
4168 // delegate to the framesc-generated code,
4169 switch ( *pFrame )
4170 {
4171 case SIR_MAC_ACTION_QOS_MGMT:
4172 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
4173 break;
4174 case SIR_MAC_ACTION_WME:
4175 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4176 break;
4177 default:
4178 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4179 "with a Category of %d; this is not"
4180 " supported & is probably an error."),
4181 *pFrame );
4182 return eSIR_FAILURE;
4183 }
4184
4185 if ( DOT11F_FAILED( status ) )
4186 {
4187 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
4188 "rame (0x%08x, %d bytes):\n"),
4189 status, nFrame);
4190 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4191 return eSIR_FAILURE;
4192 }
4193 else if ( DOT11F_WARNED( status ) )
4194 {
4195 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4196 "g an Del TS Request frame (0x%08x,"
4197 "%d bytes):\n"),
4198 status, nFrame );
4199 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4200 }
4201
4202 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4203 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4204 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4205 {
4206 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4207 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4208 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4209 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4210 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4211 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4212 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4213 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4214
4215 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4216 }
4217 else
4218 {
4219 if ( wmmdelts.WMMTSPEC.present )
4220 {
4221 pDelTs->wmeTspecPresent = 1;
4222 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4223 }
4224 else
4225 {
4226 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!\n") );
4227 return eSIR_FAILURE;
4228 }
4229 }
4230
4231 return eSIR_SUCCESS;
4232
4233} // End sirConvertDeltsReq2Struct.
4234
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004235tSirRetStatus
4236sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4237 tANI_U8 *pFrame,
4238 tANI_U32 nFrame,
4239 tSirQosMapSet *pQosMapSet)
4240{
4241 tDot11fQosMapConfigure mapConfigure;
4242 tANI_U32 status;
4243 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
4244 if ( DOT11F_FAILED( status ) )
4245 {
4246 dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):\n"),
4247 status, nFrame);
4248 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4249 return eSIR_FAILURE;
4250 }
4251 else if ( DOT11F_WARNED( status ) )
4252 {
4253 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):\n"),
4254 status, nFrame );
4255 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4256 }
4257 pQosMapSet->present = mapConfigure.QosMapSet.present;
4258 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004259 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004260 return eSIR_SUCCESS;
4261}
Jeff Johnson295189b2012-06-20 16:38:30 -07004262
4263#ifdef ANI_SUPPORT_11H
4264tSirRetStatus
4265sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4266 tANI_U8 *pFrame,
4267 tpSirMacTpcReqActionFrame pTpcReqFrame,
4268 tANI_U32 nFrame)
4269{
4270 tDot11fTPCRequest req;
4271 tANI_U32 status;
4272
4273 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304274 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004275
4276 // delegate to the framesc-generated code,
4277 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4278 if ( DOT11F_FAILED( status ) )
4279 {
4280 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):\n"),
4281 status, nFrame);
4282 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4283 return eSIR_FAILURE;
4284 }
4285 else if ( DOT11F_WARNED( status ) )
4286 {
4287 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):\n"),
4288 status, nFrame );
4289 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4290 }
4291
4292 // & "transliterate" from a 'tDot11fTPCRequest' to a
4293 // 'tSirMacTpcReqActionFrame'...
4294 pTpcReqFrame->actionHeader.category = req.Category.category;
4295 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4296 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4297 if ( req.TPCRequest.present )
4298 {
4299 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4300 pTpcReqFrame->length = 0;
4301 }
4302 else
4303 {
4304 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!\n") );
4305 return eSIR_FAILURE;
4306 }
4307
4308 return eSIR_SUCCESS;
4309
4310} // End sirConvertTpcReqFrame2Struct.
4311
4312
4313tSirRetStatus
4314sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4315 tANI_U8 *pFrame,
4316 tpSirMacMeasReqActionFrame pMeasReqFrame,
4317 tANI_U32 nFrame)
4318{
4319 tDot11fMeasurementRequest mr;
4320 tANI_U32 status;
4321
4322 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304323 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004324
4325 // delegate to the framesc-generated code,
4326 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4327 if ( DOT11F_FAILED( status ) )
4328 {
4329 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):\n"),
4330 status, nFrame);
4331 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4332 return eSIR_FAILURE;
4333 }
4334 else if ( DOT11F_WARNED( status ) )
4335 {
4336 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes):\n"),
4337 status, nFrame );
4338 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4339 }
4340
4341 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4342 // 'tpSirMacMeasReqActionFrame'...
4343 pMeasReqFrame->actionHeader.category = mr.Category.category;
4344 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4345 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4346
4347 if ( 0 == mr.num_MeasurementRequest )
4348 {
4349 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.\n") );
4350 return eSIR_FAILURE;
4351 }
4352 else if ( 1 < mr.num_MeasurementRequest )
4353 {
4354 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4355 }
4356
4357 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4358 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4359 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4360 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4361 ( mr.MeasurementRequest[0].enable << 2 ) |
4362 ( mr.MeasurementRequest[0].request << 1 ) |
4363 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4364 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4365
4366 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4367
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304368 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004369 mr.MeasurementRequest[0].meas_start_time, 8 );
4370
4371 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4372
4373 return eSIR_SUCCESS;
4374
4375} // End sirConvertMeasReqFrame2Struct.
4376#endif
4377
4378
4379void
4380PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4381 tDot11fIETSPEC *pDot11f)
4382{
4383 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4384 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4385 pDot11f->direction = pOld->tsinfo.traffic.direction;
4386 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4387 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4388 pDot11f->psb = pOld->tsinfo.traffic.psb;
4389 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4390 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4391 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4392 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4393 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4394 */
4395 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4396 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4397 pDot11f->max_msdu_size = pOld->maxMsduSz;
4398 pDot11f->min_service_int = pOld->minSvcInterval;
4399 pDot11f->max_service_int = pOld->maxSvcInterval;
4400 pDot11f->inactivity_int = pOld->inactInterval;
4401 pDot11f->suspension_int = pOld->suspendInterval;
4402 pDot11f->service_start_time = pOld->svcStartTime;
4403 pDot11f->min_data_rate = pOld->minDataRate;
4404 pDot11f->mean_data_rate = pOld->meanDataRate;
4405 pDot11f->peak_data_rate = pOld->peakDataRate;
4406 pDot11f->burst_size = pOld->maxBurstSz;
4407 pDot11f->delay_bound = pOld->delayBound;
4408 pDot11f->min_phy_rate = pOld->minPhyRate;
4409 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4410 pDot11f->medium_time = pOld->mediumTime;
4411
4412 pDot11f->present = 1;
4413
4414} // End PopulateDot11fTSPEC.
4415
4416void
4417PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4418 tDot11fIEWMMTSPEC *pDot11f)
4419{
4420 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4421 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4422 pDot11f->direction = pOld->tsinfo.traffic.direction;
4423 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4424 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4425 pDot11f->psb = pOld->tsinfo.traffic.psb;
4426 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4427 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4428 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4429 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4430 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4431 */
4432 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4433 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4434 pDot11f->max_msdu_size = pOld->maxMsduSz;
4435 pDot11f->min_service_int = pOld->minSvcInterval;
4436 pDot11f->max_service_int = pOld->maxSvcInterval;
4437 pDot11f->inactivity_int = pOld->inactInterval;
4438 pDot11f->suspension_int = pOld->suspendInterval;
4439 pDot11f->service_start_time = pOld->svcStartTime;
4440 pDot11f->min_data_rate = pOld->minDataRate;
4441 pDot11f->mean_data_rate = pOld->meanDataRate;
4442 pDot11f->peak_data_rate = pOld->peakDataRate;
4443 pDot11f->burst_size = pOld->maxBurstSz;
4444 pDot11f->delay_bound = pOld->delayBound;
4445 pDot11f->min_phy_rate = pOld->minPhyRate;
4446 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4447 pDot11f->medium_time = pOld->mediumTime;
4448
4449 pDot11f->version = 1;
4450 pDot11f->present = 1;
4451
4452} // End PopulateDot11fWMMTSPEC.
4453
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004454#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004455
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004456// Fill the ESE version currently supported
4457void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004458{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004459 pESEVersion->present = 1;
4460 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004461}
4462
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004463// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004464// The State is Normal (1)
4465// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004466void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004467{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004468 pESERadMgmtCap->present = 1;
4469 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4470 pESERadMgmtCap->mbssid_mask = 0;
4471 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004472}
4473
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004474tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004475 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004476 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004477{
4478 int idx;
4479
4480 if ( pCCKMie->length )
4481 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004482 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004483 {
4484 pDot11f->present = 1;
4485 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004486 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004487 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4488 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4489 }
4490 }
4491
4492 return eSIR_SUCCESS;
4493
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004494} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004495
Jeff Johnson295189b2012-06-20 16:38:30 -07004496void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004497 tSirMacESETSRSIE *pOld,
4498 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 tANI_U8 rate_length)
4500{
4501 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304502 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004503 pDot11f->num_tsrates = rate_length;
4504 pDot11f->present = 1;
4505}
4506#endif
4507
4508
4509tSirRetStatus
4510PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4511 tSirTclasInfo *pOld,
4512 tDot11fIETCLAS *pDot11f)
4513{
4514 pDot11f->user_priority = pOld->tclas.userPrio;
4515 pDot11f->classifier_type = pOld->tclas.classifierType;
4516 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4517
4518 switch ( pDot11f->classifier_type )
4519 {
4520 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304521 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4522 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4523 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4524 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4526 break;
4527 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4528 pDot11f->info.IpParams.version = pOld->version;
4529 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4530 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304531 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304532 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304533 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4534 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304535 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304536 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004537 pDot11f->info.IpParams.params.IpV4Params.src_port =
4538 pOld->tclasParams.ipv4.srcPort;
4539 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4540 pOld->tclasParams.ipv4.dstPort;
4541 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4542 pOld->tclasParams.ipv4.dscp;
4543 pDot11f->info.IpParams.params.IpV4Params.proto =
4544 pOld->tclasParams.ipv4.protocol;
4545 pDot11f->info.IpParams.params.IpV4Params.reserved =
4546 pOld->tclasParams.ipv4.rsvd;
4547 }
4548 else
4549 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304550 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004551 IpV6Params.source,
4552 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304553 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 IpV6Params.dest,
4555 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4556 pDot11f->info.IpParams.params.IpV6Params.src_port =
4557 pOld->tclasParams.ipv6.srcPort;
4558 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4559 pOld->tclasParams.ipv6.dstPort;
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.flow_label,
4562 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4563 }
4564 break;
4565 case SIR_MAC_TCLASTYPE_8021DQ:
4566 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4567 break;
4568 default:
4569 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4570 pDot11f->classifier_type );
4571 return eSIR_FAILURE;
4572 }
4573
4574 pDot11f->present = 1;
4575
4576 return eSIR_SUCCESS;
4577
4578} // End PopulateDot11fTCLAS.
4579
4580tSirRetStatus
4581PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4582 tSirTclasInfo *pOld,
4583 tDot11fIEWMMTCLAS *pDot11f)
4584{
4585 pDot11f->version = 1;
4586 pDot11f->user_priority = pOld->tclas.userPrio;
4587 pDot11f->classifier_type = pOld->tclas.classifierType;
4588 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4589
4590 switch ( pDot11f->classifier_type )
4591 {
4592 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304593 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004594 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304595 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4597 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4598 break;
4599 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4600 pDot11f->info.IpParams.version = pOld->version;
4601 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4602 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304603 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 IpV4Params.source,
4605 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304606 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 IpV4Params.dest,
4608 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4609 pDot11f->info.IpParams.params.IpV4Params.src_port =
4610 pOld->tclasParams.ipv4.srcPort;
4611 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4612 pOld->tclasParams.ipv4.dstPort;
4613 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4614 pOld->tclasParams.ipv4.dscp;
4615 pDot11f->info.IpParams.params.IpV4Params.proto =
4616 pOld->tclasParams.ipv4.protocol;
4617 pDot11f->info.IpParams.params.IpV4Params.reserved =
4618 pOld->tclasParams.ipv4.rsvd;
4619 }
4620 else
4621 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304622 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 IpV6Params.source,
4624 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304625 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 IpV6Params.dest,
4627 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4628 pDot11f->info.IpParams.params.IpV6Params.src_port =
4629 pOld->tclasParams.ipv6.srcPort;
4630 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4631 pOld->tclasParams.ipv6.dstPort;
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.flow_label,
4634 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4635 }
4636 break;
4637 case SIR_MAC_TCLASTYPE_8021DQ:
4638 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4639 break;
4640 default:
4641 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS.\n"),
4642 pDot11f->classifier_type );
4643 return eSIR_FAILURE;
4644 }
4645
4646 pDot11f->present = 1;
4647
4648 return eSIR_SUCCESS;
4649
4650} // End PopulateDot11fWMMTCLAS.
4651
Jeff Johnson295189b2012-06-20 16:38:30 -07004652
4653tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4654 tDot11fIEWscBeacon *pDot11f)
4655{
4656
4657 tANI_U32 wpsState;
4658
4659 pDot11f->Version.present = 1;
4660 pDot11f->Version.major = 0x01;
4661 pDot11f->Version.minor = 0x00;
4662
4663 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
4664 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
4665
4666 pDot11f->WPSState.present = 1;
4667 pDot11f->WPSState.state = (tANI_U8) wpsState;
4668
4669 pDot11f->APSetupLocked.present = 0;
4670
4671 pDot11f->SelectedRegistrar.present = 0;
4672
4673 pDot11f->DevicePasswordID.present = 0;
4674
4675 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4676
4677 pDot11f->UUID_E.present = 0;
4678
4679 pDot11f->RFBands.present = 0;
4680
4681 pDot11f->present = 1;
4682 return eSIR_SUCCESS;
4683}
4684
4685tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4686 tDot11fIEWscBeacon *pDot11f)
4687{
4688 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4689 tANI_U32 devicepasswdId;
4690
4691
4692 pDot11f->APSetupLocked.present = 1;
4693 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4694
4695 pDot11f->SelectedRegistrar.present = 1;
4696 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4697
4698 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
4699 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
4700
4701 pDot11f->DevicePasswordID.present = 1;
4702 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4703
4704 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4705 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4706
4707 // UUID_E and RF Bands are applicable only for dual band AP
4708
4709 return eSIR_SUCCESS;
4710}
4711
4712tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4713 tDot11fIEWscBeacon *pDot11f)
4714{
4715 pDot11f->APSetupLocked.present = 0;
4716 pDot11f->SelectedRegistrar.present = 0;
4717 pDot11f->DevicePasswordID.present = 0;
4718 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4719
4720 return eSIR_SUCCESS;
4721}
Jeff Johnson295189b2012-06-20 16:38:30 -07004722tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4723{
4724
4725 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4726
4727 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4728
4729
4730 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4731 {
4732 pDot11f->present = 1;
4733 pDot11f->Version.present = 1;
4734 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4735 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4736 }
4737 else
4738 {
4739 pDot11f->present = 0;
4740 pDot11f->Version.present = 0;
4741 }
4742
4743 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4744 {
4745
4746 pDot11f->WPSState.present = 1;
4747 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4748 }
4749 else
4750 pDot11f->WPSState.present = 0;
4751
4752 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4753 {
4754 pDot11f->APSetupLocked.present = 1;
4755 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4756 }
4757 else
4758 pDot11f->APSetupLocked.present = 0;
4759
4760 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4761 {
4762 pDot11f->SelectedRegistrar.present = 1;
4763 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4764 }
4765 else
4766 pDot11f->SelectedRegistrar.present = 0;
4767
4768 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4769 {
4770 pDot11f->DevicePasswordID.present = 1;
4771 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4772 }
4773 else
4774 pDot11f->DevicePasswordID.present = 0;
4775
4776 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4777 {
4778 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4779 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4780 }
4781 else
4782 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4783
4784 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4785 {
4786 pDot11f->ResponseType.present = 1;
4787 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4788 }
4789 else
4790 pDot11f->ResponseType.present = 0;
4791
4792 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4793 {
4794 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304795 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004796 }
4797 else
4798 pDot11f->UUID_E.present = 0;
4799
4800 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4801 {
4802 pDot11f->Manufacturer.present = 1;
4803 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304804 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4805 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004806 }
4807 else
4808 pDot11f->Manufacturer.present = 0;
4809
4810 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4811 {
4812 pDot11f->ModelName.present = 1;
4813 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304814 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4815 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004816 }
4817 else
4818 pDot11f->ModelName.present = 0;
4819
4820 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4821 {
4822 pDot11f->ModelNumber.present = 1;
4823 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304824 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4825 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004826 }
4827 else
4828 pDot11f->ModelNumber.present = 0;
4829
4830 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4831 {
4832 pDot11f->SerialNumber.present = 1;
4833 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304834 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4835 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004836 }
4837 else
4838 pDot11f->SerialNumber.present = 0;
4839
4840 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4841 {
4842 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304843 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4844 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004845 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4846 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4847 }
4848 else
4849 pDot11f->PrimaryDeviceType.present = 0;
4850
4851 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4852 {
4853 pDot11f->DeviceName.present = 1;
4854 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304855 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4856 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 }
4858 else
4859 pDot11f->DeviceName.present = 0;
4860
4861 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4862 {
4863 pDot11f->ConfigMethods.present = 1;
4864 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4865 }
4866 else
4867 pDot11f->ConfigMethods.present = 0;
4868
4869
4870 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4871 {
4872 pDot11f->RFBands.present = 1;
4873 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4874 }
4875 else
4876 pDot11f->RFBands.present = 0;
4877
4878 return eSIR_SUCCESS;
4879}
4880tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4881{
4882 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4883
4884 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4885
4886 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4887 {
4888 pDot11f->present = 1;
4889 pDot11f->Version.present = 1;
4890 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4891 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4892 }
4893 else
4894 {
4895 pDot11f->present = 0;
4896 pDot11f->Version.present = 0;
4897 }
4898
4899 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4900 {
4901 pDot11f->ResponseType.present = 1;
4902 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4903 }
4904 else
4905 pDot11f->ResponseType.present = 0;
4906
4907 return eSIR_SUCCESS;
4908}
4909
4910tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4911{
4912
4913 tSirWPSBeaconIE *pSirWPSBeaconIE;
4914
4915 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4916
4917
4918 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4919 {
4920 pDot11f->present = 1;
4921 pDot11f->Version.present = 1;
4922 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4923 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4924 }
4925 else
4926 {
4927 pDot11f->present = 0;
4928 pDot11f->Version.present = 0;
4929 }
4930
4931 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4932 {
4933
4934 pDot11f->WPSState.present = 1;
4935 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4936 }
4937 else
4938 pDot11f->WPSState.present = 0;
4939
4940 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4941 {
4942 pDot11f->APSetupLocked.present = 1;
4943 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4944 }
4945 else
4946 pDot11f->APSetupLocked.present = 0;
4947
4948 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4949 {
4950 pDot11f->SelectedRegistrar.present = 1;
4951 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4952 }
4953 else
4954 pDot11f->SelectedRegistrar.present = 0;
4955
4956 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4957 {
4958 pDot11f->DevicePasswordID.present = 1;
4959 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4960 }
4961 else
4962 pDot11f->DevicePasswordID.present = 0;
4963
4964 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4965 {
4966 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4967 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4968 }
4969 else
4970 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4971
4972 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4973 {
4974 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304975 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004976 }
4977 else
4978 pDot11f->UUID_E.present = 0;
4979
4980
4981 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4982 {
4983 pDot11f->RFBands.present = 1;
4984 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4985 }
4986 else
4987 pDot11f->RFBands.present = 0;
4988
4989 return eSIR_SUCCESS;
4990}
Jeff Johnson295189b2012-06-20 16:38:30 -07004991tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4992 tDot11fIEWscProbeRes *pDot11f)
4993{
4994 tANI_U32 cfgMethods;
4995 tANI_U32 cfgStrLen;
4996 tANI_U32 val;
4997 tANI_U32 wpsVersion, wpsState;
4998
4999
5000 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
5001 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_VERSION );
5002
5003 pDot11f->Version.present = 1;
5004 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
5005 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
5006
5007 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
5008 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_STATE );
5009
5010 pDot11f->WPSState.present = 1;
5011 pDot11f->WPSState.state = (tANI_U8) wpsState;
5012
5013 pDot11f->APSetupLocked.present = 0;
5014
5015 pDot11f->SelectedRegistrar.present = 0;
5016
5017 pDot11f->DevicePasswordID.present = 0;
5018
5019 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5020
5021 pDot11f->ResponseType.present = 1;
5022 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
5023 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
5024 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5025 }
5026 else{
5027 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5028 }
5029
5030 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
5031 pDot11f->UUID_E.present = 1;
5032 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
5033 if (wlan_cfgGetStr(pMac,
5034 WNI_CFG_WPS_UUID,
5035 pDot11f->UUID_E.uuid,
5036 &cfgStrLen) != eSIR_SUCCESS)
5037 {
5038 *(pDot11f->UUID_E.uuid) = '\0';
5039 }
5040
5041 pDot11f->Manufacturer.present = 1;
5042 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
5043 if (wlan_cfgGetStr(pMac,
5044 WNI_CFG_MANUFACTURER_NAME,
5045 pDot11f->Manufacturer.name,
5046 &cfgStrLen) != eSIR_SUCCESS)
5047 {
5048 pDot11f->Manufacturer.num_name = 0;
5049 *(pDot11f->Manufacturer.name) = '\0';
5050 }
5051 else
5052 {
5053 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305054 pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005055 }
5056
5057 pDot11f->ModelName.present = 1;
5058 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
5059 if (wlan_cfgGetStr(pMac,
5060 WNI_CFG_MODEL_NAME,
5061 pDot11f->ModelName.text,
5062 &cfgStrLen) != eSIR_SUCCESS)
5063 {
5064 pDot11f->ModelName.num_text = 0;
5065 *(pDot11f->ModelName.text) = '\0';
5066 }
5067 else
5068 {
5069 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305070 pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005071 }
5072
5073 pDot11f->ModelNumber.present = 1;
5074 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
5075 if (wlan_cfgGetStr(pMac,
5076 WNI_CFG_MODEL_NUMBER,
5077 pDot11f->ModelNumber.text,
5078 &cfgStrLen) != eSIR_SUCCESS)
5079 {
5080 pDot11f->ModelNumber.num_text = 0;
5081 *(pDot11f->ModelNumber.text) = '\0';
5082 }
5083 else
5084 {
5085 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305086 pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005087 }
5088
5089 pDot11f->SerialNumber.present = 1;
5090 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
5091 if (wlan_cfgGetStr(pMac,
5092 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
5093 pDot11f->SerialNumber.text,
5094 &cfgStrLen) != eSIR_SUCCESS)
5095 {
5096 pDot11f->SerialNumber.num_text = 0;
5097 *(pDot11f->SerialNumber.text) = '\0';
5098 }
5099 else
5100 {
5101 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305102 pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005103 }
5104
5105 pDot11f->PrimaryDeviceType.present = 1;
5106
5107 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
5108 {
5109 limLog(pMac, LOGP, FL("cfg get prim device category failed\n"));
5110 }
5111 else
5112 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
5113
5114 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
5115 {
5116 limLog(pMac, LOGP, FL("cfg get prim device OUI failed\n"));
5117 }
5118 else
5119 {
5120 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
5121 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
5122 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
5123 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
5124 }
5125
5126 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
5127 {
5128 limLog(pMac, LOGP, FL("cfg get prim device sub category failed\n"));
5129 }
5130 else
5131 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
5132
5133 pDot11f->DeviceName.present = 1;
5134 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
5135 if (wlan_cfgGetStr(pMac,
5136 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
5137 pDot11f->DeviceName.text,
5138 &cfgStrLen) != eSIR_SUCCESS)
5139 {
5140 pDot11f->DeviceName.num_text = 0;
5141 *(pDot11f->DeviceName.text) = '\0';
5142 }
5143 else
5144 {
5145 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305146 pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005147 }
5148
5149 if (wlan_cfgGetInt(pMac,
5150 WNI_CFG_WPS_CFG_METHOD,
5151 &cfgMethods) != eSIR_SUCCESS)
5152 {
5153 pDot11f->ConfigMethods.present = 0;
5154 pDot11f->ConfigMethods.methods = 0;
5155 }
5156 else
5157 {
5158 pDot11f->ConfigMethods.present = 1;
5159 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
5160 }
5161
5162 pDot11f->RFBands.present = 0;
5163
5164 pDot11f->present = 1;
5165 return eSIR_SUCCESS;
5166}
5167
5168tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5169 tDot11fIEWscProbeRes *pDot11f)
5170{
5171 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
5172 tANI_U32 devicepasswdId;
5173
5174 pDot11f->APSetupLocked.present = 1;
5175 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5176
5177 pDot11f->SelectedRegistrar.present = 1;
5178 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5179
5180 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
5181 limLog(pMac, LOGP,"Failed to cfg get id %d\n", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
5182
5183 pDot11f->DevicePasswordID.present = 1;
5184 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5185
5186 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5187 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5188
5189 // UUID_E and RF Bands are applicable only for dual band AP
5190
5191 return eSIR_SUCCESS;
5192}
5193
5194tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5195 tDot11fIEWscProbeRes *pDot11f)
5196{
5197 pDot11f->APSetupLocked.present = 0;
5198 pDot11f->SelectedRegistrar.present = 0;
5199 pDot11f->DevicePasswordID.present = 0;
5200 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5201
5202 return eSIR_SUCCESS;
5203}
5204
5205tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5206 tDot11fIEWscAssocRes *pDot11f,
5207 tpSirAssocReq pRcvdAssocReq)
5208{
5209 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5210 tANI_U8 *wscIe;
5211
5212
5213 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5214 if(wscIe != NULL)
5215 {
5216 // retreive WSC IE from given AssocReq
5217 dot11fUnpackIeWscAssocReq( pMac,
5218 wscIe + 2 + 4, // EID, length, OUI
5219 wscIe[ 1 ] - 4, // length without OUI
5220 &parsedWscAssocReq );
5221 pDot11f->present = 1;
5222 // version has to be 0x10
5223 pDot11f->Version.present = 1;
5224 pDot11f->Version.major = 0x1;
5225 pDot11f->Version.minor = 0x0;
5226
5227 pDot11f->ResponseType.present = 1;
5228
5229 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5230 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5231 {
5232 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5233 }
5234 else
5235 {
5236 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5237 }
5238 // Version infomration should be taken from our capability as well as peers
5239 // TODO: currently it takes from peers only
5240 if(parsedWscAssocReq.VendorExtension.present &&
5241 parsedWscAssocReq.VendorExtension.Version2.present)
5242 {
5243 pDot11f->VendorExtension.present = 1;
5244 pDot11f->VendorExtension.vendorId[0] = 0x00;
5245 pDot11f->VendorExtension.vendorId[1] = 0x37;
5246 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5247 pDot11f->VendorExtension.Version2.present = 1;
5248 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5249 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5250 }
5251 }
5252 return eSIR_SUCCESS;
5253}
5254
Jeff Johnson295189b2012-06-20 16:38:30 -07005255tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5256 tDot11fIEP2PAssocRes *pDot11f,
5257 tpSirAssocReq pRcvdAssocReq)
5258{
5259 tANI_U8 *p2pIe;
5260
5261 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5262 if(p2pIe != NULL)
5263 {
5264 pDot11f->present = 1;
5265 pDot11f->P2PStatus.present = 1;
5266 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5267 pDot11f->ExtendedListenTiming.present = 0;
5268 }
5269 return eSIR_SUCCESS;
5270}
Jeff Johnson295189b2012-06-20 16:38:30 -07005271
5272#if defined WLAN_FEATURE_VOWIFI
5273
5274tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5275 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5276{
5277 pDot11f->txPower = txPower;
5278 pDot11f->linkMargin = linkMargin;
5279 pDot11f->present = 1;
5280
5281 return eSIR_SUCCESS;
5282}
5283
5284tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5285{
5286
5287 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5288 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305289 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5290 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005291 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5292 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5293 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5294 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5295 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305296 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005297 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5298 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5299
5300 if( pBeaconReport->numIes )
5301 {
5302 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305303 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5304 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005305 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5306 }
5307
5308 return eSIR_SUCCESS;
5309
5310}
5311
5312tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5313{
5314 tpRRMCaps pRrmCaps;
5315
5316 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5317
5318 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5319 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5320 pDot11f->parallel = pRrmCaps->parallel ;
5321 pDot11f->repeated = pRrmCaps->repeated ;
5322 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5323 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5324 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5325 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5326 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5327 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5328 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5329 pDot11f->statistics = pRrmCaps->statistics ;
5330 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5331 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5332 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5333 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5334 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5335 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5336 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5337 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5338 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5339 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5340 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5341 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5342 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5343 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5344 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5345 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5346
5347 pDot11f->present = 1;
5348 return eSIR_SUCCESS;
5349}
5350#endif
5351
5352#if defined WLAN_FEATURE_VOWIFI_11R
5353void PopulateMDIE( tpAniSirGlobal pMac,
5354 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5355{
5356 pDot11f->present = 1;
5357 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5358
5359 // Plugfest fix
5360 pDot11f->overDSCap = (mdie[2] & 0x01);
5361 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5362
5363}
5364
5365void PopulateFTInfo( tpAniSirGlobal pMac,
5366 tDot11fIEFTInfo *pDot11f )
5367{
5368 pDot11f->present = 1;
5369 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5370 //All other info is zero.
5371
5372}
5373#endif
5374
5375void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5376 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5377{
5378 tANI_U8 num_supp = 0, num_ext = 0;
5379 tANI_U8 i,j;
5380
5381 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5382 {
5383 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5384 }
5385 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5386 {
5387 if( num_supp < 8 )
5388 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5389 else
5390 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5391 }
5392
5393 if( num_supp )
5394 {
5395 pSupp->num_rates = num_supp;
5396 pSupp->present = 1;
5397 }
5398 if( num_ext )
5399 {
5400 pExt->num_rates = num_ext;
5401 pExt->present = 1;
5402 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005403}
5404
5405void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5406 tDot11fIETimeoutInterval *pDot11f,
5407 tANI_U8 type, tANI_U32 value )
5408{
5409 pDot11f->present = 1;
5410 pDot11f->timeoutType = type;
5411 pDot11f->timeoutValue = value;
5412}
Jeff Johnson295189b2012-06-20 16:38:30 -07005413// parserApi.c ends here.