blob: 3ae3f50ae3ae4689dfdb6b40e301aea8aa99d424 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Sravan Kumar Kairam8bc9e1e2016-01-25 20:50:11 +05302 * Copyright (c) 2012-2016 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{
Sushant Kaushik87787972015-09-11 16:05:00 +0530144 limLog(pMac, LOG1, FL("WMM Parameters Received: "));
145 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700146 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
147
Sushant Kaushik87787972015-09-11 16:05:00 +0530148 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700149 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
150
Sushant Kaushik87787972015-09-11 16:05:00 +0530151 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
153
Sushant Kaushik87787972015-09-11 16:05:00 +0530154 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700155 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 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530207 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation."), 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"
Sushant Kaushik87787972015-09-11 16:05:00 +0530231 "itfield from CFG (%d)."), nSirStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700232 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"
Sushant Kaushik87787972015-09-11 16:05:00 +0530258 "itfield from CFG (%d)."), nSirStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 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 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530352 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting."), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 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{
Abhishek Singh883b5a12015-10-08 12:22:25 +0530370 if (IS_24G_CH(channel))
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 ){
Sravan Kumar Kairam8bc9e1e2016-01-25 20:50:11 +0530444 dot11fLog( pMac, LOG1, FL("11B protection not enabled. Not populating ERP IE %d" ),val );
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 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;
Sachin Ahujac772fd82015-09-08 17:12:19 +0530487 tANI_U8 rates[SIR_MAC_RATESET_EID_MAX];
Jeff Johnson295189b2012-06-20 16:38:30 -0700488
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"
Sushant Kaushik87787972015-09-11 16:05:00 +0530504 " populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 }
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
Sushant Kaushik87787972015-09-11 16:05:00 +0530676 limLog(pMac, LOG1, FL("maxMPDULen (2): %d"), pDot11f->maxMPDULen);
677 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d"), pDot11f->supportedChannelWidthSet);
678 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d"), pDot11f->ldpcCodingCap);
679 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d"), pDot11f->shortGI80MHz);
680 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d"), pDot11f->shortGI160and80plus80MHz);
681 limLog(pMac, LOG1, FL("txSTBC (1): %d"), pDot11f->txSTBC);
682 limLog(pMac, LOG1, FL("rxSTBC (3): %d"), pDot11f->rxSTBC);
683 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d"), pDot11f->suBeamFormerCap);
684 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d"), pDot11f->suBeamformeeCap);
685 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d"), pDot11f->csnofBeamformerAntSup);
686 limLog(pMac, LOG1, FL("numSoundingDim (3): %d"), pDot11f->numSoundingDim);
687 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d"), pDot11f->muBeamformerCap);
688 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d"), pDot11f->muBeamformeeCap);
689 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d"), pDot11f->vhtTXOPPS);
690 limLog(pMac, LOG1, FL("htcVHTCap (1): %d"), pDot11f->htcVHTCap);
691 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d"), pDot11f->maxAMPDULenExp);
692 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d"), pDot11f->vhtLinkAdaptCap);
693 limLog(pMac, LOG1, FL("rxAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
694 limLog(pMac, LOG1, FL("txAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
695 limLog(pMac, LOG1, FL("reserved1 (2): %d"), pDot11f->reserved1);
696 limLog(pMac, LOG1, FL("rxMCSMap (16): %d"), pDot11f->rxMCSMap);
697 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d"), pDot11f->rxHighSupDataRate);
698 limLog(pMac, LOG1, FL("reserve (3): %d"), pDot11f->reserved2);
699 limLog(pMac, LOG1, FL("txMCSMap (16): %d"), pDot11f->txMCSMap);
700 limLog(pMac, LOG1, FL("txSupDataRate (13): %d"), pDot11f->txSupDataRate);
701 limLog(pMac, LOG1, FL("reserv (3): %d"), 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
Sushant Kaushik87787972015-09-11 16:05:00 +0530709 limLog(pMac, LOG1, FL("chanWidth : %d"), pDot11f->chanWidth);
710 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d"), pDot11f->chanCenterFreqSeg1);
711 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d"), pDot11f->chanCenterFreqSeg2);
712 limLog(pMac, LOG1, FL("basicMCSSet: %d"), 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
Sushant Kaushik87787972015-09-11 16:05:00 +0530720 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d"), pDot11f->muMIMOCapStaCount);
721 limLog(pMac, LOG1, FL("ssUnderUtil: %d"), pDot11f->ssUnderUtil);
722 limLog(pMac, LOG1, FL("FortyMHzUtil: %d"), pDot11f->FortyMHzUtil);
723 limLog(pMac, LOG1, FL("EightyMHzUtil: %d"), pDot11f->EightyMHzUtil);
724 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d"), 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
Sushant Kaushik87787972015-09-11 16:05:00 +0530733 limLog(pMac, LOG1, FL("ChanWidth : %d"), pDot11f->chanWidth);
734 limLog(pMac, LOG1, FL("reserved: %d"), pDot11f->reserved);
735 limLog(pMac, LOG1, FL("rxNSS: %d"), pDot11f->rxNSS);
736 limLog(pMac, LOG1, FL("rxNSS Type: %d"), 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;
Agrawal Ashish17228a62015-11-30 12:31:41 +0530743 if (pQosMapSet->num_dscp_exceptions > 21)
744 pQosMapSet->num_dscp_exceptions = 21;
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700745 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
746 pQosMapSet->num_dscp_exceptions);
747 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
748 {
749 limLog(pMac, LOG1, FL("dscp value: %d"),
750 pQosMapSet->dscp_exceptions[i][0]);
751 limLog(pMac, LOG1, FL("User priority value: %d"),
752 pQosMapSet->dscp_exceptions[i][1]);
753 }
754 for (i=0;i<8;i++)
755 {
756 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
757 pQosMapSet->dscp_range[i][0]);
758 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
759 pQosMapSet->dscp_range[i][1]);
760 }
761}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700762
Jeff Johnsone7245742012-09-05 17:12:55 -0700763tSirRetStatus
764PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530765 tDot11fIEVHTCaps *pDot11f,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530766 tANI_U8 nChannelNum,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530767 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700768{
769 tSirRetStatus nStatus;
770 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530771 tAniBool disableMcs9 = eSIR_FALSE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700772
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530773 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530774 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
775 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530776 else
777 disableMcs9 =
778 pMac->roam.configParam.channelBondingMode5GHz?
779 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700780 pDot11f->present = 1;
781
782 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
783 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
784
785 nCfgValue = 0;
786 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
787 nCfgValue );
788 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
789
790 nCfgValue = 0;
791 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
792 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
793
794 nCfgValue = 0;
795 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
796 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
797
798 nCfgValue = 0;
799 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
800 nCfgValue );
801 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
802
Deepthi Gowri0c1e1682015-06-19 12:57:53 +0530803 if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
804 {
805 pDot11f->shortGI80MHz = 0;
806 pDot11f->shortGI160and80plus80MHz = 0;
807 }
808
Jeff Johnsone7245742012-09-05 17:12:55 -0700809 nCfgValue = 0;
810 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
811 pDot11f->txSTBC = (nCfgValue & 0x0001);
812
813 nCfgValue = 0;
814 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
815 pDot11f->rxSTBC = (nCfgValue & 0x0007);
816
817 nCfgValue = 0;
818 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
819 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
820
821 nCfgValue = 0;
822 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
823 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
824
825 nCfgValue = 0;
826 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
827 nCfgValue );
828 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
829
830 nCfgValue = 0;
831 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
832 nCfgValue );
833 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
834
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530835 /* muBeamformerCap should be 0 for non AP and
836 * muBeamformeeCap should be 0 for AP
837 */
838 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
839 {
840 nCfgValue = 0;
841 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
842 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
843 pDot11f->muBeamformeeCap = 0;
844 }
845 else
846 {
847 pDot11f->muBeamformerCap = 0;
848 nCfgValue = 0;
849 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
850 /* Enable only if FW and host both support the MU_MIMO feature
851 */
852 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
853 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700854
855 nCfgValue = 0;
856 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
857 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
858
859 nCfgValue = 0;
860 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
861 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
862
863 nCfgValue = 0;
864 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
865 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
866
867 nCfgValue = 0;
868 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
869 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
870
871 nCfgValue = 0;
872 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
873 pDot11f->rxAntPattern = nCfgValue;
874
875 nCfgValue = 0;
876 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
877 pDot11f->txAntPattern = nCfgValue;
878
879 pDot11f->reserved1= 0;
880
881 nCfgValue = 0;
882 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530883
884 if (eSIR_TRUE == disableMcs9)
885 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700886 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
887
888 nCfgValue = 0;
889 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
890 nCfgValue );
891 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
892
893 pDot11f->reserved2= 0;
894
895 nCfgValue = 0;
896 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530897
898 if (eSIR_TRUE == disableMcs9)
899 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700900 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
901
902 nCfgValue = 0;
903 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
904 nCfgValue );
905 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
906
907 pDot11f->reserved3= 0;
908
909 limLogVHTCap(pMac, pDot11f);
910
911 return eSIR_SUCCESS;
912
913}
914
915tSirRetStatus
916PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530917 tDot11fIEVHTOperation *pDot11f,
918 tANI_U8 nChannelNum)
Jeff Johnsone7245742012-09-05 17:12:55 -0700919{
920 tSirRetStatus nStatus;
921 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530922 tAniBool disableMcs9 = eSIR_FALSE;
923
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530924 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530925 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
926 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530927 else
928 disableMcs9 =
929 pMac->roam.configParam.channelBondingMode5GHz?
930 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700931
932 pDot11f->present = 1;
933
934 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
935 pDot11f->chanWidth = (tANI_U8)nCfgValue;
936
937 nCfgValue = 0;
938 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
939 nCfgValue );
940 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
941
942 nCfgValue = 0;
943 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
944 nCfgValue );
945 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
946
947 nCfgValue = 0;
948 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530949
950 if (eSIR_TRUE == disableMcs9)
951 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700952 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
953
954 limLogVHTOperation(pMac,pDot11f);
955
956 return eSIR_SUCCESS;
957
958}
959
960tSirRetStatus
961PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
962 tDot11fIEVHTExtBssLoad *pDot11f)
963{
964 tSirRetStatus nStatus;
965 tANI_U32 nCfgValue=0;
966
967 pDot11f->present = 1;
968
969 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
970 nCfgValue );
971 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
972
973 nCfgValue = 0;
974 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
975 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
976
977 nCfgValue=0;
978 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
979 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
980
981 nCfgValue=0;
982 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
983 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
984
985 nCfgValue=0;
986 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
987 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
988
989 limLogVHTExtBssLoad(pMac,pDot11f);
990
991 return eSIR_SUCCESS;
992}
993
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530994#ifdef WLAN_FEATURE_AP_HT40_24G
995tSirRetStatus
996PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
997 tDot11fIEOBSSScanParameters *pDot11f,
998 tpPESession psessionEntry)
999{
1000 pDot11f->present = 1;
1001
1002 pDot11f->obssScanPassiveDwell =
1003 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
1004
1005 pDot11f->obssScanActiveDwell =
1006 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
1007
1008 pDot11f->bssChannelWidthTriggerScanInterval =
1009 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
1010
1011 pDot11f->obssScanPassiveTotalPerChannel =
1012 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
1013
1014 pDot11f->obssScanActiveTotalPerChannel =
1015 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
1016
1017 pDot11f->bssWidthChannelTransitionDelayFactor =
1018 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
1019
1020 pDot11f->obssScanActivityThreshold =
1021 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
1022
1023 return eSIR_SUCCESS;
1024}
1025#endif
1026
Mohit Khanna4a70d262012-09-11 16:30:12 -07001027tSirRetStatus
1028PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +05301029 tDot11fIEExtCap *pDot11f,
1030 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -07001031{
Sandeep Puligilla60342762014-01-30 21:05:37 +05301032
Sandeep Puligilla60342762014-01-30 21:05:37 +05301033#ifdef WLAN_FEATURE_11AC
Sushant Kaushikc25b4fc2015-09-16 16:42:34 +05301034 if (psessionEntry->vhtCapability &&
1035 psessionEntry->limSystemRole != eLIM_STA_IN_IBSS_ROLE )
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301036 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301037 pDot11f->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301038 pDot11f->present = 1;
1039 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301040#endif
1041 /* while operating in 2.4GHz only then STA need to advertize
1042 the bss co-ex capability*/
1043 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
1044 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301045#ifdef WLAN_FEATURE_AP_HT40_24G
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301046 if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1047 && pMac->roam.configParam.channelBondingMode24GHz)
1048 || pMac->roam.configParam.apHT40_24GEnabled)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301049#else
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301050 if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1051 && pMac->roam.configParam.channelBondingMode24GHz)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301052#endif
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301053 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301054 pDot11f->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301055 pDot11f->present = 1;
1056 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301057 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07001058 return eSIR_SUCCESS;
1059}
1060
1061tSirRetStatus
1062PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
1063 tDot11fIEOperatingMode *pDot11f,
1064 tpPESession psessionEntry)
1065{
1066 pDot11f->present = 1;
1067
1068 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1069 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1070 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1071
1072 return eSIR_SUCCESS;
1073}
Jeff Johnsone7245742012-09-05 17:12:55 -07001074
1075#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001076tSirRetStatus
1077PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1078 tDot11fIEHTInfo *pDot11f,
1079 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001080{
1081 tANI_U32 nCfgValue, nCfgLen;
1082 tANI_U8 htInfoField1;
1083 tANI_U16 htInfoField2;
1084 tSirRetStatus nSirStatus;
1085 tSirMacHTInfoField1 *pHTInfoField1;
1086 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 union {
1088 tANI_U16 nCfgValue16;
1089 tSirMacHTInfoField3 infoField3;
1090 }uHTInfoField;
1091 union {
1092 tANI_U16 nCfgValue16;
1093 tSirMacHTInfoField2 infoField2;
1094 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001095
Jeff Johnson295189b2012-06-20 16:38:30 -07001096
1097 #if 0
1098 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1099 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301100
1101 if (NULL == psessionEntry)
1102 {
1103 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301104 FL("Invalid session entry in PopulateDot11fHTInfo()"));)
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301105 return eSIR_FAILURE;
1106 }
1107
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1109
1110 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1111
1112 htInfoField1 = ( tANI_U8 ) nCfgValue;
1113
1114 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1116 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1117
Jeff Johnsone7245742012-09-05 17:12:55 -07001118 if (psessionEntry == NULL)
1119 {
1120 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301121 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001122 }
1123 else
1124 {
1125 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1126 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001128
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001129 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1131
1132 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1133
1134 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1135 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1136 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1137
1138 uHTInfoField2.infoField2.reserved = 0;
1139
1140 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1142
1143 htInfoField2 = ( tANI_U16 ) nCfgValue;
1144
1145 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1146 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1147 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1148 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1149
1150 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001151 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001152
1153 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1154
1155
Jeff Johnson295189b2012-06-20 16:38:30 -07001156 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1157
1158
1159 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1160 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1161 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1162 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1163 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1164 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1165 uHTInfoField.infoField3.reserved = 0;
1166
Jeff Johnson295189b2012-06-20 16:38:30 -07001167
1168 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1169 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1170 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1171 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1172 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1173
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1175 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1176 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1177 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1178
Jeff Johnson295189b2012-06-20 16:38:30 -07001179
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1181 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1182 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1183 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1184 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1185 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1186 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1188 pDot11f->basicMCSSet, nCfgLen,
1189 SIZE_OF_BASIC_MCS_SET );
1190
1191 pDot11f->present = 1;
1192
1193 return eSIR_SUCCESS;
1194
1195} // End PopulateDot11fHTInfo.
1196
1197void
1198PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1199 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1200{
1201 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1202 {
1203 pDot11f->present = 1;
1204 // ATIM duration is always set to 0
1205 pDot11f->atim = 0;
1206 }
1207
1208} // End PopulateDot11fIBSSParams.
1209
1210
1211#ifdef ANI_SUPPORT_11H
1212tSirRetStatus
1213PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1214 tpSirMacMeasReqActionFrame pReq,
1215 tDot11fIEMeasurementReport *pDot11f)
1216{
1217 pDot11f->token = pReq->measReqIE.measToken;
1218 pDot11f->late = 0;
1219 pDot11f->incapable = 0;
1220 pDot11f->refused = 1;
1221 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1222
1223 pDot11f->present = 1;
1224
1225 return eSIR_SUCCESS;
1226
1227} // End PopulatedDot11fMeasurementReport0.
1228
1229tSirRetStatus
1230PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1231 tpSirMacMeasReqActionFrame pReq,
1232 tDot11fIEMeasurementReport *pDot11f)
1233{
1234 pDot11f->token = pReq->measReqIE.measToken;
1235 pDot11f->late = 0;
1236 pDot11f->incapable = 0;
1237 pDot11f->refused = 1;
1238 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1239
1240 pDot11f->present = 1;
1241
1242 return eSIR_SUCCESS;
1243
1244} // End PopulatedDot11fMeasurementReport1.
1245
1246tSirRetStatus
1247PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1248 tpSirMacMeasReqActionFrame pReq,
1249 tDot11fIEMeasurementReport *pDot11f)
1250{
1251 pDot11f->token = pReq->measReqIE.measToken;
1252 pDot11f->late = 0;
1253 pDot11f->incapable = 0;
1254 pDot11f->refused = 1;
1255 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1256
1257 pDot11f->present = 1;
1258
1259 return eSIR_SUCCESS;
1260
1261} // End PopulatedDot11fMeasurementReport2.
1262#endif
1263
1264void
1265PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1266 tDot11fIEPowerCaps *pCaps,
1267 tANI_U8 nAssocType,
1268 tpPESession psessionEntry)
1269{
1270 if (nAssocType == LIM_REASSOC)
1271 {
1272 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1273 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1274 }else
1275 {
1276 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1277 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1278
1279 }
1280
1281 pCaps->present = 1;
1282} // End PopulateDot11fPowerCaps.
1283
1284tSirRetStatus
1285PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1286 tDot11fIEPowerConstraints *pDot11f)
1287{
1288 tANI_U32 cfg;
1289 tSirRetStatus nSirStatus;
1290
1291 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1292
1293 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1294 pDot11f->present = 1;
1295
1296 return eSIR_SUCCESS;
1297} // End PopulateDot11fPowerConstraints.
1298
1299void
1300PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1301 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1302{
1303 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1304 pDot11f->reserved = 0;
1305 pDot11f->txopreq = 0;
1306 pDot11f->qreq = 0;
1307 pDot11f->qack = 0;
1308 pDot11f->present = 1;
1309} // End PopulatedDot11fQOSCaps.
1310
1311void
1312PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1313 tDot11fIEQOSCapsStation *pDot11f)
1314{
1315 tANI_U32 val = 0;
1316
1317 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301318 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001319
1320 pDot11f->more_data_ack = 0;
1321 pDot11f->max_sp_length = (tANI_U8)val;
1322 pDot11f->qack = 0;
1323
1324 if (pMac->lim.gUapsdEnable)
1325 {
1326 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1327 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1328 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1329 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1330 }
1331 pDot11f->present = 1;
1332} // End PopulatedDot11fQOSCaps.
1333
1334tSirRetStatus
1335PopulateDot11fRSN(tpAniSirGlobal pMac,
1336 tpSirRSNie pRsnIe,
1337 tDot11fIERSN *pDot11f)
1338{
1339 tANI_U32 status;
1340 int idx;
1341
1342 if ( pRsnIe->length )
1343 {
1344 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1345 {
1346 status = dot11fUnpackIeRSN( pMac,
1347 pRsnIe->rsnIEdata + idx + 2, //EID, length
1348 pRsnIe->rsnIEdata[ idx + 1 ],
1349 pDot11f );
1350 if ( DOT11F_FAILED( status ) )
1351 {
1352 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
Sushant Kaushik87787972015-09-11 16:05:00 +05301353 "N (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 status );
1355 return eSIR_FAILURE;
1356 }
1357 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301358 "PopulateDot11fRSN."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 }
1360
1361 }
1362
1363 return eSIR_SUCCESS;
1364} // End PopulateDot11fRSN.
1365
1366tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1367 tpSirRSNie pRsnIe,
1368 tDot11fIERSNOpaque *pDot11f )
1369{
1370 int idx;
1371
1372 if ( pRsnIe->length )
1373 {
1374 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1375 {
1376 pDot11f->present = 1;
1377 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301378 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 pRsnIe->rsnIEdata + idx + 2, // EID, len
1380 pRsnIe->rsnIEdata[ idx + 1 ] );
1381 }
1382 }
1383
1384 return eSIR_SUCCESS;
1385
1386} // End PopulateDot11fRSNOpaque.
1387
1388
1389
1390#if defined(FEATURE_WLAN_WAPI)
1391
1392tSirRetStatus
1393PopulateDot11fWAPI(tpAniSirGlobal pMac,
1394 tpSirRSNie pRsnIe,
1395 tDot11fIEWAPI *pDot11f)
1396 {
1397 tANI_U32 status;
1398 int idx;
1399
1400 if ( pRsnIe->length )
1401 {
1402 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1403 {
1404 status = dot11fUnpackIeWAPI( pMac,
1405 pRsnIe->rsnIEdata + idx + 2, //EID, length
1406 pRsnIe->rsnIEdata[ idx + 1 ],
1407 pDot11f );
1408 if ( DOT11F_FAILED( status ) )
1409 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301410 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001411 status );
1412 return eSIR_FAILURE;
1413 }
1414 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301415 "PopulateDot11fWAPI."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 }
1417 }
1418
1419 return eSIR_SUCCESS;
1420} // End PopulateDot11fWAPI.
1421
1422tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1423 tpSirRSNie pRsnIe,
1424 tDot11fIEWAPIOpaque *pDot11f )
1425{
1426 int idx;
1427
1428 if ( pRsnIe->length )
1429 {
1430 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1431 {
1432 pDot11f->present = 1;
1433 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301434 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 pRsnIe->rsnIEdata + idx + 2, // EID, len
1436 pRsnIe->rsnIEdata[ idx + 1 ] );
1437 }
1438 }
1439
1440 return eSIR_SUCCESS;
1441
1442} // End PopulateDot11fWAPIOpaque.
1443
1444
1445#endif //defined(FEATURE_WLAN_WAPI)
1446
1447void
1448PopulateDot11fSSID(tpAniSirGlobal pMac,
1449 tSirMacSSid *pInternal,
1450 tDot11fIESSID *pDot11f)
1451{
1452 pDot11f->present = 1;
1453 pDot11f->num_ssid = pInternal->length;
1454 if ( pInternal->length )
1455 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301456 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 pInternal->length );
1458 }
1459} // End PopulateDot11fSSID.
1460
1461tSirRetStatus
1462PopulateDot11fSSID2(tpAniSirGlobal pMac,
1463 tDot11fIESSID *pDot11f)
1464{
1465 tANI_U32 nCfg;
1466 tSirRetStatus nSirStatus;
1467
1468 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1469 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1470 pDot11f->present = 1;
1471 return eSIR_SUCCESS;
1472} // End PopulateDot11fSSID2.
1473
1474void
1475PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1476 tDot11fIESchedule *pDot11f)
1477{
1478 pDot11f->aggregation = pSchedule->info.aggregation;
1479 pDot11f->tsid = pSchedule->info.tsid;
1480 pDot11f->direction = pSchedule->info.direction;
1481 pDot11f->reserved = pSchedule->info.rsvd;
1482 pDot11f->service_start_time = pSchedule->svcStartTime;
1483 pDot11f->service_interval = pSchedule->svcInterval;
1484 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1485 pDot11f->spec_interval = pSchedule->specInterval;
1486
1487 pDot11f->present = 1;
1488} // End PopulateDot11fSchedule.
1489
1490void
1491PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1492 tDot11fIESuppChannels *pDot11f,
1493 tANI_U8 nAssocType,
1494 tpPESession psessionEntry)
1495{
1496 tANI_U8 i;
1497 tANI_U8 *p;
1498
1499 if (nAssocType == LIM_REASSOC)
1500 {
1501 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1502 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1503 }else
1504 {
1505 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1506 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1507 }
1508 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1509 {
1510 pDot11f->bands[i][0] = *p;
1511 pDot11f->bands[i][1] = 1;
1512 }
1513
1514 pDot11f->present = 1;
1515
1516} // End PopulateDot11fSuppChannels.
1517
1518tSirRetStatus
1519PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1520 tANI_U8 nChannelNum,
1521 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1522{
1523 tSirRetStatus nSirStatus;
1524 tANI_U32 nRates;
1525 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1526
1527 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1528 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1529 sending mgmt frames (lile probe req) which need to go out before any session is present.
1530 */
1531 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1532 {
1533 #if 0
1534 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1535 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1536 #endif //TO SUPPORT BT-AMP
1537 if(psessionEntry != NULL)
1538 {
1539 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301540 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001541 nRates);
1542 }
1543 else
1544 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301545 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001546 nRates = 0;
1547 }
1548 }
1549 else if ( 14 >= nChannelNum )
1550 {
1551 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1552 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1553 }
1554 else
1555 {
1556 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1557 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1558 }
1559
1560 if ( 0 != nRates )
1561 {
1562 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301563 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 pDot11f->present = 1;
1565 }
1566
1567 return eSIR_SUCCESS;
1568
1569} // End PopulateDot11fSuppRates.
1570
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301571/**
1572 * PopulateDot11fRatesTdls() - populate supported rates and
1573 * extended supported rates IE.
1574 * @p_mac gloabl - header.
1575 * @p_supp_rates - pointer to supported rates IE
1576 * @p_ext_supp_rates - pointer to extended supported rates IE
1577 *
1578 * This function populates the supported rates and extended supported
1579 * rates IE based in the STA capability. If the number of rates
1580 * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
1581 * IE is populated.
1582 *
1583 * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
1584 * on failure.
1585 */
1586
1587tSirRetStatus
1588PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
1589 tDot11fIESuppRates *p_supp_rates,
Masti, Narayanraddi621299e2015-12-24 14:41:29 +05301590 tDot11fIEExtSuppRates *p_ext_supp_rates,
1591 tANI_U8 curr_oper_channel)
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301592{
1593 tSirMacRateSet temp_rateset;
1594 tSirMacRateSet temp_rateset2;
1595 uint32_t val, i;
1596 uint32_t self_dot11mode = 0;
1597
1598 wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
1599
1600 /**
Masti, Narayanraddi621299e2015-12-24 14:41:29 +05301601 * Include 11b rates only when the device configured
1602 * in auto, 11a/b/g or 11b_only and also if current base
1603 * channel is 5 GHz then no need to advertise the 11b rates.
1604 * If devices to move 2.4GHz off-channel then they can communicate
1605 * in 11g rates i.e. (6, 9, 12, 18, 24, 36 and 54).
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301606 */
Masti, Narayanraddi621299e2015-12-24 14:41:29 +05301607 limLog(p_mac, LOG1, FL("Current operating channel %d self_dot11mode = %d"),
1608 curr_oper_channel, self_dot11mode);
1609
1610 if ((curr_oper_channel <= SIR_11B_CHANNEL_END) &&
1611 ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301612 (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1613 (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
1614 (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
1615 (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
Masti, Narayanraddi621299e2015-12-24 14:41:29 +05301616 (self_dot11mode == WNI_CFG_DOT11_MODE_11B)))
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301617 {
1618 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1619 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
1620 (tANI_U8 *)&temp_rateset.rate, &val);
1621 temp_rateset.numRates = (tANI_U8) val;
1622 }
1623 else
1624 {
1625 temp_rateset.numRates = 0;
1626 }
1627
1628 /* Include 11a rates when the device configured in non-11b mode */
1629 if (!IS_DOT11_MODE_11B(self_dot11mode))
1630 {
1631 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1632 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
1633 (tANI_U8 *)&temp_rateset2.rate, &val);
1634 temp_rateset2.numRates = (tANI_U8) val;
1635 }
1636 else
1637 {
1638 temp_rateset2.numRates = 0;
1639 }
1640
1641 if ((temp_rateset.numRates + temp_rateset2.numRates) >
1642 SIR_MAC_MAX_NUMBER_OF_RATES)
1643 {
1644 limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
1645 SIR_MAC_MAX_NUMBER_OF_RATES);
1646 return eSIR_FAILURE;
1647 }
1648
1649 /**
1650 * copy all rates in temp_rateset,
1651 * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
1652 */
1653 for (i = 0; i < temp_rateset2.numRates; i++)
1654 temp_rateset.rate[i + temp_rateset.numRates] =
1655 temp_rateset2.rate[i];
1656
1657 temp_rateset.numRates += temp_rateset2.numRates;
1658
1659 if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
1660 {
1661 p_supp_rates->num_rates = temp_rateset.numRates;
1662 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1663 p_supp_rates->num_rates);
1664 p_supp_rates->present = 1;
1665 }
1666 else /* Populate extended capability as well */
1667 {
1668 p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
1669 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1670 p_supp_rates->num_rates);
1671 p_supp_rates->present = 1;
1672 p_ext_supp_rates->num_rates = temp_rateset.numRates -
1673 MAX_NUM_SUPPORTED_RATES;
1674 vos_mem_copy(p_ext_supp_rates->rates,
1675 (tANI_U8 *)temp_rateset.rate +
1676 MAX_NUM_SUPPORTED_RATES,
1677 p_ext_supp_rates->num_rates);
1678 p_ext_supp_rates->present = 1;
1679 }
1680
1681 return eSIR_SUCCESS;
1682
1683} /* End PopulateDot11fRatesTdls */
1684
Jeff Johnson295189b2012-06-20 16:38:30 -07001685tSirRetStatus
1686PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1687 tDot11fIETPCReport *pDot11f,
1688 tpPESession psessionEntry)
1689{
1690 tANI_U16 staid, txPower;
1691 tSirRetStatus nSirStatus;
1692
1693 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1694 if ( eSIR_SUCCESS != nSirStatus )
1695 {
1696 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1697 "eDot11fTPCReport; limGetMgmtStaid "
Sushant Kaushik87787972015-09-11 16:05:00 +05301698 "returned status %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 nSirStatus );
1700 return eSIR_FAILURE;
1701 }
1702
1703 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1704 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1705 txPower = 0;
1706 pDot11f->tx_power = ( tANI_U8 )txPower;
1707 pDot11f->link_margin = 0;
1708 pDot11f->present = 1;
1709
1710 return eSIR_SUCCESS;
1711} // End PopulateDot11fTPCReport.
1712
1713
1714void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1715 tDot11fFfTSInfo *pDot11f)
1716{
1717 pDot11f->traffic_type = pInfo->traffic.trafficType;
1718 pDot11f->tsid = pInfo->traffic.tsid;
1719 pDot11f->direction = pInfo->traffic.direction;
1720 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1721 pDot11f->aggregation = pInfo->traffic.aggregation;
1722 pDot11f->psb = pInfo->traffic.psb;
1723 pDot11f->user_priority = pInfo->traffic.userPrio;
1724 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1725 pDot11f->schedule = pInfo->schedule.schedule;
1726} // End PopulatedDot11fTSInfo.
1727
1728void PopulateDot11fWMM(tpAniSirGlobal pMac,
1729 tDot11fIEWMMInfoAp *pInfo,
1730 tDot11fIEWMMParams *pParams,
1731 tDot11fIEWMMCaps *pCaps,
1732 tpPESession psessionEntry)
1733{
1734 if ( psessionEntry->limWmeEnabled )
1735 {
1736 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1737 {
1738 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1739 {
1740 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1741 }
1742 }
1743 else
1744 {
1745 {
1746 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1747 }
1748
1749 if ( psessionEntry->limWsmEnabled )
1750 {
1751 PopulateDot11fWMMCaps( pCaps );
1752 }
1753 }
1754 }
1755} // End PopulateDot11fWMM.
1756
1757void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1758{
1759 pCaps->version = SIR_MAC_OUI_VERSION_1;
1760 pCaps->qack = 0;
1761 pCaps->queue_request = 1;
1762 pCaps->txop_request = 0;
1763 pCaps->more_ack = 0;
1764 pCaps->present = 1;
1765} // End PopulateDot11fWmmCaps.
1766
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001767#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001768void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1769{
1770 tANI_U8 numTspecs = 0, idx;
1771 tTspecInfo *pTspec = NULL;
1772
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001773 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1774 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 pReassoc->num_WMMTSPEC = numTspecs;
1776 if (numTspecs) {
1777 for (idx=0; idx<numTspecs; idx++) {
1778 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301779 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001780 pTspec++;
1781 }
1782 }
1783}
1784#endif
1785
1786void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1787 tpPESession psessionEntry)
1788{
1789 pInfo->version = SIR_MAC_OUI_VERSION_1;
1790
1791 /* WMM Specification 3.1.3, 3.2.3
1792 * An IBSS staion shall always use its default WMM parameters.
1793 */
1794 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1795 {
1796 pInfo->param_set_count = 0;
1797 pInfo->uapsd = 0;
1798 }
1799 else
1800 {
1801 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001802 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1803 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1804 }
1805 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1807 }
1808 pInfo->present = 1;
1809}
1810
1811void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1812{
1813 tANI_U32 val = 0;
1814
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301815 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001816 pInfo->version = SIR_MAC_OUI_VERSION_1;
1817 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1818 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1819 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1820 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1821
1822 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301823 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001824 pInfo->max_sp_length = (tANI_U8)val;
1825 pInfo->present = 1;
1826}
1827
Jeff Johnson295189b2012-06-20 16:38:30 -07001828void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1829 tDot11fIEWMMParams *pParams,
1830 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001831{
1832 pParams->version = SIR_MAC_OUI_VERSION_1;
1833
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1835 pParams->qosInfo =
1836 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1837 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 pParams->qosInfo =
1839 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1840
1841 // Fill each EDCA parameter set in order: be, bk, vi, vo
1842 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1843 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1844 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1845 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1846 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1847 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1848
1849 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1850 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1851 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1852 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1853 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1854 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1855
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1857 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1858 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1860
1861
1862
1863 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1864 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1865 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1866 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1867 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1868
Jeff Johnson295189b2012-06-20 16:38:30 -07001869 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1870 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1871 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1873
1874 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1875 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1876 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1877 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1878 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1879
1880 pParams->present = 1;
1881
1882} // End PopulateDot11fWMMParams.
1883
1884void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1885 tDot11fIEWMMSchedule *pDot11f)
1886{
1887 pDot11f->version = 1;
1888 pDot11f->aggregation = pSchedule->info.aggregation;
1889 pDot11f->tsid = pSchedule->info.tsid;
1890 pDot11f->direction = pSchedule->info.direction;
1891 pDot11f->reserved = pSchedule->info.rsvd;
1892 pDot11f->service_start_time = pSchedule->svcStartTime;
1893 pDot11f->service_interval = pSchedule->svcInterval;
1894 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1895 pDot11f->spec_interval = pSchedule->specInterval;
1896
1897 pDot11f->present = 1;
1898} // End PopulateDot11fWMMSchedule.
1899
1900tSirRetStatus
1901PopulateDot11fWPA(tpAniSirGlobal pMac,
1902 tpSirRSNie pRsnIe,
1903 tDot11fIEWPA *pDot11f)
1904{
1905 tANI_U32 status;
1906 int idx;
1907
1908 if ( pRsnIe->length )
1909 {
1910 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1911 {
1912 status = dot11fUnpackIeWPA( pMac,
1913 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1914 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1915 pDot11f );
1916 if ( DOT11F_FAILED( status ) )
1917 {
1918 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
Sushant Kaushik87787972015-09-11 16:05:00 +05301919 "A (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 status );
1921 return eSIR_FAILURE;
1922 }
1923 }
1924 }
1925
1926 return eSIR_SUCCESS;
1927} // End PopulateDot11fWPA.
1928
1929
1930
1931tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1932 tpSirRSNie pRsnIe,
1933 tDot11fIEWPAOpaque *pDot11f )
1934{
1935 int idx;
1936
1937 if ( pRsnIe->length )
1938 {
1939 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1940 {
1941 pDot11f->present = 1;
1942 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301943 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1945 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1946 }
1947 }
1948
1949 return eSIR_SUCCESS;
1950
1951} // End PopulateDot11fWPAOpaque.
1952
1953////////////////////////////////////////////////////////////////////////
1954
1955tSirRetStatus
1956sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1957{
1958#if 0
1959 tANI_U32 val;
1960
1961 *caps = 0;
1962 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1963 != eSIR_SUCCESS)
1964 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301965 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 return eSIR_FAILURE;
1967 }
1968 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1969 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301970 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001971 return eSIR_FAILURE;
1972 }
1973
1974 *caps = (tANI_U16) val;
1975#endif
1976 return eSIR_SUCCESS;
1977}
1978
1979tSirRetStatus
1980sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1981 tANI_U8 *pFrame,
1982 tANI_U32 nFrame,
1983 tpSirProbeReq pProbeReq)
1984{
1985 tANI_U32 status;
1986 tDot11fProbeRequest pr;
1987
1988 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301989 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001990
1991 // delegate to the framesc-generated code,
1992 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1993 if ( DOT11F_FAILED( status ) )
1994 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301995 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 status, nFrame);
1997 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1998 return eSIR_FAILURE;
1999 }
2000 else if ( DOT11F_WARNED( status ) )
2001 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302002 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 status, nFrame );
2004 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2005 }
2006
2007 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
2008 if ( ! pr.SSID.present )
2009 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302010 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002011 }
2012 else
2013 {
2014 pProbeReq->ssidPresent = 1;
2015 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
2016 }
2017
2018 if ( ! pr.SuppRates.present )
2019 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302020 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002021 return eSIR_FAILURE;
2022 }
2023 else
2024 {
2025 pProbeReq->suppRatesPresent = 1;
2026 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
2027 }
2028
2029 if ( pr.ExtSuppRates.present )
2030 {
2031 pProbeReq->extendedRatesPresent = 1;
2032 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
2033 }
2034
2035 if ( pr.HTCaps.present )
2036 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302037 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002038 }
2039
2040 if ( pr.WscProbeReq.present )
2041 {
2042 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05302043 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002045#ifdef WLAN_FEATURE_11AC
2046 if ( pr.VHTCaps.present )
2047 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302048 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002049 }
2050#endif
2051
Jeff Johnson295189b2012-06-20 16:38:30 -07002052
2053 if ( pr.P2PProbeReq.present )
2054 {
2055 pProbeReq->p2pIePresent = 1;
2056 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002057
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 return eSIR_SUCCESS;
2059
2060} // End sirConvertProbeReqFrame2Struct.
2061
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302062/* function ValidateAndRectifyIEs checks for the malformed frame.
2063 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302064 * (Tagged elements).
2065 * Every Tagged IE has tag number, tag length and data. Tag length indicates
2066 * the size of data in bytes.
2067 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302068 * And also rectifies missing optional fields in IE.
2069 *
2070 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
2071 * extended to rectify other optional fields in other IEs.
2072 *
2073 */
2074tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
2075 tANI_U8 *pMgmtFrame,
2076 tANI_U32 nFrameBytes,
2077 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302078{
2079 tANI_U32 length = SIZE_OF_FIXED_PARAM;
2080 tANI_U8 *refFrame;
2081
2082 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302083 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302084 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302085 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302086 {
2087 /*refFrame points to next IE */
2088 refFrame = pMgmtFrame + length;
2089 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
2090 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
2091 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302092 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302093 {
2094 /* Workaround : Some APs may not include RSN Capability but
2095 * the length of which is included in RSN IE length.
2096 * this may cause in updating RSN Capability with junk value.
2097 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302098 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302099 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302100 if ((*refFrame == RSNIEID) &&
2101 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302102 {
2103 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302104 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302105 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302106 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302107 limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05302108 FL("Added RSN Capability to the RSNIE as 0x00 0x00"));
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302109
2110 return eHAL_STATUS_SUCCESS;
Hu Wang3e5c9742016-03-04 10:34:24 +08002111 } else {
2112 /* Workaround: Some APs may add extra 0x00 padding after IEs.
2113 * Return true to allow these probe response frames proceed.
2114 */
2115 if (nFrameBytes - length > 0) {
2116 tANI_U32 i;
2117 tANI_BOOLEAN zero_padding = VOS_TRUE;
2118
2119 for (i = length; i < nFrameBytes; i ++) {
2120 if (pMgmtFrame[i-1] != 0x0) {
2121 zero_padding = VOS_FALSE;
2122 break;
2123 }
2124 }
2125
2126 if (zero_padding) {
2127 return eHAL_STATUS_SUCCESS;
2128 }
2129 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302130 }
Hu Wang3e5c9742016-03-04 10:34:24 +08002131
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302132 return eSIR_FAILURE;
2133 }
2134 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302135 return eHAL_STATUS_SUCCESS;
2136}
2137
Jeff Johnson295189b2012-06-20 16:38:30 -07002138tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
2139 tANI_U8 *pFrame,
2140 tANI_U32 nFrame,
2141 tpSirProbeRespBeacon pProbeResp)
2142{
2143 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002144 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002145
2146 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302147 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
Abhishek Singhc75726d2015-04-13 14:44:14 +05302149 pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302150 if ( NULL == pr )
2151 status = eHAL_STATUS_FAILURE;
2152 else
2153 status = eHAL_STATUS_SUCCESS;
2154 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07002155 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302156 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002157 return eSIR_FAILURE;
2158 }
2159
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302160 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002161
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002163 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 if ( DOT11F_FAILED( status ) )
2165 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302166 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 status, nFrame);
2168 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05302169 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 return eSIR_FAILURE;
2171 }
2172 else if ( DOT11F_WARNED( status ) )
2173 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302174 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 status, nFrame );
2176 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2177 }
2178
2179 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
2180
2181 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302182 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
2183 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002184
2185 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07002186 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002187
2188 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07002189 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
2190 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
2191 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
2192 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
2193 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
2194 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
2195 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
2196 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
2197 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
2198 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
2199 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2200 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2201 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2202 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2203 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2204 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002205
Jeff Johnson32d95a32012-09-10 13:15:23 -07002206 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302208 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 }
2210 else
2211 {
2212 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002213 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 }
2215
Jeff Johnson32d95a32012-09-10 13:15:23 -07002216 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302218 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 }
2220 else
2221 {
2222 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002223 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 }
2225
Jeff Johnson32d95a32012-09-10 13:15:23 -07002226 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 {
2228 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002229 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 }
2231
2232
Jeff Johnson32d95a32012-09-10 13:15:23 -07002233 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 {
2235 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002236 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 }
2238
Jeff Johnson32d95a32012-09-10 13:15:23 -07002239 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 {
2241 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002242 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 }
2244
Jeff Johnson32d95a32012-09-10 13:15:23 -07002245 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 {
2247 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002248 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 }
2250
Jeff Johnson32d95a32012-09-10 13:15:23 -07002251 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 {
2253 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302254 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 sizeof(tDot11fIEExtChanSwitchAnn) );
2256 }
2257
Jeff Johnson32d95a32012-09-10 13:15:23 -07002258 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 {
2260 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302261 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 sizeof(tDot11fIEExtChanSwitchAnn) );
2263 }
2264
Jeff Johnson32d95a32012-09-10 13:15:23 -07002265 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 {
2267 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302268 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 }
2270
Jeff Johnson32d95a32012-09-10 13:15:23 -07002271 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 {
2273 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302274 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2275 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 }
2277
Jeff Johnson32d95a32012-09-10 13:15:23 -07002278 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 {
2280 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302281 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 }
2283
Jeff Johnson32d95a32012-09-10 13:15:23 -07002284 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302286 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 }
2288
Jeff Johnson32d95a32012-09-10 13:15:23 -07002289 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302291 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 }
2293
Jeff Johnson32d95a32012-09-10 13:15:23 -07002294 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 {
2296 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002297 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002299 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002301 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 }
2303
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002304 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 {
2306 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002307 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 }
2309
Jeff Johnson32d95a32012-09-10 13:15:23 -07002310 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002311 {
2312 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002313 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002314 }
2315
Jeff Johnson32d95a32012-09-10 13:15:23 -07002316 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 {
2318 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002319 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05302320 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002321 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 }
2323
Jeff Johnson32d95a32012-09-10 13:15:23 -07002324 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 {
2326 pProbeResp->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05302327 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 }
2329
Jeff Johnson32d95a32012-09-10 13:15:23 -07002330 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 {
2332 pProbeResp->wsmCapablePresent = 1;
2333 }
2334
2335
Jeff Johnson32d95a32012-09-10 13:15:23 -07002336 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 {
2338 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002339 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002340 }
2341
2342#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002343 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002344 {
2345 // MobilityDomain
2346 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302347 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2348 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002349 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002350#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Sushant Kaushik87787972015-09-11 16:05:00 +05302351 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2353#endif
2354 }
2355#endif
2356
Kapil Guptab3a981b2016-06-26 13:36:51 +05302357#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
Jeff Johnson32d95a32012-09-10 13:15:23 -07002358 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302360 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 }
2362#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002363 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302365 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002366 sizeof(tDot11fIEP2PProbeRes) );
2367 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002368#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002369 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002370 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302371 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002372 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002373 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002374 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302375 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002376 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002377 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002378 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302379 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002380 }
2381#endif
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302382
Abhishek Singhc75726d2015-04-13 14:44:14 +05302383 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002384 return eSIR_SUCCESS;
2385
2386} // End sirConvertProbeFrame2Struct.
2387
2388tSirRetStatus
2389sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2390 tANI_U8 *pFrame,
2391 tANI_U32 nFrame,
2392 tpSirAssocReq pAssocReq)
2393{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002394 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 tANI_U32 status;
2396
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302397 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2398 if ( NULL == ar )
2399 status = eHAL_STATUS_FAILURE;
2400 else
2401 status = eHAL_STATUS_SUCCESS;
2402 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002403 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302404 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002405 return eSIR_FAILURE;
2406 }
2407 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302408 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2409 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002410
2411 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002412 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002413 if ( DOT11F_FAILED( status ) )
2414 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302415 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 status, nFrame);
2417 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302418 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002419 return eSIR_FAILURE;
2420 }
2421 else if ( DOT11F_WARNED( status ) )
2422 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302423 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 status, nFrame );
2425 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2426 }
2427
2428 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2429
2430 // make sure this is seen as an assoc request
2431 pAssocReq->reassocRequest = 0;
2432
2433 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002434 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2435 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2436 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2437 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2438 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2439 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2440 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2441 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2442 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2443 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2444 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2445 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2446 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2447 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2448 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2449 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002450
2451 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002452 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002453
2454 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002455 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002456 {
2457 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002458 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 }
2460
2461 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002462 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002463 {
2464 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002465 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 }
2467
2468 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002469 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 {
2471 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002472 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002473 }
2474
2475 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002476 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 {
2478 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002479 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 }
2481
2482 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002483 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002484 {
2485 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002486 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002487 }
2488
2489 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002490 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002491 {
2492 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002493 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 }
2495
2496 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002497 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 {
2499 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002500 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 }
2502
2503
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002504 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 {
2506 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002507 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002509#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002510 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002511 {
2512 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002513 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002514 }
2515#endif
2516
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002518 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002519 {
2520 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002521 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002522 }
2523
2524 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002525 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002526 {
2527 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002528 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 }
2530
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002531 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002532 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302533 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002534 }
2535
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002536 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002537 {
2538 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302539 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2540 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002541
2542 }
2543
2544
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002545 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002546
2547 if ( ! pAssocReq->ssidPresent )
2548 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302549 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302550 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002551 return eSIR_FAILURE;
2552 }
2553
2554 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2555 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302556 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302557 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 return eSIR_FAILURE;
2559 }
2560
Jeff Johnsone7245742012-09-05 17:12:55 -07002561#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002562 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002563 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302564 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302565 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002566 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2567 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002568 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002569 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302570 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Sushant Kaushik87787972015-09-11 16:05:00 +05302571 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002572 limLogOperatingMode( pMac, &pAssocReq->operMode);
2573 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002574#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302575 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002576 return eSIR_SUCCESS;
2577
2578} // End sirConvertAssocReqFrame2Struct.
2579
2580tSirRetStatus
2581sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2582 tANI_U8 *pFrame,
2583 tANI_U32 nFrame,
2584 tpSirAssocRsp pAssocRsp)
2585{
2586 static tDot11fAssocResponse ar;
2587 tANI_U32 status;
2588 tANI_U8 cnt =0;
2589
2590 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302591 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002592
2593 // delegate to the framesc-generated code,
2594 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2595 if ( DOT11F_FAILED( status ) )
2596 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302597 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002598 status, nFrame);
2599 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2600 return eSIR_FAILURE;
2601 }
2602 else if ( DOT11F_WARNED( status ) )
2603 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302604 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 status, nFrame );
2606 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2607 }
2608
2609 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2610
2611 // Capabilities
2612 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2613 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2614 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2615 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2616 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2617 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2618 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2619 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2620 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2621 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2622 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2623 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2624 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2625 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2626 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2627 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2628
2629 pAssocRsp->statusCode = ar.Status.status;
2630 pAssocRsp->aid = ar.AID.associd;
2631
2632 if ( ! ar.SuppRates.present )
2633 {
2634 pAssocRsp->suppRatesPresent = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302635 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002636 }
2637 else
2638 {
2639 pAssocRsp->suppRatesPresent = 1;
2640 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2641 }
2642
2643 if ( ar.ExtSuppRates.present )
2644 {
2645 pAssocRsp->extendedRatesPresent = 1;
2646 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2647 }
2648
2649 if ( ar.EDCAParamSet.present )
2650 {
2651 pAssocRsp->edcaPresent = 1;
2652 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2653 }
Atul Mittalbceb4a12014-11-27 18:50:19 +05302654 if (ar.ExtCap.present)
2655 {
2656 vos_mem_copy(&pAssocRsp->ExtCap, &ar.ExtCap, sizeof(tDot11fIEExtCap));
2657 limLog(pMac, LOG1,
2658 FL("ExtCap is present, TDLSChanSwitProhibited: %d"),
2659 ar.ExtCap.TDLSChanSwitProhibited);
2660 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 if ( ar.WMMParams.present )
2662 {
2663 pAssocRsp->wmeEdcaPresent = 1;
2664 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002665 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 __printWMMParams(pMac, &ar.WMMParams);
2667 }
2668
2669 if ( ar.HTCaps.present )
2670 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302671 limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302672 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002673 }
2674
2675 if ( ar.HTInfo.present )
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302676 { limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302677 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002678 }
2679
2680#ifdef WLAN_FEATURE_VOWIFI_11R
2681 if (ar.MobilityDomain.present)
2682 {
2683 // MobilityDomain
2684 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302685 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2686 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2688#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002689 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2691#endif
2692 }
2693
2694 if ( ar.FTInfo.present )
2695 {
2696#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002697 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 -07002698 ar.FTInfo.R0KH_ID.present,
2699 ar.FTInfo.R1KH_ID.present);
2700#endif
2701 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302702 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 }
2704#endif
2705
2706#ifdef WLAN_FEATURE_VOWIFI_11R
2707 if (ar.num_RICDataDesc) {
2708 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2709 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302710 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2711 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 }
2713 }
2714 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2715 pAssocRsp->ricPresent = TRUE;
2716 }
2717#endif
2718
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002719#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002720 if (ar.num_WMMTSPEC) {
2721 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2722 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302723 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2724 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002725 }
2726 pAssocRsp->tspecPresent = TRUE;
2727 }
2728
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002729 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002730 {
2731 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302732 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002733 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 }
2735#endif
2736
Jeff Johnsone7245742012-09-05 17:12:55 -07002737#ifdef WLAN_FEATURE_11AC
2738 if ( ar.VHTCaps.present )
2739 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302740 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002741 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002742 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2743 }
2744 if ( ar.VHTOperation.present )
2745 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302746 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002747 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002748 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2749 }
2750#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302751 if(ar.OBSSScanParameters.present)
2752 {
2753 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2754 sizeof( tDot11fIEOBSSScanParameters));
2755 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002756 if ( ar.QosMapSet.present )
2757 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002758 pAssocRsp->QosMapSet.present = 1;
2759 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002760 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002761 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002762 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002764} // End sirConvertAssocRespFrame2Struct.
2765
2766tSirRetStatus
2767sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2768 tANI_U8 *pFrame,
2769 tANI_U32 nFrame,
2770 tpSirAssocReq pAssocReq)
2771{
2772 static tDot11fReAssocRequest ar;
2773 tANI_U32 status;
2774
2775 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302776 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002777
2778 // delegate to the framesc-generated code,
2779 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2780 if ( DOT11F_FAILED( status ) )
2781 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302782 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002783 status, nFrame);
2784 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2785 return eSIR_FAILURE;
2786 }
2787 else if ( DOT11F_WARNED( status ) )
2788 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302789 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002790 status, nFrame );
2791 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2792 }
2793
2794 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2795
2796 // make sure this is seen as a re-assoc request
2797 pAssocReq->reassocRequest = 1;
2798
2799 // Capabilities
2800 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2801 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2802 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2803 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2804 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2805 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2806 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2807 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2808 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2809 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2810 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2811 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2812 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2813 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2814 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2815 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2816
2817 // Listen Interval
2818 pAssocReq->listenInterval = ar.ListenInterval.interval;
2819
2820 // SSID
2821 if ( ar.SSID.present )
2822 {
2823 pAssocReq->ssidPresent = 1;
2824 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2825 }
2826
2827 // Supported Rates
2828 if ( ar.SuppRates.present )
2829 {
2830 pAssocReq->suppRatesPresent = 1;
2831 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2832 }
2833
2834 // Extended Supported Rates
2835 if ( ar.ExtSuppRates.present )
2836 {
2837 pAssocReq->extendedRatesPresent = 1;
2838 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2839 &ar.ExtSuppRates );
2840 }
2841
2842 // QOS Capabilities:
2843 if ( ar.QOSCapsStation.present )
2844 {
2845 pAssocReq->qosCapabilityPresent = 1;
2846 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2847 }
2848
2849 // WPA
2850 if ( ar.WPAOpaque.present )
2851 {
2852 pAssocReq->wpaPresent = 1;
2853 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2854 }
2855
2856 // RSN
2857 if ( ar.RSNOpaque.present )
2858 {
2859 pAssocReq->rsnPresent = 1;
2860 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2861 }
2862
2863
2864 // Power Capabilities
2865 if ( ar.PowerCaps.present )
2866 {
2867 pAssocReq->powerCapabilityPresent = 1;
2868 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2869 }
2870
2871 // Supported Channels
2872 if ( ar.SuppChannels.present )
2873 {
2874 pAssocReq->supportedChannelsPresent = 1;
2875 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2876 }
2877
2878 if ( ar.HTCaps.present )
2879 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302880 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 }
2882
2883 if ( ar.WMMInfoStation.present )
2884 {
2885 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302886 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2887 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002888
2889 }
2890
2891 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2892
2893 if ( ! pAssocReq->ssidPresent )
2894 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302895 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002896 return eSIR_FAILURE;
2897 }
2898
2899 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2900 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302901 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002902 return eSIR_FAILURE;
2903 }
2904
2905 // Why no call to 'updateAssocReqFromPropCapability' here, like
2906 // there is in 'sirConvertAssocReqFrame2Struct'?
2907
2908 // WSC IE
2909 if (ar.WscIEOpaque.present)
2910 {
2911 pAssocReq->addIEPresent = 1;
2912 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2913 }
2914
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 if(ar.P2PIEOpaque.present)
2916 {
2917 pAssocReq->addIEPresent = 1;
2918 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2919 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002920
Jeff Johnsone7245742012-09-05 17:12:55 -07002921#ifdef WLAN_FEATURE_WFD
2922 if(ar.WFDIEOpaque.present)
2923 {
2924 pAssocReq->addIEPresent = 1;
2925 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2926 }
2927#endif
2928
2929#ifdef WLAN_FEATURE_11AC
2930 if ( ar.VHTCaps.present )
2931 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302932 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002933 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002934 if ( ar.OperatingMode.present )
2935 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302936 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302937 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002938 limLogOperatingMode( pMac, &pAssocReq->operMode);
2939 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002940#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 return eSIR_SUCCESS;
2942
2943} // End sirConvertReassocReqFrame2Struct.
2944
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002945
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002946#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002947tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002948sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002949 tANI_U8 *pPayload,
2950 const tANI_U32 nPayload,
2951 tANI_U8 **outIeBuf,
2952 tANI_U32 *pOutIeLen)
2953{
2954 tDot11fBeaconIEs *pBies = NULL;
2955 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002956 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002957 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002958
2959 /* To store how many bytes are required to be allocated
2960 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002961 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002962 tANI_U8 *pos = NULL;
2963
2964 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002965 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002966 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2967 if ( NULL == pBies )
2968 status = eHAL_STATUS_FAILURE;
2969 else
2970 status = eHAL_STATUS_SUCCESS;
2971 if (!HAL_STATUS_SUCCESS(status))
2972 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302973 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002974 return eSIR_FAILURE;
2975 }
2976 // delegate to the framesc-generated code,
2977 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2978
2979 if ( DOT11F_FAILED( status ) )
2980 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302981 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002982 status, nPayload);
2983 vos_mem_free(pBies);
2984 return eSIR_FAILURE;
2985 }
2986 else if ( DOT11F_WARNED( status ) )
2987 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302988 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002989 status, nPayload );
2990 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2991 }
2992
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002993 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002994 if ( !pBies->SSID.present )
2995 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302996 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002997 }
2998 else
2999 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003000 eseBcnReportMandatoryIe.ssidPresent = 1;
3001 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003002 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003003 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003004 }
3005
3006 if ( !pBies->SuppRates.present )
3007 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303008 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003009 }
3010 else
3011 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003012 eseBcnReportMandatoryIe.suppRatesPresent = 1;
3013 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
3014 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003015 }
3016
3017 if ( pBies->FHParamSet.present)
3018 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003019 eseBcnReportMandatoryIe.fhParamPresent = 1;
3020 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003021 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
3022 }
3023
3024 if ( pBies->DSParams.present )
3025 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003026 eseBcnReportMandatoryIe.dsParamsPresent = 1;
3027 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003028 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
3029 }
3030
3031 if ( pBies->CFParams.present )
3032 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003033 eseBcnReportMandatoryIe.cfPresent = 1;
3034 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003035 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
3036 }
3037
3038 if ( pBies->IBSSParams.present )
3039 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003040 eseBcnReportMandatoryIe.ibssParamPresent = 1;
3041 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003042 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3043 }
3044
3045 if ( pBies->TIM.present )
3046 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003047 eseBcnReportMandatoryIe.timPresent = 1;
3048 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
3049 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
3050 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
3051 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003052 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
3053 }
3054
3055 if ( pBies->RRMEnabledCap.present )
3056 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003057 eseBcnReportMandatoryIe.rrmPresent = 1;
3058 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003059 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3060 }
3061
3062 *outIeBuf = vos_mem_malloc(numBytes);
3063 if (NULL == *outIeBuf)
3064 {
3065 limLog(pMac, LOGP, FL("Memory Allocation failure"));
3066 vos_mem_free(pBies);
3067 return eSIR_FAILURE;
3068 }
3069 pos = *outIeBuf;
3070 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003071 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003072
3073 /* Start filling the output Ie with Mandatory IE information */
3074 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003075 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003076 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003077 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003078 {
3079 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
3080 retStatus = eSIR_FAILURE;
3081 goto err_bcnrep;
3082 }
3083 *pos = SIR_MAC_SSID_EID;
3084 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003085 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003086 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003087 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
3088 eseBcnReportMandatoryIe.ssId.length);
3089 pos += eseBcnReportMandatoryIe.ssId.length;
3090 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003091 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003092
3093 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003094 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003095 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003096 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003097 {
3098 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
3099 retStatus = eSIR_FAILURE;
3100 goto err_bcnrep;
3101 }
Hanumantha Reddy Pothulada389492016-02-11 17:29:27 +05303102 if (eseBcnReportMandatoryIe.supportedRates.numRates <=
3103 SIR_MAC_RATESET_EID_MAX) {
3104 *pos = SIR_MAC_RATESET_EID;
3105 pos++;
3106 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
3107 pos++;
3108 vos_mem_copy(pos,
3109 (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
3110 eseBcnReportMandatoryIe.supportedRates.numRates);
3111 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
3112 freeBytes -= (1 + 1 +
3113 eseBcnReportMandatoryIe.supportedRates.numRates);
3114 }
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003115 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003116
3117 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003118 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003119 {
3120 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
3121 {
3122 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
3123 retStatus = eSIR_FAILURE;
3124 goto err_bcnrep;
3125 }
3126 *pos = SIR_MAC_FH_PARAM_SET_EID;
3127 pos++;
3128 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
3129 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003130 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003131 SIR_MAC_FH_PARAM_SET_EID_MAX);
3132 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
3133 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
3134 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003135
3136 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003137 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003138 {
3139 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
3140 {
3141 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
3142 retStatus = eSIR_FAILURE;
3143 goto err_bcnrep;
3144 }
3145 *pos = SIR_MAC_DS_PARAM_SET_EID;
3146 pos++;
3147 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
3148 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003149 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003150 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
3151 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
3152 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003153
3154 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003155 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003156 {
3157 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
3158 {
3159 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
3160 retStatus = eSIR_FAILURE;
3161 goto err_bcnrep;
3162 }
3163 *pos = SIR_MAC_CF_PARAM_SET_EID;
3164 pos++;
3165 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
3166 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003167 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003168 SIR_MAC_CF_PARAM_SET_EID_MAX);
3169 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
3170 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
3171 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003172
3173 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003174 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003175 {
3176 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
3177 {
3178 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
3179 retStatus = eSIR_FAILURE;
3180 goto err_bcnrep;
3181 }
3182 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
3183 pos++;
3184 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3185 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003186 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003187 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3188 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3189 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3190 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003191
3192 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003193 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003194 {
3195 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
3196 {
3197 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
3198 retStatus = eSIR_FAILURE;
3199 goto err_bcnrep;
3200 }
3201 *pos = SIR_MAC_TIM_EID;
3202 pos++;
3203 *pos = SIR_MAC_TIM_EID_MIN;
3204 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003205 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003206 SIR_MAC_TIM_EID_MIN);
3207 pos += SIR_MAC_TIM_EID_MIN;
3208 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
3209 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003210
3211 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003212 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003213 {
3214 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3215 {
3216 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3217 retStatus = eSIR_FAILURE;
3218 goto err_bcnrep;
3219 }
3220 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3221 pos++;
3222 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3223 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003224 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003225 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3226 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3227 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003228
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003229 if (freeBytes != 0)
3230 {
3231 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3232 retStatus = eSIR_FAILURE;
3233 }
3234
3235err_bcnrep:
3236 /* The message counter would not be incremented in case of
3237 * returning failure and hence next time, this function gets
3238 * called, it would be using the same msg ctr for a different
3239 * BSS.So, it is good to clear the memory allocated for a BSS
3240 * that is returning failure.On success, the caller would take
3241 * care of freeing up the memory*/
3242 if (retStatus == eSIR_FAILURE)
3243 {
3244 vos_mem_free(*outIeBuf);
3245 *outIeBuf = NULL;
3246 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003247 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003248 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003249}
3250
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003251#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003252
Jeff Johnson295189b2012-06-20 16:38:30 -07003253tSirRetStatus
3254sirParseBeaconIE(tpAniSirGlobal pMac,
3255 tpSirProbeRespBeacon pBeaconStruct,
3256 tANI_U8 *pPayload,
3257 tANI_U32 nPayload)
3258{
3259 tDot11fBeaconIEs *pBies;
3260 tANI_U32 status;
3261
3262 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303263 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003264
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303265 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3266 if ( NULL == pBies )
3267 status = eHAL_STATUS_FAILURE;
3268 else
3269 status = eHAL_STATUS_SUCCESS;
3270 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003271 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303272 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 return eSIR_FAILURE;
3274 }
3275 // delegate to the framesc-generated code,
3276 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3277
3278 if ( DOT11F_FAILED( status ) )
3279 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303280 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 status, nPayload);
3282 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303283 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 return eSIR_FAILURE;
3285 }
3286 else if ( DOT11F_WARNED( status ) )
3287 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303288 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 status, nPayload );
3290 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3291 }
3292
3293 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3294 if ( ! pBies->SSID.present )
3295 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303296 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 }
3298 else
3299 {
3300 pBeaconStruct->ssidPresent = 1;
3301 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3302 }
3303
3304 if ( ! pBies->SuppRates.present )
3305 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303306 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 }
3308 else
3309 {
3310 pBeaconStruct->suppRatesPresent = 1;
3311 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3312 }
3313
3314 if ( pBies->ExtSuppRates.present )
3315 {
3316 pBeaconStruct->extendedRatesPresent = 1;
3317 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3318 }
3319
3320 if ( pBies->CFParams.present )
3321 {
3322 pBeaconStruct->cfPresent = 1;
3323 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3324 }
3325
3326 if ( pBies->TIM.present )
3327 {
3328 pBeaconStruct->timPresent = 1;
3329 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3330 }
3331
3332 if ( pBies->Country.present )
3333 {
3334 pBeaconStruct->countryInfoPresent = 1;
3335 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3336 }
3337
3338 // 11h IEs
3339 if(pBies->TPCReport.present)
3340 {
3341 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303342 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 &pBies->TPCReport,
3344 sizeof( tDot11fIETPCReport));
3345 }
3346
3347 if(pBies->PowerConstraints.present)
3348 {
3349 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303350 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003351 &pBies->PowerConstraints,
3352 sizeof(tDot11fIEPowerConstraints));
3353 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003354#ifdef FEATURE_WLAN_ESE
3355 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003356 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003357 pBeaconStruct->eseTxPwr.present = 1;
3358 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003359 }
3360 if (pBies->QBSSLoad.present)
3361 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303362 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 }
3364#endif
3365
3366 if ( pBies->EDCAParamSet.present )
3367 {
3368 pBeaconStruct->edcaPresent = 1;
3369 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3370 }
3371
3372 // QOS Capabilities:
3373 if ( pBies->QOSCapsAp.present )
3374 {
3375 pBeaconStruct->qosCapabilityPresent = 1;
3376 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3377 }
3378
3379
3380
3381 if ( pBies->ChanSwitchAnn.present )
3382 {
3383 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303384 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 sizeof(tDot11fIEChanSwitchAnn));
3386 }
3387
3388 if ( pBies->ExtChanSwitchAnn.present)
3389 {
3390 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303391 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 sizeof(tDot11fIEExtChanSwitchAnn));
3393 }
3394
3395 if ( pBies->Quiet.present )
3396 {
3397 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303398 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003399 }
3400
3401 if ( pBies->HTCaps.present )
3402 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303403 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003404 }
3405
3406 if ( pBies->HTInfo.present )
3407 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303408 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003409 }
3410
3411 if ( pBies->DSParams.present )
3412 {
3413 pBeaconStruct->dsParamsPresent = 1;
3414 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3415 }
3416 else if(pBies->HTInfo.present)
3417 {
3418 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3419 }
3420
3421 if ( pBies->RSN.present )
3422 {
3423 pBeaconStruct->rsnPresent = 1;
3424 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3425 }
3426
3427 if ( pBies->WPA.present )
3428 {
3429 pBeaconStruct->wpaPresent = 1;
3430 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3431 }
3432
3433 if ( pBies->WMMParams.present )
3434 {
3435 pBeaconStruct->wmeEdcaPresent = 1;
3436 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3437 }
3438
3439 if ( pBies->WMMInfoAp.present )
3440 {
3441 pBeaconStruct->wmeInfoPresent = 1;
3442 }
3443
3444 if ( pBies->WMMCaps.present )
3445 {
3446 pBeaconStruct->wsmCapablePresent = 1;
3447 }
3448
3449
3450 if ( pBies->ERPInfo.present )
3451 {
3452 pBeaconStruct->erpPresent = 1;
3453 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3454 }
3455
Jeff Johnsone7245742012-09-05 17:12:55 -07003456#ifdef WLAN_FEATURE_11AC
3457 if ( pBies->VHTCaps.present )
3458 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303459 pBeaconStruct->VHTCaps.present = 1;
3460 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003461 }
3462 if ( pBies->VHTOperation.present )
3463 {
3464 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303465 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3466 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003467 }
3468 if ( pBies->VHTExtBssLoad.present )
3469 {
3470 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303471 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3472 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003473 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003474 if( pBies->OperatingMode.present)
3475 {
3476 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303477 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3478 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003479 }
3480
Jeff Johnsone7245742012-09-05 17:12:55 -07003481#endif
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303482 if (pBies->ExtCap.present )
3483 {
3484 pBeaconStruct->ExtCap.present = 1;
3485 vos_mem_copy( &pBeaconStruct->ExtCap, &pBies->ExtCap,
3486 sizeof(tDot11fIEExtCap));
3487 }
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303488 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003489
Jeff Johnsone7245742012-09-05 17:12:55 -07003490
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 return eSIR_SUCCESS;
3492
3493} // End sirParseBeaconIE.
3494
3495tSirRetStatus
3496sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3497 tANI_U8 *pFrame,
3498 tpSirProbeRespBeacon pBeaconStruct)
3499{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003500 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 tANI_U32 status, nPayload;
3502 tANI_U8 *pPayload;
3503 tpSirMacMgmtHdr pHdr;
3504 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003505 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003506
3507 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3508 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3509 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3510 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003511 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003512
3513 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303514 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3515
Abhishek Singhc75726d2015-04-13 14:44:14 +05303516 pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303517 if ( NULL == pBeacon )
3518 status = eHAL_STATUS_FAILURE;
3519 else
3520 status = eHAL_STATUS_SUCCESS;
3521 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003522 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303523 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003524 return eSIR_FAILURE;
3525 }
3526
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303527 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003528
3529 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303530 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003531
3532 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003533 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 if ( DOT11F_FAILED( status ) )
3535 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303536 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003537 status, nPayload);
3538 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05303539 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003540 return eSIR_FAILURE;
3541 }
3542 else if ( DOT11F_WARNED( status ) )
3543 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303544 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003545 status, nPayload );
3546 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3547 }
3548
3549 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3550 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303551 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3552 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003553
3554 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003555 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003556
3557 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003558 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3559 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3560 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3561 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3562 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3563 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3564 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3565 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3566 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3567 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3568 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3569 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3570 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3571 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3572 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3573 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003574
Jeff Johnson32d95a32012-09-10 13:15:23 -07003575 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003576 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303577 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003578 }
3579 else
3580 {
3581 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003582 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003583 }
3584
Jeff Johnson32d95a32012-09-10 13:15:23 -07003585 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303587 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003588 }
3589 else
3590 {
3591 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003592 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003593 }
3594
Jeff Johnson32d95a32012-09-10 13:15:23 -07003595 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003596 {
3597 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003598 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 }
3600
3601
Jeff Johnson32d95a32012-09-10 13:15:23 -07003602 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 {
3604 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003605 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 }
3607
Jeff Johnson32d95a32012-09-10 13:15:23 -07003608 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 {
3610 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003611 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003612 }
3613
Jeff Johnson32d95a32012-09-10 13:15:23 -07003614 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 {
3616 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003617 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003618 }
3619
3620 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003621 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 {
3623 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003624 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 }
3626
Jeff Johnson32d95a32012-09-10 13:15:23 -07003627 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 {
3629 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003630 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003631 }
3632
Jeff Johnson32d95a32012-09-10 13:15:23 -07003633 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003634 {
3635 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303636 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 sizeof(tDot11fIEChanSwitchAnn) );
3638 }
3639
Jeff Johnson32d95a32012-09-10 13:15:23 -07003640 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 {
3642 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303643 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 sizeof(tDot11fIEExtChanSwitchAnn) );
3645 }
3646
Jeff Johnson32d95a32012-09-10 13:15:23 -07003647 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003648 {
3649 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303650 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 sizeof(tDot11fIETPCReport));
3652 }
3653
Jeff Johnson32d95a32012-09-10 13:15:23 -07003654 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003655 {
3656 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303657 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003658 sizeof(tDot11fIEPowerConstraints));
3659 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003660
3661 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003662 {
3663 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303664 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 }
3666
Jeff Johnson32d95a32012-09-10 13:15:23 -07003667 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303669 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 }
3671
Jeff Johnson32d95a32012-09-10 13:15:23 -07003672 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003673 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303674 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003675
3676 }
3677
Jeff Johnson32d95a32012-09-10 13:15:23 -07003678 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003679 {
3680 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003681 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003683 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003685 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 }
3687 else
3688 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003689 if ((!rfBand) || IS_5G_BAND(rfBand))
3690 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3691 else if (IS_24G_BAND(rfBand))
3692 pBeaconStruct->channelNumber = mappedRXCh;
3693 else
3694 {
3695 /*Only 0, 1, 2 are expected values for RF band from FW
3696 * if FW fixes are not present then rf band value will
3697 * be 0, else either 1 or 2 are expected from FW, 3 is
3698 * not expected from FW */
3699 PELOGE(limLog(pMac, LOGE,
3700 FL("Channel info is not present in Beacon and"
3701 " mapping is not done correctly"));)
3702 pBeaconStruct->channelNumber = mappedRXCh;
3703 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 }
3705
Jeff Johnson32d95a32012-09-10 13:15:23 -07003706 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 {
3708 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003709 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 }
3711
Jeff Johnson32d95a32012-09-10 13:15:23 -07003712 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003713 {
3714 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003715 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003716 }
3717
Jeff Johnson32d95a32012-09-10 13:15:23 -07003718 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 {
3720 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003721 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05303722 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003723 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003724 }
3725
Jeff Johnson32d95a32012-09-10 13:15:23 -07003726 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003727 {
3728 pBeaconStruct->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05303729 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003730 }
3731
Jeff Johnson32d95a32012-09-10 13:15:23 -07003732 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003733 {
3734 pBeaconStruct->wsmCapablePresent = 1;
3735 }
3736
Jeff Johnson32d95a32012-09-10 13:15:23 -07003737 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003738 {
3739 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003740 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003741 }
3742
3743#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003744 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 {
3746 // MobilityDomain
3747 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303748 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3749 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003750 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003751
3752 }
3753#endif
3754
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003755#ifdef FEATURE_WLAN_ESE
3756 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303757 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003758 //ESE Tx Power
3759 pBeaconStruct->eseTxPwr.present = 1;
3760 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3761 &pBeacon->ESETxmitPower,
3762 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303763 }
3764#endif
3765
Jeff Johnsone7245742012-09-05 17:12:55 -07003766#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003767 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003768 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303769 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003770 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003771 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003772 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303773 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3774 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003775 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003776 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003777 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303778 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3779 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003780 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003781 if(pBeacon->OperatingMode.present)
3782 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303783 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3784 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003785 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003786 if(pBeacon->WiderBWChanSwitchAnn.present)
3787 {
3788 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303789 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3790 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003791 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003792#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303793 if(pBeacon->OBSSScanParameters.present)
3794 {
3795 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3796 &pBeacon->OBSSScanParameters,
3797 sizeof( tDot11fIEOBSSScanParameters));
3798 }
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303799
Abhishek Singhc75726d2015-04-13 14:44:14 +05303800 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 return eSIR_SUCCESS;
3802
3803} // End sirConvertBeaconFrame2Struct.
3804
3805tSirRetStatus
3806sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3807 tANI_U8 *pFrame,
3808 tANI_U32 nFrame,
3809 tpSirMacAuthFrameBody pAuth)
3810{
3811 static tDot11fAuthentication auth;
3812 tANI_U32 status;
3813
3814 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303815 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003816
3817 // delegate to the framesc-generated code,
3818 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3819 if ( DOT11F_FAILED( status ) )
3820 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303821 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 status, nFrame);
3823 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3824 return eSIR_FAILURE;
3825 }
3826 else if ( DOT11F_WARNED( status ) )
3827 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303828 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 status, nFrame );
3830 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3831 }
3832
3833 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3834 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3835 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3836 pAuth->authStatusCode = auth.Status.status;
3837
3838 if ( auth.ChallengeText.present )
3839 {
3840 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3841 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303842 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003843 }
3844
3845 return eSIR_SUCCESS;
3846
3847} // End sirConvertAuthFrame2Struct.
3848
3849tSirRetStatus
3850sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3851 tANI_U8 *pFrame,
3852 tANI_U32 nFrame,
3853 tSirAddtsReqInfo *pAddTs)
3854{
3855 tDot11fAddTSRequest addts = {{0}};
3856 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3857 tANI_U8 j;
3858 tANI_U16 i;
3859 tANI_U32 status;
3860
3861 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3862 {
3863 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3864 "with an Action of %d; this is not "
3865 "supported & is probably an error."),
3866 *( pFrame + 1 ) );
3867 return eSIR_FAILURE;
3868 }
3869
3870 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303871 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003872
3873 // delegate to the framesc-generated code,
3874 switch ( *pFrame )
3875 {
3876 case SIR_MAC_ACTION_QOS_MGMT:
3877 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3878 break;
3879 case SIR_MAC_ACTION_WME:
3880 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3881 break;
3882 default:
3883 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3884 "with a Category of %d; this is not"
3885 " supported & is probably an error."),
3886 *pFrame );
3887 return eSIR_FAILURE;
3888 }
3889
3890 if ( DOT11F_FAILED( status ) )
3891 {
3892 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05303893 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003894 status, nFrame);
3895 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3896 return eSIR_FAILURE;
3897 }
3898 else if ( DOT11F_WARNED( status ) )
3899 {
3900 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3901 "g an Add TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05303902 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 status, nFrame );
3904 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3905 }
3906
3907 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3908 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3909 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3910 {
3911 pAddTs->dialogToken = addts.DialogToken.token;
3912
3913 if ( addts.TSPEC.present )
3914 {
3915 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3916 }
3917 else
3918 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303919 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 return eSIR_FAILURE;
3921 }
3922
3923 if ( addts.num_TCLAS )
3924 {
3925 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3926
3927 for ( i = 0U; i < addts.num_TCLAS; ++i )
3928 {
3929 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3930 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303931 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 return eSIR_FAILURE;
3933 }
3934 }
3935 }
3936
3937 if ( addts.TCLASSPROC.present )
3938 {
3939 pAddTs->tclasProcPresent = 1;
3940 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3941 }
3942
3943 if ( addts.WMMTSPEC.present )
3944 {
3945 pAddTs->wsmTspecPresent = 1;
3946 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3947 }
3948
3949 if ( addts.num_WMMTCLAS )
3950 {
3951 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3952 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3953
3954 for ( i = pAddTs->numTclas; i < j; ++i )
3955 {
3956 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3957 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303958 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 return eSIR_FAILURE;
3960 }
3961 }
3962 }
3963
3964 if ( addts.WMMTCLASPROC.present )
3965 {
3966 pAddTs->tclasProcPresent = 1;
3967 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3968 }
3969
3970 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3971 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303972 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 pAddTs->numTclas );
3974 return eSIR_FAILURE;
3975 }
3976 }
3977 else
3978 {
3979 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3980
3981 if ( wmmaddts.WMMTSPEC.present )
3982 {
3983 pAddTs->wmeTspecPresent = 1;
3984 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3985 }
3986 else
3987 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303988 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003989 return eSIR_FAILURE;
3990 }
3991 }
3992
3993 return eSIR_SUCCESS;
3994
3995} // End sirConvertAddtsReq2Struct.
3996
3997tSirRetStatus
3998sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3999 tANI_U8 *pFrame,
4000 tANI_U32 nFrame,
4001 tSirAddtsRspInfo *pAddTs)
4002{
4003 tDot11fAddTSResponse addts = {{0}};
4004 tDot11fWMMAddTSResponse wmmaddts = {{0}};
4005 tANI_U8 j;
4006 tANI_U16 i;
4007 tANI_U32 status;
4008
4009 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
4010 {
4011 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4012 "with an Action of %d; this is not "
4013 "supported & is probably an error."),
4014 *( pFrame + 1 ) );
4015 return eSIR_FAILURE;
4016 }
4017
4018 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304019 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
4020 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
4021 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004022
4023
4024 // delegate to the framesc-generated code,
4025 switch ( *pFrame )
4026 {
4027 case SIR_MAC_ACTION_QOS_MGMT:
4028 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
4029 break;
4030 case SIR_MAC_ACTION_WME:
4031 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
4032 break;
4033 default:
4034 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4035 "with a Category of %d; this is not"
4036 " supported & is probably an error."),
4037 *pFrame );
4038 return eSIR_FAILURE;
4039 }
4040
4041 if ( DOT11F_FAILED( status ) )
4042 {
4043 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304044 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004045 status, nFrame);
4046 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4047 return eSIR_FAILURE;
4048 }
4049 else if ( DOT11F_WARNED( status ) )
4050 {
4051 limLog( pMac, LOGW, FL("There were warnings while unpackin"
4052 "g an Add TS Response frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304053 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004054 status, nFrame );
4055 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4056 }
4057
4058 // & "transliterate" from a 'tDot11fAddTSResponse' or a
4059 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
4060 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4061 {
4062 pAddTs->dialogToken = addts.DialogToken.token;
4063 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
4064
4065 if ( addts.TSDelay.present )
4066 {
4067 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
4068 }
4069
4070 // TS Delay is present iff status indicates its presence
4071 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
4072 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304073 limLog( pMac, LOGW, FL("Missing TSDelay IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004074 }
4075
4076 if ( addts.TSPEC.present )
4077 {
4078 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
4079 }
4080 else
4081 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304082 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004083 return eSIR_FAILURE;
4084 }
4085
4086 if ( addts.num_TCLAS )
4087 {
4088 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4089
4090 for ( i = 0U; i < addts.num_TCLAS; ++i )
4091 {
4092 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4093 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304094 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 return eSIR_FAILURE;
4096 }
4097 }
4098 }
4099
4100 if ( addts.TCLASSPROC.present )
4101 {
4102 pAddTs->tclasProcPresent = 1;
4103 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4104 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004105#ifdef FEATURE_WLAN_ESE
4106 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 {
4108 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304109 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004110 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004111 }
4112#endif
4113 if ( addts.Schedule.present )
4114 {
4115 pAddTs->schedulePresent = 1;
4116 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
4117 }
4118
4119 if ( addts.WMMSchedule.present )
4120 {
4121 pAddTs->schedulePresent = 1;
4122 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
4123 }
4124
4125 if ( addts.WMMTSPEC.present )
4126 {
4127 pAddTs->wsmTspecPresent = 1;
4128 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4129 }
4130
4131 if ( addts.num_WMMTCLAS )
4132 {
4133 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
4134 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
4135
4136 for ( i = pAddTs->numTclas; i < j; ++i )
4137 {
4138 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4139 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304140 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004141 return eSIR_FAILURE;
4142 }
4143 }
4144 }
4145
4146 if ( addts.WMMTCLASPROC.present )
4147 {
4148 pAddTs->tclasProcPresent = 1;
4149 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4150 }
4151
4152 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4153 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304154 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 pAddTs->numTclas );
4156 return eSIR_FAILURE;
4157 }
4158 }
4159 else
4160 {
4161 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4162 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
4163
4164 if ( wmmaddts.WMMTSPEC.present )
4165 {
4166 pAddTs->wmeTspecPresent = 1;
4167 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4168 }
4169 else
4170 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304171 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004172 return eSIR_FAILURE;
4173 }
4174
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004175#ifdef FEATURE_WLAN_ESE
4176 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004177 {
4178 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304179 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004180 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004181 }
4182#endif
4183
4184 }
4185
4186 return eSIR_SUCCESS;
4187
4188} // End sirConvertAddtsRsp2Struct.
4189
4190tSirRetStatus
4191sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
4192 tANI_U8 *pFrame,
4193 tANI_U32 nFrame,
4194 tSirDeltsReqInfo *pDelTs)
4195{
4196 tDot11fDelTS delts = {{0}};
4197 tDot11fWMMDelTS wmmdelts = {{0}};
4198 tANI_U32 status;
4199
4200 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
4201 {
4202 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4203 "with an Action of %d; this is not "
4204 "supported & is probably an error."),
4205 *( pFrame + 1 ) );
4206 return eSIR_FAILURE;
4207 }
4208
4209 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304210 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004211
4212 // delegate to the framesc-generated code,
4213 switch ( *pFrame )
4214 {
4215 case SIR_MAC_ACTION_QOS_MGMT:
4216 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
4217 break;
4218 case SIR_MAC_ACTION_WME:
4219 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4220 break;
4221 default:
4222 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4223 "with a Category of %d; this is not"
4224 " supported & is probably an error."),
4225 *pFrame );
4226 return eSIR_FAILURE;
4227 }
4228
4229 if ( DOT11F_FAILED( status ) )
4230 {
4231 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304232 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004233 status, nFrame);
4234 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4235 return eSIR_FAILURE;
4236 }
4237 else if ( DOT11F_WARNED( status ) )
4238 {
4239 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4240 "g an Del TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304241 "%d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 status, nFrame );
4243 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4244 }
4245
4246 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4247 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4248 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4249 {
4250 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4251 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4252 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4253 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4254 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4255 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4256 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4257 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4258
4259 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4260 }
4261 else
4262 {
4263 if ( wmmdelts.WMMTSPEC.present )
4264 {
4265 pDelTs->wmeTspecPresent = 1;
4266 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4267 }
4268 else
4269 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304270 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 return eSIR_FAILURE;
4272 }
4273 }
4274
4275 return eSIR_SUCCESS;
4276
4277} // End sirConvertDeltsReq2Struct.
4278
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004279tSirRetStatus
4280sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4281 tANI_U8 *pFrame,
4282 tANI_U32 nFrame,
4283 tSirQosMapSet *pQosMapSet)
4284{
4285 tDot11fQosMapConfigure mapConfigure;
4286 tANI_U32 status;
4287 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
Sreelakshmi Konamki325c47b2016-02-19 16:12:23 +05304288 if ( DOT11F_FAILED( status ) || !mapConfigure.QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004289 {
Sreelakshmi Konamki325c47b2016-02-19 16:12:23 +05304290 dot11fLog(pMac, LOGE, FL("Failed to parse or QosMapSet not present(0x%08x, %d bytes):"),
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004291 status, nFrame);
4292 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4293 return eSIR_FAILURE;
4294 }
4295 else if ( DOT11F_WARNED( status ) )
4296 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304297 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking Qos Map Configure frame (0x%08x, %d bytes):"),
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004298 status, nFrame );
4299 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4300 }
4301 pQosMapSet->present = mapConfigure.QosMapSet.present;
4302 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004303 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004304 return eSIR_SUCCESS;
4305}
Jeff Johnson295189b2012-06-20 16:38:30 -07004306
4307#ifdef ANI_SUPPORT_11H
4308tSirRetStatus
4309sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4310 tANI_U8 *pFrame,
4311 tpSirMacTpcReqActionFrame pTpcReqFrame,
4312 tANI_U32 nFrame)
4313{
4314 tDot11fTPCRequest req;
4315 tANI_U32 status;
4316
4317 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304318 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004319
4320 // delegate to the framesc-generated code,
4321 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4322 if ( DOT11F_FAILED( status ) )
4323 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304324 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 status, nFrame);
4326 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4327 return eSIR_FAILURE;
4328 }
4329 else if ( DOT11F_WARNED( status ) )
4330 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304331 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004332 status, nFrame );
4333 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4334 }
4335
4336 // & "transliterate" from a 'tDot11fTPCRequest' to a
4337 // 'tSirMacTpcReqActionFrame'...
4338 pTpcReqFrame->actionHeader.category = req.Category.category;
4339 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4340 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4341 if ( req.TPCRequest.present )
4342 {
4343 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4344 pTpcReqFrame->length = 0;
4345 }
4346 else
4347 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304348 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004349 return eSIR_FAILURE;
4350 }
4351
4352 return eSIR_SUCCESS;
4353
4354} // End sirConvertTpcReqFrame2Struct.
4355
4356
4357tSirRetStatus
4358sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4359 tANI_U8 *pFrame,
4360 tpSirMacMeasReqActionFrame pMeasReqFrame,
4361 tANI_U32 nFrame)
4362{
4363 tDot11fMeasurementRequest mr;
4364 tANI_U32 status;
4365
4366 // Zero-init our [out] parameter,
Sunkad, Anand Ningappafe8b7542016-02-08 12:08:13 +05304367 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(*pMeasReqFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004368
4369 // delegate to the framesc-generated code,
4370 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4371 if ( DOT11F_FAILED( status ) )
4372 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304373 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 status, nFrame);
4375 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4376 return eSIR_FAILURE;
4377 }
4378 else if ( DOT11F_WARNED( status ) )
4379 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304380 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004381 status, nFrame );
4382 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4383 }
4384
4385 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4386 // 'tpSirMacMeasReqActionFrame'...
4387 pMeasReqFrame->actionHeader.category = mr.Category.category;
4388 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4389 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4390
4391 if ( 0 == mr.num_MeasurementRequest )
4392 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304393 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004394 return eSIR_FAILURE;
4395 }
4396 else if ( 1 < mr.num_MeasurementRequest )
4397 {
4398 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4399 }
4400
4401 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4402 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4403 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4404 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4405 ( mr.MeasurementRequest[0].enable << 2 ) |
4406 ( mr.MeasurementRequest[0].request << 1 ) |
4407 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4408 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4409
4410 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4411
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304412 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 mr.MeasurementRequest[0].meas_start_time, 8 );
4414
4415 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4416
4417 return eSIR_SUCCESS;
4418
4419} // End sirConvertMeasReqFrame2Struct.
4420#endif
4421
4422
4423void
4424PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4425 tDot11fIETSPEC *pDot11f)
4426{
4427 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4428 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4429 pDot11f->direction = pOld->tsinfo.traffic.direction;
4430 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4431 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4432 pDot11f->psb = pOld->tsinfo.traffic.psb;
4433 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4434 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4435 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4436 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4437 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4438 */
4439 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4440 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4441 pDot11f->max_msdu_size = pOld->maxMsduSz;
4442 pDot11f->min_service_int = pOld->minSvcInterval;
4443 pDot11f->max_service_int = pOld->maxSvcInterval;
4444 pDot11f->inactivity_int = pOld->inactInterval;
4445 pDot11f->suspension_int = pOld->suspendInterval;
4446 pDot11f->service_start_time = pOld->svcStartTime;
4447 pDot11f->min_data_rate = pOld->minDataRate;
4448 pDot11f->mean_data_rate = pOld->meanDataRate;
4449 pDot11f->peak_data_rate = pOld->peakDataRate;
4450 pDot11f->burst_size = pOld->maxBurstSz;
4451 pDot11f->delay_bound = pOld->delayBound;
4452 pDot11f->min_phy_rate = pOld->minPhyRate;
4453 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4454 pDot11f->medium_time = pOld->mediumTime;
4455
4456 pDot11f->present = 1;
4457
4458} // End PopulateDot11fTSPEC.
4459
4460void
4461PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4462 tDot11fIEWMMTSPEC *pDot11f)
4463{
4464 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4465 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4466 pDot11f->direction = pOld->tsinfo.traffic.direction;
4467 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4468 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4469 pDot11f->psb = pOld->tsinfo.traffic.psb;
4470 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4471 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4472 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4473 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4474 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4475 */
4476 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4477 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4478 pDot11f->max_msdu_size = pOld->maxMsduSz;
4479 pDot11f->min_service_int = pOld->minSvcInterval;
4480 pDot11f->max_service_int = pOld->maxSvcInterval;
4481 pDot11f->inactivity_int = pOld->inactInterval;
4482 pDot11f->suspension_int = pOld->suspendInterval;
4483 pDot11f->service_start_time = pOld->svcStartTime;
4484 pDot11f->min_data_rate = pOld->minDataRate;
4485 pDot11f->mean_data_rate = pOld->meanDataRate;
4486 pDot11f->peak_data_rate = pOld->peakDataRate;
4487 pDot11f->burst_size = pOld->maxBurstSz;
4488 pDot11f->delay_bound = pOld->delayBound;
4489 pDot11f->min_phy_rate = pOld->minPhyRate;
4490 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4491 pDot11f->medium_time = pOld->mediumTime;
4492
4493 pDot11f->version = 1;
4494 pDot11f->present = 1;
4495
4496} // End PopulateDot11fWMMTSPEC.
4497
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004498#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004499
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004500// Fill the ESE version currently supported
4501void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004502{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004503 pESEVersion->present = 1;
4504 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004505}
4506
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004507// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004508// The State is Normal (1)
4509// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004510void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004511{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004512 pESERadMgmtCap->present = 1;
4513 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4514 pESERadMgmtCap->mbssid_mask = 0;
4515 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004516}
4517
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004518tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004519 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004520 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004521{
4522 int idx;
4523
4524 if ( pCCKMie->length )
4525 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004526 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004527 {
4528 pDot11f->present = 1;
4529 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004530 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004531 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4532 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4533 }
4534 }
4535
4536 return eSIR_SUCCESS;
4537
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004538} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004539
Jeff Johnson295189b2012-06-20 16:38:30 -07004540void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004541 tSirMacESETSRSIE *pOld,
4542 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004543 tANI_U8 rate_length)
4544{
4545 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304546 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 pDot11f->num_tsrates = rate_length;
4548 pDot11f->present = 1;
4549}
4550#endif
4551
4552
4553tSirRetStatus
4554PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4555 tSirTclasInfo *pOld,
4556 tDot11fIETCLAS *pDot11f)
4557{
4558 pDot11f->user_priority = pOld->tclas.userPrio;
4559 pDot11f->classifier_type = pOld->tclas.classifierType;
4560 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4561
4562 switch ( pDot11f->classifier_type )
4563 {
4564 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304565 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4566 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4567 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4568 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4570 break;
4571 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4572 pDot11f->info.IpParams.version = pOld->version;
4573 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4574 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304575 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304576 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304577 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4578 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304579 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304580 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004581 pDot11f->info.IpParams.params.IpV4Params.src_port =
4582 pOld->tclasParams.ipv4.srcPort;
4583 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4584 pOld->tclasParams.ipv4.dstPort;
4585 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4586 pOld->tclasParams.ipv4.dscp;
4587 pDot11f->info.IpParams.params.IpV4Params.proto =
4588 pOld->tclasParams.ipv4.protocol;
4589 pDot11f->info.IpParams.params.IpV4Params.reserved =
4590 pOld->tclasParams.ipv4.rsvd;
4591 }
4592 else
4593 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304594 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 IpV6Params.source,
4596 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304597 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 IpV6Params.dest,
4599 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4600 pDot11f->info.IpParams.params.IpV6Params.src_port =
4601 pOld->tclasParams.ipv6.srcPort;
4602 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4603 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304604 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004605 IpV6Params.flow_label,
4606 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4607 }
4608 break;
4609 case SIR_MAC_TCLASTYPE_8021DQ:
4610 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4611 break;
4612 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304613 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 pDot11f->classifier_type );
4615 return eSIR_FAILURE;
4616 }
4617
4618 pDot11f->present = 1;
4619
4620 return eSIR_SUCCESS;
4621
4622} // End PopulateDot11fTCLAS.
4623
4624tSirRetStatus
4625PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4626 tSirTclasInfo *pOld,
4627 tDot11fIEWMMTCLAS *pDot11f)
4628{
4629 pDot11f->version = 1;
4630 pDot11f->user_priority = pOld->tclas.userPrio;
4631 pDot11f->classifier_type = pOld->tclas.classifierType;
4632 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4633
4634 switch ( pDot11f->classifier_type )
4635 {
4636 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304637 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004638 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304639 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4641 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4642 break;
4643 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4644 pDot11f->info.IpParams.version = pOld->version;
4645 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4646 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304647 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004648 IpV4Params.source,
4649 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304650 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 IpV4Params.dest,
4652 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4653 pDot11f->info.IpParams.params.IpV4Params.src_port =
4654 pOld->tclasParams.ipv4.srcPort;
4655 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4656 pOld->tclasParams.ipv4.dstPort;
4657 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4658 pOld->tclasParams.ipv4.dscp;
4659 pDot11f->info.IpParams.params.IpV4Params.proto =
4660 pOld->tclasParams.ipv4.protocol;
4661 pDot11f->info.IpParams.params.IpV4Params.reserved =
4662 pOld->tclasParams.ipv4.rsvd;
4663 }
4664 else
4665 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304666 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004667 IpV6Params.source,
4668 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304669 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004670 IpV6Params.dest,
4671 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4672 pDot11f->info.IpParams.params.IpV6Params.src_port =
4673 pOld->tclasParams.ipv6.srcPort;
4674 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4675 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304676 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004677 IpV6Params.flow_label,
4678 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4679 }
4680 break;
4681 case SIR_MAC_TCLASTYPE_8021DQ:
4682 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4683 break;
4684 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304685 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004686 pDot11f->classifier_type );
4687 return eSIR_FAILURE;
4688 }
4689
4690 pDot11f->present = 1;
4691
4692 return eSIR_SUCCESS;
4693
4694} // End PopulateDot11fWMMTCLAS.
4695
Jeff Johnson295189b2012-06-20 16:38:30 -07004696
4697tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4698 tDot11fIEWscBeacon *pDot11f)
4699{
4700
4701 tANI_U32 wpsState;
4702
4703 pDot11f->Version.present = 1;
4704 pDot11f->Version.major = 0x01;
4705 pDot11f->Version.minor = 0x00;
4706
4707 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304708 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004709
4710 pDot11f->WPSState.present = 1;
4711 pDot11f->WPSState.state = (tANI_U8) wpsState;
4712
4713 pDot11f->APSetupLocked.present = 0;
4714
4715 pDot11f->SelectedRegistrar.present = 0;
4716
4717 pDot11f->DevicePasswordID.present = 0;
4718
4719 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4720
4721 pDot11f->UUID_E.present = 0;
4722
4723 pDot11f->RFBands.present = 0;
4724
4725 pDot11f->present = 1;
4726 return eSIR_SUCCESS;
4727}
4728
4729tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4730 tDot11fIEWscBeacon *pDot11f)
4731{
4732 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4733 tANI_U32 devicepasswdId;
4734
4735
4736 pDot11f->APSetupLocked.present = 1;
4737 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4738
4739 pDot11f->SelectedRegistrar.present = 1;
4740 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4741
4742 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304743 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07004744
4745 pDot11f->DevicePasswordID.present = 1;
4746 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4747
4748 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4749 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4750
4751 // UUID_E and RF Bands are applicable only for dual band AP
4752
4753 return eSIR_SUCCESS;
4754}
4755
4756tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4757 tDot11fIEWscBeacon *pDot11f)
4758{
4759 pDot11f->APSetupLocked.present = 0;
4760 pDot11f->SelectedRegistrar.present = 0;
4761 pDot11f->DevicePasswordID.present = 0;
4762 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4763
4764 return eSIR_SUCCESS;
4765}
Jeff Johnson295189b2012-06-20 16:38:30 -07004766tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4767{
4768
4769 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4770
4771 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4772
4773
4774 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4775 {
4776 pDot11f->present = 1;
4777 pDot11f->Version.present = 1;
4778 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4779 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4780 }
4781 else
4782 {
4783 pDot11f->present = 0;
4784 pDot11f->Version.present = 0;
4785 }
4786
4787 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4788 {
4789
4790 pDot11f->WPSState.present = 1;
4791 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4792 }
4793 else
4794 pDot11f->WPSState.present = 0;
4795
4796 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4797 {
4798 pDot11f->APSetupLocked.present = 1;
4799 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4800 }
4801 else
4802 pDot11f->APSetupLocked.present = 0;
4803
4804 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4805 {
4806 pDot11f->SelectedRegistrar.present = 1;
4807 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4808 }
4809 else
4810 pDot11f->SelectedRegistrar.present = 0;
4811
4812 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4813 {
4814 pDot11f->DevicePasswordID.present = 1;
4815 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4816 }
4817 else
4818 pDot11f->DevicePasswordID.present = 0;
4819
4820 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4821 {
4822 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4823 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4824 }
4825 else
4826 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4827
4828 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4829 {
4830 pDot11f->ResponseType.present = 1;
4831 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4832 }
4833 else
4834 pDot11f->ResponseType.present = 0;
4835
4836 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4837 {
4838 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304839 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004840 }
4841 else
4842 pDot11f->UUID_E.present = 0;
4843
4844 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4845 {
4846 pDot11f->Manufacturer.present = 1;
4847 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304848 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4849 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 }
4851 else
4852 pDot11f->Manufacturer.present = 0;
4853
4854 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4855 {
4856 pDot11f->ModelName.present = 1;
4857 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304858 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4859 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004860 }
4861 else
4862 pDot11f->ModelName.present = 0;
4863
4864 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4865 {
4866 pDot11f->ModelNumber.present = 1;
4867 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304868 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4869 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004870 }
4871 else
4872 pDot11f->ModelNumber.present = 0;
4873
4874 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4875 {
4876 pDot11f->SerialNumber.present = 1;
4877 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304878 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4879 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004880 }
4881 else
4882 pDot11f->SerialNumber.present = 0;
4883
4884 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4885 {
4886 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304887 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4888 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004889 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4890 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4891 }
4892 else
4893 pDot11f->PrimaryDeviceType.present = 0;
4894
4895 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4896 {
4897 pDot11f->DeviceName.present = 1;
4898 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304899 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4900 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 }
4902 else
4903 pDot11f->DeviceName.present = 0;
4904
4905 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4906 {
4907 pDot11f->ConfigMethods.present = 1;
4908 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4909 }
4910 else
4911 pDot11f->ConfigMethods.present = 0;
4912
4913
4914 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4915 {
4916 pDot11f->RFBands.present = 1;
4917 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4918 }
4919 else
4920 pDot11f->RFBands.present = 0;
4921
4922 return eSIR_SUCCESS;
4923}
4924tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4925{
4926 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4927
4928 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4929
4930 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4931 {
4932 pDot11f->present = 1;
4933 pDot11f->Version.present = 1;
4934 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4935 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4936 }
4937 else
4938 {
4939 pDot11f->present = 0;
4940 pDot11f->Version.present = 0;
4941 }
4942
4943 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4944 {
4945 pDot11f->ResponseType.present = 1;
4946 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4947 }
4948 else
4949 pDot11f->ResponseType.present = 0;
4950
4951 return eSIR_SUCCESS;
4952}
4953
4954tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4955{
4956
4957 tSirWPSBeaconIE *pSirWPSBeaconIE;
4958
4959 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4960
4961
4962 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4963 {
4964 pDot11f->present = 1;
4965 pDot11f->Version.present = 1;
4966 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4967 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4968 }
4969 else
4970 {
4971 pDot11f->present = 0;
4972 pDot11f->Version.present = 0;
4973 }
4974
4975 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4976 {
4977
4978 pDot11f->WPSState.present = 1;
4979 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4980 }
4981 else
4982 pDot11f->WPSState.present = 0;
4983
4984 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4985 {
4986 pDot11f->APSetupLocked.present = 1;
4987 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4988 }
4989 else
4990 pDot11f->APSetupLocked.present = 0;
4991
4992 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4993 {
4994 pDot11f->SelectedRegistrar.present = 1;
4995 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4996 }
4997 else
4998 pDot11f->SelectedRegistrar.present = 0;
4999
5000 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
5001 {
5002 pDot11f->DevicePasswordID.present = 1;
5003 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
5004 }
5005 else
5006 pDot11f->DevicePasswordID.present = 0;
5007
5008 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
5009 {
5010 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5011 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
5012 }
5013 else
5014 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5015
5016 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
5017 {
5018 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305019 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07005020 }
5021 else
5022 pDot11f->UUID_E.present = 0;
5023
5024
5025 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
5026 {
5027 pDot11f->RFBands.present = 1;
5028 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
5029 }
5030 else
5031 pDot11f->RFBands.present = 0;
5032
5033 return eSIR_SUCCESS;
5034}
Jeff Johnson295189b2012-06-20 16:38:30 -07005035tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
5036 tDot11fIEWscProbeRes *pDot11f)
5037{
5038 tANI_U32 cfgMethods;
5039 tANI_U32 cfgStrLen;
5040 tANI_U32 val;
5041 tANI_U32 wpsVersion, wpsState;
5042
5043
5044 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305045 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_VERSION );
Jeff Johnson295189b2012-06-20 16:38:30 -07005046
5047 pDot11f->Version.present = 1;
5048 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
5049 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
5050
5051 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305052 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07005053
5054 pDot11f->WPSState.present = 1;
5055 pDot11f->WPSState.state = (tANI_U8) wpsState;
5056
5057 pDot11f->APSetupLocked.present = 0;
5058
5059 pDot11f->SelectedRegistrar.present = 0;
5060
5061 pDot11f->DevicePasswordID.present = 0;
5062
5063 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5064
5065 pDot11f->ResponseType.present = 1;
5066 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
5067 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
5068 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5069 }
5070 else{
5071 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5072 }
5073
5074 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
5075 pDot11f->UUID_E.present = 1;
5076 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
5077 if (wlan_cfgGetStr(pMac,
5078 WNI_CFG_WPS_UUID,
5079 pDot11f->UUID_E.uuid,
5080 &cfgStrLen) != eSIR_SUCCESS)
5081 {
5082 *(pDot11f->UUID_E.uuid) = '\0';
5083 }
5084
5085 pDot11f->Manufacturer.present = 1;
5086 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
5087 if (wlan_cfgGetStr(pMac,
5088 WNI_CFG_MANUFACTURER_NAME,
5089 pDot11f->Manufacturer.name,
5090 &cfgStrLen) != eSIR_SUCCESS)
5091 {
5092 pDot11f->Manufacturer.num_name = 0;
5093 *(pDot11f->Manufacturer.name) = '\0';
5094 }
5095 else
5096 {
5097 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305098 pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005099 }
5100
5101 pDot11f->ModelName.present = 1;
5102 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
5103 if (wlan_cfgGetStr(pMac,
5104 WNI_CFG_MODEL_NAME,
5105 pDot11f->ModelName.text,
5106 &cfgStrLen) != eSIR_SUCCESS)
5107 {
5108 pDot11f->ModelName.num_text = 0;
5109 *(pDot11f->ModelName.text) = '\0';
5110 }
5111 else
5112 {
5113 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305114 pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005115 }
5116
5117 pDot11f->ModelNumber.present = 1;
5118 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
5119 if (wlan_cfgGetStr(pMac,
5120 WNI_CFG_MODEL_NUMBER,
5121 pDot11f->ModelNumber.text,
5122 &cfgStrLen) != eSIR_SUCCESS)
5123 {
5124 pDot11f->ModelNumber.num_text = 0;
5125 *(pDot11f->ModelNumber.text) = '\0';
5126 }
5127 else
5128 {
5129 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305130 pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005131 }
5132
5133 pDot11f->SerialNumber.present = 1;
5134 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
5135 if (wlan_cfgGetStr(pMac,
5136 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
5137 pDot11f->SerialNumber.text,
5138 &cfgStrLen) != eSIR_SUCCESS)
5139 {
5140 pDot11f->SerialNumber.num_text = 0;
5141 *(pDot11f->SerialNumber.text) = '\0';
5142 }
5143 else
5144 {
5145 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305146 pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005147 }
5148
5149 pDot11f->PrimaryDeviceType.present = 1;
5150
5151 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
5152 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305153 limLog(pMac, LOGP, FL("cfg get prim device category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005154 }
5155 else
5156 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
5157
5158 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
5159 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305160 limLog(pMac, LOGP, FL("cfg get prim device OUI failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005161 }
5162 else
5163 {
5164 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
5165 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
5166 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
5167 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
5168 }
5169
5170 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
5171 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305172 limLog(pMac, LOGP, FL("cfg get prim device sub category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005173 }
5174 else
5175 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
5176
5177 pDot11f->DeviceName.present = 1;
5178 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
5179 if (wlan_cfgGetStr(pMac,
5180 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
5181 pDot11f->DeviceName.text,
5182 &cfgStrLen) != eSIR_SUCCESS)
5183 {
5184 pDot11f->DeviceName.num_text = 0;
5185 *(pDot11f->DeviceName.text) = '\0';
5186 }
5187 else
5188 {
5189 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305190 pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005191 }
5192
5193 if (wlan_cfgGetInt(pMac,
5194 WNI_CFG_WPS_CFG_METHOD,
5195 &cfgMethods) != eSIR_SUCCESS)
5196 {
5197 pDot11f->ConfigMethods.present = 0;
5198 pDot11f->ConfigMethods.methods = 0;
5199 }
5200 else
5201 {
5202 pDot11f->ConfigMethods.present = 1;
5203 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
5204 }
5205
5206 pDot11f->RFBands.present = 0;
5207
5208 pDot11f->present = 1;
5209 return eSIR_SUCCESS;
5210}
5211
5212tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5213 tDot11fIEWscProbeRes *pDot11f)
5214{
5215 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
5216 tANI_U32 devicepasswdId;
5217
5218 pDot11f->APSetupLocked.present = 1;
5219 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5220
5221 pDot11f->SelectedRegistrar.present = 1;
5222 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5223
5224 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305225 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07005226
5227 pDot11f->DevicePasswordID.present = 1;
5228 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5229
5230 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5231 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5232
5233 // UUID_E and RF Bands are applicable only for dual band AP
5234
5235 return eSIR_SUCCESS;
5236}
5237
5238tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5239 tDot11fIEWscProbeRes *pDot11f)
5240{
5241 pDot11f->APSetupLocked.present = 0;
5242 pDot11f->SelectedRegistrar.present = 0;
5243 pDot11f->DevicePasswordID.present = 0;
5244 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5245
5246 return eSIR_SUCCESS;
5247}
5248
5249tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5250 tDot11fIEWscAssocRes *pDot11f,
5251 tpSirAssocReq pRcvdAssocReq)
5252{
5253 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5254 tANI_U8 *wscIe;
5255
5256
5257 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5258 if(wscIe != NULL)
5259 {
5260 // retreive WSC IE from given AssocReq
5261 dot11fUnpackIeWscAssocReq( pMac,
5262 wscIe + 2 + 4, // EID, length, OUI
5263 wscIe[ 1 ] - 4, // length without OUI
5264 &parsedWscAssocReq );
5265 pDot11f->present = 1;
5266 // version has to be 0x10
5267 pDot11f->Version.present = 1;
5268 pDot11f->Version.major = 0x1;
5269 pDot11f->Version.minor = 0x0;
5270
5271 pDot11f->ResponseType.present = 1;
5272
5273 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5274 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5275 {
5276 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5277 }
5278 else
5279 {
5280 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5281 }
5282 // Version infomration should be taken from our capability as well as peers
5283 // TODO: currently it takes from peers only
5284 if(parsedWscAssocReq.VendorExtension.present &&
5285 parsedWscAssocReq.VendorExtension.Version2.present)
5286 {
5287 pDot11f->VendorExtension.present = 1;
5288 pDot11f->VendorExtension.vendorId[0] = 0x00;
5289 pDot11f->VendorExtension.vendorId[1] = 0x37;
5290 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5291 pDot11f->VendorExtension.Version2.present = 1;
5292 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5293 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5294 }
5295 }
5296 return eSIR_SUCCESS;
5297}
5298
Jeff Johnson295189b2012-06-20 16:38:30 -07005299tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5300 tDot11fIEP2PAssocRes *pDot11f,
5301 tpSirAssocReq pRcvdAssocReq)
5302{
5303 tANI_U8 *p2pIe;
5304
5305 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5306 if(p2pIe != NULL)
5307 {
5308 pDot11f->present = 1;
5309 pDot11f->P2PStatus.present = 1;
5310 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5311 pDot11f->ExtendedListenTiming.present = 0;
5312 }
5313 return eSIR_SUCCESS;
5314}
Jeff Johnson295189b2012-06-20 16:38:30 -07005315
5316#if defined WLAN_FEATURE_VOWIFI
5317
5318tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5319 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5320{
5321 pDot11f->txPower = txPower;
5322 pDot11f->linkMargin = linkMargin;
5323 pDot11f->present = 1;
5324
5325 return eSIR_SUCCESS;
5326}
5327
5328tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5329{
5330
5331 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5332 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305333 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5334 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005335 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5336 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5337 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5338 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5339 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305340 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005341 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5342 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5343
5344 if( pBeaconReport->numIes )
5345 {
5346 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305347 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5348 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005349 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5350 }
5351
5352 return eSIR_SUCCESS;
5353
5354}
5355
5356tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5357{
5358 tpRRMCaps pRrmCaps;
5359
5360 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5361
5362 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5363 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5364 pDot11f->parallel = pRrmCaps->parallel ;
5365 pDot11f->repeated = pRrmCaps->repeated ;
5366 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5367 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5368 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5369 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5370 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5371 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5372 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5373 pDot11f->statistics = pRrmCaps->statistics ;
5374 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5375 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5376 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5377 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5378 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5379 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5380 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5381 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5382 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5383 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5384 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5385 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5386 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5387 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5388 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5389 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5390
5391 pDot11f->present = 1;
5392 return eSIR_SUCCESS;
5393}
5394#endif
5395
5396#if defined WLAN_FEATURE_VOWIFI_11R
5397void PopulateMDIE( tpAniSirGlobal pMac,
5398 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5399{
5400 pDot11f->present = 1;
5401 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5402
5403 // Plugfest fix
5404 pDot11f->overDSCap = (mdie[2] & 0x01);
5405 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5406
5407}
5408
5409void PopulateFTInfo( tpAniSirGlobal pMac,
5410 tDot11fIEFTInfo *pDot11f )
5411{
5412 pDot11f->present = 1;
5413 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5414 //All other info is zero.
5415
5416}
5417#endif
5418
5419void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5420 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5421{
5422 tANI_U8 num_supp = 0, num_ext = 0;
5423 tANI_U8 i,j;
5424
5425 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5426 {
5427 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5428 }
5429 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5430 {
5431 if( num_supp < 8 )
5432 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5433 else
5434 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5435 }
5436
5437 if( num_supp )
5438 {
5439 pSupp->num_rates = num_supp;
5440 pSupp->present = 1;
5441 }
5442 if( num_ext )
5443 {
5444 pExt->num_rates = num_ext;
5445 pExt->present = 1;
5446 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005447}
5448
5449void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5450 tDot11fIETimeoutInterval *pDot11f,
5451 tANI_U8 type, tANI_U32 value )
5452{
5453 pDot11f->present = 1;
5454 pDot11f->timeoutType = type;
5455 pDot11f->timeoutValue = value;
5456}
Jeff Johnson295189b2012-06-20 16:38:30 -07005457// parserApi.c ends here.