blob: 70f542f5a86e5eebff756a68d717159b5ccbd9b9 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singhc75726d2015-04-13 14:44:14 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
Kiet Lamaa8e15a2014-02-11 23:30:06 -080021
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080022/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -080023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 * This file parserApi.cc contains the code for parsing
30 * 802.11 messages.
31 * Author: Pierre Vandwalle
32 * Date: 03/18/02
33 * History:-
34 * Date Modified by Modification Information
35 * --------------------------------------------------------------------
36 *
37 */
38
39#include "sirApi.h"
40#include "aniGlobal.h"
41#include "parserApi.h"
42#include "cfgApi.h"
43#include "limUtils.h"
44#include "utilsParser.h"
45#include "limSerDesUtils.h"
46#include "schApi.h"
47#include "palApi.h"
48#include "wmmApsd.h"
49#if defined WLAN_FEATURE_VOWIFI
50#include "rrmApi.h"
51#endif
52
53
54
55////////////////////////////////////////////////////////////////////////
56void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
57{
58#ifdef WLAN_DEBUG
59 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
60 {
61 return;
62 }
63 else
64 {
65 va_list marker;
66
67 va_start( marker, pString ); /* Initialize variable arguments. */
68
69 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
70
71 va_end( marker ); /* Reset variable arguments. */
72 }
73#endif
74}
75
76void
77swapBitField16(tANI_U16 in, tANI_U16 *out)
78{
79# ifdef ANI_LITTLE_BIT_ENDIAN
80 *out = in;
81# else // Big-Endian...
82 *out = ( ( in & 0x8000 ) >> 15 ) |
83 ( ( in & 0x4000 ) >> 13 ) |
84 ( ( in & 0x2000 ) >> 11 ) |
85 ( ( in & 0x1000 ) >> 9 ) |
86 ( ( in & 0x0800 ) >> 7 ) |
87 ( ( in & 0x0400 ) >> 5 ) |
88 ( ( in & 0x0200 ) >> 3 ) |
89 ( ( in & 0x0100 ) >> 1 ) |
90 ( ( in & 0x0080 ) << 1 ) |
91 ( ( in & 0x0040 ) << 3 ) |
92 ( ( in & 0x0020 ) << 5 ) |
93 ( ( in & 0x0010 ) << 7 ) |
94 ( ( in & 0x0008 ) << 9 ) |
95 ( ( in & 0x0004 ) << 11 ) |
96 ( ( in & 0x0002 ) << 13 ) |
97 ( ( in & 0x0001 ) << 15 );
98# endif // ANI_LITTLE_BIT_ENDIAN
99}
100
101void
102swapBitField32(tANI_U32 in, tANI_U32 *out)
103{
104# ifdef ANI_LITTLE_BIT_ENDIAN
105 *out = in;
106# else // Big-Endian...
107 *out = ( ( in & 0x80000000 ) >> 31 ) |
108 ( ( in & 0x40000000 ) >> 29 ) |
109 ( ( in & 0x20000000 ) >> 27 ) |
110 ( ( in & 0x10000000 ) >> 25 ) |
111 ( ( in & 0x08000000 ) >> 23 ) |
112 ( ( in & 0x04000000 ) >> 21 ) |
113 ( ( in & 0x02000000 ) >> 19 ) |
114 ( ( in & 0x01000000 ) >> 17 ) |
115 ( ( in & 0x00800000 ) >> 15 ) |
116 ( ( in & 0x00400000 ) >> 13 ) |
117 ( ( in & 0x00200000 ) >> 11 ) |
118 ( ( in & 0x00100000 ) >> 9 ) |
119 ( ( in & 0x00080000 ) >> 7 ) |
120 ( ( in & 0x00040000 ) >> 5 ) |
121 ( ( in & 0x00020000 ) >> 3 ) |
122 ( ( in & 0x00010000 ) >> 1 ) |
123 ( ( in & 0x00008000 ) << 1 ) |
124 ( ( in & 0x00004000 ) << 3 ) |
125 ( ( in & 0x00002000 ) << 5 ) |
126 ( ( in & 0x00001000 ) << 7 ) |
127 ( ( in & 0x00000800 ) << 9 ) |
128 ( ( in & 0x00000400 ) << 11 ) |
129 ( ( in & 0x00000200 ) << 13 ) |
130 ( ( in & 0x00000100 ) << 15 ) |
131 ( ( in & 0x00000080 ) << 17 ) |
132 ( ( in & 0x00000040 ) << 19 ) |
133 ( ( in & 0x00000020 ) << 21 ) |
134 ( ( in & 0x00000010 ) << 23 ) |
135 ( ( in & 0x00000008 ) << 25 ) |
136 ( ( in & 0x00000004 ) << 27 ) |
137 ( ( in & 0x00000002 ) << 29 ) |
138 ( ( in & 0x00000001 ) << 31 );
139# endif // ANI_LITTLE_BIT_ENDIAN
140}
141
142inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
143{
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 ){
Sushant Kaushik87787972015-09-11 16:05:00 +0530444 dot11fLog( pMac, LOGE, 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;
743 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
744 pQosMapSet->num_dscp_exceptions);
745 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
746 {
747 limLog(pMac, LOG1, FL("dscp value: %d"),
748 pQosMapSet->dscp_exceptions[i][0]);
749 limLog(pMac, LOG1, FL("User priority value: %d"),
750 pQosMapSet->dscp_exceptions[i][1]);
751 }
752 for (i=0;i<8;i++)
753 {
754 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
755 pQosMapSet->dscp_range[i][0]);
756 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
757 pQosMapSet->dscp_range[i][1]);
758 }
759}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700760
Jeff Johnsone7245742012-09-05 17:12:55 -0700761tSirRetStatus
762PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530763 tDot11fIEVHTCaps *pDot11f,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530764 tANI_U8 nChannelNum,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530765 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700766{
767 tSirRetStatus nStatus;
768 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530769 tAniBool disableMcs9 = eSIR_FALSE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700770
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530771 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530772 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
773 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530774 else
775 disableMcs9 =
776 pMac->roam.configParam.channelBondingMode5GHz?
777 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700778 pDot11f->present = 1;
779
780 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
781 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
782
783 nCfgValue = 0;
784 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
785 nCfgValue );
786 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
787
788 nCfgValue = 0;
789 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
790 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
791
792 nCfgValue = 0;
793 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
794 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
795
796 nCfgValue = 0;
797 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
798 nCfgValue );
799 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
800
Deepthi Gowri0c1e1682015-06-19 12:57:53 +0530801 if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
802 {
803 pDot11f->shortGI80MHz = 0;
804 pDot11f->shortGI160and80plus80MHz = 0;
805 }
806
Jeff Johnsone7245742012-09-05 17:12:55 -0700807 nCfgValue = 0;
808 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
809 pDot11f->txSTBC = (nCfgValue & 0x0001);
810
811 nCfgValue = 0;
812 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
813 pDot11f->rxSTBC = (nCfgValue & 0x0007);
814
815 nCfgValue = 0;
816 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
817 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
818
819 nCfgValue = 0;
820 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
821 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
822
823 nCfgValue = 0;
824 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
825 nCfgValue );
826 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
827
828 nCfgValue = 0;
829 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
830 nCfgValue );
831 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
832
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530833 /* muBeamformerCap should be 0 for non AP and
834 * muBeamformeeCap should be 0 for AP
835 */
836 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
837 {
838 nCfgValue = 0;
839 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
840 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
841 pDot11f->muBeamformeeCap = 0;
842 }
843 else
844 {
845 pDot11f->muBeamformerCap = 0;
846 nCfgValue = 0;
847 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
848 /* Enable only if FW and host both support the MU_MIMO feature
849 */
850 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
851 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700852
853 nCfgValue = 0;
854 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
855 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
856
857 nCfgValue = 0;
858 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
859 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
860
861 nCfgValue = 0;
862 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
863 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
864
865 nCfgValue = 0;
866 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
867 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
868
869 nCfgValue = 0;
870 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
871 pDot11f->rxAntPattern = nCfgValue;
872
873 nCfgValue = 0;
874 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
875 pDot11f->txAntPattern = nCfgValue;
876
877 pDot11f->reserved1= 0;
878
879 nCfgValue = 0;
880 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530881
882 if (eSIR_TRUE == disableMcs9)
883 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700884 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
885
886 nCfgValue = 0;
887 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
888 nCfgValue );
889 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
890
891 pDot11f->reserved2= 0;
892
893 nCfgValue = 0;
894 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530895
896 if (eSIR_TRUE == disableMcs9)
897 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700898 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
899
900 nCfgValue = 0;
901 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
902 nCfgValue );
903 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
904
905 pDot11f->reserved3= 0;
906
907 limLogVHTCap(pMac, pDot11f);
908
909 return eSIR_SUCCESS;
910
911}
912
913tSirRetStatus
914PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530915 tDot11fIEVHTOperation *pDot11f,
916 tANI_U8 nChannelNum)
Jeff Johnsone7245742012-09-05 17:12:55 -0700917{
918 tSirRetStatus nStatus;
919 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530920 tAniBool disableMcs9 = eSIR_FALSE;
921
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530922 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530923 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
924 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530925 else
926 disableMcs9 =
927 pMac->roam.configParam.channelBondingMode5GHz?
928 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700929
930 pDot11f->present = 1;
931
932 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
933 pDot11f->chanWidth = (tANI_U8)nCfgValue;
934
935 nCfgValue = 0;
936 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
937 nCfgValue );
938 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
939
940 nCfgValue = 0;
941 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
942 nCfgValue );
943 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
944
945 nCfgValue = 0;
946 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530947
948 if (eSIR_TRUE == disableMcs9)
949 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700950 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
951
952 limLogVHTOperation(pMac,pDot11f);
953
954 return eSIR_SUCCESS;
955
956}
957
958tSirRetStatus
959PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
960 tDot11fIEVHTExtBssLoad *pDot11f)
961{
962 tSirRetStatus nStatus;
963 tANI_U32 nCfgValue=0;
964
965 pDot11f->present = 1;
966
967 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
968 nCfgValue );
969 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
970
971 nCfgValue = 0;
972 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
973 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
974
975 nCfgValue=0;
976 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
977 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
978
979 nCfgValue=0;
980 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
981 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
982
983 nCfgValue=0;
984 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
985 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
986
987 limLogVHTExtBssLoad(pMac,pDot11f);
988
989 return eSIR_SUCCESS;
990}
991
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530992#ifdef WLAN_FEATURE_AP_HT40_24G
993tSirRetStatus
994PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
995 tDot11fIEOBSSScanParameters *pDot11f,
996 tpPESession psessionEntry)
997{
998 pDot11f->present = 1;
999
1000 pDot11f->obssScanPassiveDwell =
1001 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
1002
1003 pDot11f->obssScanActiveDwell =
1004 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
1005
1006 pDot11f->bssChannelWidthTriggerScanInterval =
1007 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
1008
1009 pDot11f->obssScanPassiveTotalPerChannel =
1010 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
1011
1012 pDot11f->obssScanActiveTotalPerChannel =
1013 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
1014
1015 pDot11f->bssWidthChannelTransitionDelayFactor =
1016 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
1017
1018 pDot11f->obssScanActivityThreshold =
1019 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
1020
1021 return eSIR_SUCCESS;
1022}
1023#endif
1024
Mohit Khanna4a70d262012-09-11 16:30:12 -07001025tSirRetStatus
1026PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +05301027 tDot11fIEExtCap *pDot11f,
1028 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -07001029{
Sandeep Puligilla60342762014-01-30 21:05:37 +05301030
Sandeep Puligilla60342762014-01-30 21:05:37 +05301031#ifdef WLAN_FEATURE_11AC
Sushant Kaushikc25b4fc2015-09-16 16:42:34 +05301032 if (psessionEntry->vhtCapability &&
1033 psessionEntry->limSystemRole != eLIM_STA_IN_IBSS_ROLE )
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301034 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301035 pDot11f->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301036 pDot11f->present = 1;
1037 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301038#endif
1039 /* while operating in 2.4GHz only then STA need to advertize
1040 the bss co-ex capability*/
1041 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
1042 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301043#ifdef WLAN_FEATURE_AP_HT40_24G
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301044 if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1045 && pMac->roam.configParam.channelBondingMode24GHz)
1046 || pMac->roam.configParam.apHT40_24GEnabled)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301047#else
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301048 if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1049 && pMac->roam.configParam.channelBondingMode24GHz)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301050#endif
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301051 {
Sandeep Puligilla60342762014-01-30 21:05:37 +05301052 pDot11f->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301053 pDot11f->present = 1;
1054 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301055 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07001056 return eSIR_SUCCESS;
1057}
1058
1059tSirRetStatus
1060PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
1061 tDot11fIEOperatingMode *pDot11f,
1062 tpPESession psessionEntry)
1063{
1064 pDot11f->present = 1;
1065
1066 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1067 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1068 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1069
1070 return eSIR_SUCCESS;
1071}
Jeff Johnsone7245742012-09-05 17:12:55 -07001072
1073#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001074tSirRetStatus
1075PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1076 tDot11fIEHTInfo *pDot11f,
1077 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001078{
1079 tANI_U32 nCfgValue, nCfgLen;
1080 tANI_U8 htInfoField1;
1081 tANI_U16 htInfoField2;
1082 tSirRetStatus nSirStatus;
1083 tSirMacHTInfoField1 *pHTInfoField1;
1084 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 union {
1086 tANI_U16 nCfgValue16;
1087 tSirMacHTInfoField3 infoField3;
1088 }uHTInfoField;
1089 union {
1090 tANI_U16 nCfgValue16;
1091 tSirMacHTInfoField2 infoField2;
1092 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001093
Jeff Johnson295189b2012-06-20 16:38:30 -07001094
1095 #if 0
1096 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1097 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301098
1099 if (NULL == psessionEntry)
1100 {
1101 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301102 FL("Invalid session entry in PopulateDot11fHTInfo()"));)
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301103 return eSIR_FAILURE;
1104 }
1105
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1107
1108 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1109
1110 htInfoField1 = ( tANI_U8 ) nCfgValue;
1111
1112 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1114 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1115
Jeff Johnsone7245742012-09-05 17:12:55 -07001116 if (psessionEntry == NULL)
1117 {
1118 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301119 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001120 }
1121 else
1122 {
1123 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1124 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1125 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001126
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001127 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001128 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1129
1130 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1131
1132 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1133 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1134 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1135
1136 uHTInfoField2.infoField2.reserved = 0;
1137
1138 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001139 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1140
1141 htInfoField2 = ( tANI_U16 ) nCfgValue;
1142
1143 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1144 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1145 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1146 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1147
1148 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001149 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001150
1151 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1152
1153
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1155
1156
1157 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1158 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1159 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1160 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1161 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1162 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1163 uHTInfoField.infoField3.reserved = 0;
1164
Jeff Johnson295189b2012-06-20 16:38:30 -07001165
1166 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1167 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1168 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1169 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1170 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1171
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1173 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1174 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1175 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1176
Jeff Johnson295189b2012-06-20 16:38:30 -07001177
Jeff Johnson295189b2012-06-20 16:38:30 -07001178 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1179 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1180 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1181 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1182 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1183 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1184 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1186 pDot11f->basicMCSSet, nCfgLen,
1187 SIZE_OF_BASIC_MCS_SET );
1188
1189 pDot11f->present = 1;
1190
1191 return eSIR_SUCCESS;
1192
1193} // End PopulateDot11fHTInfo.
1194
1195void
1196PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1197 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1198{
1199 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1200 {
1201 pDot11f->present = 1;
1202 // ATIM duration is always set to 0
1203 pDot11f->atim = 0;
1204 }
1205
1206} // End PopulateDot11fIBSSParams.
1207
1208
1209#ifdef ANI_SUPPORT_11H
1210tSirRetStatus
1211PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1212 tpSirMacMeasReqActionFrame pReq,
1213 tDot11fIEMeasurementReport *pDot11f)
1214{
1215 pDot11f->token = pReq->measReqIE.measToken;
1216 pDot11f->late = 0;
1217 pDot11f->incapable = 0;
1218 pDot11f->refused = 1;
1219 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1220
1221 pDot11f->present = 1;
1222
1223 return eSIR_SUCCESS;
1224
1225} // End PopulatedDot11fMeasurementReport0.
1226
1227tSirRetStatus
1228PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1229 tpSirMacMeasReqActionFrame pReq,
1230 tDot11fIEMeasurementReport *pDot11f)
1231{
1232 pDot11f->token = pReq->measReqIE.measToken;
1233 pDot11f->late = 0;
1234 pDot11f->incapable = 0;
1235 pDot11f->refused = 1;
1236 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1237
1238 pDot11f->present = 1;
1239
1240 return eSIR_SUCCESS;
1241
1242} // End PopulatedDot11fMeasurementReport1.
1243
1244tSirRetStatus
1245PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1246 tpSirMacMeasReqActionFrame pReq,
1247 tDot11fIEMeasurementReport *pDot11f)
1248{
1249 pDot11f->token = pReq->measReqIE.measToken;
1250 pDot11f->late = 0;
1251 pDot11f->incapable = 0;
1252 pDot11f->refused = 1;
1253 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1254
1255 pDot11f->present = 1;
1256
1257 return eSIR_SUCCESS;
1258
1259} // End PopulatedDot11fMeasurementReport2.
1260#endif
1261
1262void
1263PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1264 tDot11fIEPowerCaps *pCaps,
1265 tANI_U8 nAssocType,
1266 tpPESession psessionEntry)
1267{
1268 if (nAssocType == LIM_REASSOC)
1269 {
1270 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1271 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1272 }else
1273 {
1274 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1275 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1276
1277 }
1278
1279 pCaps->present = 1;
1280} // End PopulateDot11fPowerCaps.
1281
1282tSirRetStatus
1283PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1284 tDot11fIEPowerConstraints *pDot11f)
1285{
1286 tANI_U32 cfg;
1287 tSirRetStatus nSirStatus;
1288
1289 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1290
1291 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1292 pDot11f->present = 1;
1293
1294 return eSIR_SUCCESS;
1295} // End PopulateDot11fPowerConstraints.
1296
1297void
1298PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1299 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1300{
1301 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1302 pDot11f->reserved = 0;
1303 pDot11f->txopreq = 0;
1304 pDot11f->qreq = 0;
1305 pDot11f->qack = 0;
1306 pDot11f->present = 1;
1307} // End PopulatedDot11fQOSCaps.
1308
1309void
1310PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1311 tDot11fIEQOSCapsStation *pDot11f)
1312{
1313 tANI_U32 val = 0;
1314
1315 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301316 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001317
1318 pDot11f->more_data_ack = 0;
1319 pDot11f->max_sp_length = (tANI_U8)val;
1320 pDot11f->qack = 0;
1321
1322 if (pMac->lim.gUapsdEnable)
1323 {
1324 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1325 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1326 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1327 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1328 }
1329 pDot11f->present = 1;
1330} // End PopulatedDot11fQOSCaps.
1331
1332tSirRetStatus
1333PopulateDot11fRSN(tpAniSirGlobal pMac,
1334 tpSirRSNie pRsnIe,
1335 tDot11fIERSN *pDot11f)
1336{
1337 tANI_U32 status;
1338 int idx;
1339
1340 if ( pRsnIe->length )
1341 {
1342 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1343 {
1344 status = dot11fUnpackIeRSN( pMac,
1345 pRsnIe->rsnIEdata + idx + 2, //EID, length
1346 pRsnIe->rsnIEdata[ idx + 1 ],
1347 pDot11f );
1348 if ( DOT11F_FAILED( status ) )
1349 {
1350 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
Sushant Kaushik87787972015-09-11 16:05:00 +05301351 "N (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001352 status );
1353 return eSIR_FAILURE;
1354 }
1355 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301356 "PopulateDot11fRSN."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 }
1358
1359 }
1360
1361 return eSIR_SUCCESS;
1362} // End PopulateDot11fRSN.
1363
1364tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1365 tpSirRSNie pRsnIe,
1366 tDot11fIERSNOpaque *pDot11f )
1367{
1368 int idx;
1369
1370 if ( pRsnIe->length )
1371 {
1372 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1373 {
1374 pDot11f->present = 1;
1375 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301376 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001377 pRsnIe->rsnIEdata + idx + 2, // EID, len
1378 pRsnIe->rsnIEdata[ idx + 1 ] );
1379 }
1380 }
1381
1382 return eSIR_SUCCESS;
1383
1384} // End PopulateDot11fRSNOpaque.
1385
1386
1387
1388#if defined(FEATURE_WLAN_WAPI)
1389
1390tSirRetStatus
1391PopulateDot11fWAPI(tpAniSirGlobal pMac,
1392 tpSirRSNie pRsnIe,
1393 tDot11fIEWAPI *pDot11f)
1394 {
1395 tANI_U32 status;
1396 int idx;
1397
1398 if ( pRsnIe->length )
1399 {
1400 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1401 {
1402 status = dot11fUnpackIeWAPI( pMac,
1403 pRsnIe->rsnIEdata + idx + 2, //EID, length
1404 pRsnIe->rsnIEdata[ idx + 1 ],
1405 pDot11f );
1406 if ( DOT11F_FAILED( status ) )
1407 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301408 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 status );
1410 return eSIR_FAILURE;
1411 }
1412 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301413 "PopulateDot11fWAPI."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 }
1415 }
1416
1417 return eSIR_SUCCESS;
1418} // End PopulateDot11fWAPI.
1419
1420tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1421 tpSirRSNie pRsnIe,
1422 tDot11fIEWAPIOpaque *pDot11f )
1423{
1424 int idx;
1425
1426 if ( pRsnIe->length )
1427 {
1428 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1429 {
1430 pDot11f->present = 1;
1431 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301432 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 pRsnIe->rsnIEdata + idx + 2, // EID, len
1434 pRsnIe->rsnIEdata[ idx + 1 ] );
1435 }
1436 }
1437
1438 return eSIR_SUCCESS;
1439
1440} // End PopulateDot11fWAPIOpaque.
1441
1442
1443#endif //defined(FEATURE_WLAN_WAPI)
1444
1445void
1446PopulateDot11fSSID(tpAniSirGlobal pMac,
1447 tSirMacSSid *pInternal,
1448 tDot11fIESSID *pDot11f)
1449{
1450 pDot11f->present = 1;
1451 pDot11f->num_ssid = pInternal->length;
1452 if ( pInternal->length )
1453 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301454 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 pInternal->length );
1456 }
1457} // End PopulateDot11fSSID.
1458
1459tSirRetStatus
1460PopulateDot11fSSID2(tpAniSirGlobal pMac,
1461 tDot11fIESSID *pDot11f)
1462{
1463 tANI_U32 nCfg;
1464 tSirRetStatus nSirStatus;
1465
1466 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1467 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1468 pDot11f->present = 1;
1469 return eSIR_SUCCESS;
1470} // End PopulateDot11fSSID2.
1471
1472void
1473PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1474 tDot11fIESchedule *pDot11f)
1475{
1476 pDot11f->aggregation = pSchedule->info.aggregation;
1477 pDot11f->tsid = pSchedule->info.tsid;
1478 pDot11f->direction = pSchedule->info.direction;
1479 pDot11f->reserved = pSchedule->info.rsvd;
1480 pDot11f->service_start_time = pSchedule->svcStartTime;
1481 pDot11f->service_interval = pSchedule->svcInterval;
1482 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1483 pDot11f->spec_interval = pSchedule->specInterval;
1484
1485 pDot11f->present = 1;
1486} // End PopulateDot11fSchedule.
1487
1488void
1489PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1490 tDot11fIESuppChannels *pDot11f,
1491 tANI_U8 nAssocType,
1492 tpPESession psessionEntry)
1493{
1494 tANI_U8 i;
1495 tANI_U8 *p;
1496
1497 if (nAssocType == LIM_REASSOC)
1498 {
1499 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1500 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1501 }else
1502 {
1503 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1504 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1505 }
1506 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1507 {
1508 pDot11f->bands[i][0] = *p;
1509 pDot11f->bands[i][1] = 1;
1510 }
1511
1512 pDot11f->present = 1;
1513
1514} // End PopulateDot11fSuppChannels.
1515
1516tSirRetStatus
1517PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1518 tANI_U8 nChannelNum,
1519 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1520{
1521 tSirRetStatus nSirStatus;
1522 tANI_U32 nRates;
1523 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1524
1525 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1526 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1527 sending mgmt frames (lile probe req) which need to go out before any session is present.
1528 */
1529 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1530 {
1531 #if 0
1532 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1533 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1534 #endif //TO SUPPORT BT-AMP
1535 if(psessionEntry != NULL)
1536 {
1537 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301538 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 nRates);
1540 }
1541 else
1542 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301543 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 nRates = 0;
1545 }
1546 }
1547 else if ( 14 >= nChannelNum )
1548 {
1549 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1550 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1551 }
1552 else
1553 {
1554 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1555 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1556 }
1557
1558 if ( 0 != nRates )
1559 {
1560 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301561 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 pDot11f->present = 1;
1563 }
1564
1565 return eSIR_SUCCESS;
1566
1567} // End PopulateDot11fSuppRates.
1568
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301569/**
1570 * PopulateDot11fRatesTdls() - populate supported rates and
1571 * extended supported rates IE.
1572 * @p_mac gloabl - header.
1573 * @p_supp_rates - pointer to supported rates IE
1574 * @p_ext_supp_rates - pointer to extended supported rates IE
1575 *
1576 * This function populates the supported rates and extended supported
1577 * rates IE based in the STA capability. If the number of rates
1578 * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
1579 * IE is populated.
1580 *
1581 * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
1582 * on failure.
1583 */
1584
1585tSirRetStatus
1586PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
1587 tDot11fIESuppRates *p_supp_rates,
1588 tDot11fIEExtSuppRates *p_ext_supp_rates)
1589{
1590 tSirMacRateSet temp_rateset;
1591 tSirMacRateSet temp_rateset2;
1592 uint32_t val, i;
1593 uint32_t self_dot11mode = 0;
1594
1595 wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
1596
1597 /**
1598 * Include 11b rates only when the device configured in
1599 * auto, 11a/b/g or 11b_only
1600 */
1601 if ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
1602 (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1603 (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
1604 (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
1605 (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
1606 (self_dot11mode == WNI_CFG_DOT11_MODE_11B) )
1607 {
1608 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1609 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
1610 (tANI_U8 *)&temp_rateset.rate, &val);
1611 temp_rateset.numRates = (tANI_U8) val;
1612 }
1613 else
1614 {
1615 temp_rateset.numRates = 0;
1616 }
1617
1618 /* Include 11a rates when the device configured in non-11b mode */
1619 if (!IS_DOT11_MODE_11B(self_dot11mode))
1620 {
1621 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1622 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
1623 (tANI_U8 *)&temp_rateset2.rate, &val);
1624 temp_rateset2.numRates = (tANI_U8) val;
1625 }
1626 else
1627 {
1628 temp_rateset2.numRates = 0;
1629 }
1630
1631 if ((temp_rateset.numRates + temp_rateset2.numRates) >
1632 SIR_MAC_MAX_NUMBER_OF_RATES)
1633 {
1634 limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
1635 SIR_MAC_MAX_NUMBER_OF_RATES);
1636 return eSIR_FAILURE;
1637 }
1638
1639 /**
1640 * copy all rates in temp_rateset,
1641 * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
1642 */
1643 for (i = 0; i < temp_rateset2.numRates; i++)
1644 temp_rateset.rate[i + temp_rateset.numRates] =
1645 temp_rateset2.rate[i];
1646
1647 temp_rateset.numRates += temp_rateset2.numRates;
1648
1649 if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
1650 {
1651 p_supp_rates->num_rates = temp_rateset.numRates;
1652 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1653 p_supp_rates->num_rates);
1654 p_supp_rates->present = 1;
1655 }
1656 else /* Populate extended capability as well */
1657 {
1658 p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
1659 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1660 p_supp_rates->num_rates);
1661 p_supp_rates->present = 1;
1662 p_ext_supp_rates->num_rates = temp_rateset.numRates -
1663 MAX_NUM_SUPPORTED_RATES;
1664 vos_mem_copy(p_ext_supp_rates->rates,
1665 (tANI_U8 *)temp_rateset.rate +
1666 MAX_NUM_SUPPORTED_RATES,
1667 p_ext_supp_rates->num_rates);
1668 p_ext_supp_rates->present = 1;
1669 }
1670
1671 return eSIR_SUCCESS;
1672
1673} /* End PopulateDot11fRatesTdls */
1674
Jeff Johnson295189b2012-06-20 16:38:30 -07001675tSirRetStatus
1676PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1677 tDot11fIETPCReport *pDot11f,
1678 tpPESession psessionEntry)
1679{
1680 tANI_U16 staid, txPower;
1681 tSirRetStatus nSirStatus;
1682
1683 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1684 if ( eSIR_SUCCESS != nSirStatus )
1685 {
1686 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1687 "eDot11fTPCReport; limGetMgmtStaid "
Sushant Kaushik87787972015-09-11 16:05:00 +05301688 "returned status %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001689 nSirStatus );
1690 return eSIR_FAILURE;
1691 }
1692
1693 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1694 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1695 txPower = 0;
1696 pDot11f->tx_power = ( tANI_U8 )txPower;
1697 pDot11f->link_margin = 0;
1698 pDot11f->present = 1;
1699
1700 return eSIR_SUCCESS;
1701} // End PopulateDot11fTPCReport.
1702
1703
1704void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1705 tDot11fFfTSInfo *pDot11f)
1706{
1707 pDot11f->traffic_type = pInfo->traffic.trafficType;
1708 pDot11f->tsid = pInfo->traffic.tsid;
1709 pDot11f->direction = pInfo->traffic.direction;
1710 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1711 pDot11f->aggregation = pInfo->traffic.aggregation;
1712 pDot11f->psb = pInfo->traffic.psb;
1713 pDot11f->user_priority = pInfo->traffic.userPrio;
1714 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1715 pDot11f->schedule = pInfo->schedule.schedule;
1716} // End PopulatedDot11fTSInfo.
1717
1718void PopulateDot11fWMM(tpAniSirGlobal pMac,
1719 tDot11fIEWMMInfoAp *pInfo,
1720 tDot11fIEWMMParams *pParams,
1721 tDot11fIEWMMCaps *pCaps,
1722 tpPESession psessionEntry)
1723{
1724 if ( psessionEntry->limWmeEnabled )
1725 {
1726 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1727 {
1728 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1729 {
1730 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1731 }
1732 }
1733 else
1734 {
1735 {
1736 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1737 }
1738
1739 if ( psessionEntry->limWsmEnabled )
1740 {
1741 PopulateDot11fWMMCaps( pCaps );
1742 }
1743 }
1744 }
1745} // End PopulateDot11fWMM.
1746
1747void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1748{
1749 pCaps->version = SIR_MAC_OUI_VERSION_1;
1750 pCaps->qack = 0;
1751 pCaps->queue_request = 1;
1752 pCaps->txop_request = 0;
1753 pCaps->more_ack = 0;
1754 pCaps->present = 1;
1755} // End PopulateDot11fWmmCaps.
1756
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001757#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001758void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1759{
1760 tANI_U8 numTspecs = 0, idx;
1761 tTspecInfo *pTspec = NULL;
1762
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001763 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1764 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001765 pReassoc->num_WMMTSPEC = numTspecs;
1766 if (numTspecs) {
1767 for (idx=0; idx<numTspecs; idx++) {
1768 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301769 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001770 pTspec++;
1771 }
1772 }
1773}
1774#endif
1775
1776void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1777 tpPESession psessionEntry)
1778{
1779 pInfo->version = SIR_MAC_OUI_VERSION_1;
1780
1781 /* WMM Specification 3.1.3, 3.2.3
1782 * An IBSS staion shall always use its default WMM parameters.
1783 */
1784 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1785 {
1786 pInfo->param_set_count = 0;
1787 pInfo->uapsd = 0;
1788 }
1789 else
1790 {
1791 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1793 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1794 }
1795 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1797 }
1798 pInfo->present = 1;
1799}
1800
1801void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1802{
1803 tANI_U32 val = 0;
1804
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301805 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 pInfo->version = SIR_MAC_OUI_VERSION_1;
1807 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1808 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1809 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1810 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1811
1812 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301813 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 pInfo->max_sp_length = (tANI_U8)val;
1815 pInfo->present = 1;
1816}
1817
Jeff Johnson295189b2012-06-20 16:38:30 -07001818void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1819 tDot11fIEWMMParams *pParams,
1820 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001821{
1822 pParams->version = SIR_MAC_OUI_VERSION_1;
1823
Jeff Johnson295189b2012-06-20 16:38:30 -07001824 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1825 pParams->qosInfo =
1826 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1827 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 pParams->qosInfo =
1829 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1830
1831 // Fill each EDCA parameter set in order: be, bk, vi, vo
1832 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1833 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1834 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1835 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1836 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1837 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1838
1839 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1840 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1841 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1842 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1843 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1844 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1845
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1847 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1848 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1850
1851
1852
1853 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1854 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1855 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1856 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1857 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1858
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1860 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1861 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1863
1864 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1865 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1866 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1867 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1868 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1869
1870 pParams->present = 1;
1871
1872} // End PopulateDot11fWMMParams.
1873
1874void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1875 tDot11fIEWMMSchedule *pDot11f)
1876{
1877 pDot11f->version = 1;
1878 pDot11f->aggregation = pSchedule->info.aggregation;
1879 pDot11f->tsid = pSchedule->info.tsid;
1880 pDot11f->direction = pSchedule->info.direction;
1881 pDot11f->reserved = pSchedule->info.rsvd;
1882 pDot11f->service_start_time = pSchedule->svcStartTime;
1883 pDot11f->service_interval = pSchedule->svcInterval;
1884 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1885 pDot11f->spec_interval = pSchedule->specInterval;
1886
1887 pDot11f->present = 1;
1888} // End PopulateDot11fWMMSchedule.
1889
1890tSirRetStatus
1891PopulateDot11fWPA(tpAniSirGlobal pMac,
1892 tpSirRSNie pRsnIe,
1893 tDot11fIEWPA *pDot11f)
1894{
1895 tANI_U32 status;
1896 int idx;
1897
1898 if ( pRsnIe->length )
1899 {
1900 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1901 {
1902 status = dot11fUnpackIeWPA( pMac,
1903 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1904 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1905 pDot11f );
1906 if ( DOT11F_FAILED( status ) )
1907 {
1908 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
Sushant Kaushik87787972015-09-11 16:05:00 +05301909 "A (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001910 status );
1911 return eSIR_FAILURE;
1912 }
1913 }
1914 }
1915
1916 return eSIR_SUCCESS;
1917} // End PopulateDot11fWPA.
1918
1919
1920
1921tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1922 tpSirRSNie pRsnIe,
1923 tDot11fIEWPAOpaque *pDot11f )
1924{
1925 int idx;
1926
1927 if ( pRsnIe->length )
1928 {
1929 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1930 {
1931 pDot11f->present = 1;
1932 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301933 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1935 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1936 }
1937 }
1938
1939 return eSIR_SUCCESS;
1940
1941} // End PopulateDot11fWPAOpaque.
1942
1943////////////////////////////////////////////////////////////////////////
1944
1945tSirRetStatus
1946sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1947{
1948#if 0
1949 tANI_U32 val;
1950
1951 *caps = 0;
1952 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
1953 != eSIR_SUCCESS)
1954 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301955 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 return eSIR_FAILURE;
1957 }
1958 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
1959 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301960 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 return eSIR_FAILURE;
1962 }
1963
1964 *caps = (tANI_U16) val;
1965#endif
1966 return eSIR_SUCCESS;
1967}
1968
1969tSirRetStatus
1970sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
1971 tANI_U8 *pFrame,
1972 tANI_U32 nFrame,
1973 tpSirProbeReq pProbeReq)
1974{
1975 tANI_U32 status;
1976 tDot11fProbeRequest pr;
1977
1978 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301979 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001980
1981 // delegate to the framesc-generated code,
1982 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
1983 if ( DOT11F_FAILED( status ) )
1984 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301985 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001986 status, nFrame);
1987 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1988 return eSIR_FAILURE;
1989 }
1990 else if ( DOT11F_WARNED( status ) )
1991 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301992 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 status, nFrame );
1994 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
1995 }
1996
1997 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
1998 if ( ! pr.SSID.present )
1999 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302000 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 }
2002 else
2003 {
2004 pProbeReq->ssidPresent = 1;
2005 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
2006 }
2007
2008 if ( ! pr.SuppRates.present )
2009 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302010 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002011 return eSIR_FAILURE;
2012 }
2013 else
2014 {
2015 pProbeReq->suppRatesPresent = 1;
2016 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
2017 }
2018
2019 if ( pr.ExtSuppRates.present )
2020 {
2021 pProbeReq->extendedRatesPresent = 1;
2022 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
2023 }
2024
2025 if ( pr.HTCaps.present )
2026 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302027 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 }
2029
2030 if ( pr.WscProbeReq.present )
2031 {
2032 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05302033 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002035#ifdef WLAN_FEATURE_11AC
2036 if ( pr.VHTCaps.present )
2037 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302038 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002039 }
2040#endif
2041
Jeff Johnson295189b2012-06-20 16:38:30 -07002042
2043 if ( pr.P2PProbeReq.present )
2044 {
2045 pProbeReq->p2pIePresent = 1;
2046 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002047
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 return eSIR_SUCCESS;
2049
2050} // End sirConvertProbeReqFrame2Struct.
2051
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302052/* function ValidateAndRectifyIEs checks for the malformed frame.
2053 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302054 * (Tagged elements).
2055 * Every Tagged IE has tag number, tag length and data. Tag length indicates
2056 * the size of data in bytes.
2057 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302058 * And also rectifies missing optional fields in IE.
2059 *
2060 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
2061 * extended to rectify other optional fields in other IEs.
2062 *
2063 */
2064tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
2065 tANI_U8 *pMgmtFrame,
2066 tANI_U32 nFrameBytes,
2067 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302068{
2069 tANI_U32 length = SIZE_OF_FIXED_PARAM;
2070 tANI_U8 *refFrame;
2071
2072 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302073 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302074 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302075 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302076 {
2077 /*refFrame points to next IE */
2078 refFrame = pMgmtFrame + length;
2079 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
2080 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
2081 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302082 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302083 {
2084 /* Workaround : Some APs may not include RSN Capability but
2085 * the length of which is included in RSN IE length.
2086 * this may cause in updating RSN Capability with junk value.
2087 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302088 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302089 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302090 if ((*refFrame == RSNIEID) &&
2091 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302092 {
2093 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302094 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302095 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302096 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302097 limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05302098 FL("Added RSN Capability to the RSNIE as 0x00 0x00"));
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302099
2100 return eHAL_STATUS_SUCCESS;
2101 }
2102 return eSIR_FAILURE;
2103 }
2104 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302105 return eHAL_STATUS_SUCCESS;
2106}
2107
Jeff Johnson295189b2012-06-20 16:38:30 -07002108tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
2109 tANI_U8 *pFrame,
2110 tANI_U32 nFrame,
2111 tpSirProbeRespBeacon pProbeResp)
2112{
2113 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002114 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002115
2116 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302117 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002118
Abhishek Singhc75726d2015-04-13 14:44:14 +05302119 pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302120 if ( NULL == pr )
2121 status = eHAL_STATUS_FAILURE;
2122 else
2123 status = eHAL_STATUS_SUCCESS;
2124 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07002125 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302126 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002127 return eSIR_FAILURE;
2128 }
2129
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302130 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002131
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002133 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 if ( DOT11F_FAILED( status ) )
2135 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302136 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 status, nFrame);
2138 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05302139 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 return eSIR_FAILURE;
2141 }
2142 else if ( DOT11F_WARNED( status ) )
2143 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302144 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002145 status, nFrame );
2146 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2147 }
2148
2149 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
2150
2151 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302152 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
2153 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002154
2155 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07002156 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002157
2158 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07002159 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
2160 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
2161 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
2162 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
2163 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
2164 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
2165 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
2166 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
2167 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
2168 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
2169 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2170 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2171 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2172 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2173 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2174 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002175
Jeff Johnson32d95a32012-09-10 13:15:23 -07002176 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302178 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 }
2180 else
2181 {
2182 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002183 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 }
2185
Jeff Johnson32d95a32012-09-10 13:15:23 -07002186 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302188 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 }
2190 else
2191 {
2192 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002193 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 }
2195
Jeff Johnson32d95a32012-09-10 13:15:23 -07002196 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 {
2198 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002199 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 }
2201
2202
Jeff Johnson32d95a32012-09-10 13:15:23 -07002203 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 {
2205 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002206 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 }
2208
Jeff Johnson32d95a32012-09-10 13:15:23 -07002209 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 {
2211 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002212 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 }
2214
Jeff Johnson32d95a32012-09-10 13:15:23 -07002215 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 {
2217 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002218 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 }
2220
Jeff Johnson32d95a32012-09-10 13:15:23 -07002221 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 {
2223 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302224 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 sizeof(tDot11fIEExtChanSwitchAnn) );
2226 }
2227
Jeff Johnson32d95a32012-09-10 13:15:23 -07002228 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 {
2230 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302231 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 sizeof(tDot11fIEExtChanSwitchAnn) );
2233 }
2234
Jeff Johnson32d95a32012-09-10 13:15:23 -07002235 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 {
2237 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302238 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 }
2240
Jeff Johnson32d95a32012-09-10 13:15:23 -07002241 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 {
2243 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302244 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2245 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 }
2247
Jeff Johnson32d95a32012-09-10 13:15:23 -07002248 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 {
2250 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302251 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 }
2253
Jeff Johnson32d95a32012-09-10 13:15:23 -07002254 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302256 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 }
2258
Jeff Johnson32d95a32012-09-10 13:15:23 -07002259 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302261 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002262 }
2263
Jeff Johnson32d95a32012-09-10 13:15:23 -07002264 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 {
2266 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002267 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002269 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002271 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 }
2273
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002274 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 {
2276 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002277 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 }
2279
Jeff Johnson32d95a32012-09-10 13:15:23 -07002280 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 {
2282 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002283 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 }
2285
Jeff Johnson32d95a32012-09-10 13:15:23 -07002286 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 {
2288 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002289 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05302290 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002291 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 }
2293
Jeff Johnson32d95a32012-09-10 13:15:23 -07002294 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 {
2296 pProbeResp->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05302297 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002298 }
2299
Jeff Johnson32d95a32012-09-10 13:15:23 -07002300 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 {
2302 pProbeResp->wsmCapablePresent = 1;
2303 }
2304
2305
Jeff Johnson32d95a32012-09-10 13:15:23 -07002306 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 {
2308 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002309 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 }
2311
2312#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002313 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002314 {
2315 // MobilityDomain
2316 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302317 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2318 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002319 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002320#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Sushant Kaushik87787972015-09-11 16:05:00 +05302321 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2323#endif
2324 }
2325#endif
2326
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002327#if defined FEATURE_WLAN_ESE
Jeff Johnson32d95a32012-09-10 13:15:23 -07002328 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302330 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 }
2332#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002333 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302335 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 sizeof(tDot11fIEP2PProbeRes) );
2337 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002338#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002339 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002340 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302341 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002342 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002343 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002344 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302345 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002346 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002347 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002348 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302349 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002350 }
2351#endif
Abhishek Singhc75726d2015-04-13 14:44:14 +05302352 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 return eSIR_SUCCESS;
2354
2355} // End sirConvertProbeFrame2Struct.
2356
2357tSirRetStatus
2358sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2359 tANI_U8 *pFrame,
2360 tANI_U32 nFrame,
2361 tpSirAssocReq pAssocReq)
2362{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002363 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 tANI_U32 status;
2365
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302366 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2367 if ( NULL == ar )
2368 status = eHAL_STATUS_FAILURE;
2369 else
2370 status = eHAL_STATUS_SUCCESS;
2371 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002372 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302373 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002374 return eSIR_FAILURE;
2375 }
2376 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302377 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2378 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002379
2380 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002381 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 if ( DOT11F_FAILED( status ) )
2383 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302384 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 status, nFrame);
2386 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302387 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 return eSIR_FAILURE;
2389 }
2390 else if ( DOT11F_WARNED( status ) )
2391 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302392 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 status, nFrame );
2394 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2395 }
2396
2397 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2398
2399 // make sure this is seen as an assoc request
2400 pAssocReq->reassocRequest = 0;
2401
2402 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002403 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2404 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2405 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2406 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2407 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2408 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2409 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2410 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2411 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2412 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2413 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2414 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2415 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2416 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2417 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2418 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002419
2420 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002421 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002422
2423 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002424 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002425 {
2426 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002427 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002428 }
2429
2430 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002431 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002432 {
2433 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002434 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002435 }
2436
2437 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002438 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002439 {
2440 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002441 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 }
2443
2444 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002445 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002446 {
2447 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002448 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002449 }
2450
2451 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002452 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002453 {
2454 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002455 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002456 }
2457
2458 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002459 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 {
2461 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002462 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002463 }
2464
2465 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002466 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002467 {
2468 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002469 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 }
2471
2472
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002473 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 {
2475 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002476 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002478#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002479 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002480 {
2481 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002482 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002483 }
2484#endif
2485
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002487 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 {
2489 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002490 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002491 }
2492
2493 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002494 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002495 {
2496 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002497 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 }
2499
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002500 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302502 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 }
2504
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002505 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002506 {
2507 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302508 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2509 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002510
2511 }
2512
2513
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002514 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002515
2516 if ( ! pAssocReq->ssidPresent )
2517 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302518 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302519 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 return eSIR_FAILURE;
2521 }
2522
2523 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2524 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302525 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302526 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 return eSIR_FAILURE;
2528 }
2529
Jeff Johnsone7245742012-09-05 17:12:55 -07002530#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002531 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002532 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302533 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302534 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002535 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2536 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002537 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002538 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302539 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Sushant Kaushik87787972015-09-11 16:05:00 +05302540 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002541 limLogOperatingMode( pMac, &pAssocReq->operMode);
2542 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002543#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302544 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 return eSIR_SUCCESS;
2546
2547} // End sirConvertAssocReqFrame2Struct.
2548
2549tSirRetStatus
2550sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2551 tANI_U8 *pFrame,
2552 tANI_U32 nFrame,
2553 tpSirAssocRsp pAssocRsp)
2554{
2555 static tDot11fAssocResponse ar;
2556 tANI_U32 status;
2557 tANI_U8 cnt =0;
2558
2559 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302560 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002561
2562 // delegate to the framesc-generated code,
2563 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2564 if ( DOT11F_FAILED( status ) )
2565 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302566 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 status, nFrame);
2568 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2569 return eSIR_FAILURE;
2570 }
2571 else if ( DOT11F_WARNED( status ) )
2572 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302573 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 status, nFrame );
2575 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2576 }
2577
2578 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2579
2580 // Capabilities
2581 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2582 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2583 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2584 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2585 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2586 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2587 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2588 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2589 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2590 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2591 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2592 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2593 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2594 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2595 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2596 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2597
2598 pAssocRsp->statusCode = ar.Status.status;
2599 pAssocRsp->aid = ar.AID.associd;
2600
2601 if ( ! ar.SuppRates.present )
2602 {
2603 pAssocRsp->suppRatesPresent = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302604 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 }
2606 else
2607 {
2608 pAssocRsp->suppRatesPresent = 1;
2609 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2610 }
2611
2612 if ( ar.ExtSuppRates.present )
2613 {
2614 pAssocRsp->extendedRatesPresent = 1;
2615 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2616 }
2617
2618 if ( ar.EDCAParamSet.present )
2619 {
2620 pAssocRsp->edcaPresent = 1;
2621 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2622 }
Atul Mittalbceb4a12014-11-27 18:50:19 +05302623 if (ar.ExtCap.present)
2624 {
2625 vos_mem_copy(&pAssocRsp->ExtCap, &ar.ExtCap, sizeof(tDot11fIEExtCap));
2626 limLog(pMac, LOG1,
2627 FL("ExtCap is present, TDLSChanSwitProhibited: %d"),
2628 ar.ExtCap.TDLSChanSwitProhibited);
2629 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 if ( ar.WMMParams.present )
2631 {
2632 pAssocRsp->wmeEdcaPresent = 1;
2633 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002634 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 __printWMMParams(pMac, &ar.WMMParams);
2636 }
2637
2638 if ( ar.HTCaps.present )
2639 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302640 limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302641 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 }
2643
2644 if ( ar.HTInfo.present )
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302645 { limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302646 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002647 }
2648
2649#ifdef WLAN_FEATURE_VOWIFI_11R
2650 if (ar.MobilityDomain.present)
2651 {
2652 // MobilityDomain
2653 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302654 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2655 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002656 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2657#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002658 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2660#endif
2661 }
2662
2663 if ( ar.FTInfo.present )
2664 {
2665#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002666 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 -07002667 ar.FTInfo.R0KH_ID.present,
2668 ar.FTInfo.R1KH_ID.present);
2669#endif
2670 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302671 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 }
2673#endif
2674
2675#ifdef WLAN_FEATURE_VOWIFI_11R
2676 if (ar.num_RICDataDesc) {
2677 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2678 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302679 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2680 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 }
2682 }
2683 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2684 pAssocRsp->ricPresent = TRUE;
2685 }
2686#endif
2687
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002688#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 if (ar.num_WMMTSPEC) {
2690 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2691 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302692 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2693 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 }
2695 pAssocRsp->tspecPresent = TRUE;
2696 }
2697
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002698 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002699 {
2700 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302701 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002702 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 }
2704#endif
2705
Jeff Johnsone7245742012-09-05 17:12:55 -07002706#ifdef WLAN_FEATURE_11AC
2707 if ( ar.VHTCaps.present )
2708 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302709 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002710 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002711 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2712 }
2713 if ( ar.VHTOperation.present )
2714 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302715 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002716 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002717 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2718 }
2719#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302720 if(ar.OBSSScanParameters.present)
2721 {
2722 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2723 sizeof( tDot11fIEOBSSScanParameters));
2724 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002725 if ( ar.QosMapSet.present )
2726 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002727 pAssocRsp->QosMapSet.present = 1;
2728 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002729 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002730 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002731 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002732 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002733} // End sirConvertAssocRespFrame2Struct.
2734
2735tSirRetStatus
2736sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2737 tANI_U8 *pFrame,
2738 tANI_U32 nFrame,
2739 tpSirAssocReq pAssocReq)
2740{
2741 static tDot11fReAssocRequest ar;
2742 tANI_U32 status;
2743
2744 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302745 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002746
2747 // delegate to the framesc-generated code,
2748 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2749 if ( DOT11F_FAILED( status ) )
2750 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302751 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002752 status, nFrame);
2753 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2754 return eSIR_FAILURE;
2755 }
2756 else if ( DOT11F_WARNED( status ) )
2757 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302758 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002759 status, nFrame );
2760 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2761 }
2762
2763 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2764
2765 // make sure this is seen as a re-assoc request
2766 pAssocReq->reassocRequest = 1;
2767
2768 // Capabilities
2769 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2770 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2771 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2772 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2773 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2774 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2775 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2776 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2777 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2778 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2779 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2780 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2781 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2782 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2783 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2784 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2785
2786 // Listen Interval
2787 pAssocReq->listenInterval = ar.ListenInterval.interval;
2788
2789 // SSID
2790 if ( ar.SSID.present )
2791 {
2792 pAssocReq->ssidPresent = 1;
2793 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2794 }
2795
2796 // Supported Rates
2797 if ( ar.SuppRates.present )
2798 {
2799 pAssocReq->suppRatesPresent = 1;
2800 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2801 }
2802
2803 // Extended Supported Rates
2804 if ( ar.ExtSuppRates.present )
2805 {
2806 pAssocReq->extendedRatesPresent = 1;
2807 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2808 &ar.ExtSuppRates );
2809 }
2810
2811 // QOS Capabilities:
2812 if ( ar.QOSCapsStation.present )
2813 {
2814 pAssocReq->qosCapabilityPresent = 1;
2815 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2816 }
2817
2818 // WPA
2819 if ( ar.WPAOpaque.present )
2820 {
2821 pAssocReq->wpaPresent = 1;
2822 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2823 }
2824
2825 // RSN
2826 if ( ar.RSNOpaque.present )
2827 {
2828 pAssocReq->rsnPresent = 1;
2829 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2830 }
2831
2832
2833 // Power Capabilities
2834 if ( ar.PowerCaps.present )
2835 {
2836 pAssocReq->powerCapabilityPresent = 1;
2837 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2838 }
2839
2840 // Supported Channels
2841 if ( ar.SuppChannels.present )
2842 {
2843 pAssocReq->supportedChannelsPresent = 1;
2844 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2845 }
2846
2847 if ( ar.HTCaps.present )
2848 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302849 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 }
2851
2852 if ( ar.WMMInfoStation.present )
2853 {
2854 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302855 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2856 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002857
2858 }
2859
2860 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2861
2862 if ( ! pAssocReq->ssidPresent )
2863 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302864 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 return eSIR_FAILURE;
2866 }
2867
2868 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2869 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302870 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002871 return eSIR_FAILURE;
2872 }
2873
2874 // Why no call to 'updateAssocReqFromPropCapability' here, like
2875 // there is in 'sirConvertAssocReqFrame2Struct'?
2876
2877 // WSC IE
2878 if (ar.WscIEOpaque.present)
2879 {
2880 pAssocReq->addIEPresent = 1;
2881 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2882 }
2883
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 if(ar.P2PIEOpaque.present)
2885 {
2886 pAssocReq->addIEPresent = 1;
2887 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2888 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002889
Jeff Johnsone7245742012-09-05 17:12:55 -07002890#ifdef WLAN_FEATURE_WFD
2891 if(ar.WFDIEOpaque.present)
2892 {
2893 pAssocReq->addIEPresent = 1;
2894 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2895 }
2896#endif
2897
2898#ifdef WLAN_FEATURE_11AC
2899 if ( ar.VHTCaps.present )
2900 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302901 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002902 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002903 if ( ar.OperatingMode.present )
2904 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302905 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302906 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002907 limLogOperatingMode( pMac, &pAssocReq->operMode);
2908 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002909#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 return eSIR_SUCCESS;
2911
2912} // End sirConvertReassocReqFrame2Struct.
2913
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002914
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002915#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002916tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002917sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002918 tANI_U8 *pPayload,
2919 const tANI_U32 nPayload,
2920 tANI_U8 **outIeBuf,
2921 tANI_U32 *pOutIeLen)
2922{
2923 tDot11fBeaconIEs *pBies = NULL;
2924 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002925 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002926 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002927
2928 /* To store how many bytes are required to be allocated
2929 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002930 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002931 tANI_U8 *pos = NULL;
2932
2933 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002934 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002935 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2936 if ( NULL == pBies )
2937 status = eHAL_STATUS_FAILURE;
2938 else
2939 status = eHAL_STATUS_SUCCESS;
2940 if (!HAL_STATUS_SUCCESS(status))
2941 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302942 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002943 return eSIR_FAILURE;
2944 }
2945 // delegate to the framesc-generated code,
2946 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
2947
2948 if ( DOT11F_FAILED( status ) )
2949 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302950 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002951 status, nPayload);
2952 vos_mem_free(pBies);
2953 return eSIR_FAILURE;
2954 }
2955 else if ( DOT11F_WARNED( status ) )
2956 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302957 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002958 status, nPayload );
2959 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
2960 }
2961
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002962 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002963 if ( !pBies->SSID.present )
2964 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302965 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002966 }
2967 else
2968 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002969 eseBcnReportMandatoryIe.ssidPresent = 1;
2970 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002971 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002972 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002973 }
2974
2975 if ( !pBies->SuppRates.present )
2976 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302977 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002978 }
2979 else
2980 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002981 eseBcnReportMandatoryIe.suppRatesPresent = 1;
2982 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
2983 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002984 }
2985
2986 if ( pBies->FHParamSet.present)
2987 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002988 eseBcnReportMandatoryIe.fhParamPresent = 1;
2989 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002990 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
2991 }
2992
2993 if ( pBies->DSParams.present )
2994 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002995 eseBcnReportMandatoryIe.dsParamsPresent = 1;
2996 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002997 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
2998 }
2999
3000 if ( pBies->CFParams.present )
3001 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003002 eseBcnReportMandatoryIe.cfPresent = 1;
3003 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003004 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
3005 }
3006
3007 if ( pBies->IBSSParams.present )
3008 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003009 eseBcnReportMandatoryIe.ibssParamPresent = 1;
3010 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003011 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3012 }
3013
3014 if ( pBies->TIM.present )
3015 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003016 eseBcnReportMandatoryIe.timPresent = 1;
3017 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
3018 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
3019 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
3020 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003021 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
3022 }
3023
3024 if ( pBies->RRMEnabledCap.present )
3025 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003026 eseBcnReportMandatoryIe.rrmPresent = 1;
3027 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003028 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3029 }
3030
3031 *outIeBuf = vos_mem_malloc(numBytes);
3032 if (NULL == *outIeBuf)
3033 {
3034 limLog(pMac, LOGP, FL("Memory Allocation failure"));
3035 vos_mem_free(pBies);
3036 return eSIR_FAILURE;
3037 }
3038 pos = *outIeBuf;
3039 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003040 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003041
3042 /* Start filling the output Ie with Mandatory IE information */
3043 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003044 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003045 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003046 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003047 {
3048 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
3049 retStatus = eSIR_FAILURE;
3050 goto err_bcnrep;
3051 }
3052 *pos = SIR_MAC_SSID_EID;
3053 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003054 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003055 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003056 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
3057 eseBcnReportMandatoryIe.ssId.length);
3058 pos += eseBcnReportMandatoryIe.ssId.length;
3059 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003060 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003061
3062 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003063 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003064 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003065 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003066 {
3067 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
3068 retStatus = eSIR_FAILURE;
3069 goto err_bcnrep;
3070 }
3071 *pos = SIR_MAC_RATESET_EID;
3072 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003073 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003074 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003075 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
3076 eseBcnReportMandatoryIe.supportedRates.numRates);
3077 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
3078 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003079 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003080
3081 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003082 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003083 {
3084 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
3085 {
3086 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
3087 retStatus = eSIR_FAILURE;
3088 goto err_bcnrep;
3089 }
3090 *pos = SIR_MAC_FH_PARAM_SET_EID;
3091 pos++;
3092 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
3093 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003094 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003095 SIR_MAC_FH_PARAM_SET_EID_MAX);
3096 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
3097 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
3098 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003099
3100 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003101 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003102 {
3103 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
3104 {
3105 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
3106 retStatus = eSIR_FAILURE;
3107 goto err_bcnrep;
3108 }
3109 *pos = SIR_MAC_DS_PARAM_SET_EID;
3110 pos++;
3111 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
3112 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003113 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003114 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
3115 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
3116 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003117
3118 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003119 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003120 {
3121 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
3122 {
3123 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
3124 retStatus = eSIR_FAILURE;
3125 goto err_bcnrep;
3126 }
3127 *pos = SIR_MAC_CF_PARAM_SET_EID;
3128 pos++;
3129 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
3130 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003131 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003132 SIR_MAC_CF_PARAM_SET_EID_MAX);
3133 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
3134 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
3135 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003136
3137 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003138 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003139 {
3140 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
3141 {
3142 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
3143 retStatus = eSIR_FAILURE;
3144 goto err_bcnrep;
3145 }
3146 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
3147 pos++;
3148 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3149 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003150 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003151 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3152 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3153 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3154 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003155
3156 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003157 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003158 {
3159 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
3160 {
3161 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
3162 retStatus = eSIR_FAILURE;
3163 goto err_bcnrep;
3164 }
3165 *pos = SIR_MAC_TIM_EID;
3166 pos++;
3167 *pos = SIR_MAC_TIM_EID_MIN;
3168 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003169 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003170 SIR_MAC_TIM_EID_MIN);
3171 pos += SIR_MAC_TIM_EID_MIN;
3172 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
3173 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003174
3175 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003176 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003177 {
3178 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3179 {
3180 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3181 retStatus = eSIR_FAILURE;
3182 goto err_bcnrep;
3183 }
3184 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3185 pos++;
3186 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3187 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003188 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003189 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3190 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3191 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003192
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003193 if (freeBytes != 0)
3194 {
3195 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3196 retStatus = eSIR_FAILURE;
3197 }
3198
3199err_bcnrep:
3200 /* The message counter would not be incremented in case of
3201 * returning failure and hence next time, this function gets
3202 * called, it would be using the same msg ctr for a different
3203 * BSS.So, it is good to clear the memory allocated for a BSS
3204 * that is returning failure.On success, the caller would take
3205 * care of freeing up the memory*/
3206 if (retStatus == eSIR_FAILURE)
3207 {
3208 vos_mem_free(*outIeBuf);
3209 *outIeBuf = NULL;
3210 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003211 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003212 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003213}
3214
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003215#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003216
Jeff Johnson295189b2012-06-20 16:38:30 -07003217tSirRetStatus
3218sirParseBeaconIE(tpAniSirGlobal pMac,
3219 tpSirProbeRespBeacon pBeaconStruct,
3220 tANI_U8 *pPayload,
3221 tANI_U32 nPayload)
3222{
3223 tDot11fBeaconIEs *pBies;
3224 tANI_U32 status;
3225
3226 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303227 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003228
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303229 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3230 if ( NULL == pBies )
3231 status = eHAL_STATUS_FAILURE;
3232 else
3233 status = eHAL_STATUS_SUCCESS;
3234 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303236 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 return eSIR_FAILURE;
3238 }
3239 // delegate to the framesc-generated code,
3240 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3241
3242 if ( DOT11F_FAILED( status ) )
3243 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303244 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 status, nPayload);
3246 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303247 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 return eSIR_FAILURE;
3249 }
3250 else if ( DOT11F_WARNED( status ) )
3251 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303252 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003253 status, nPayload );
3254 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3255 }
3256
3257 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3258 if ( ! pBies->SSID.present )
3259 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303260 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 }
3262 else
3263 {
3264 pBeaconStruct->ssidPresent = 1;
3265 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3266 }
3267
3268 if ( ! pBies->SuppRates.present )
3269 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303270 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003271 }
3272 else
3273 {
3274 pBeaconStruct->suppRatesPresent = 1;
3275 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3276 }
3277
3278 if ( pBies->ExtSuppRates.present )
3279 {
3280 pBeaconStruct->extendedRatesPresent = 1;
3281 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3282 }
3283
3284 if ( pBies->CFParams.present )
3285 {
3286 pBeaconStruct->cfPresent = 1;
3287 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3288 }
3289
3290 if ( pBies->TIM.present )
3291 {
3292 pBeaconStruct->timPresent = 1;
3293 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3294 }
3295
3296 if ( pBies->Country.present )
3297 {
3298 pBeaconStruct->countryInfoPresent = 1;
3299 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3300 }
3301
3302 // 11h IEs
3303 if(pBies->TPCReport.present)
3304 {
3305 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303306 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 &pBies->TPCReport,
3308 sizeof( tDot11fIETPCReport));
3309 }
3310
3311 if(pBies->PowerConstraints.present)
3312 {
3313 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303314 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 &pBies->PowerConstraints,
3316 sizeof(tDot11fIEPowerConstraints));
3317 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003318#ifdef FEATURE_WLAN_ESE
3319 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003320 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003321 pBeaconStruct->eseTxPwr.present = 1;
3322 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003323 }
3324 if (pBies->QBSSLoad.present)
3325 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303326 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003327 }
3328#endif
3329
3330 if ( pBies->EDCAParamSet.present )
3331 {
3332 pBeaconStruct->edcaPresent = 1;
3333 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3334 }
3335
3336 // QOS Capabilities:
3337 if ( pBies->QOSCapsAp.present )
3338 {
3339 pBeaconStruct->qosCapabilityPresent = 1;
3340 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3341 }
3342
3343
3344
3345 if ( pBies->ChanSwitchAnn.present )
3346 {
3347 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303348 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 sizeof(tDot11fIEChanSwitchAnn));
3350 }
3351
3352 if ( pBies->ExtChanSwitchAnn.present)
3353 {
3354 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303355 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003356 sizeof(tDot11fIEExtChanSwitchAnn));
3357 }
3358
3359 if ( pBies->Quiet.present )
3360 {
3361 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303362 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 }
3364
3365 if ( pBies->HTCaps.present )
3366 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303367 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 }
3369
3370 if ( pBies->HTInfo.present )
3371 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303372 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003373 }
3374
3375 if ( pBies->DSParams.present )
3376 {
3377 pBeaconStruct->dsParamsPresent = 1;
3378 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3379 }
3380 else if(pBies->HTInfo.present)
3381 {
3382 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3383 }
3384
3385 if ( pBies->RSN.present )
3386 {
3387 pBeaconStruct->rsnPresent = 1;
3388 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3389 }
3390
3391 if ( pBies->WPA.present )
3392 {
3393 pBeaconStruct->wpaPresent = 1;
3394 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3395 }
3396
3397 if ( pBies->WMMParams.present )
3398 {
3399 pBeaconStruct->wmeEdcaPresent = 1;
3400 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3401 }
3402
3403 if ( pBies->WMMInfoAp.present )
3404 {
3405 pBeaconStruct->wmeInfoPresent = 1;
3406 }
3407
3408 if ( pBies->WMMCaps.present )
3409 {
3410 pBeaconStruct->wsmCapablePresent = 1;
3411 }
3412
3413
3414 if ( pBies->ERPInfo.present )
3415 {
3416 pBeaconStruct->erpPresent = 1;
3417 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3418 }
3419
Jeff Johnsone7245742012-09-05 17:12:55 -07003420#ifdef WLAN_FEATURE_11AC
3421 if ( pBies->VHTCaps.present )
3422 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303423 pBeaconStruct->VHTCaps.present = 1;
3424 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003425 }
3426 if ( pBies->VHTOperation.present )
3427 {
3428 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303429 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3430 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003431 }
3432 if ( pBies->VHTExtBssLoad.present )
3433 {
3434 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303435 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3436 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003437 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003438 if( pBies->OperatingMode.present)
3439 {
3440 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303441 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3442 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003443 }
3444
Jeff Johnsone7245742012-09-05 17:12:55 -07003445#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303446 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003447
Jeff Johnsone7245742012-09-05 17:12:55 -07003448
Jeff Johnson295189b2012-06-20 16:38:30 -07003449 return eSIR_SUCCESS;
3450
3451} // End sirParseBeaconIE.
3452
3453tSirRetStatus
3454sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3455 tANI_U8 *pFrame,
3456 tpSirProbeRespBeacon pBeaconStruct)
3457{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003458 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 tANI_U32 status, nPayload;
3460 tANI_U8 *pPayload;
3461 tpSirMacMgmtHdr pHdr;
3462 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003463 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003464
3465 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3466 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3467 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3468 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003469 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003470
3471 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303472 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3473
Abhishek Singhc75726d2015-04-13 14:44:14 +05303474 pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303475 if ( NULL == pBeacon )
3476 status = eHAL_STATUS_FAILURE;
3477 else
3478 status = eHAL_STATUS_SUCCESS;
3479 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003480 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303481 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003482 return eSIR_FAILURE;
3483 }
3484
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303485 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003486
3487 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303488 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003489
3490 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003491 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 if ( DOT11F_FAILED( status ) )
3493 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303494 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 status, nPayload);
3496 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05303497 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 return eSIR_FAILURE;
3499 }
3500 else if ( DOT11F_WARNED( status ) )
3501 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303502 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 status, nPayload );
3504 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3505 }
3506
3507 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3508 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303509 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3510 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003511
3512 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003513 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003514
3515 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003516 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3517 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3518 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3519 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3520 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3521 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3522 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3523 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3524 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3525 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3526 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3527 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3528 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3529 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3530 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3531 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003532
Jeff Johnson32d95a32012-09-10 13:15:23 -07003533 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303535 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003536 }
3537 else
3538 {
3539 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003540 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003541 }
3542
Jeff Johnson32d95a32012-09-10 13:15:23 -07003543 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303545 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003546 }
3547 else
3548 {
3549 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003550 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003551 }
3552
Jeff Johnson32d95a32012-09-10 13:15:23 -07003553 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003554 {
3555 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003556 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 }
3558
3559
Jeff Johnson32d95a32012-09-10 13:15:23 -07003560 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003561 {
3562 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003563 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003564 }
3565
Jeff Johnson32d95a32012-09-10 13:15:23 -07003566 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003567 {
3568 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003569 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 }
3571
Jeff Johnson32d95a32012-09-10 13:15:23 -07003572 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003573 {
3574 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003575 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003576 }
3577
3578 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003579 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003580 {
3581 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003582 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003583 }
3584
Jeff Johnson32d95a32012-09-10 13:15:23 -07003585 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003586 {
3587 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003588 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003589 }
3590
Jeff Johnson32d95a32012-09-10 13:15:23 -07003591 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003592 {
3593 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303594 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003595 sizeof(tDot11fIEChanSwitchAnn) );
3596 }
3597
Jeff Johnson32d95a32012-09-10 13:15:23 -07003598 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 {
3600 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303601 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003602 sizeof(tDot11fIEExtChanSwitchAnn) );
3603 }
3604
Jeff Johnson32d95a32012-09-10 13:15:23 -07003605 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 {
3607 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303608 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003609 sizeof(tDot11fIETPCReport));
3610 }
3611
Jeff Johnson32d95a32012-09-10 13:15:23 -07003612 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 {
3614 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303615 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003616 sizeof(tDot11fIEPowerConstraints));
3617 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003618
3619 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003620 {
3621 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303622 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 }
3624
Jeff Johnson32d95a32012-09-10 13:15:23 -07003625 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003626 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303627 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 }
3629
Jeff Johnson32d95a32012-09-10 13:15:23 -07003630 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003631 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303632 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003633
3634 }
3635
Jeff Johnson32d95a32012-09-10 13:15:23 -07003636 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003637 {
3638 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003639 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003640 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003641 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003642 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003643 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003644 }
3645 else
3646 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003647 if ((!rfBand) || IS_5G_BAND(rfBand))
3648 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3649 else if (IS_24G_BAND(rfBand))
3650 pBeaconStruct->channelNumber = mappedRXCh;
3651 else
3652 {
3653 /*Only 0, 1, 2 are expected values for RF band from FW
3654 * if FW fixes are not present then rf band value will
3655 * be 0, else either 1 or 2 are expected from FW, 3 is
3656 * not expected from FW */
3657 PELOGE(limLog(pMac, LOGE,
3658 FL("Channel info is not present in Beacon and"
3659 " mapping is not done correctly"));)
3660 pBeaconStruct->channelNumber = mappedRXCh;
3661 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003662 }
3663
Jeff Johnson32d95a32012-09-10 13:15:23 -07003664 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 {
3666 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003667 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 }
3669
Jeff Johnson32d95a32012-09-10 13:15:23 -07003670 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 {
3672 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003673 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003674 }
3675
Jeff Johnson32d95a32012-09-10 13:15:23 -07003676 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003677 {
3678 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003679 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05303680 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003681 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 }
3683
Jeff Johnson32d95a32012-09-10 13:15:23 -07003684 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003685 {
3686 pBeaconStruct->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05303687 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 }
3689
Jeff Johnson32d95a32012-09-10 13:15:23 -07003690 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003691 {
3692 pBeaconStruct->wsmCapablePresent = 1;
3693 }
3694
Jeff Johnson32d95a32012-09-10 13:15:23 -07003695 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 {
3697 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003698 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003699 }
3700
3701#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003702 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 {
3704 // MobilityDomain
3705 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303706 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3707 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003708 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003709
3710 }
3711#endif
3712
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003713#ifdef FEATURE_WLAN_ESE
3714 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303715 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003716 //ESE Tx Power
3717 pBeaconStruct->eseTxPwr.present = 1;
3718 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3719 &pBeacon->ESETxmitPower,
3720 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303721 }
3722#endif
3723
Jeff Johnsone7245742012-09-05 17:12:55 -07003724#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003725 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003726 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303727 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003728 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003729 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003730 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303731 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3732 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003733 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003734 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003735 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303736 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3737 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003738 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003739 if(pBeacon->OperatingMode.present)
3740 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303741 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3742 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003743 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003744 if(pBeacon->WiderBWChanSwitchAnn.present)
3745 {
3746 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303747 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3748 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003749 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003750#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303751 if(pBeacon->OBSSScanParameters.present)
3752 {
3753 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3754 &pBeacon->OBSSScanParameters,
3755 sizeof( tDot11fIEOBSSScanParameters));
3756 }
Abhishek Singhc75726d2015-04-13 14:44:14 +05303757 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003758 return eSIR_SUCCESS;
3759
3760} // End sirConvertBeaconFrame2Struct.
3761
3762tSirRetStatus
3763sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3764 tANI_U8 *pFrame,
3765 tANI_U32 nFrame,
3766 tpSirMacAuthFrameBody pAuth)
3767{
3768 static tDot11fAuthentication auth;
3769 tANI_U32 status;
3770
3771 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303772 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003773
3774 // delegate to the framesc-generated code,
3775 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3776 if ( DOT11F_FAILED( status ) )
3777 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303778 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 status, nFrame);
3780 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3781 return eSIR_FAILURE;
3782 }
3783 else if ( DOT11F_WARNED( status ) )
3784 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303785 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003786 status, nFrame );
3787 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3788 }
3789
3790 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3791 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3792 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3793 pAuth->authStatusCode = auth.Status.status;
3794
3795 if ( auth.ChallengeText.present )
3796 {
3797 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3798 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303799 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 }
3801
3802 return eSIR_SUCCESS;
3803
3804} // End sirConvertAuthFrame2Struct.
3805
3806tSirRetStatus
3807sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3808 tANI_U8 *pFrame,
3809 tANI_U32 nFrame,
3810 tSirAddtsReqInfo *pAddTs)
3811{
3812 tDot11fAddTSRequest addts = {{0}};
3813 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3814 tANI_U8 j;
3815 tANI_U16 i;
3816 tANI_U32 status;
3817
3818 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3819 {
3820 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3821 "with an Action of %d; this is not "
3822 "supported & is probably an error."),
3823 *( pFrame + 1 ) );
3824 return eSIR_FAILURE;
3825 }
3826
3827 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303828 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003829
3830 // delegate to the framesc-generated code,
3831 switch ( *pFrame )
3832 {
3833 case SIR_MAC_ACTION_QOS_MGMT:
3834 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3835 break;
3836 case SIR_MAC_ACTION_WME:
3837 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3838 break;
3839 default:
3840 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3841 "with a Category of %d; this is not"
3842 " supported & is probably an error."),
3843 *pFrame );
3844 return eSIR_FAILURE;
3845 }
3846
3847 if ( DOT11F_FAILED( status ) )
3848 {
3849 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05303850 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003851 status, nFrame);
3852 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3853 return eSIR_FAILURE;
3854 }
3855 else if ( DOT11F_WARNED( status ) )
3856 {
3857 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3858 "g an Add TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05303859 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003860 status, nFrame );
3861 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3862 }
3863
3864 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3865 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3866 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3867 {
3868 pAddTs->dialogToken = addts.DialogToken.token;
3869
3870 if ( addts.TSPEC.present )
3871 {
3872 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3873 }
3874 else
3875 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303876 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 return eSIR_FAILURE;
3878 }
3879
3880 if ( addts.num_TCLAS )
3881 {
3882 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3883
3884 for ( i = 0U; i < addts.num_TCLAS; ++i )
3885 {
3886 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3887 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303888 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003889 return eSIR_FAILURE;
3890 }
3891 }
3892 }
3893
3894 if ( addts.TCLASSPROC.present )
3895 {
3896 pAddTs->tclasProcPresent = 1;
3897 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3898 }
3899
3900 if ( addts.WMMTSPEC.present )
3901 {
3902 pAddTs->wsmTspecPresent = 1;
3903 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3904 }
3905
3906 if ( addts.num_WMMTCLAS )
3907 {
3908 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3909 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3910
3911 for ( i = pAddTs->numTclas; i < j; ++i )
3912 {
3913 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3914 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303915 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003916 return eSIR_FAILURE;
3917 }
3918 }
3919 }
3920
3921 if ( addts.WMMTCLASPROC.present )
3922 {
3923 pAddTs->tclasProcPresent = 1;
3924 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
3925 }
3926
3927 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
3928 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303929 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07003930 pAddTs->numTclas );
3931 return eSIR_FAILURE;
3932 }
3933 }
3934 else
3935 {
3936 pAddTs->dialogToken = wmmaddts.DialogToken.token;
3937
3938 if ( wmmaddts.WMMTSPEC.present )
3939 {
3940 pAddTs->wmeTspecPresent = 1;
3941 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
3942 }
3943 else
3944 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303945 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003946 return eSIR_FAILURE;
3947 }
3948 }
3949
3950 return eSIR_SUCCESS;
3951
3952} // End sirConvertAddtsReq2Struct.
3953
3954tSirRetStatus
3955sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
3956 tANI_U8 *pFrame,
3957 tANI_U32 nFrame,
3958 tSirAddtsRspInfo *pAddTs)
3959{
3960 tDot11fAddTSResponse addts = {{0}};
3961 tDot11fWMMAddTSResponse wmmaddts = {{0}};
3962 tANI_U8 j;
3963 tANI_U16 i;
3964 tANI_U32 status;
3965
3966 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
3967 {
3968 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3969 "with an Action of %d; this is not "
3970 "supported & is probably an error."),
3971 *( pFrame + 1 ) );
3972 return eSIR_FAILURE;
3973 }
3974
3975 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303976 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
3977 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
3978 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003979
3980
3981 // delegate to the framesc-generated code,
3982 switch ( *pFrame )
3983 {
3984 case SIR_MAC_ACTION_QOS_MGMT:
3985 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
3986 break;
3987 case SIR_MAC_ACTION_WME:
3988 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
3989 break;
3990 default:
3991 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
3992 "with a Category of %d; this is not"
3993 " supported & is probably an error."),
3994 *pFrame );
3995 return eSIR_FAILURE;
3996 }
3997
3998 if ( DOT11F_FAILED( status ) )
3999 {
4000 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304001 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004002 status, nFrame);
4003 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4004 return eSIR_FAILURE;
4005 }
4006 else if ( DOT11F_WARNED( status ) )
4007 {
4008 limLog( pMac, LOGW, FL("There were warnings while unpackin"
4009 "g an Add TS Response frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304010 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 status, nFrame );
4012 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4013 }
4014
4015 // & "transliterate" from a 'tDot11fAddTSResponse' or a
4016 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
4017 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4018 {
4019 pAddTs->dialogToken = addts.DialogToken.token;
4020 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
4021
4022 if ( addts.TSDelay.present )
4023 {
4024 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
4025 }
4026
4027 // TS Delay is present iff status indicates its presence
4028 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
4029 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304030 limLog( pMac, LOGW, FL("Missing TSDelay IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004031 }
4032
4033 if ( addts.TSPEC.present )
4034 {
4035 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
4036 }
4037 else
4038 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304039 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 return eSIR_FAILURE;
4041 }
4042
4043 if ( addts.num_TCLAS )
4044 {
4045 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4046
4047 for ( i = 0U; i < addts.num_TCLAS; ++i )
4048 {
4049 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4050 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304051 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 return eSIR_FAILURE;
4053 }
4054 }
4055 }
4056
4057 if ( addts.TCLASSPROC.present )
4058 {
4059 pAddTs->tclasProcPresent = 1;
4060 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4061 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004062#ifdef FEATURE_WLAN_ESE
4063 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 {
4065 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304066 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004067 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 }
4069#endif
4070 if ( addts.Schedule.present )
4071 {
4072 pAddTs->schedulePresent = 1;
4073 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
4074 }
4075
4076 if ( addts.WMMSchedule.present )
4077 {
4078 pAddTs->schedulePresent = 1;
4079 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
4080 }
4081
4082 if ( addts.WMMTSPEC.present )
4083 {
4084 pAddTs->wsmTspecPresent = 1;
4085 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4086 }
4087
4088 if ( addts.num_WMMTCLAS )
4089 {
4090 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
4091 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
4092
4093 for ( i = pAddTs->numTclas; i < j; ++i )
4094 {
4095 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4096 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304097 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004098 return eSIR_FAILURE;
4099 }
4100 }
4101 }
4102
4103 if ( addts.WMMTCLASPROC.present )
4104 {
4105 pAddTs->tclasProcPresent = 1;
4106 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4107 }
4108
4109 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4110 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304111 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 pAddTs->numTclas );
4113 return eSIR_FAILURE;
4114 }
4115 }
4116 else
4117 {
4118 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4119 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
4120
4121 if ( wmmaddts.WMMTSPEC.present )
4122 {
4123 pAddTs->wmeTspecPresent = 1;
4124 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4125 }
4126 else
4127 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304128 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004129 return eSIR_FAILURE;
4130 }
4131
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004132#ifdef FEATURE_WLAN_ESE
4133 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004134 {
4135 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304136 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004137 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004138 }
4139#endif
4140
4141 }
4142
4143 return eSIR_SUCCESS;
4144
4145} // End sirConvertAddtsRsp2Struct.
4146
4147tSirRetStatus
4148sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
4149 tANI_U8 *pFrame,
4150 tANI_U32 nFrame,
4151 tSirDeltsReqInfo *pDelTs)
4152{
4153 tDot11fDelTS delts = {{0}};
4154 tDot11fWMMDelTS wmmdelts = {{0}};
4155 tANI_U32 status;
4156
4157 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
4158 {
4159 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4160 "with an Action of %d; this is not "
4161 "supported & is probably an error."),
4162 *( pFrame + 1 ) );
4163 return eSIR_FAILURE;
4164 }
4165
4166 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304167 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004168
4169 // delegate to the framesc-generated code,
4170 switch ( *pFrame )
4171 {
4172 case SIR_MAC_ACTION_QOS_MGMT:
4173 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
4174 break;
4175 case SIR_MAC_ACTION_WME:
4176 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4177 break;
4178 default:
4179 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4180 "with a Category of %d; this is not"
4181 " supported & is probably an error."),
4182 *pFrame );
4183 return eSIR_FAILURE;
4184 }
4185
4186 if ( DOT11F_FAILED( status ) )
4187 {
4188 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304189 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 status, nFrame);
4191 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4192 return eSIR_FAILURE;
4193 }
4194 else if ( DOT11F_WARNED( status ) )
4195 {
4196 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4197 "g an Del TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304198 "%d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 status, nFrame );
4200 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4201 }
4202
4203 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4204 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4205 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4206 {
4207 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4208 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4209 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4210 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4211 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4212 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4213 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4214 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4215
4216 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4217 }
4218 else
4219 {
4220 if ( wmmdelts.WMMTSPEC.present )
4221 {
4222 pDelTs->wmeTspecPresent = 1;
4223 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4224 }
4225 else
4226 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304227 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 return eSIR_FAILURE;
4229 }
4230 }
4231
4232 return eSIR_SUCCESS;
4233
4234} // End sirConvertDeltsReq2Struct.
4235
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004236tSirRetStatus
4237sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4238 tANI_U8 *pFrame,
4239 tANI_U32 nFrame,
4240 tSirQosMapSet *pQosMapSet)
4241{
4242 tDot11fQosMapConfigure mapConfigure;
4243 tANI_U32 status;
4244 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
4245 if ( DOT11F_FAILED( status ) )
4246 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304247 dot11fLog(pMac, LOGE, FL("Failed to parse Qos Map Configure frame (0x%08x, %d bytes):"),
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004248 status, nFrame);
4249 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4250 return eSIR_FAILURE;
4251 }
4252 else if ( DOT11F_WARNED( status ) )
4253 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304254 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 -07004255 status, nFrame );
4256 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4257 }
4258 pQosMapSet->present = mapConfigure.QosMapSet.present;
4259 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004260 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004261 return eSIR_SUCCESS;
4262}
Jeff Johnson295189b2012-06-20 16:38:30 -07004263
4264#ifdef ANI_SUPPORT_11H
4265tSirRetStatus
4266sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4267 tANI_U8 *pFrame,
4268 tpSirMacTpcReqActionFrame pTpcReqFrame,
4269 tANI_U32 nFrame)
4270{
4271 tDot11fTPCRequest req;
4272 tANI_U32 status;
4273
4274 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304275 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004276
4277 // delegate to the framesc-generated code,
4278 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4279 if ( DOT11F_FAILED( status ) )
4280 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304281 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 status, nFrame);
4283 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4284 return eSIR_FAILURE;
4285 }
4286 else if ( DOT11F_WARNED( status ) )
4287 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304288 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004289 status, nFrame );
4290 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4291 }
4292
4293 // & "transliterate" from a 'tDot11fTPCRequest' to a
4294 // 'tSirMacTpcReqActionFrame'...
4295 pTpcReqFrame->actionHeader.category = req.Category.category;
4296 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4297 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4298 if ( req.TPCRequest.present )
4299 {
4300 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4301 pTpcReqFrame->length = 0;
4302 }
4303 else
4304 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304305 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 return eSIR_FAILURE;
4307 }
4308
4309 return eSIR_SUCCESS;
4310
4311} // End sirConvertTpcReqFrame2Struct.
4312
4313
4314tSirRetStatus
4315sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4316 tANI_U8 *pFrame,
4317 tpSirMacMeasReqActionFrame pMeasReqFrame,
4318 tANI_U32 nFrame)
4319{
4320 tDot11fMeasurementRequest mr;
4321 tANI_U32 status;
4322
4323 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304324 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(tpSirMacMeasReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004325
4326 // delegate to the framesc-generated code,
4327 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4328 if ( DOT11F_FAILED( status ) )
4329 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304330 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004331 status, nFrame);
4332 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4333 return eSIR_FAILURE;
4334 }
4335 else if ( DOT11F_WARNED( status ) )
4336 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304337 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004338 status, nFrame );
4339 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4340 }
4341
4342 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4343 // 'tpSirMacMeasReqActionFrame'...
4344 pMeasReqFrame->actionHeader.category = mr.Category.category;
4345 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4346 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4347
4348 if ( 0 == mr.num_MeasurementRequest )
4349 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304350 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004351 return eSIR_FAILURE;
4352 }
4353 else if ( 1 < mr.num_MeasurementRequest )
4354 {
4355 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4356 }
4357
4358 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4359 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4360 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4361 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4362 ( mr.MeasurementRequest[0].enable << 2 ) |
4363 ( mr.MeasurementRequest[0].request << 1 ) |
4364 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4365 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4366
4367 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4368
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304369 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004370 mr.MeasurementRequest[0].meas_start_time, 8 );
4371
4372 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4373
4374 return eSIR_SUCCESS;
4375
4376} // End sirConvertMeasReqFrame2Struct.
4377#endif
4378
4379
4380void
4381PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4382 tDot11fIETSPEC *pDot11f)
4383{
4384 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4385 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4386 pDot11f->direction = pOld->tsinfo.traffic.direction;
4387 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4388 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4389 pDot11f->psb = pOld->tsinfo.traffic.psb;
4390 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4391 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4392 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4393 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4394 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4395 */
4396 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4397 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4398 pDot11f->max_msdu_size = pOld->maxMsduSz;
4399 pDot11f->min_service_int = pOld->minSvcInterval;
4400 pDot11f->max_service_int = pOld->maxSvcInterval;
4401 pDot11f->inactivity_int = pOld->inactInterval;
4402 pDot11f->suspension_int = pOld->suspendInterval;
4403 pDot11f->service_start_time = pOld->svcStartTime;
4404 pDot11f->min_data_rate = pOld->minDataRate;
4405 pDot11f->mean_data_rate = pOld->meanDataRate;
4406 pDot11f->peak_data_rate = pOld->peakDataRate;
4407 pDot11f->burst_size = pOld->maxBurstSz;
4408 pDot11f->delay_bound = pOld->delayBound;
4409 pDot11f->min_phy_rate = pOld->minPhyRate;
4410 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4411 pDot11f->medium_time = pOld->mediumTime;
4412
4413 pDot11f->present = 1;
4414
4415} // End PopulateDot11fTSPEC.
4416
4417void
4418PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4419 tDot11fIEWMMTSPEC *pDot11f)
4420{
4421 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4422 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4423 pDot11f->direction = pOld->tsinfo.traffic.direction;
4424 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4425 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4426 pDot11f->psb = pOld->tsinfo.traffic.psb;
4427 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4428 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4429 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4430 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4431 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4432 */
4433 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4434 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4435 pDot11f->max_msdu_size = pOld->maxMsduSz;
4436 pDot11f->min_service_int = pOld->minSvcInterval;
4437 pDot11f->max_service_int = pOld->maxSvcInterval;
4438 pDot11f->inactivity_int = pOld->inactInterval;
4439 pDot11f->suspension_int = pOld->suspendInterval;
4440 pDot11f->service_start_time = pOld->svcStartTime;
4441 pDot11f->min_data_rate = pOld->minDataRate;
4442 pDot11f->mean_data_rate = pOld->meanDataRate;
4443 pDot11f->peak_data_rate = pOld->peakDataRate;
4444 pDot11f->burst_size = pOld->maxBurstSz;
4445 pDot11f->delay_bound = pOld->delayBound;
4446 pDot11f->min_phy_rate = pOld->minPhyRate;
4447 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4448 pDot11f->medium_time = pOld->mediumTime;
4449
4450 pDot11f->version = 1;
4451 pDot11f->present = 1;
4452
4453} // End PopulateDot11fWMMTSPEC.
4454
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004455#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004456
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004457// Fill the ESE version currently supported
4458void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004459{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004460 pESEVersion->present = 1;
4461 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004462}
4463
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004464// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004465// The State is Normal (1)
4466// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004467void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004468{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004469 pESERadMgmtCap->present = 1;
4470 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4471 pESERadMgmtCap->mbssid_mask = 0;
4472 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004473}
4474
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004475tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004476 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004477 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004478{
4479 int idx;
4480
4481 if ( pCCKMie->length )
4482 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004483 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004484 {
4485 pDot11f->present = 1;
4486 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004487 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004488 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4489 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4490 }
4491 }
4492
4493 return eSIR_SUCCESS;
4494
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004495} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004496
Jeff Johnson295189b2012-06-20 16:38:30 -07004497void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004498 tSirMacESETSRSIE *pOld,
4499 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004500 tANI_U8 rate_length)
4501{
4502 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304503 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004504 pDot11f->num_tsrates = rate_length;
4505 pDot11f->present = 1;
4506}
4507#endif
4508
4509
4510tSirRetStatus
4511PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4512 tSirTclasInfo *pOld,
4513 tDot11fIETCLAS *pDot11f)
4514{
4515 pDot11f->user_priority = pOld->tclas.userPrio;
4516 pDot11f->classifier_type = pOld->tclas.classifierType;
4517 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4518
4519 switch ( pDot11f->classifier_type )
4520 {
4521 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304522 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4523 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4524 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4525 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4527 break;
4528 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4529 pDot11f->info.IpParams.version = pOld->version;
4530 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4531 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304532 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304533 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304534 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4535 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304536 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304537 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 pDot11f->info.IpParams.params.IpV4Params.src_port =
4539 pOld->tclasParams.ipv4.srcPort;
4540 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4541 pOld->tclasParams.ipv4.dstPort;
4542 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4543 pOld->tclasParams.ipv4.dscp;
4544 pDot11f->info.IpParams.params.IpV4Params.proto =
4545 pOld->tclasParams.ipv4.protocol;
4546 pDot11f->info.IpParams.params.IpV4Params.reserved =
4547 pOld->tclasParams.ipv4.rsvd;
4548 }
4549 else
4550 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304551 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 IpV6Params.source,
4553 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304554 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004555 IpV6Params.dest,
4556 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4557 pDot11f->info.IpParams.params.IpV6Params.src_port =
4558 pOld->tclasParams.ipv6.srcPort;
4559 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4560 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304561 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 IpV6Params.flow_label,
4563 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4564 }
4565 break;
4566 case SIR_MAC_TCLASTYPE_8021DQ:
4567 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4568 break;
4569 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304570 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 pDot11f->classifier_type );
4572 return eSIR_FAILURE;
4573 }
4574
4575 pDot11f->present = 1;
4576
4577 return eSIR_SUCCESS;
4578
4579} // End PopulateDot11fTCLAS.
4580
4581tSirRetStatus
4582PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4583 tSirTclasInfo *pOld,
4584 tDot11fIEWMMTCLAS *pDot11f)
4585{
4586 pDot11f->version = 1;
4587 pDot11f->user_priority = pOld->tclas.userPrio;
4588 pDot11f->classifier_type = pOld->tclas.classifierType;
4589 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4590
4591 switch ( pDot11f->classifier_type )
4592 {
4593 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304594 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304596 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4598 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4599 break;
4600 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4601 pDot11f->info.IpParams.version = pOld->version;
4602 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4603 {
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 IpV4Params.source,
4606 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304607 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 IpV4Params.dest,
4609 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4610 pDot11f->info.IpParams.params.IpV4Params.src_port =
4611 pOld->tclasParams.ipv4.srcPort;
4612 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4613 pOld->tclasParams.ipv4.dstPort;
4614 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4615 pOld->tclasParams.ipv4.dscp;
4616 pDot11f->info.IpParams.params.IpV4Params.proto =
4617 pOld->tclasParams.ipv4.protocol;
4618 pDot11f->info.IpParams.params.IpV4Params.reserved =
4619 pOld->tclasParams.ipv4.rsvd;
4620 }
4621 else
4622 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304623 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004624 IpV6Params.source,
4625 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304626 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004627 IpV6Params.dest,
4628 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4629 pDot11f->info.IpParams.params.IpV6Params.src_port =
4630 pOld->tclasParams.ipv6.srcPort;
4631 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4632 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304633 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004634 IpV6Params.flow_label,
4635 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4636 }
4637 break;
4638 case SIR_MAC_TCLASTYPE_8021DQ:
4639 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4640 break;
4641 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304642 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 pDot11f->classifier_type );
4644 return eSIR_FAILURE;
4645 }
4646
4647 pDot11f->present = 1;
4648
4649 return eSIR_SUCCESS;
4650
4651} // End PopulateDot11fWMMTCLAS.
4652
Jeff Johnson295189b2012-06-20 16:38:30 -07004653
4654tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4655 tDot11fIEWscBeacon *pDot11f)
4656{
4657
4658 tANI_U32 wpsState;
4659
4660 pDot11f->Version.present = 1;
4661 pDot11f->Version.major = 0x01;
4662 pDot11f->Version.minor = 0x00;
4663
4664 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304665 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004666
4667 pDot11f->WPSState.present = 1;
4668 pDot11f->WPSState.state = (tANI_U8) wpsState;
4669
4670 pDot11f->APSetupLocked.present = 0;
4671
4672 pDot11f->SelectedRegistrar.present = 0;
4673
4674 pDot11f->DevicePasswordID.present = 0;
4675
4676 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4677
4678 pDot11f->UUID_E.present = 0;
4679
4680 pDot11f->RFBands.present = 0;
4681
4682 pDot11f->present = 1;
4683 return eSIR_SUCCESS;
4684}
4685
4686tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4687 tDot11fIEWscBeacon *pDot11f)
4688{
4689 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4690 tANI_U32 devicepasswdId;
4691
4692
4693 pDot11f->APSetupLocked.present = 1;
4694 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4695
4696 pDot11f->SelectedRegistrar.present = 1;
4697 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4698
4699 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304700 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07004701
4702 pDot11f->DevicePasswordID.present = 1;
4703 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4704
4705 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4706 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4707
4708 // UUID_E and RF Bands are applicable only for dual band AP
4709
4710 return eSIR_SUCCESS;
4711}
4712
4713tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4714 tDot11fIEWscBeacon *pDot11f)
4715{
4716 pDot11f->APSetupLocked.present = 0;
4717 pDot11f->SelectedRegistrar.present = 0;
4718 pDot11f->DevicePasswordID.present = 0;
4719 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4720
4721 return eSIR_SUCCESS;
4722}
Jeff Johnson295189b2012-06-20 16:38:30 -07004723tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4724{
4725
4726 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4727
4728 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4729
4730
4731 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4732 {
4733 pDot11f->present = 1;
4734 pDot11f->Version.present = 1;
4735 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4736 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4737 }
4738 else
4739 {
4740 pDot11f->present = 0;
4741 pDot11f->Version.present = 0;
4742 }
4743
4744 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4745 {
4746
4747 pDot11f->WPSState.present = 1;
4748 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4749 }
4750 else
4751 pDot11f->WPSState.present = 0;
4752
4753 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4754 {
4755 pDot11f->APSetupLocked.present = 1;
4756 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4757 }
4758 else
4759 pDot11f->APSetupLocked.present = 0;
4760
4761 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4762 {
4763 pDot11f->SelectedRegistrar.present = 1;
4764 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4765 }
4766 else
4767 pDot11f->SelectedRegistrar.present = 0;
4768
4769 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4770 {
4771 pDot11f->DevicePasswordID.present = 1;
4772 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4773 }
4774 else
4775 pDot11f->DevicePasswordID.present = 0;
4776
4777 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4778 {
4779 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4780 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4781 }
4782 else
4783 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4784
4785 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4786 {
4787 pDot11f->ResponseType.present = 1;
4788 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4789 }
4790 else
4791 pDot11f->ResponseType.present = 0;
4792
4793 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4794 {
4795 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304796 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004797 }
4798 else
4799 pDot11f->UUID_E.present = 0;
4800
4801 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4802 {
4803 pDot11f->Manufacturer.present = 1;
4804 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304805 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4806 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004807 }
4808 else
4809 pDot11f->Manufacturer.present = 0;
4810
4811 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4812 {
4813 pDot11f->ModelName.present = 1;
4814 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304815 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4816 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004817 }
4818 else
4819 pDot11f->ModelName.present = 0;
4820
4821 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4822 {
4823 pDot11f->ModelNumber.present = 1;
4824 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304825 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4826 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004827 }
4828 else
4829 pDot11f->ModelNumber.present = 0;
4830
4831 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4832 {
4833 pDot11f->SerialNumber.present = 1;
4834 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304835 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4836 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004837 }
4838 else
4839 pDot11f->SerialNumber.present = 0;
4840
4841 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4842 {
4843 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304844 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4845 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004846 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4847 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4848 }
4849 else
4850 pDot11f->PrimaryDeviceType.present = 0;
4851
4852 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4853 {
4854 pDot11f->DeviceName.present = 1;
4855 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304856 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4857 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004858 }
4859 else
4860 pDot11f->DeviceName.present = 0;
4861
4862 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4863 {
4864 pDot11f->ConfigMethods.present = 1;
4865 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4866 }
4867 else
4868 pDot11f->ConfigMethods.present = 0;
4869
4870
4871 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4872 {
4873 pDot11f->RFBands.present = 1;
4874 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4875 }
4876 else
4877 pDot11f->RFBands.present = 0;
4878
4879 return eSIR_SUCCESS;
4880}
4881tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4882{
4883 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4884
4885 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4886
4887 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4888 {
4889 pDot11f->present = 1;
4890 pDot11f->Version.present = 1;
4891 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4892 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4893 }
4894 else
4895 {
4896 pDot11f->present = 0;
4897 pDot11f->Version.present = 0;
4898 }
4899
4900 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4901 {
4902 pDot11f->ResponseType.present = 1;
4903 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4904 }
4905 else
4906 pDot11f->ResponseType.present = 0;
4907
4908 return eSIR_SUCCESS;
4909}
4910
4911tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4912{
4913
4914 tSirWPSBeaconIE *pSirWPSBeaconIE;
4915
4916 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4917
4918
4919 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4920 {
4921 pDot11f->present = 1;
4922 pDot11f->Version.present = 1;
4923 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
4924 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
4925 }
4926 else
4927 {
4928 pDot11f->present = 0;
4929 pDot11f->Version.present = 0;
4930 }
4931
4932 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
4933 {
4934
4935 pDot11f->WPSState.present = 1;
4936 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
4937 }
4938 else
4939 pDot11f->WPSState.present = 0;
4940
4941 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
4942 {
4943 pDot11f->APSetupLocked.present = 1;
4944 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
4945 }
4946 else
4947 pDot11f->APSetupLocked.present = 0;
4948
4949 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
4950 {
4951 pDot11f->SelectedRegistrar.present = 1;
4952 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
4953 }
4954 else
4955 pDot11f->SelectedRegistrar.present = 0;
4956
4957 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
4958 {
4959 pDot11f->DevicePasswordID.present = 1;
4960 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
4961 }
4962 else
4963 pDot11f->DevicePasswordID.present = 0;
4964
4965 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
4966 {
4967 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4968 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
4969 }
4970 else
4971 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4972
4973 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
4974 {
4975 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304976 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004977 }
4978 else
4979 pDot11f->UUID_E.present = 0;
4980
4981
4982 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
4983 {
4984 pDot11f->RFBands.present = 1;
4985 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
4986 }
4987 else
4988 pDot11f->RFBands.present = 0;
4989
4990 return eSIR_SUCCESS;
4991}
Jeff Johnson295189b2012-06-20 16:38:30 -07004992tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
4993 tDot11fIEWscProbeRes *pDot11f)
4994{
4995 tANI_U32 cfgMethods;
4996 tANI_U32 cfgStrLen;
4997 tANI_U32 val;
4998 tANI_U32 wpsVersion, wpsState;
4999
5000
5001 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305002 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_VERSION );
Jeff Johnson295189b2012-06-20 16:38:30 -07005003
5004 pDot11f->Version.present = 1;
5005 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
5006 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
5007
5008 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305009 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07005010
5011 pDot11f->WPSState.present = 1;
5012 pDot11f->WPSState.state = (tANI_U8) wpsState;
5013
5014 pDot11f->APSetupLocked.present = 0;
5015
5016 pDot11f->SelectedRegistrar.present = 0;
5017
5018 pDot11f->DevicePasswordID.present = 0;
5019
5020 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5021
5022 pDot11f->ResponseType.present = 1;
5023 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
5024 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
5025 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5026 }
5027 else{
5028 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5029 }
5030
5031 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
5032 pDot11f->UUID_E.present = 1;
5033 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
5034 if (wlan_cfgGetStr(pMac,
5035 WNI_CFG_WPS_UUID,
5036 pDot11f->UUID_E.uuid,
5037 &cfgStrLen) != eSIR_SUCCESS)
5038 {
5039 *(pDot11f->UUID_E.uuid) = '\0';
5040 }
5041
5042 pDot11f->Manufacturer.present = 1;
5043 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
5044 if (wlan_cfgGetStr(pMac,
5045 WNI_CFG_MANUFACTURER_NAME,
5046 pDot11f->Manufacturer.name,
5047 &cfgStrLen) != eSIR_SUCCESS)
5048 {
5049 pDot11f->Manufacturer.num_name = 0;
5050 *(pDot11f->Manufacturer.name) = '\0';
5051 }
5052 else
5053 {
5054 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305055 pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005056 }
5057
5058 pDot11f->ModelName.present = 1;
5059 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
5060 if (wlan_cfgGetStr(pMac,
5061 WNI_CFG_MODEL_NAME,
5062 pDot11f->ModelName.text,
5063 &cfgStrLen) != eSIR_SUCCESS)
5064 {
5065 pDot11f->ModelName.num_text = 0;
5066 *(pDot11f->ModelName.text) = '\0';
5067 }
5068 else
5069 {
5070 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305071 pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005072 }
5073
5074 pDot11f->ModelNumber.present = 1;
5075 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
5076 if (wlan_cfgGetStr(pMac,
5077 WNI_CFG_MODEL_NUMBER,
5078 pDot11f->ModelNumber.text,
5079 &cfgStrLen) != eSIR_SUCCESS)
5080 {
5081 pDot11f->ModelNumber.num_text = 0;
5082 *(pDot11f->ModelNumber.text) = '\0';
5083 }
5084 else
5085 {
5086 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305087 pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005088 }
5089
5090 pDot11f->SerialNumber.present = 1;
5091 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
5092 if (wlan_cfgGetStr(pMac,
5093 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
5094 pDot11f->SerialNumber.text,
5095 &cfgStrLen) != eSIR_SUCCESS)
5096 {
5097 pDot11f->SerialNumber.num_text = 0;
5098 *(pDot11f->SerialNumber.text) = '\0';
5099 }
5100 else
5101 {
5102 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305103 pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005104 }
5105
5106 pDot11f->PrimaryDeviceType.present = 1;
5107
5108 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
5109 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305110 limLog(pMac, LOGP, FL("cfg get prim device category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005111 }
5112 else
5113 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
5114
5115 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
5116 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305117 limLog(pMac, LOGP, FL("cfg get prim device OUI failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005118 }
5119 else
5120 {
5121 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
5122 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
5123 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
5124 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
5125 }
5126
5127 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
5128 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305129 limLog(pMac, LOGP, FL("cfg get prim device sub category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005130 }
5131 else
5132 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
5133
5134 pDot11f->DeviceName.present = 1;
5135 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
5136 if (wlan_cfgGetStr(pMac,
5137 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
5138 pDot11f->DeviceName.text,
5139 &cfgStrLen) != eSIR_SUCCESS)
5140 {
5141 pDot11f->DeviceName.num_text = 0;
5142 *(pDot11f->DeviceName.text) = '\0';
5143 }
5144 else
5145 {
5146 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305147 pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005148 }
5149
5150 if (wlan_cfgGetInt(pMac,
5151 WNI_CFG_WPS_CFG_METHOD,
5152 &cfgMethods) != eSIR_SUCCESS)
5153 {
5154 pDot11f->ConfigMethods.present = 0;
5155 pDot11f->ConfigMethods.methods = 0;
5156 }
5157 else
5158 {
5159 pDot11f->ConfigMethods.present = 1;
5160 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
5161 }
5162
5163 pDot11f->RFBands.present = 0;
5164
5165 pDot11f->present = 1;
5166 return eSIR_SUCCESS;
5167}
5168
5169tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5170 tDot11fIEWscProbeRes *pDot11f)
5171{
5172 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
5173 tANI_U32 devicepasswdId;
5174
5175 pDot11f->APSetupLocked.present = 1;
5176 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5177
5178 pDot11f->SelectedRegistrar.present = 1;
5179 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5180
5181 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305182 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07005183
5184 pDot11f->DevicePasswordID.present = 1;
5185 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5186
5187 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5188 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5189
5190 // UUID_E and RF Bands are applicable only for dual band AP
5191
5192 return eSIR_SUCCESS;
5193}
5194
5195tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5196 tDot11fIEWscProbeRes *pDot11f)
5197{
5198 pDot11f->APSetupLocked.present = 0;
5199 pDot11f->SelectedRegistrar.present = 0;
5200 pDot11f->DevicePasswordID.present = 0;
5201 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5202
5203 return eSIR_SUCCESS;
5204}
5205
5206tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5207 tDot11fIEWscAssocRes *pDot11f,
5208 tpSirAssocReq pRcvdAssocReq)
5209{
5210 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5211 tANI_U8 *wscIe;
5212
5213
5214 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5215 if(wscIe != NULL)
5216 {
5217 // retreive WSC IE from given AssocReq
5218 dot11fUnpackIeWscAssocReq( pMac,
5219 wscIe + 2 + 4, // EID, length, OUI
5220 wscIe[ 1 ] - 4, // length without OUI
5221 &parsedWscAssocReq );
5222 pDot11f->present = 1;
5223 // version has to be 0x10
5224 pDot11f->Version.present = 1;
5225 pDot11f->Version.major = 0x1;
5226 pDot11f->Version.minor = 0x0;
5227
5228 pDot11f->ResponseType.present = 1;
5229
5230 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5231 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5232 {
5233 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5234 }
5235 else
5236 {
5237 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5238 }
5239 // Version infomration should be taken from our capability as well as peers
5240 // TODO: currently it takes from peers only
5241 if(parsedWscAssocReq.VendorExtension.present &&
5242 parsedWscAssocReq.VendorExtension.Version2.present)
5243 {
5244 pDot11f->VendorExtension.present = 1;
5245 pDot11f->VendorExtension.vendorId[0] = 0x00;
5246 pDot11f->VendorExtension.vendorId[1] = 0x37;
5247 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5248 pDot11f->VendorExtension.Version2.present = 1;
5249 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5250 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5251 }
5252 }
5253 return eSIR_SUCCESS;
5254}
5255
Jeff Johnson295189b2012-06-20 16:38:30 -07005256tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5257 tDot11fIEP2PAssocRes *pDot11f,
5258 tpSirAssocReq pRcvdAssocReq)
5259{
5260 tANI_U8 *p2pIe;
5261
5262 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5263 if(p2pIe != NULL)
5264 {
5265 pDot11f->present = 1;
5266 pDot11f->P2PStatus.present = 1;
5267 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5268 pDot11f->ExtendedListenTiming.present = 0;
5269 }
5270 return eSIR_SUCCESS;
5271}
Jeff Johnson295189b2012-06-20 16:38:30 -07005272
5273#if defined WLAN_FEATURE_VOWIFI
5274
5275tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5276 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5277{
5278 pDot11f->txPower = txPower;
5279 pDot11f->linkMargin = linkMargin;
5280 pDot11f->present = 1;
5281
5282 return eSIR_SUCCESS;
5283}
5284
5285tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5286{
5287
5288 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5289 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305290 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5291 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005292 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5293 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5294 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5295 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5296 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305297 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005298 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5299 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5300
5301 if( pBeaconReport->numIes )
5302 {
5303 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305304 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5305 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005306 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5307 }
5308
5309 return eSIR_SUCCESS;
5310
5311}
5312
5313tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5314{
5315 tpRRMCaps pRrmCaps;
5316
5317 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5318
5319 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5320 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5321 pDot11f->parallel = pRrmCaps->parallel ;
5322 pDot11f->repeated = pRrmCaps->repeated ;
5323 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5324 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5325 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5326 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5327 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5328 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5329 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5330 pDot11f->statistics = pRrmCaps->statistics ;
5331 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5332 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5333 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5334 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5335 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5336 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5337 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5338 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5339 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5340 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5341 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5342 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5343 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5344 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5345 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5346 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5347
5348 pDot11f->present = 1;
5349 return eSIR_SUCCESS;
5350}
5351#endif
5352
5353#if defined WLAN_FEATURE_VOWIFI_11R
5354void PopulateMDIE( tpAniSirGlobal pMac,
5355 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5356{
5357 pDot11f->present = 1;
5358 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5359
5360 // Plugfest fix
5361 pDot11f->overDSCap = (mdie[2] & 0x01);
5362 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5363
5364}
5365
5366void PopulateFTInfo( tpAniSirGlobal pMac,
5367 tDot11fIEFTInfo *pDot11f )
5368{
5369 pDot11f->present = 1;
5370 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5371 //All other info is zero.
5372
5373}
5374#endif
5375
5376void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5377 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5378{
5379 tANI_U8 num_supp = 0, num_ext = 0;
5380 tANI_U8 i,j;
5381
5382 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5383 {
5384 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5385 }
5386 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5387 {
5388 if( num_supp < 8 )
5389 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5390 else
5391 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5392 }
5393
5394 if( num_supp )
5395 {
5396 pSupp->num_rates = num_supp;
5397 pSupp->present = 1;
5398 }
5399 if( num_ext )
5400 {
5401 pExt->num_rates = num_ext;
5402 pExt->present = 1;
5403 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005404}
5405
5406void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5407 tDot11fIETimeoutInterval *pDot11f,
5408 tANI_U8 type, tANI_U32 value )
5409{
5410 pDot11f->present = 1;
5411 pDot11f->timeoutType = type;
5412 pDot11f->timeoutValue = value;
5413}
Jeff Johnson295189b2012-06-20 16:38:30 -07005414// parserApi.c ends here.