blob: 28d8575958271dceaa7de9aa035ed012fc99b584 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kapil Guptafe2adca2017-06-15 15:04:16 +05302 * Copyright (c) 2012-2017 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
Agrawal Ashisha8e8a722016-10-18 19:07:45 +053053#define DOT11F_RSN_VERSION 1 /* current supported version */
54#define DOT11F_RSN_OUI_SIZE 4
55#define DOT11F_RSN_CSE_NULL 0x00
56#define DOT11F_RSN_CSE_WEP40 0x01
57#define DOT11F_RSN_CSE_TKIP 0x02
58#define DOT11F_RSN_CSE_WRAP 0x03
59#define DOT11F_RSN_CSE_CCMP 0x04
60#define DOT11F_RSN_CSE_WEP104 0x05
61#define DOT11F_RSN_CSE_AES_CMAC 0x06
62
63static const tANI_U8 sirRSNOui[][ DOT11F_RSN_OUI_SIZE ] = {
64 { 0x00, 0x0F, 0xAC, 0x00 }, /* group cipher */
65 { 0x00, 0x0F, 0xAC, 0x01 }, /* WEP-40 or RSN */
66 { 0x00, 0x0F, 0xAC, 0x02 }, /* TKIP or RSN-PSK */
67 { 0x00, 0x0F, 0xAC, 0x03 }, /* Reserved */
68 { 0x00, 0x0F, 0xAC, 0x04 }, /* AES-CCMP */
69 { 0x00, 0x0F, 0xAC, 0x05 }, /* WEP-104 */
70 { 0x00, 0x40, 0x96, 0x00 }, /* CCKM */
71 /* BIP (encryption type) or RSN-PSK-SHA256 (authentication type) */
72 { 0x00, 0x0F, 0xAC, 0x06 },
73 /* RSN-8021X-SHA256 (authentication type) */
74 { 0x00, 0x0F, 0xAC, 0x05 }
75};
76
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
79////////////////////////////////////////////////////////////////////////
80void dot11fLog(tpAniSirGlobal pMac, int loglevel, const char *pString,...)
81{
82#ifdef WLAN_DEBUG
83 if( (tANI_U32)loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_DBG_MODULE_ID )] )
84 {
85 return;
86 }
87 else
88 {
89 va_list marker;
90
91 va_start( marker, pString ); /* Initialize variable arguments. */
92
93 logDebug(pMac, SIR_DBG_MODULE_ID, loglevel, pString, marker);
94
95 va_end( marker ); /* Reset variable arguments. */
96 }
97#endif
98}
99
100void
101swapBitField16(tANI_U16 in, tANI_U16 *out)
102{
103# ifdef ANI_LITTLE_BIT_ENDIAN
104 *out = in;
105# else // Big-Endian...
106 *out = ( ( in & 0x8000 ) >> 15 ) |
107 ( ( in & 0x4000 ) >> 13 ) |
108 ( ( in & 0x2000 ) >> 11 ) |
109 ( ( in & 0x1000 ) >> 9 ) |
110 ( ( in & 0x0800 ) >> 7 ) |
111 ( ( in & 0x0400 ) >> 5 ) |
112 ( ( in & 0x0200 ) >> 3 ) |
113 ( ( in & 0x0100 ) >> 1 ) |
114 ( ( in & 0x0080 ) << 1 ) |
115 ( ( in & 0x0040 ) << 3 ) |
116 ( ( in & 0x0020 ) << 5 ) |
117 ( ( in & 0x0010 ) << 7 ) |
118 ( ( in & 0x0008 ) << 9 ) |
119 ( ( in & 0x0004 ) << 11 ) |
120 ( ( in & 0x0002 ) << 13 ) |
121 ( ( in & 0x0001 ) << 15 );
122# endif // ANI_LITTLE_BIT_ENDIAN
123}
124
125void
126swapBitField32(tANI_U32 in, tANI_U32 *out)
127{
128# ifdef ANI_LITTLE_BIT_ENDIAN
129 *out = in;
130# else // Big-Endian...
131 *out = ( ( in & 0x80000000 ) >> 31 ) |
132 ( ( in & 0x40000000 ) >> 29 ) |
133 ( ( in & 0x20000000 ) >> 27 ) |
134 ( ( in & 0x10000000 ) >> 25 ) |
135 ( ( in & 0x08000000 ) >> 23 ) |
136 ( ( in & 0x04000000 ) >> 21 ) |
137 ( ( in & 0x02000000 ) >> 19 ) |
138 ( ( in & 0x01000000 ) >> 17 ) |
139 ( ( in & 0x00800000 ) >> 15 ) |
140 ( ( in & 0x00400000 ) >> 13 ) |
141 ( ( in & 0x00200000 ) >> 11 ) |
142 ( ( in & 0x00100000 ) >> 9 ) |
143 ( ( in & 0x00080000 ) >> 7 ) |
144 ( ( in & 0x00040000 ) >> 5 ) |
145 ( ( in & 0x00020000 ) >> 3 ) |
146 ( ( in & 0x00010000 ) >> 1 ) |
147 ( ( in & 0x00008000 ) << 1 ) |
148 ( ( in & 0x00004000 ) << 3 ) |
149 ( ( in & 0x00002000 ) << 5 ) |
150 ( ( in & 0x00001000 ) << 7 ) |
151 ( ( in & 0x00000800 ) << 9 ) |
152 ( ( in & 0x00000400 ) << 11 ) |
153 ( ( in & 0x00000200 ) << 13 ) |
154 ( ( in & 0x00000100 ) << 15 ) |
155 ( ( in & 0x00000080 ) << 17 ) |
156 ( ( in & 0x00000040 ) << 19 ) |
157 ( ( in & 0x00000020 ) << 21 ) |
158 ( ( in & 0x00000010 ) << 23 ) |
159 ( ( in & 0x00000008 ) << 25 ) |
160 ( ( in & 0x00000004 ) << 27 ) |
161 ( ( in & 0x00000002 ) << 29 ) |
162 ( ( in & 0x00000001 ) << 31 );
163# endif // ANI_LITTLE_BIT_ENDIAN
164}
165
166inline static void __printWMMParams(tpAniSirGlobal pMac, tDot11fIEWMMParams *pWmm)
167{
Sushant Kaushik87787972015-09-11 16:05:00 +0530168 limLog(pMac, LOG1, FL("WMM Parameters Received: "));
169 limLog(pMac, LOG1, FL("BE: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 pWmm->acbe_aifsn, pWmm->acbe_acm, pWmm->acbe_aci, pWmm->acbe_acwmin, pWmm->acbe_acwmax, pWmm->acbe_txoplimit);
171
Sushant Kaushik87787972015-09-11 16:05:00 +0530172 limLog(pMac, LOG1, FL("BK: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700173 pWmm->acbk_aifsn, pWmm->acbk_acm, pWmm->acbk_aci, pWmm->acbk_acwmin, pWmm->acbk_acwmax, pWmm->acbk_txoplimit);
174
Sushant Kaushik87787972015-09-11 16:05:00 +0530175 limLog(pMac, LOG1, FL("VI: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700176 pWmm->acvi_aifsn, pWmm->acvi_acm, pWmm->acvi_aci, pWmm->acvi_acwmin, pWmm->acvi_acwmax, pWmm->acvi_txoplimit);
177
Sushant Kaushik87787972015-09-11 16:05:00 +0530178 limLog(pMac, LOG1, FL("VO: aifsn %d, acm %d, aci %d, cwmin %d, cwmax %d, txop %d "),
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 pWmm->acvo_aifsn, pWmm->acvo_acm, pWmm->acvo_aci, pWmm->acvo_acwmin, pWmm->acvo_acwmax, pWmm->acvo_txoplimit);
180
181 return;
182}
183
184////////////////////////////////////////////////////////////////////////
185// Functions for populating "dot11f" style IEs
186
187
188// return: >= 0, the starting location of the IE in rsnIEdata inside tSirRSNie
189// < 0, cannot find
190int FindIELocation( tpAniSirGlobal pMac,
191 tpSirRSNie pRsnIe,
192 tANI_U8 EID)
193{
194 int idx, ieLen, bytesLeft;
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800195 int ret_val = -1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700196
197 // Here's what's going on: 'rsnIe' looks like this:
198
199 // typedef struct sSirRSNie
200 // {
201 // tANI_U16 length;
202 // tANI_U8 rsnIEdata[SIR_MAC_MAX_IE_LENGTH+2];
203 // } tSirRSNie, *tpSirRSNie;
204
205 // other code records both the WPA & RSN IEs (including their EIDs &
206 // lengths) into the array 'rsnIEdata'. We may have:
207
208 // With WAPI support, there may be 3 IEs here
209 // It can be only WPA IE, or only RSN IE or only WAPI IE
210 // Or two or all three of them with no particular ordering
211
212 // The if/then/else statements that follow are here to figure out
213 // whether we have the WPA IE, and where it is if we *do* have it.
214
215 //Save the first IE length
216 ieLen = pRsnIe->rsnIEdata[ 1 ] + 2;
217 idx = 0;
218 bytesLeft = pRsnIe->length;
219
220 while( 1 )
221 {
222 if ( EID == pRsnIe->rsnIEdata[ idx ] )
223 {
224 //Found it
225 return (idx);
226 }
227 else if ( EID != pRsnIe->rsnIEdata[ idx ] &&
228 // & if no more IE,
229 bytesLeft <= (tANI_U16)( ieLen ) )
230 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530231 dot11fLog( pMac, LOG3, FL("No IE (%d) in FindIELocation."), EID );
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800232 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 }
234 bytesLeft -= ieLen;
235 ieLen = pRsnIe->rsnIEdata[ idx + 1 ] + 2;
236 idx += ieLen;
237 }
238
Madan Mohan Koyyalamudicae253a2012-11-06 19:10:35 -0800239 return ret_val;
Jeff Johnson295189b2012-06-20 16:38:30 -0700240}
241
242
243tSirRetStatus
244PopulateDot11fCapabilities(tpAniSirGlobal pMac,
245 tDot11fFfCapabilities *pDot11f,
246 tpPESession psessionEntry)
247{
248 tANI_U16 cfg;
249 tSirRetStatus nSirStatus;
250
251 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg,psessionEntry );
252 if ( eSIR_SUCCESS != nSirStatus )
253 {
254 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
Sushant Kaushik87787972015-09-11 16:05:00 +0530255 "itfield from CFG (%d)."), nSirStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700256 return nSirStatus;
257 }
258
259#if 0
260 if ( sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_11EQOS ) )
261 {
262 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
263 }
264#endif
265 swapBitField16( cfg, ( tANI_U16* )pDot11f );
266
267 return eSIR_SUCCESS;
268} // End PopulateDot11fCapabilities.
269
270tSirRetStatus
271PopulateDot11fCapabilities2(tpAniSirGlobal pMac,
272 tDot11fFfCapabilities *pDot11f,
273 tpDphHashNode pSta,
274 tpPESession psessionEntry)
275{
276 tANI_U16 cfg;
277 tSirRetStatus nSirStatus;
278 nSirStatus = cfgGetCapabilityInfo( pMac, &cfg ,psessionEntry);
279 if ( eSIR_SUCCESS != nSirStatus )
280 {
281 dot11fLog( pMac, LOGP, FL("Failed to retrieve the Capabilities b"
Sushant Kaushik87787972015-09-11 16:05:00 +0530282 "itfield from CFG (%d)."), nSirStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return nSirStatus;
284 }
285
286 if ( ( NULL != pSta ) && pSta->aniPeer &&
287 PROP_CAPABILITY_GET( 11EQOS, pSta->propCapability ) )
288 {
289 SIR_MAC_CLEAR_CAPABILITY( cfg, QOS );
290 }
291
292 swapBitField16( cfg, ( tANI_U16* )pDot11f );
293
294 return eSIR_SUCCESS;
295
296} // End PopulateDot11fCapabilities2.
297
298void
299PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700300 tDot11fIEChanSwitchAnn *pDot11f,
301 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700302{
Jeff Johnsone7245742012-09-05 17:12:55 -0700303 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
304 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
305 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700306
307 pDot11f->present = 1;
308} // End PopulateDot11fChanSwitchAnn.
309
310void
311PopulateDot11fExtChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700312 tDot11fIEExtChanSwitchAnn *pDot11f,
313 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700314{
315 //Has to be updated on the cb state basis
316 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700317 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700318
319 pDot11f->present = 1;
320}
321
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700322#ifdef WLAN_FEATURE_11AC
323void
324PopulateDot11fWiderBWChanSwitchAnn(tpAniSirGlobal pMac,
325 tDot11fIEWiderBWChanSwitchAnn *pDot11f,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700326 tpPESession psessionEntry)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700327{
328 pDot11f->present = 1;
329 pDot11f->newChanWidth = psessionEntry->gLimWiderBWChannelSwitch.newChanWidth;
330 pDot11f->newCenterChanFreq0 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0;
331 pDot11f->newCenterChanFreq1 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1;
332}
333#endif
334
Jeff Johnson295189b2012-06-20 16:38:30 -0700335tSirRetStatus
336PopulateDot11fCountry(tpAniSirGlobal pMac,
337 tDot11fIECountry *pDot11f,
338 tpPESession psessionEntry)
339{
340 tANI_U32 len, maxlen, codelen;
341 tANI_U16 item;
342 tSirRetStatus nSirStatus;
343 tSirRFBand rfBand;
344 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
345
346 if (psessionEntry->lim11dEnabled )
347 {
348 limGetRfBand(pMac, &rfBand, psessionEntry);
349 if (rfBand == SIR_BAND_5_GHZ)
350 {
351 item = WNI_CFG_MAX_TX_POWER_5;
352 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
353 }
354 else
355 {
356 item = WNI_CFG_MAX_TX_POWER_2_4;
357 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
358 }
359
360 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
361
362 if ( 3 > len )
363 {
364 // no limit on tx power, cannot include the IE because at least
365 // one (channel,num,tx power) must be present
366 return eSIR_SUCCESS;
367 }
368
369 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
370 code, codelen, 3 );
371
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530372 vos_mem_copy( pDot11f->country, code, codelen );
Jeff Johnson295189b2012-06-20 16:38:30 -0700373
374 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
375 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530376 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting."), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
378 }
379
380 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530381 vos_mem_copy( ( tANI_U8* )pDot11f->triplets, temp, len );
Jeff Johnson295189b2012-06-20 16:38:30 -0700382
383 pDot11f->present = 1;
384 }
385
386 return eSIR_SUCCESS;
387} // End PopulateDot11fCountry.
388
389tSirRetStatus
390PopulateDot11fDSParams(tpAniSirGlobal pMac,
391 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
392 tpPESession psessionEntry)
393{
Abhishek Singh883b5a12015-10-08 12:22:25 +0530394 if (IS_24G_CH(channel))
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 {
396 // .11b/g mode PHY => Include the DS Parameter Set IE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700397 pDot11f->curr_channel = channel;
398 pDot11f->present = 1;
399 }
400
401 return eSIR_SUCCESS;
402} // End PopulateDot11fDSParams.
403
404#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
405
406
407void
408PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
409 tDot11fIEEDCAParamSet *pDot11f,
410 tpPESession psessionEntry)
411{
412
413 if ( psessionEntry->limQosEnabled )
414 {
415 //change to bitwise operation, after this is fixed in frames.
416 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
417
418 // Fill each EDCA parameter set in order: be, bk, vi, vo
419 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
420 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
421 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
422 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
423 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
424 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
425
426 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
427 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
428 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
429 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
430 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
431 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
432
433 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
434 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
435 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
436 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
437 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
438 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
439
440 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
441 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
442 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
443 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
444 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
445 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
446
447 pDot11f->present = 1;
448 }
449
450} // End PopluateDot11fEDCAParamSet.
451
452tSirRetStatus
453PopulateDot11fERPInfo(tpAniSirGlobal pMac,
454 tDot11fIEERPInfo *pDot11f,
455 tpPESession psessionEntry)
456{
457 tSirRetStatus nSirStatus;
458 tANI_U32 val;
459 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
460
461 limGetRfBand(pMac, &rfBand, psessionEntry);
462 if(SIR_BAND_2_4_GHZ == rfBand)
463 {
464 pDot11f->present = 1;
465
466 val = psessionEntry->cfgProtection.fromllb;
467 if(!val ){
Sravan Kumar Kairamcebb2182016-01-25 20:50:11 +0530468 dot11fLog( pMac, LOG1, FL("11B protection not enabled. Not populating ERP IE %d" ),val );
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 return eSIR_SUCCESS;
470 }
471
472 if (psessionEntry->gLim11bParams.protectionEnabled)
473 {
474 pDot11f->non_erp_present = 1;
475 pDot11f->use_prot = 1;
476 }
477
478 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
479 {
480 //FIXME_PROTECTION: we should be setting non_erp present also.
481 //check the test plan first.
482 pDot11f->use_prot = 1;
483 }
484
485
486 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
487 || !psessionEntry->beaconParams.fShortPreamble){
488 pDot11f->barker_preamble = 1;
489
490 }
491 // if protection always flag is set, advertise protection enabled
492 // regardless of legacy stations presence
493 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
494
495 if ( val )
496 {
497 pDot11f->use_prot = 1;
498 }
499 }
500
501 return eSIR_SUCCESS;
502} // End PopulateDot11fERPInfo.
503
504tSirRetStatus
505PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
506 tDot11fIEExtSuppRates *pDot11f,
507 tpPESession psessionEntry)
508{
509 tSirRetStatus nSirStatus;
510 tANI_U32 nRates = 0;
Sachin Ahujac772fd82015-09-08 17:12:19 +0530511 tANI_U8 rates[SIR_MAC_RATESET_EID_MAX];
Jeff Johnson295189b2012-06-20 16:38:30 -0700512
513 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
514 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
515 sending mgmt frames (lile probe req) which need to go out before any session is present.
516 */
517 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
518 {
519 if(psessionEntry != NULL)
520 {
521 nRates = psessionEntry->extRateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530522 vos_mem_copy( rates, psessionEntry->extRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 nRates);
524 }
525 else
526 {
527 dot11fLog( pMac, LOGE, FL("no session context exists while"
Sushant Kaushik87787972015-09-11 16:05:00 +0530528 " populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 }
530 }
531 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
532 {
533 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
534 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
535 }
536
537 if ( 0 != nRates )
538 {
539 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530540 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 pDot11f->present = 1;
542 }
543
544 return eSIR_SUCCESS;
545
546} // End PopulateDot11fExtSuppRates.
547
548tSirRetStatus
549PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
550 tANI_U8 nChannelNum,
551 tDot11fIEExtSuppRates *pDot11f)
552{
553 tANI_U32 nRates;
554 tSirRetStatus nSirStatus;
555 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
556
557 if ( 14 < nChannelNum )
558 {
559 pDot11f->present = 0;
560 return eSIR_SUCCESS;
561 }
562
563 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
564 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
565 // previously & I'm afraid to change it!
566 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
567 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
568
569 if ( 0 != nRates )
570 {
571 pDot11f->num_rates = ( tANI_U8 ) nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530572 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 pDot11f->present = 1;
574 }
575
576 return eSIR_SUCCESS;
577} // PopulateDot11fExtSuppRates1.
578
579tSirRetStatus
580PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700581 tpPESession psessionEntry,
582 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700583{
584 tANI_U32 nCfgValue, nCfgLen;
585 tANI_U8 nCfgValue8;
586 tSirRetStatus nSirStatus;
587 tSirMacHTParametersInfo *pHTParametersInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700588 union {
589 tANI_U16 nCfgValue16;
590 tSirMacHTCapabilityInfo htCapInfo;
591 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
592 } uHTCapabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700593
594 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
595 tSirMacASCapabilityInfo *pASCapabilityInfo;
596
597 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
598
Jeff Johnson295189b2012-06-20 16:38:30 -0700599 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700600
Kapil Guptafe2adca2017-06-15 15:04:16 +0530601
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
603 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
604 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
605 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
606 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
607 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
608 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
609 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
610 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
611 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
612 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
613 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614
Jeff Johnsone7245742012-09-05 17:12:55 -0700615 // All sessionized entries will need the check below
616 if (psessionEntry == NULL) // Only in case of NO session
617 {
618 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
Kapil Guptafe2adca2017-06-15 15:04:16 +0530619 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnsone7245742012-09-05 17:12:55 -0700620 }
621 else
622 {
623 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
Kapil Guptafe2adca2017-06-15 15:04:16 +0530624 if (psessionEntry->txLdpcIniFeatureEnabled & 0x1)
625 pDot11f->advCodingCap = 1;
626 else
627 pDot11f->advCodingCap = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700628 }
629
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
631 eHT_CHANNEL_WIDTH_20MHZ */
632 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
633 {
634 pDot11f->shortGI40MHz = 0;
635 }
636
Jeff Johnson295189b2012-06-20 16:38:30 -0700637
638
639 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
640
641 nCfgValue8 = ( tANI_U8 ) nCfgValue;
642 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
643
644 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
645 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
646 pDot11f->reserved1 = pHTParametersInfo->reserved;
647
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
649 pDot11f->supportedMCSSet, nCfgLen,
650 SIZE_OF_SUPPORTED_MCS_SET );
651
652
653 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
654
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
656
657 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
658 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
659 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
660
Jeff Johnson295189b2012-06-20 16:38:30 -0700661
662 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
663
664 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
665 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
666 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
667 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
668 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
669 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
670 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
671 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
672 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
673 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
674 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
675 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
676 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
677 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
678 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
679 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
680
681 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
682
683 nCfgValue8 = ( tANI_U8 ) nCfgValue;
684
685 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
686 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
687 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
688 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
689 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
690 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
691 pDot11f->rxAS = pASCapabilityInfo->rxAS;
692 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
693
694 pDot11f->present = 1;
695
696 return eSIR_SUCCESS;
697
698} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700699#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700700
Jeff Johnsone7245742012-09-05 17:12:55 -0700701void limLogVHTCap(tpAniSirGlobal pMac,
702 tDot11fIEVHTCaps *pDot11f)
703{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700704#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530705 limLog(pMac, LOG1, FL("maxMPDULen (2): %d"), pDot11f->maxMPDULen);
706 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d"), pDot11f->supportedChannelWidthSet);
707 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d"), pDot11f->ldpcCodingCap);
708 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d"), pDot11f->shortGI80MHz);
709 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d"), pDot11f->shortGI160and80plus80MHz);
710 limLog(pMac, LOG1, FL("txSTBC (1): %d"), pDot11f->txSTBC);
711 limLog(pMac, LOG1, FL("rxSTBC (3): %d"), pDot11f->rxSTBC);
712 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d"), pDot11f->suBeamFormerCap);
713 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d"), pDot11f->suBeamformeeCap);
714 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d"), pDot11f->csnofBeamformerAntSup);
715 limLog(pMac, LOG1, FL("numSoundingDim (3): %d"), pDot11f->numSoundingDim);
716 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d"), pDot11f->muBeamformerCap);
717 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d"), pDot11f->muBeamformeeCap);
718 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d"), pDot11f->vhtTXOPPS);
719 limLog(pMac, LOG1, FL("htcVHTCap (1): %d"), pDot11f->htcVHTCap);
720 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d"), pDot11f->maxAMPDULenExp);
721 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d"), pDot11f->vhtLinkAdaptCap);
722 limLog(pMac, LOG1, FL("rxAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
723 limLog(pMac, LOG1, FL("txAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
724 limLog(pMac, LOG1, FL("reserved1 (2): %d"), pDot11f->reserved1);
725 limLog(pMac, LOG1, FL("rxMCSMap (16): %d"), pDot11f->rxMCSMap);
726 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d"), pDot11f->rxHighSupDataRate);
727 limLog(pMac, LOG1, FL("reserve (3): %d"), pDot11f->reserved2);
728 limLog(pMac, LOG1, FL("txMCSMap (16): %d"), pDot11f->txMCSMap);
729 limLog(pMac, LOG1, FL("txSupDataRate (13): %d"), pDot11f->txSupDataRate);
730 limLog(pMac, LOG1, FL("reserv (3): %d"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700731#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700732}
733
734void limLogVHTOperation(tpAniSirGlobal pMac,
735 tDot11fIEVHTOperation *pDot11f)
736{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700737#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530738 limLog(pMac, LOG1, FL("chanWidth : %d"), pDot11f->chanWidth);
739 limLog(pMac, LOG1, FL("chanCenterFreqSeg1: %d"), pDot11f->chanCenterFreqSeg1);
740 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d"), pDot11f->chanCenterFreqSeg2);
741 limLog(pMac, LOG1, FL("basicMCSSet: %d"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700742#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700743}
744
745void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
746 tDot11fIEVHTExtBssLoad *pDot11f)
747{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700748#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530749 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d"), pDot11f->muMIMOCapStaCount);
750 limLog(pMac, LOG1, FL("ssUnderUtil: %d"), pDot11f->ssUnderUtil);
751 limLog(pMac, LOG1, FL("FortyMHzUtil: %d"), pDot11f->FortyMHzUtil);
752 limLog(pMac, LOG1, FL("EightyMHzUtil: %d"), pDot11f->EightyMHzUtil);
753 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700754#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700755}
756
757
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700758void limLogOperatingMode( tpAniSirGlobal pMac,
759 tDot11fIEOperatingMode *pDot11f)
760{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700761#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530762 limLog(pMac, LOG1, FL("ChanWidth : %d"), pDot11f->chanWidth);
763 limLog(pMac, LOG1, FL("reserved: %d"), pDot11f->reserved);
764 limLog(pMac, LOG1, FL("rxNSS: %d"), pDot11f->rxNSS);
765 limLog(pMac, LOG1, FL("rxNSS Type: %d"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700766#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700767}
768
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700769void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
770{
771 tANI_U8 i;
Agrawal Ashishacba1872015-11-30 12:31:41 +0530772 if (pQosMapSet->num_dscp_exceptions > 21)
773 pQosMapSet->num_dscp_exceptions = 21;
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700774 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
775 pQosMapSet->num_dscp_exceptions);
776 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
777 {
778 limLog(pMac, LOG1, FL("dscp value: %d"),
779 pQosMapSet->dscp_exceptions[i][0]);
780 limLog(pMac, LOG1, FL("User priority value: %d"),
781 pQosMapSet->dscp_exceptions[i][1]);
782 }
783 for (i=0;i<8;i++)
784 {
785 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
786 pQosMapSet->dscp_range[i][0]);
787 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
788 pQosMapSet->dscp_range[i][1]);
789 }
790}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700791
Jeff Johnsone7245742012-09-05 17:12:55 -0700792tSirRetStatus
793PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530794 tDot11fIEVHTCaps *pDot11f,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530795 tANI_U8 nChannelNum,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530796 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700797{
798 tSirRetStatus nStatus;
799 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530800 tAniBool disableMcs9 = eSIR_FALSE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700801
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530802 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530803 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
804 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530805 else
806 disableMcs9 =
807 pMac->roam.configParam.channelBondingMode5GHz?
808 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700809 pDot11f->present = 1;
810
811 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
812 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
813
814 nCfgValue = 0;
815 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
816 nCfgValue );
817 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
818
819 nCfgValue = 0;
820 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
Kapil Guptafe2adca2017-06-15 15:04:16 +0530821 if (nCfgValue & 0x2)
822 pDot11f->ldpcCodingCap = 1;
823 else
824 pDot11f->ldpcCodingCap = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -0700825
826 nCfgValue = 0;
827 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
828 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
829
830 nCfgValue = 0;
831 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
832 nCfgValue );
833 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
834
Deepthi Gowri0c1e1682015-06-19 12:57:53 +0530835 if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
836 {
837 pDot11f->shortGI80MHz = 0;
838 pDot11f->shortGI160and80plus80MHz = 0;
839 }
840
Jeff Johnsone7245742012-09-05 17:12:55 -0700841 nCfgValue = 0;
842 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
843 pDot11f->txSTBC = (nCfgValue & 0x0001);
844
845 nCfgValue = 0;
846 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
847 pDot11f->rxSTBC = (nCfgValue & 0x0007);
848
849 nCfgValue = 0;
850 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
851 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
852
853 nCfgValue = 0;
854 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
855 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
856
857 nCfgValue = 0;
858 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
859 nCfgValue );
860 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
861
862 nCfgValue = 0;
863 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
864 nCfgValue );
865 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
866
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530867 /* muBeamformerCap should be 0 for non AP and
868 * muBeamformeeCap should be 0 for AP
869 */
870 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
871 {
872 nCfgValue = 0;
873 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
874 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
875 pDot11f->muBeamformeeCap = 0;
876 }
877 else
878 {
879 pDot11f->muBeamformerCap = 0;
880 nCfgValue = 0;
881 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
882 /* Enable only if FW and host both support the MU_MIMO feature
883 */
884 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
885 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700886
887 nCfgValue = 0;
888 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
889 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
890
891 nCfgValue = 0;
892 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
893 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
894
895 nCfgValue = 0;
896 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
897 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
898
899 nCfgValue = 0;
900 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
901 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
902
903 nCfgValue = 0;
904 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
905 pDot11f->rxAntPattern = nCfgValue;
906
907 nCfgValue = 0;
908 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
909 pDot11f->txAntPattern = nCfgValue;
910
911 pDot11f->reserved1= 0;
912
913 nCfgValue = 0;
914 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530915
916 if (eSIR_TRUE == disableMcs9)
917 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700918 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
919
920 nCfgValue = 0;
921 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
922 nCfgValue );
923 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
924
925 pDot11f->reserved2= 0;
926
927 nCfgValue = 0;
928 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530929
930 if (eSIR_TRUE == disableMcs9)
931 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700932 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
933
934 nCfgValue = 0;
935 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
936 nCfgValue );
937 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
938
939 pDot11f->reserved3= 0;
940
941 limLogVHTCap(pMac, pDot11f);
942
943 return eSIR_SUCCESS;
944
945}
946
947tSirRetStatus
948PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530949 tDot11fIEVHTOperation *pDot11f,
950 tANI_U8 nChannelNum)
Jeff Johnsone7245742012-09-05 17:12:55 -0700951{
952 tSirRetStatus nStatus;
953 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530954 tAniBool disableMcs9 = eSIR_FALSE;
955
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530956 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530957 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
958 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530959 else
960 disableMcs9 =
961 pMac->roam.configParam.channelBondingMode5GHz?
962 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700963
964 pDot11f->present = 1;
965
966 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
967 pDot11f->chanWidth = (tANI_U8)nCfgValue;
968
969 nCfgValue = 0;
970 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
971 nCfgValue );
972 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
973
974 nCfgValue = 0;
975 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
976 nCfgValue );
977 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
978
979 nCfgValue = 0;
980 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530981
982 if (eSIR_TRUE == disableMcs9)
983 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700984 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
985
986 limLogVHTOperation(pMac,pDot11f);
987
988 return eSIR_SUCCESS;
989
990}
991
992tSirRetStatus
993PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
994 tDot11fIEVHTExtBssLoad *pDot11f)
995{
996 tSirRetStatus nStatus;
997 tANI_U32 nCfgValue=0;
998
999 pDot11f->present = 1;
1000
1001 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
1002 nCfgValue );
1003 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
1004
1005 nCfgValue = 0;
1006 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
1007 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
1008
1009 nCfgValue=0;
1010 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
1011 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
1012
1013 nCfgValue=0;
1014 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
1015 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
1016
1017 nCfgValue=0;
1018 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
1019 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
1020
1021 limLogVHTExtBssLoad(pMac,pDot11f);
1022
1023 return eSIR_SUCCESS;
1024}
1025
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301026#ifdef WLAN_FEATURE_AP_HT40_24G
1027tSirRetStatus
1028PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
1029 tDot11fIEOBSSScanParameters *pDot11f,
1030 tpPESession psessionEntry)
1031{
1032 pDot11f->present = 1;
1033
1034 pDot11f->obssScanPassiveDwell =
1035 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
1036
1037 pDot11f->obssScanActiveDwell =
1038 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
1039
1040 pDot11f->bssChannelWidthTriggerScanInterval =
1041 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
1042
1043 pDot11f->obssScanPassiveTotalPerChannel =
1044 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
1045
1046 pDot11f->obssScanActiveTotalPerChannel =
1047 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
1048
1049 pDot11f->bssWidthChannelTransitionDelayFactor =
1050 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
1051
1052 pDot11f->obssScanActivityThreshold =
1053 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
1054
1055 return eSIR_SUCCESS;
1056}
1057#endif
1058
Mohit Khanna4a70d262012-09-11 16:30:12 -07001059tSirRetStatus
1060PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +05301061 tDot11fIEExtCap *pDot11f,
1062 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -07001063{
Hu Wangc12631c2016-08-11 09:57:03 +08001064 struct s_ext_cap *p_ext_cap = (struct s_ext_cap *)pDot11f->bytes;
Sandeep Puligilla60342762014-01-30 21:05:37 +05301065
Sandeep Puligilla60342762014-01-30 21:05:37 +05301066#ifdef WLAN_FEATURE_11AC
Sushant Kaushikc25b4fc2015-09-16 16:42:34 +05301067 if (psessionEntry->vhtCapability &&
1068 psessionEntry->limSystemRole != eLIM_STA_IN_IBSS_ROLE )
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301069 {
Hu Wangc12631c2016-08-11 09:57:03 +08001070 p_ext_cap->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301071 pDot11f->present = 1;
1072 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301073#endif
1074 /* while operating in 2.4GHz only then STA need to advertize
1075 the bss co-ex capability*/
1076 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
1077 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301078#ifdef WLAN_FEATURE_AP_HT40_24G
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301079 if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1080 && pMac->roam.configParam.channelBondingMode24GHz)
1081 || pMac->roam.configParam.apHT40_24GEnabled)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301082#else
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301083 if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1084 && pMac->roam.configParam.channelBondingMode24GHz)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301085#endif
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301086 {
Hu Wangc12631c2016-08-11 09:57:03 +08001087 p_ext_cap->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301088 pDot11f->present = 1;
1089 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301090 }
Hu Wangc12631c2016-08-11 09:57:03 +08001091
1092 if (pDot11f->present)
1093 {
1094 /* Need to compute the num_bytes based on bits set */
1095 pDot11f->num_bytes = lim_compute_ext_cap_ie_length(pDot11f);
1096 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07001097 return eSIR_SUCCESS;
1098}
1099
1100tSirRetStatus
1101PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
1102 tDot11fIEOperatingMode *pDot11f,
1103 tpPESession psessionEntry)
1104{
1105 pDot11f->present = 1;
1106
1107 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1108 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1109 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1110
1111 return eSIR_SUCCESS;
1112}
Jeff Johnsone7245742012-09-05 17:12:55 -07001113
1114#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001115tSirRetStatus
1116PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1117 tDot11fIEHTInfo *pDot11f,
1118 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001119{
1120 tANI_U32 nCfgValue, nCfgLen;
1121 tANI_U8 htInfoField1;
1122 tANI_U16 htInfoField2;
1123 tSirRetStatus nSirStatus;
1124 tSirMacHTInfoField1 *pHTInfoField1;
1125 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 union {
1127 tANI_U16 nCfgValue16;
1128 tSirMacHTInfoField3 infoField3;
1129 }uHTInfoField;
1130 union {
1131 tANI_U16 nCfgValue16;
1132 tSirMacHTInfoField2 infoField2;
1133 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001134
Jeff Johnson295189b2012-06-20 16:38:30 -07001135
1136 #if 0
1137 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1138 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301139
1140 if (NULL == psessionEntry)
1141 {
1142 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301143 FL("Invalid session entry in PopulateDot11fHTInfo()"));)
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301144 return eSIR_FAILURE;
1145 }
1146
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1148
1149 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1150
1151 htInfoField1 = ( tANI_U8 ) nCfgValue;
1152
1153 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1155 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1156
Jeff Johnsone7245742012-09-05 17:12:55 -07001157 if (psessionEntry == NULL)
1158 {
1159 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301160 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001161 }
1162 else
1163 {
1164 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1165 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1166 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001167
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001168 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1170
1171 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1172
1173 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1174 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1175 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1176
1177 uHTInfoField2.infoField2.reserved = 0;
1178
1179 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1181
1182 htInfoField2 = ( tANI_U16 ) nCfgValue;
1183
1184 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1185 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1186 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1187 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1188
1189 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001191
1192 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1193
1194
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1196
1197
1198 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1199 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1200 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1201 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1202 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1203 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1204 uHTInfoField.infoField3.reserved = 0;
1205
Jeff Johnson295189b2012-06-20 16:38:30 -07001206
1207 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1208 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1209 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1210 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1211 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1212
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1214 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1215 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1216 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1217
Jeff Johnson295189b2012-06-20 16:38:30 -07001218
Jeff Johnson295189b2012-06-20 16:38:30 -07001219 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1220 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1221 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1222 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1223 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1224 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1225 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001226 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1227 pDot11f->basicMCSSet, nCfgLen,
1228 SIZE_OF_BASIC_MCS_SET );
1229
1230 pDot11f->present = 1;
1231
1232 return eSIR_SUCCESS;
1233
1234} // End PopulateDot11fHTInfo.
1235
1236void
1237PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1238 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1239{
1240 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1241 {
1242 pDot11f->present = 1;
1243 // ATIM duration is always set to 0
1244 pDot11f->atim = 0;
1245 }
1246
1247} // End PopulateDot11fIBSSParams.
1248
1249
1250#ifdef ANI_SUPPORT_11H
1251tSirRetStatus
1252PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1253 tpSirMacMeasReqActionFrame pReq,
1254 tDot11fIEMeasurementReport *pDot11f)
1255{
1256 pDot11f->token = pReq->measReqIE.measToken;
1257 pDot11f->late = 0;
1258 pDot11f->incapable = 0;
1259 pDot11f->refused = 1;
1260 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1261
1262 pDot11f->present = 1;
1263
1264 return eSIR_SUCCESS;
1265
1266} // End PopulatedDot11fMeasurementReport0.
1267
1268tSirRetStatus
1269PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1270 tpSirMacMeasReqActionFrame pReq,
1271 tDot11fIEMeasurementReport *pDot11f)
1272{
1273 pDot11f->token = pReq->measReqIE.measToken;
1274 pDot11f->late = 0;
1275 pDot11f->incapable = 0;
1276 pDot11f->refused = 1;
1277 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1278
1279 pDot11f->present = 1;
1280
1281 return eSIR_SUCCESS;
1282
1283} // End PopulatedDot11fMeasurementReport1.
1284
1285tSirRetStatus
1286PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1287 tpSirMacMeasReqActionFrame pReq,
1288 tDot11fIEMeasurementReport *pDot11f)
1289{
1290 pDot11f->token = pReq->measReqIE.measToken;
1291 pDot11f->late = 0;
1292 pDot11f->incapable = 0;
1293 pDot11f->refused = 1;
1294 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1295
1296 pDot11f->present = 1;
1297
1298 return eSIR_SUCCESS;
1299
1300} // End PopulatedDot11fMeasurementReport2.
1301#endif
1302
1303void
1304PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1305 tDot11fIEPowerCaps *pCaps,
1306 tANI_U8 nAssocType,
1307 tpPESession psessionEntry)
1308{
1309 if (nAssocType == LIM_REASSOC)
1310 {
1311 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1312 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1313 }else
1314 {
1315 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1316 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1317
1318 }
1319
1320 pCaps->present = 1;
1321} // End PopulateDot11fPowerCaps.
1322
1323tSirRetStatus
1324PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1325 tDot11fIEPowerConstraints *pDot11f)
1326{
1327 tANI_U32 cfg;
1328 tSirRetStatus nSirStatus;
1329
1330 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1331
1332 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1333 pDot11f->present = 1;
1334
1335 return eSIR_SUCCESS;
1336} // End PopulateDot11fPowerConstraints.
1337
1338void
1339PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1340 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1341{
1342 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1343 pDot11f->reserved = 0;
1344 pDot11f->txopreq = 0;
1345 pDot11f->qreq = 0;
1346 pDot11f->qack = 0;
1347 pDot11f->present = 1;
1348} // End PopulatedDot11fQOSCaps.
1349
1350void
1351PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1352 tDot11fIEQOSCapsStation *pDot11f)
1353{
1354 tANI_U32 val = 0;
1355
1356 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301357 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
1359 pDot11f->more_data_ack = 0;
1360 pDot11f->max_sp_length = (tANI_U8)val;
1361 pDot11f->qack = 0;
1362
1363 if (pMac->lim.gUapsdEnable)
1364 {
1365 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1366 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1367 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1368 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1369 }
1370 pDot11f->present = 1;
1371} // End PopulatedDot11fQOSCaps.
1372
1373tSirRetStatus
1374PopulateDot11fRSN(tpAniSirGlobal pMac,
1375 tpSirRSNie pRsnIe,
1376 tDot11fIERSN *pDot11f)
1377{
1378 tANI_U32 status;
1379 int idx;
1380
1381 if ( pRsnIe->length )
1382 {
1383 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1384 {
1385 status = dot11fUnpackIeRSN( pMac,
1386 pRsnIe->rsnIEdata + idx + 2, //EID, length
1387 pRsnIe->rsnIEdata[ idx + 1 ],
1388 pDot11f );
1389 if ( DOT11F_FAILED( status ) )
1390 {
1391 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
Sushant Kaushik87787972015-09-11 16:05:00 +05301392 "N (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001393 status );
1394 return eSIR_FAILURE;
1395 }
1396 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301397 "PopulateDot11fRSN."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001398 }
1399
1400 }
1401
1402 return eSIR_SUCCESS;
1403} // End PopulateDot11fRSN.
1404
1405tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1406 tpSirRSNie pRsnIe,
1407 tDot11fIERSNOpaque *pDot11f )
1408{
1409 int idx;
1410
1411 if ( pRsnIe->length )
1412 {
1413 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1414 {
1415 pDot11f->present = 1;
1416 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301417 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 pRsnIe->rsnIEdata + idx + 2, // EID, len
1419 pRsnIe->rsnIEdata[ idx + 1 ] );
1420 }
1421 }
1422
1423 return eSIR_SUCCESS;
1424
1425} // End PopulateDot11fRSNOpaque.
1426
1427
1428
1429#if defined(FEATURE_WLAN_WAPI)
1430
1431tSirRetStatus
1432PopulateDot11fWAPI(tpAniSirGlobal pMac,
1433 tpSirRSNie pRsnIe,
1434 tDot11fIEWAPI *pDot11f)
1435 {
1436 tANI_U32 status;
1437 int idx;
1438
1439 if ( pRsnIe->length )
1440 {
1441 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1442 {
1443 status = dot11fUnpackIeWAPI( pMac,
1444 pRsnIe->rsnIEdata + idx + 2, //EID, length
1445 pRsnIe->rsnIEdata[ idx + 1 ],
1446 pDot11f );
1447 if ( DOT11F_FAILED( status ) )
1448 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301449 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 status );
1451 return eSIR_FAILURE;
1452 }
1453 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301454 "PopulateDot11fWAPI."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 }
1456 }
1457
1458 return eSIR_SUCCESS;
1459} // End PopulateDot11fWAPI.
1460
1461tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1462 tpSirRSNie pRsnIe,
1463 tDot11fIEWAPIOpaque *pDot11f )
1464{
1465 int idx;
1466
1467 if ( pRsnIe->length )
1468 {
1469 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1470 {
1471 pDot11f->present = 1;
1472 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301473 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001474 pRsnIe->rsnIEdata + idx + 2, // EID, len
1475 pRsnIe->rsnIEdata[ idx + 1 ] );
1476 }
1477 }
1478
1479 return eSIR_SUCCESS;
1480
1481} // End PopulateDot11fWAPIOpaque.
1482
1483
1484#endif //defined(FEATURE_WLAN_WAPI)
1485
1486void
1487PopulateDot11fSSID(tpAniSirGlobal pMac,
1488 tSirMacSSid *pInternal,
1489 tDot11fIESSID *pDot11f)
1490{
1491 pDot11f->present = 1;
1492 pDot11f->num_ssid = pInternal->length;
1493 if ( pInternal->length )
1494 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301495 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001496 pInternal->length );
1497 }
1498} // End PopulateDot11fSSID.
1499
1500tSirRetStatus
1501PopulateDot11fSSID2(tpAniSirGlobal pMac,
1502 tDot11fIESSID *pDot11f)
1503{
1504 tANI_U32 nCfg;
1505 tSirRetStatus nSirStatus;
1506
1507 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1508 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1509 pDot11f->present = 1;
1510 return eSIR_SUCCESS;
1511} // End PopulateDot11fSSID2.
1512
1513void
1514PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1515 tDot11fIESchedule *pDot11f)
1516{
1517 pDot11f->aggregation = pSchedule->info.aggregation;
1518 pDot11f->tsid = pSchedule->info.tsid;
1519 pDot11f->direction = pSchedule->info.direction;
1520 pDot11f->reserved = pSchedule->info.rsvd;
1521 pDot11f->service_start_time = pSchedule->svcStartTime;
1522 pDot11f->service_interval = pSchedule->svcInterval;
1523 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1524 pDot11f->spec_interval = pSchedule->specInterval;
1525
1526 pDot11f->present = 1;
1527} // End PopulateDot11fSchedule.
1528
1529void
1530PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1531 tDot11fIESuppChannels *pDot11f,
1532 tANI_U8 nAssocType,
1533 tpPESession psessionEntry)
1534{
1535 tANI_U8 i;
1536 tANI_U8 *p;
1537
1538 if (nAssocType == LIM_REASSOC)
1539 {
1540 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1541 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1542 }else
1543 {
1544 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1545 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1546 }
1547 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1548 {
1549 pDot11f->bands[i][0] = *p;
1550 pDot11f->bands[i][1] = 1;
1551 }
1552
1553 pDot11f->present = 1;
1554
1555} // End PopulateDot11fSuppChannels.
1556
1557tSirRetStatus
1558PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1559 tANI_U8 nChannelNum,
1560 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1561{
1562 tSirRetStatus nSirStatus;
1563 tANI_U32 nRates;
1564 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1565
1566 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1567 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1568 sending mgmt frames (lile probe req) which need to go out before any session is present.
1569 */
1570 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1571 {
1572 #if 0
1573 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1574 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1575 #endif //TO SUPPORT BT-AMP
1576 if(psessionEntry != NULL)
1577 {
1578 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301579 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 nRates);
1581 }
1582 else
1583 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301584 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001585 nRates = 0;
1586 }
1587 }
1588 else if ( 14 >= nChannelNum )
1589 {
1590 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1591 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1592 }
1593 else
1594 {
1595 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1596 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1597 }
1598
1599 if ( 0 != nRates )
1600 {
1601 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301602 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 pDot11f->present = 1;
1604 }
1605
1606 return eSIR_SUCCESS;
1607
1608} // End PopulateDot11fSuppRates.
1609
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301610/**
1611 * PopulateDot11fRatesTdls() - populate supported rates and
1612 * extended supported rates IE.
1613 * @p_mac gloabl - header.
1614 * @p_supp_rates - pointer to supported rates IE
1615 * @p_ext_supp_rates - pointer to extended supported rates IE
1616 *
1617 * This function populates the supported rates and extended supported
1618 * rates IE based in the STA capability. If the number of rates
1619 * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
1620 * IE is populated.
1621 *
1622 * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
1623 * on failure.
1624 */
1625
1626tSirRetStatus
1627PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
1628 tDot11fIESuppRates *p_supp_rates,
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301629 tDot11fIEExtSuppRates *p_ext_supp_rates,
1630 tANI_U8 curr_oper_channel)
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301631{
1632 tSirMacRateSet temp_rateset;
1633 tSirMacRateSet temp_rateset2;
1634 uint32_t val, i;
1635 uint32_t self_dot11mode = 0;
1636
1637 wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
1638
1639 /**
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301640 * Include 11b rates only when the device configured
1641 * in auto, 11a/b/g or 11b_only and also if current base
1642 * channel is 5 GHz then no need to advertise the 11b rates.
1643 * If devices to move 2.4GHz off-channel then they can communicate
1644 * in 11g rates i.e. (6, 9, 12, 18, 24, 36 and 54).
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301645 */
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301646 limLog(p_mac, LOG1, FL("Current operating channel %d self_dot11mode = %d"),
1647 curr_oper_channel, self_dot11mode);
1648
1649 if ((curr_oper_channel <= SIR_11B_CHANNEL_END) &&
1650 ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301651 (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1652 (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
1653 (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
1654 (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301655 (self_dot11mode == WNI_CFG_DOT11_MODE_11B)))
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301656 {
1657 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1658 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
1659 (tANI_U8 *)&temp_rateset.rate, &val);
1660 temp_rateset.numRates = (tANI_U8) val;
1661 }
1662 else
1663 {
1664 temp_rateset.numRates = 0;
1665 }
1666
1667 /* Include 11a rates when the device configured in non-11b mode */
1668 if (!IS_DOT11_MODE_11B(self_dot11mode))
1669 {
1670 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1671 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
1672 (tANI_U8 *)&temp_rateset2.rate, &val);
1673 temp_rateset2.numRates = (tANI_U8) val;
1674 }
1675 else
1676 {
1677 temp_rateset2.numRates = 0;
1678 }
1679
1680 if ((temp_rateset.numRates + temp_rateset2.numRates) >
1681 SIR_MAC_MAX_NUMBER_OF_RATES)
1682 {
1683 limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
1684 SIR_MAC_MAX_NUMBER_OF_RATES);
1685 return eSIR_FAILURE;
1686 }
1687
1688 /**
1689 * copy all rates in temp_rateset,
1690 * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
1691 */
1692 for (i = 0; i < temp_rateset2.numRates; i++)
1693 temp_rateset.rate[i + temp_rateset.numRates] =
1694 temp_rateset2.rate[i];
1695
1696 temp_rateset.numRates += temp_rateset2.numRates;
1697
1698 if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
1699 {
1700 p_supp_rates->num_rates = temp_rateset.numRates;
1701 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1702 p_supp_rates->num_rates);
1703 p_supp_rates->present = 1;
1704 }
1705 else /* Populate extended capability as well */
1706 {
1707 p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
1708 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1709 p_supp_rates->num_rates);
1710 p_supp_rates->present = 1;
1711 p_ext_supp_rates->num_rates = temp_rateset.numRates -
1712 MAX_NUM_SUPPORTED_RATES;
1713 vos_mem_copy(p_ext_supp_rates->rates,
1714 (tANI_U8 *)temp_rateset.rate +
1715 MAX_NUM_SUPPORTED_RATES,
1716 p_ext_supp_rates->num_rates);
1717 p_ext_supp_rates->present = 1;
1718 }
1719
1720 return eSIR_SUCCESS;
1721
1722} /* End PopulateDot11fRatesTdls */
1723
Jeff Johnson295189b2012-06-20 16:38:30 -07001724tSirRetStatus
1725PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1726 tDot11fIETPCReport *pDot11f,
1727 tpPESession psessionEntry)
1728{
1729 tANI_U16 staid, txPower;
1730 tSirRetStatus nSirStatus;
1731
1732 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1733 if ( eSIR_SUCCESS != nSirStatus )
1734 {
1735 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1736 "eDot11fTPCReport; limGetMgmtStaid "
Sushant Kaushik87787972015-09-11 16:05:00 +05301737 "returned status %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 nSirStatus );
1739 return eSIR_FAILURE;
1740 }
1741
1742 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1743 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1744 txPower = 0;
1745 pDot11f->tx_power = ( tANI_U8 )txPower;
1746 pDot11f->link_margin = 0;
1747 pDot11f->present = 1;
1748
1749 return eSIR_SUCCESS;
1750} // End PopulateDot11fTPCReport.
1751
1752
1753void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1754 tDot11fFfTSInfo *pDot11f)
1755{
1756 pDot11f->traffic_type = pInfo->traffic.trafficType;
1757 pDot11f->tsid = pInfo->traffic.tsid;
1758 pDot11f->direction = pInfo->traffic.direction;
1759 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1760 pDot11f->aggregation = pInfo->traffic.aggregation;
1761 pDot11f->psb = pInfo->traffic.psb;
1762 pDot11f->user_priority = pInfo->traffic.userPrio;
1763 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1764 pDot11f->schedule = pInfo->schedule.schedule;
1765} // End PopulatedDot11fTSInfo.
1766
1767void PopulateDot11fWMM(tpAniSirGlobal pMac,
1768 tDot11fIEWMMInfoAp *pInfo,
1769 tDot11fIEWMMParams *pParams,
1770 tDot11fIEWMMCaps *pCaps,
1771 tpPESession psessionEntry)
1772{
1773 if ( psessionEntry->limWmeEnabled )
1774 {
1775 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1776 {
1777 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1778 {
1779 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1780 }
1781 }
1782 else
1783 {
1784 {
1785 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1786 }
1787
1788 if ( psessionEntry->limWsmEnabled )
1789 {
1790 PopulateDot11fWMMCaps( pCaps );
1791 }
1792 }
1793 }
1794} // End PopulateDot11fWMM.
1795
1796void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1797{
1798 pCaps->version = SIR_MAC_OUI_VERSION_1;
1799 pCaps->qack = 0;
1800 pCaps->queue_request = 1;
1801 pCaps->txop_request = 0;
1802 pCaps->more_ack = 0;
1803 pCaps->present = 1;
1804} // End PopulateDot11fWmmCaps.
1805
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001806#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001807void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1808{
1809 tANI_U8 numTspecs = 0, idx;
1810 tTspecInfo *pTspec = NULL;
1811
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001812 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1813 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 pReassoc->num_WMMTSPEC = numTspecs;
1815 if (numTspecs) {
1816 for (idx=0; idx<numTspecs; idx++) {
1817 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301818 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 pTspec++;
1820 }
1821 }
1822}
1823#endif
1824
1825void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1826 tpPESession psessionEntry)
1827{
1828 pInfo->version = SIR_MAC_OUI_VERSION_1;
1829
1830 /* WMM Specification 3.1.3, 3.2.3
1831 * An IBSS staion shall always use its default WMM parameters.
1832 */
1833 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1834 {
1835 pInfo->param_set_count = 0;
1836 pInfo->uapsd = 0;
1837 }
1838 else
1839 {
1840 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1842 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1843 }
1844 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001845 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1846 }
1847 pInfo->present = 1;
1848}
1849
1850void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1851{
1852 tANI_U32 val = 0;
1853
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301854 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 pInfo->version = SIR_MAC_OUI_VERSION_1;
1856 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1857 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1858 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1859 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1860
1861 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301862 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 pInfo->max_sp_length = (tANI_U8)val;
1864 pInfo->present = 1;
1865}
1866
Jeff Johnson295189b2012-06-20 16:38:30 -07001867void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1868 tDot11fIEWMMParams *pParams,
1869 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001870{
1871 pParams->version = SIR_MAC_OUI_VERSION_1;
1872
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1874 pParams->qosInfo =
1875 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1876 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001877 pParams->qosInfo =
1878 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1879
1880 // Fill each EDCA parameter set in order: be, bk, vi, vo
1881 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1882 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1883 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1884 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1885 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1886 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1887
1888 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1889 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1890 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1891 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1892 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1893 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1894
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1896 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1897 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1899
1900
1901
1902 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1903 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1904 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1905 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1906 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1907
Jeff Johnson295189b2012-06-20 16:38:30 -07001908 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1909 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1910 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1912
1913 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1914 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1915 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1916 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1917 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1918
1919 pParams->present = 1;
1920
1921} // End PopulateDot11fWMMParams.
1922
1923void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1924 tDot11fIEWMMSchedule *pDot11f)
1925{
1926 pDot11f->version = 1;
1927 pDot11f->aggregation = pSchedule->info.aggregation;
1928 pDot11f->tsid = pSchedule->info.tsid;
1929 pDot11f->direction = pSchedule->info.direction;
1930 pDot11f->reserved = pSchedule->info.rsvd;
1931 pDot11f->service_start_time = pSchedule->svcStartTime;
1932 pDot11f->service_interval = pSchedule->svcInterval;
1933 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1934 pDot11f->spec_interval = pSchedule->specInterval;
1935
1936 pDot11f->present = 1;
1937} // End PopulateDot11fWMMSchedule.
1938
1939tSirRetStatus
1940PopulateDot11fWPA(tpAniSirGlobal pMac,
1941 tpSirRSNie pRsnIe,
1942 tDot11fIEWPA *pDot11f)
1943{
1944 tANI_U32 status;
1945 int idx;
1946
1947 if ( pRsnIe->length )
1948 {
1949 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1950 {
1951 status = dot11fUnpackIeWPA( pMac,
1952 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1953 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1954 pDot11f );
1955 if ( DOT11F_FAILED( status ) )
1956 {
1957 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
Sushant Kaushik87787972015-09-11 16:05:00 +05301958 "A (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 status );
1960 return eSIR_FAILURE;
1961 }
1962 }
1963 }
1964
1965 return eSIR_SUCCESS;
1966} // End PopulateDot11fWPA.
1967
1968
1969
1970tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1971 tpSirRSNie pRsnIe,
1972 tDot11fIEWPAOpaque *pDot11f )
1973{
1974 int idx;
1975
1976 if ( pRsnIe->length )
1977 {
1978 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1979 {
1980 pDot11f->present = 1;
1981 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301982 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001983 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
1984 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
1985 }
1986 }
1987
1988 return eSIR_SUCCESS;
1989
1990} // End PopulateDot11fWPAOpaque.
1991
1992////////////////////////////////////////////////////////////////////////
1993
1994tSirRetStatus
1995sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
1996{
1997#if 0
1998 tANI_U32 val;
1999
2000 *caps = 0;
2001 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
2002 != eSIR_SUCCESS)
2003 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302004 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 return eSIR_FAILURE;
2006 }
2007 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
2008 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302009 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 return eSIR_FAILURE;
2011 }
2012
2013 *caps = (tANI_U16) val;
2014#endif
2015 return eSIR_SUCCESS;
2016}
2017
2018tSirRetStatus
2019sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
2020 tANI_U8 *pFrame,
2021 tANI_U32 nFrame,
2022 tpSirProbeReq pProbeReq)
2023{
2024 tANI_U32 status;
2025 tDot11fProbeRequest pr;
2026
2027 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302028 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002029
2030 // delegate to the framesc-generated code,
2031 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
2032 if ( DOT11F_FAILED( status ) )
2033 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302034 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 status, nFrame);
2036 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2037 return eSIR_FAILURE;
2038 }
2039 else if ( DOT11F_WARNED( status ) )
2040 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302041 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 status, nFrame );
2043 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2044 }
2045
2046 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
2047 if ( ! pr.SSID.present )
2048 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302049 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002050 }
2051 else
2052 {
2053 pProbeReq->ssidPresent = 1;
2054 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
2055 }
2056
2057 if ( ! pr.SuppRates.present )
2058 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302059 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002060 return eSIR_FAILURE;
2061 }
2062 else
2063 {
2064 pProbeReq->suppRatesPresent = 1;
2065 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
2066 }
2067
2068 if ( pr.ExtSuppRates.present )
2069 {
2070 pProbeReq->extendedRatesPresent = 1;
2071 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
2072 }
2073
2074 if ( pr.HTCaps.present )
2075 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302076 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 }
2078
2079 if ( pr.WscProbeReq.present )
2080 {
2081 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05302082 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002084#ifdef WLAN_FEATURE_11AC
2085 if ( pr.VHTCaps.present )
2086 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302087 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002088 }
2089#endif
2090
Jeff Johnson295189b2012-06-20 16:38:30 -07002091
2092 if ( pr.P2PProbeReq.present )
2093 {
2094 pProbeReq->p2pIePresent = 1;
2095 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002096
Jeff Johnson295189b2012-06-20 16:38:30 -07002097 return eSIR_SUCCESS;
2098
2099} // End sirConvertProbeReqFrame2Struct.
2100
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302101/* function ValidateAndRectifyIEs checks for the malformed frame.
2102 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302103 * (Tagged elements).
2104 * Every Tagged IE has tag number, tag length and data. Tag length indicates
2105 * the size of data in bytes.
2106 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302107 * And also rectifies missing optional fields in IE.
2108 *
2109 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
2110 * extended to rectify other optional fields in other IEs.
2111 *
2112 */
2113tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
2114 tANI_U8 *pMgmtFrame,
2115 tANI_U32 nFrameBytes,
2116 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302117{
2118 tANI_U32 length = SIZE_OF_FIXED_PARAM;
2119 tANI_U8 *refFrame;
2120
2121 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302122 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302123 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302124 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302125 {
2126 /*refFrame points to next IE */
2127 refFrame = pMgmtFrame + length;
2128 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
2129 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
2130 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302131 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302132 {
2133 /* Workaround : Some APs may not include RSN Capability but
2134 * the length of which is included in RSN IE length.
2135 * this may cause in updating RSN Capability with junk value.
2136 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302137 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302138 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302139 if ((*refFrame == RSNIEID) &&
2140 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302141 {
2142 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302143 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302144 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302145 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302146 limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05302147 FL("Added RSN Capability to the RSNIE as 0x00 0x00"));
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302148
2149 return eHAL_STATUS_SUCCESS;
Hu Wangfcc5e132016-03-04 10:34:24 +08002150 } else {
2151 /* Workaround: Some APs may add extra 0x00 padding after IEs.
2152 * Return true to allow these probe response frames proceed.
2153 */
2154 if (nFrameBytes - length > 0) {
2155 tANI_U32 i;
2156 tANI_BOOLEAN zero_padding = VOS_TRUE;
2157
2158 for (i = length; i < nFrameBytes; i ++) {
2159 if (pMgmtFrame[i-1] != 0x0) {
2160 zero_padding = VOS_FALSE;
2161 break;
2162 }
2163 }
2164
2165 if (zero_padding) {
2166 return eHAL_STATUS_SUCCESS;
2167 }
2168 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302169 }
Hu Wangfcc5e132016-03-04 10:34:24 +08002170
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302171 return eSIR_FAILURE;
2172 }
2173 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302174 return eHAL_STATUS_SUCCESS;
2175}
2176
Jeff Johnson295189b2012-06-20 16:38:30 -07002177tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
2178 tANI_U8 *pFrame,
2179 tANI_U32 nFrame,
2180 tpSirProbeRespBeacon pProbeResp)
2181{
2182 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002183 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002184
2185 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302186 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002187
Abhishek Singhc75726d2015-04-13 14:44:14 +05302188 pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302189 if ( NULL == pr )
2190 status = eHAL_STATUS_FAILURE;
2191 else
2192 status = eHAL_STATUS_SUCCESS;
2193 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07002194 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302195 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002196 return eSIR_FAILURE;
2197 }
2198
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302199 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002200
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002202 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 if ( DOT11F_FAILED( status ) )
2204 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302205 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 status, nFrame);
2207 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05302208 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 return eSIR_FAILURE;
2210 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002211
2212 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
2213
2214 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302215 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
2216 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002217
2218 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07002219 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002220
2221 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07002222 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
2223 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
2224 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
2225 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
2226 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
2227 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
2228 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
2229 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
2230 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
2231 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
2232 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2233 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2234 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2235 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2236 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2237 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002238
Jeff Johnson32d95a32012-09-10 13:15:23 -07002239 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002240 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302241 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 }
2243 else
2244 {
2245 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002246 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 }
2248
Jeff Johnson32d95a32012-09-10 13:15:23 -07002249 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302251 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 }
2253 else
2254 {
2255 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002256 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 }
2258
Jeff Johnson32d95a32012-09-10 13:15:23 -07002259 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 {
2261 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002262 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 }
2264
2265
Jeff Johnson32d95a32012-09-10 13:15:23 -07002266 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 {
2268 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002269 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 }
2271
Jeff Johnson32d95a32012-09-10 13:15:23 -07002272 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 {
2274 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002275 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002276 }
2277
Jeff Johnson32d95a32012-09-10 13:15:23 -07002278 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 {
2280 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002281 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 }
2283
Jeff Johnson32d95a32012-09-10 13:15:23 -07002284 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 {
2286 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302287 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 sizeof(tDot11fIEExtChanSwitchAnn) );
2289 }
2290
Jeff Johnson32d95a32012-09-10 13:15:23 -07002291 if ( pr->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 {
2293 pProbeResp->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302294 vos_mem_copy ( &pProbeResp->extChannelSwitchIE, &pr->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 sizeof(tDot11fIEExtChanSwitchAnn) );
2296 }
2297
Jeff Johnson32d95a32012-09-10 13:15:23 -07002298 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 {
2300 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302301 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 }
2303
Jeff Johnson32d95a32012-09-10 13:15:23 -07002304 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 {
2306 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302307 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2308 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 }
2310
Jeff Johnson32d95a32012-09-10 13:15:23 -07002311 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 {
2313 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302314 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 }
2316
Jeff Johnson32d95a32012-09-10 13:15:23 -07002317 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302319 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 }
2321
Jeff Johnson32d95a32012-09-10 13:15:23 -07002322 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302324 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 }
2326
Jeff Johnson32d95a32012-09-10 13:15:23 -07002327 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002328 {
2329 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002330 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002331 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002332 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002334 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 }
2336
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002337 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 {
2339 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002340 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 }
2342
Jeff Johnson32d95a32012-09-10 13:15:23 -07002343 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002344 {
2345 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002346 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 }
2348
Jeff Johnson32d95a32012-09-10 13:15:23 -07002349 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 {
2351 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002352 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05302353 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002354 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 }
2356
Jeff Johnson32d95a32012-09-10 13:15:23 -07002357 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 {
2359 pProbeResp->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05302360 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 }
2362
Jeff Johnson32d95a32012-09-10 13:15:23 -07002363 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 {
2365 pProbeResp->wsmCapablePresent = 1;
2366 }
2367
2368
Jeff Johnson32d95a32012-09-10 13:15:23 -07002369 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002370 {
2371 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002372 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 }
2374
2375#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002376 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 {
2378 // MobilityDomain
2379 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302380 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2381 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002382 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002383#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Sushant Kaushik87787972015-09-11 16:05:00 +05302384 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2386#endif
2387 }
2388#endif
2389
Kapil Gupta04ab1992016-06-26 13:36:51 +05302390#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
Jeff Johnson32d95a32012-09-10 13:15:23 -07002391 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002392 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302393 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002394 }
2395#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002396 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302398 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 sizeof(tDot11fIEP2PProbeRes) );
2400 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002401#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002402 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002403 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302404 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002405 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002406 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002407 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302408 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002409 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002410 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002411 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302412 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002413 }
2414#endif
Abhishek Singh74037df2017-07-20 11:08:56 +05302415 sir_copy_hs20_ie(&pProbeResp->hs20vendor_ie, &pr->hs20vendor_ie);
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302416
Abhishek Singhc75726d2015-04-13 14:44:14 +05302417 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 return eSIR_SUCCESS;
2419
2420} // End sirConvertProbeFrame2Struct.
2421
2422tSirRetStatus
2423sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2424 tANI_U8 *pFrame,
2425 tANI_U32 nFrame,
2426 tpSirAssocReq pAssocReq)
2427{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002428 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002429 tANI_U32 status;
2430
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302431 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2432 if ( NULL == ar )
2433 status = eHAL_STATUS_FAILURE;
2434 else
2435 status = eHAL_STATUS_SUCCESS;
2436 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002437 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302438 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002439 return eSIR_FAILURE;
2440 }
2441 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302442 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2443 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002444
2445 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002446 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002447 if ( DOT11F_FAILED( status ) )
2448 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302449 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 status, nFrame);
2451 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302452 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002453 return eSIR_FAILURE;
2454 }
2455 else if ( DOT11F_WARNED( status ) )
2456 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302457 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 status, nFrame );
2459 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2460 }
2461
2462 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2463
2464 // make sure this is seen as an assoc request
2465 pAssocReq->reassocRequest = 0;
2466
2467 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002468 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2469 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2470 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2471 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2472 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2473 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2474 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2475 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2476 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2477 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2478 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2479 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2480 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2481 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2482 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2483 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002484
2485 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002486 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002487
2488 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002489 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 {
2491 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002492 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002493 }
2494
2495 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002496 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 {
2498 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002499 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002500 }
2501
2502 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002503 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 {
2505 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002506 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002507 }
2508
2509 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002510 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 {
2512 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002513 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 }
2515
2516 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002517 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 {
2519 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002520 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002521 }
2522
2523 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002524 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002525 {
2526 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002527 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002528 }
2529
2530 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002531 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002532 {
2533 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002534 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002535 }
2536
2537
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002538 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 {
2540 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002541 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002542 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002543#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002544 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002545 {
2546 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002547 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002548 }
2549#endif
2550
Jeff Johnson295189b2012-06-20 16:38:30 -07002551 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002552 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 {
2554 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002555 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002556 }
2557
2558 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002559 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 {
2561 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002562 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 }
2564
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002565 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002566 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302567 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 }
2569
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002570 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 {
2572 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302573 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2574 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002575
2576 }
2577
2578
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002579 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581 if ( ! pAssocReq->ssidPresent )
2582 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302583 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302584 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 return eSIR_FAILURE;
2586 }
2587
2588 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2589 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302590 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302591 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002592 return eSIR_FAILURE;
2593 }
2594
Jeff Johnsone7245742012-09-05 17:12:55 -07002595#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002596 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002597 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302598 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302599 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002600 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2601 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002602 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002603 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302604 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Sushant Kaushik87787972015-09-11 16:05:00 +05302605 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002606 limLogOperatingMode( pMac, &pAssocReq->operMode);
2607 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002608#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302609 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 return eSIR_SUCCESS;
2611
2612} // End sirConvertAssocReqFrame2Struct.
2613
2614tSirRetStatus
2615sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2616 tANI_U8 *pFrame,
2617 tANI_U32 nFrame,
2618 tpSirAssocRsp pAssocRsp)
2619{
2620 static tDot11fAssocResponse ar;
2621 tANI_U32 status;
2622 tANI_U8 cnt =0;
2623
2624 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302625 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002626
2627 // delegate to the framesc-generated code,
2628 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2629 if ( DOT11F_FAILED( status ) )
2630 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302631 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002632 status, nFrame);
2633 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2634 return eSIR_FAILURE;
2635 }
2636 else if ( DOT11F_WARNED( status ) )
2637 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302638 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002639 status, nFrame );
2640 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2641 }
2642
2643 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2644
2645 // Capabilities
2646 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2647 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2648 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2649 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2650 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2651 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2652 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2653 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2654 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2655 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2656 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2657 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2658 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2659 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2660 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2661 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2662
2663 pAssocRsp->statusCode = ar.Status.status;
2664 pAssocRsp->aid = ar.AID.associd;
2665
2666 if ( ! ar.SuppRates.present )
2667 {
2668 pAssocRsp->suppRatesPresent = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302669 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002670 }
2671 else
2672 {
2673 pAssocRsp->suppRatesPresent = 1;
2674 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2675 }
2676
2677 if ( ar.ExtSuppRates.present )
2678 {
2679 pAssocRsp->extendedRatesPresent = 1;
2680 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2681 }
2682
2683 if ( ar.EDCAParamSet.present )
2684 {
2685 pAssocRsp->edcaPresent = 1;
2686 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2687 }
Atul Mittalbceb4a12014-11-27 18:50:19 +05302688 if (ar.ExtCap.present)
2689 {
Hu Wangc12631c2016-08-11 09:57:03 +08002690 struct s_ext_cap *p_ext_cap;
Atul Mittalbceb4a12014-11-27 18:50:19 +05302691 vos_mem_copy(&pAssocRsp->ExtCap, &ar.ExtCap, sizeof(tDot11fIEExtCap));
Hu Wangc12631c2016-08-11 09:57:03 +08002692
2693 p_ext_cap = (struct s_ext_cap *)&pAssocRsp->ExtCap.bytes;
Atul Mittalbceb4a12014-11-27 18:50:19 +05302694 limLog(pMac, LOG1,
2695 FL("ExtCap is present, TDLSChanSwitProhibited: %d"),
Hu Wangc12631c2016-08-11 09:57:03 +08002696 p_ext_cap->TDLSChanSwitProhibited);
Atul Mittalbceb4a12014-11-27 18:50:19 +05302697 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 if ( ar.WMMParams.present )
2699 {
2700 pAssocRsp->wmeEdcaPresent = 1;
2701 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002702 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 __printWMMParams(pMac, &ar.WMMParams);
2704 }
2705
2706 if ( ar.HTCaps.present )
2707 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302708 limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302709 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002710 }
2711
2712 if ( ar.HTInfo.present )
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302713 { limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302714 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002715 }
2716
2717#ifdef WLAN_FEATURE_VOWIFI_11R
2718 if (ar.MobilityDomain.present)
2719 {
2720 // MobilityDomain
2721 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302722 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2723 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002724 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2725#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002726 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2728#endif
2729 }
2730
2731 if ( ar.FTInfo.present )
2732 {
2733#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002734 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 -07002735 ar.FTInfo.R0KH_ID.present,
2736 ar.FTInfo.R1KH_ID.present);
2737#endif
2738 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302739 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 }
2741#endif
2742
2743#ifdef WLAN_FEATURE_VOWIFI_11R
Sreelakshmi Konamki81c95e22016-12-16 19:57:52 +05302744 if (ar.num_RICDataDesc <= 2) {
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2746 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302747 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2748 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 }
2750 }
2751 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2752 pAssocRsp->ricPresent = TRUE;
2753 }
2754#endif
2755
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002756#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002757 if (ar.num_WMMTSPEC) {
2758 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2759 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302760 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2761 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002762 }
2763 pAssocRsp->tspecPresent = TRUE;
2764 }
2765
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002766 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 {
2768 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302769 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002770 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 }
2772#endif
2773
Jeff Johnsone7245742012-09-05 17:12:55 -07002774#ifdef WLAN_FEATURE_11AC
2775 if ( ar.VHTCaps.present )
2776 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302777 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002778 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002779 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2780 }
2781 if ( ar.VHTOperation.present )
2782 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302783 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002784 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002785 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2786 }
2787#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302788 if(ar.OBSSScanParameters.present)
2789 {
2790 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2791 sizeof( tDot11fIEOBSSScanParameters));
2792 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002793 if ( ar.QosMapSet.present )
2794 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002795 pAssocRsp->QosMapSet.present = 1;
2796 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002797 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002798 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002799 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002800 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002801} // End sirConvertAssocRespFrame2Struct.
2802
2803tSirRetStatus
2804sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2805 tANI_U8 *pFrame,
2806 tANI_U32 nFrame,
2807 tpSirAssocReq pAssocReq)
2808{
2809 static tDot11fReAssocRequest ar;
2810 tANI_U32 status;
2811
2812 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302813 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002814
2815 // delegate to the framesc-generated code,
2816 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2817 if ( DOT11F_FAILED( status ) )
2818 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302819 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 status, nFrame);
2821 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2822 return eSIR_FAILURE;
2823 }
2824 else if ( DOT11F_WARNED( status ) )
2825 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302826 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 status, nFrame );
2828 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2829 }
2830
2831 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2832
2833 // make sure this is seen as a re-assoc request
2834 pAssocReq->reassocRequest = 1;
2835
2836 // Capabilities
2837 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2838 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2839 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2840 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2841 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2842 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2843 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2844 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2845 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2846 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2847 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2848 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2849 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2850 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2851 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2852 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2853
2854 // Listen Interval
2855 pAssocReq->listenInterval = ar.ListenInterval.interval;
2856
2857 // SSID
2858 if ( ar.SSID.present )
2859 {
2860 pAssocReq->ssidPresent = 1;
2861 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2862 }
2863
2864 // Supported Rates
2865 if ( ar.SuppRates.present )
2866 {
2867 pAssocReq->suppRatesPresent = 1;
2868 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2869 }
2870
2871 // Extended Supported Rates
2872 if ( ar.ExtSuppRates.present )
2873 {
2874 pAssocReq->extendedRatesPresent = 1;
2875 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2876 &ar.ExtSuppRates );
2877 }
2878
2879 // QOS Capabilities:
2880 if ( ar.QOSCapsStation.present )
2881 {
2882 pAssocReq->qosCapabilityPresent = 1;
2883 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2884 }
2885
2886 // WPA
2887 if ( ar.WPAOpaque.present )
2888 {
2889 pAssocReq->wpaPresent = 1;
2890 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2891 }
2892
2893 // RSN
2894 if ( ar.RSNOpaque.present )
2895 {
2896 pAssocReq->rsnPresent = 1;
2897 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2898 }
2899
2900
2901 // Power Capabilities
2902 if ( ar.PowerCaps.present )
2903 {
2904 pAssocReq->powerCapabilityPresent = 1;
2905 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2906 }
2907
2908 // Supported Channels
2909 if ( ar.SuppChannels.present )
2910 {
2911 pAssocReq->supportedChannelsPresent = 1;
2912 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2913 }
2914
2915 if ( ar.HTCaps.present )
2916 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302917 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002918 }
2919
2920 if ( ar.WMMInfoStation.present )
2921 {
2922 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302923 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2924 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002925
2926 }
2927
2928 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2929
2930 if ( ! pAssocReq->ssidPresent )
2931 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302932 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002933 return eSIR_FAILURE;
2934 }
2935
2936 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2937 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302938 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002939 return eSIR_FAILURE;
2940 }
2941
2942 // Why no call to 'updateAssocReqFromPropCapability' here, like
2943 // there is in 'sirConvertAssocReqFrame2Struct'?
2944
2945 // WSC IE
2946 if (ar.WscIEOpaque.present)
2947 {
2948 pAssocReq->addIEPresent = 1;
2949 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2950 }
2951
Jeff Johnson295189b2012-06-20 16:38:30 -07002952 if(ar.P2PIEOpaque.present)
2953 {
2954 pAssocReq->addIEPresent = 1;
2955 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2956 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002957
Jeff Johnsone7245742012-09-05 17:12:55 -07002958#ifdef WLAN_FEATURE_WFD
2959 if(ar.WFDIEOpaque.present)
2960 {
2961 pAssocReq->addIEPresent = 1;
2962 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2963 }
2964#endif
2965
2966#ifdef WLAN_FEATURE_11AC
2967 if ( ar.VHTCaps.present )
2968 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302969 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002970 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002971 if ( ar.OperatingMode.present )
2972 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302973 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302974 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002975 limLogOperatingMode( pMac, &pAssocReq->operMode);
2976 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002977#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 return eSIR_SUCCESS;
2979
2980} // End sirConvertReassocReqFrame2Struct.
2981
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002982
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002983#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002984tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002985sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002986 tANI_U8 *pPayload,
2987 const tANI_U32 nPayload,
2988 tANI_U8 **outIeBuf,
2989 tANI_U32 *pOutIeLen)
2990{
2991 tDot11fBeaconIEs *pBies = NULL;
2992 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002993 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002994 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002995
2996 /* To store how many bytes are required to be allocated
2997 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08002998 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08002999 tANI_U8 *pos = NULL;
3000
3001 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003002 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003003 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3004 if ( NULL == pBies )
3005 status = eHAL_STATUS_FAILURE;
3006 else
3007 status = eHAL_STATUS_SUCCESS;
3008 if (!HAL_STATUS_SUCCESS(status))
3009 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303010 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003011 return eSIR_FAILURE;
3012 }
Hu Wangc12631c2016-08-11 09:57:03 +08003013 vos_mem_zero(pBies, sizeof(tDot11fBeaconIEs));
3014
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003015 // delegate to the framesc-generated code,
3016 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3017
3018 if ( DOT11F_FAILED( status ) )
3019 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303020 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003021 status, nPayload);
3022 vos_mem_free(pBies);
3023 return eSIR_FAILURE;
3024 }
3025 else if ( DOT11F_WARNED( status ) )
3026 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303027 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003028 status, nPayload );
3029 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3030 }
3031
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003032 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003033 if ( !pBies->SSID.present )
3034 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303035 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003036 }
3037 else
3038 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003039 eseBcnReportMandatoryIe.ssidPresent = 1;
3040 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003041 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003042 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003043 }
3044
3045 if ( !pBies->SuppRates.present )
3046 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303047 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003048 }
3049 else
3050 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003051 eseBcnReportMandatoryIe.suppRatesPresent = 1;
3052 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
3053 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003054 }
3055
3056 if ( pBies->FHParamSet.present)
3057 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003058 eseBcnReportMandatoryIe.fhParamPresent = 1;
3059 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003060 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
3061 }
3062
3063 if ( pBies->DSParams.present )
3064 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003065 eseBcnReportMandatoryIe.dsParamsPresent = 1;
3066 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003067 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
3068 }
3069
3070 if ( pBies->CFParams.present )
3071 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003072 eseBcnReportMandatoryIe.cfPresent = 1;
3073 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003074 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
3075 }
3076
3077 if ( pBies->IBSSParams.present )
3078 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003079 eseBcnReportMandatoryIe.ibssParamPresent = 1;
3080 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003081 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3082 }
3083
3084 if ( pBies->TIM.present )
3085 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003086 eseBcnReportMandatoryIe.timPresent = 1;
3087 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
3088 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
3089 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
3090 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003091 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
3092 }
3093
3094 if ( pBies->RRMEnabledCap.present )
3095 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003096 eseBcnReportMandatoryIe.rrmPresent = 1;
3097 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003098 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3099 }
3100
3101 *outIeBuf = vos_mem_malloc(numBytes);
3102 if (NULL == *outIeBuf)
3103 {
3104 limLog(pMac, LOGP, FL("Memory Allocation failure"));
3105 vos_mem_free(pBies);
3106 return eSIR_FAILURE;
3107 }
3108 pos = *outIeBuf;
3109 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003110 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003111
3112 /* Start filling the output Ie with Mandatory IE information */
3113 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003114 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003115 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003116 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003117 {
3118 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
3119 retStatus = eSIR_FAILURE;
3120 goto err_bcnrep;
3121 }
3122 *pos = SIR_MAC_SSID_EID;
3123 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003124 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003125 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003126 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
3127 eseBcnReportMandatoryIe.ssId.length);
3128 pos += eseBcnReportMandatoryIe.ssId.length;
3129 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003130 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003131
3132 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003133 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003134 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003135 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003136 {
3137 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
3138 retStatus = eSIR_FAILURE;
3139 goto err_bcnrep;
3140 }
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05303141 if (eseBcnReportMandatoryIe.supportedRates.numRates <=
3142 SIR_MAC_RATESET_EID_MAX) {
3143 *pos = SIR_MAC_RATESET_EID;
3144 pos++;
3145 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
3146 pos++;
3147 vos_mem_copy(pos,
3148 (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
3149 eseBcnReportMandatoryIe.supportedRates.numRates);
3150 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
3151 freeBytes -= (1 + 1 +
3152 eseBcnReportMandatoryIe.supportedRates.numRates);
3153 }
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003154 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003155
3156 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003157 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003158 {
3159 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
3160 {
3161 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
3162 retStatus = eSIR_FAILURE;
3163 goto err_bcnrep;
3164 }
3165 *pos = SIR_MAC_FH_PARAM_SET_EID;
3166 pos++;
3167 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
3168 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003169 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003170 SIR_MAC_FH_PARAM_SET_EID_MAX);
3171 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
3172 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
3173 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003174
3175 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003176 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003177 {
3178 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
3179 {
3180 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
3181 retStatus = eSIR_FAILURE;
3182 goto err_bcnrep;
3183 }
3184 *pos = SIR_MAC_DS_PARAM_SET_EID;
3185 pos++;
3186 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
3187 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003188 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003189 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
3190 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
3191 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003192
3193 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003194 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003195 {
3196 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
3197 {
3198 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
3199 retStatus = eSIR_FAILURE;
3200 goto err_bcnrep;
3201 }
3202 *pos = SIR_MAC_CF_PARAM_SET_EID;
3203 pos++;
3204 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
3205 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003206 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003207 SIR_MAC_CF_PARAM_SET_EID_MAX);
3208 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
3209 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
3210 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003211
3212 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003213 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003214 {
3215 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
3216 {
3217 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
3218 retStatus = eSIR_FAILURE;
3219 goto err_bcnrep;
3220 }
3221 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
3222 pos++;
3223 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3224 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003225 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003226 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3227 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3228 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3229 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003230
3231 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003232 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003233 {
3234 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
3235 {
3236 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
3237 retStatus = eSIR_FAILURE;
3238 goto err_bcnrep;
3239 }
3240 *pos = SIR_MAC_TIM_EID;
3241 pos++;
3242 *pos = SIR_MAC_TIM_EID_MIN;
3243 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003244 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003245 SIR_MAC_TIM_EID_MIN);
3246 pos += SIR_MAC_TIM_EID_MIN;
3247 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
3248 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003249
3250 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003251 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003252 {
3253 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3254 {
3255 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3256 retStatus = eSIR_FAILURE;
3257 goto err_bcnrep;
3258 }
3259 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3260 pos++;
3261 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3262 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003263 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003264 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3265 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3266 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003267
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003268 if (freeBytes != 0)
3269 {
3270 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3271 retStatus = eSIR_FAILURE;
3272 }
3273
3274err_bcnrep:
3275 /* The message counter would not be incremented in case of
3276 * returning failure and hence next time, this function gets
3277 * called, it would be using the same msg ctr for a different
3278 * BSS.So, it is good to clear the memory allocated for a BSS
3279 * that is returning failure.On success, the caller would take
3280 * care of freeing up the memory*/
3281 if (retStatus == eSIR_FAILURE)
3282 {
3283 vos_mem_free(*outIeBuf);
3284 *outIeBuf = NULL;
3285 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003286 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003287 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003288}
3289
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003290#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003291
Jeff Johnson295189b2012-06-20 16:38:30 -07003292tSirRetStatus
3293sirParseBeaconIE(tpAniSirGlobal pMac,
3294 tpSirProbeRespBeacon pBeaconStruct,
3295 tANI_U8 *pPayload,
3296 tANI_U32 nPayload)
3297{
3298 tDot11fBeaconIEs *pBies;
3299 tANI_U32 status;
3300
3301 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303302 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003303
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303304 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3305 if ( NULL == pBies )
3306 status = eHAL_STATUS_FAILURE;
3307 else
3308 status = eHAL_STATUS_SUCCESS;
3309 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303311 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 return eSIR_FAILURE;
3313 }
Hu Wangc12631c2016-08-11 09:57:03 +08003314 vos_mem_zero(pBies, sizeof(tDot11fBeaconIEs));
3315
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 // delegate to the framesc-generated code,
3317 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3318
3319 if ( DOT11F_FAILED( status ) )
3320 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303321 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 status, nPayload);
3323 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303324 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 return eSIR_FAILURE;
3326 }
3327 else if ( DOT11F_WARNED( status ) )
3328 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303329 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 status, nPayload );
3331 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3332 }
3333
3334 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3335 if ( ! pBies->SSID.present )
3336 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303337 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 }
3339 else
3340 {
3341 pBeaconStruct->ssidPresent = 1;
3342 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3343 }
3344
3345 if ( ! pBies->SuppRates.present )
3346 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303347 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 }
3349 else
3350 {
3351 pBeaconStruct->suppRatesPresent = 1;
3352 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3353 }
3354
3355 if ( pBies->ExtSuppRates.present )
3356 {
3357 pBeaconStruct->extendedRatesPresent = 1;
3358 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3359 }
3360
3361 if ( pBies->CFParams.present )
3362 {
3363 pBeaconStruct->cfPresent = 1;
3364 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3365 }
3366
3367 if ( pBies->TIM.present )
3368 {
3369 pBeaconStruct->timPresent = 1;
3370 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3371 }
3372
3373 if ( pBies->Country.present )
3374 {
3375 pBeaconStruct->countryInfoPresent = 1;
3376 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3377 }
3378
3379 // 11h IEs
3380 if(pBies->TPCReport.present)
3381 {
3382 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303383 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 &pBies->TPCReport,
3385 sizeof( tDot11fIETPCReport));
3386 }
3387
3388 if(pBies->PowerConstraints.present)
3389 {
3390 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303391 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 &pBies->PowerConstraints,
3393 sizeof(tDot11fIEPowerConstraints));
3394 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003395#ifdef FEATURE_WLAN_ESE
3396 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003397 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003398 pBeaconStruct->eseTxPwr.present = 1;
3399 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 }
3401 if (pBies->QBSSLoad.present)
3402 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303403 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003404 }
3405#endif
3406
3407 if ( pBies->EDCAParamSet.present )
3408 {
3409 pBeaconStruct->edcaPresent = 1;
3410 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3411 }
3412
3413 // QOS Capabilities:
3414 if ( pBies->QOSCapsAp.present )
3415 {
3416 pBeaconStruct->qosCapabilityPresent = 1;
3417 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3418 }
3419
3420
3421
3422 if ( pBies->ChanSwitchAnn.present )
3423 {
3424 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303425 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 sizeof(tDot11fIEChanSwitchAnn));
3427 }
3428
3429 if ( pBies->ExtChanSwitchAnn.present)
3430 {
3431 pBeaconStruct->extChannelSwitchPresent= 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303432 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBies->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003433 sizeof(tDot11fIEExtChanSwitchAnn));
3434 }
3435
3436 if ( pBies->Quiet.present )
3437 {
3438 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303439 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003440 }
3441
3442 if ( pBies->HTCaps.present )
3443 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303444 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003445 }
3446
3447 if ( pBies->HTInfo.present )
3448 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303449 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 }
3451
3452 if ( pBies->DSParams.present )
3453 {
3454 pBeaconStruct->dsParamsPresent = 1;
3455 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3456 }
3457 else if(pBies->HTInfo.present)
3458 {
3459 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3460 }
3461
3462 if ( pBies->RSN.present )
3463 {
3464 pBeaconStruct->rsnPresent = 1;
3465 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3466 }
3467
3468 if ( pBies->WPA.present )
3469 {
3470 pBeaconStruct->wpaPresent = 1;
3471 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3472 }
3473
3474 if ( pBies->WMMParams.present )
3475 {
3476 pBeaconStruct->wmeEdcaPresent = 1;
3477 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3478 }
3479
3480 if ( pBies->WMMInfoAp.present )
3481 {
3482 pBeaconStruct->wmeInfoPresent = 1;
3483 }
3484
3485 if ( pBies->WMMCaps.present )
3486 {
3487 pBeaconStruct->wsmCapablePresent = 1;
3488 }
3489
3490
3491 if ( pBies->ERPInfo.present )
3492 {
3493 pBeaconStruct->erpPresent = 1;
3494 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3495 }
3496
Jeff Johnsone7245742012-09-05 17:12:55 -07003497#ifdef WLAN_FEATURE_11AC
3498 if ( pBies->VHTCaps.present )
3499 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303500 pBeaconStruct->VHTCaps.present = 1;
3501 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003502 }
3503 if ( pBies->VHTOperation.present )
3504 {
3505 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303506 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3507 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003508 }
3509 if ( pBies->VHTExtBssLoad.present )
3510 {
3511 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303512 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3513 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003514 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003515 if( pBies->OperatingMode.present)
3516 {
3517 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303518 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3519 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003520 }
3521
Jeff Johnsone7245742012-09-05 17:12:55 -07003522#endif
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303523 if (pBies->ExtCap.present )
3524 {
3525 pBeaconStruct->ExtCap.present = 1;
3526 vos_mem_copy( &pBeaconStruct->ExtCap, &pBies->ExtCap,
3527 sizeof(tDot11fIEExtCap));
3528 }
Abhishek Singh74037df2017-07-20 11:08:56 +05303529 sir_copy_hs20_ie(&pBeaconStruct->hs20vendor_ie, &pBies->hs20vendor_ie);
3530
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303531 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003532
Jeff Johnsone7245742012-09-05 17:12:55 -07003533
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 return eSIR_SUCCESS;
3535
3536} // End sirParseBeaconIE.
3537
3538tSirRetStatus
3539sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3540 tANI_U8 *pFrame,
3541 tpSirProbeRespBeacon pBeaconStruct)
3542{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003543 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 tANI_U32 status, nPayload;
3545 tANI_U8 *pPayload;
3546 tpSirMacMgmtHdr pHdr;
3547 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003548 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003549
3550 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3551 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3552 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3553 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003554 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003555
3556 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303557 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3558
Abhishek Singhc75726d2015-04-13 14:44:14 +05303559 pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303560 if ( NULL == pBeacon )
3561 status = eHAL_STATUS_FAILURE;
3562 else
3563 status = eHAL_STATUS_SUCCESS;
3564 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003565 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303566 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003567 return eSIR_FAILURE;
3568 }
3569
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303570 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003571
3572 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303573 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003574
3575 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003576 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003577 if ( DOT11F_FAILED( status ) )
3578 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303579 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003580 status, nPayload);
3581 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05303582 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003583 return eSIR_FAILURE;
3584 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003585
3586 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3587 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303588 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3589 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003590
3591 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003592 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003593
3594 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003595 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3596 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3597 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3598 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3599 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3600 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3601 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3602 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3603 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3604 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3605 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3606 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3607 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3608 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3609 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3610 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003611
Jeff Johnson32d95a32012-09-10 13:15:23 -07003612 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303614 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 }
3616 else
3617 {
3618 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003619 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003620 }
3621
Jeff Johnson32d95a32012-09-10 13:15:23 -07003622 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303624 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 }
3626 else
3627 {
3628 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003629 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003630 }
3631
Jeff Johnson32d95a32012-09-10 13:15:23 -07003632 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003633 {
3634 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003635 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003636 }
3637
3638
Jeff Johnson32d95a32012-09-10 13:15:23 -07003639 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003640 {
3641 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003642 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003643 }
3644
Jeff Johnson32d95a32012-09-10 13:15:23 -07003645 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003646 {
3647 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003648 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003649 }
3650
Jeff Johnson32d95a32012-09-10 13:15:23 -07003651 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 {
3653 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003654 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003655 }
3656
3657 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003658 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003659 {
3660 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003661 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003662 }
3663
Jeff Johnson32d95a32012-09-10 13:15:23 -07003664 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 {
3666 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003667 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 }
3669
Jeff Johnson32d95a32012-09-10 13:15:23 -07003670 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 {
3672 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303673 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003674 sizeof(tDot11fIEChanSwitchAnn) );
3675 }
3676
Jeff Johnson32d95a32012-09-10 13:15:23 -07003677 if ( pBeacon->ExtChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 {
3679 pBeaconStruct->extChannelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303680 vos_mem_copy( &pBeaconStruct->extChannelSwitchIE, &pBeacon->ExtChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003681 sizeof(tDot11fIEExtChanSwitchAnn) );
3682 }
3683
Jeff Johnson32d95a32012-09-10 13:15:23 -07003684 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003685 {
3686 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303687 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 sizeof(tDot11fIETPCReport));
3689 }
3690
Jeff Johnson32d95a32012-09-10 13:15:23 -07003691 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 {
3693 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303694 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 sizeof(tDot11fIEPowerConstraints));
3696 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003697
3698 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003699 {
3700 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303701 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003702 }
3703
Jeff Johnson32d95a32012-09-10 13:15:23 -07003704 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303706 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 }
3708
Jeff Johnson32d95a32012-09-10 13:15:23 -07003709 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303711 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003712
3713 }
3714
Jeff Johnson32d95a32012-09-10 13:15:23 -07003715 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003716 {
3717 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003718 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003720 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003721 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003722 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003723 }
3724 else
3725 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003726 if ((!rfBand) || IS_5G_BAND(rfBand))
3727 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3728 else if (IS_24G_BAND(rfBand))
3729 pBeaconStruct->channelNumber = mappedRXCh;
3730 else
3731 {
3732 /*Only 0, 1, 2 are expected values for RF band from FW
3733 * if FW fixes are not present then rf band value will
3734 * be 0, else either 1 or 2 are expected from FW, 3 is
3735 * not expected from FW */
3736 PELOGE(limLog(pMac, LOGE,
3737 FL("Channel info is not present in Beacon and"
3738 " mapping is not done correctly"));)
3739 pBeaconStruct->channelNumber = mappedRXCh;
3740 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003741 }
3742
Jeff Johnson32d95a32012-09-10 13:15:23 -07003743 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003744 {
3745 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003746 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003747 }
3748
Jeff Johnson32d95a32012-09-10 13:15:23 -07003749 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 {
3751 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003752 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 }
3754
Jeff Johnson32d95a32012-09-10 13:15:23 -07003755 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003756 {
3757 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003758 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05303759 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003760 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003761 }
3762
Jeff Johnson32d95a32012-09-10 13:15:23 -07003763 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003764 {
3765 pBeaconStruct->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05303766 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003767 }
3768
Jeff Johnson32d95a32012-09-10 13:15:23 -07003769 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003770 {
3771 pBeaconStruct->wsmCapablePresent = 1;
3772 }
3773
Jeff Johnson32d95a32012-09-10 13:15:23 -07003774 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 {
3776 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003777 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003778 }
3779
3780#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003781 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003782 {
3783 // MobilityDomain
3784 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303785 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3786 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003787 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003788
3789 }
3790#endif
3791
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003792#ifdef FEATURE_WLAN_ESE
3793 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303794 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003795 //ESE Tx Power
3796 pBeaconStruct->eseTxPwr.present = 1;
3797 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3798 &pBeacon->ESETxmitPower,
3799 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303800 }
3801#endif
3802
Jeff Johnsone7245742012-09-05 17:12:55 -07003803#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003804 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003805 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303806 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003807 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003808 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003809 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303810 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3811 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003812 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003813 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003814 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303815 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3816 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003817 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003818 if(pBeacon->OperatingMode.present)
3819 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303820 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3821 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003822 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003823 if(pBeacon->WiderBWChanSwitchAnn.present)
3824 {
3825 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303826 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3827 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003828 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003829#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303830 if(pBeacon->OBSSScanParameters.present)
3831 {
3832 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3833 &pBeacon->OBSSScanParameters,
3834 sizeof( tDot11fIEOBSSScanParameters));
3835 }
Abhishek Singh74037df2017-07-20 11:08:56 +05303836 sir_copy_hs20_ie(&pBeaconStruct->hs20vendor_ie, &pBeacon->hs20vendor_ie);
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303837
Abhishek Singhc75726d2015-04-13 14:44:14 +05303838 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 return eSIR_SUCCESS;
3840
3841} // End sirConvertBeaconFrame2Struct.
3842
3843tSirRetStatus
3844sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3845 tANI_U8 *pFrame,
3846 tANI_U32 nFrame,
3847 tpSirMacAuthFrameBody pAuth)
3848{
3849 static tDot11fAuthentication auth;
3850 tANI_U32 status;
3851
3852 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303853 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003854
3855 // delegate to the framesc-generated code,
3856 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3857 if ( DOT11F_FAILED( status ) )
3858 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303859 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003860 status, nFrame);
3861 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3862 return eSIR_FAILURE;
3863 }
3864 else if ( DOT11F_WARNED( status ) )
3865 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303866 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 status, nFrame );
3868 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3869 }
3870
3871 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3872 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3873 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3874 pAuth->authStatusCode = auth.Status.status;
3875
3876 if ( auth.ChallengeText.present )
3877 {
3878 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3879 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303880 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 }
3882
3883 return eSIR_SUCCESS;
3884
3885} // End sirConvertAuthFrame2Struct.
3886
3887tSirRetStatus
3888sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3889 tANI_U8 *pFrame,
3890 tANI_U32 nFrame,
3891 tSirAddtsReqInfo *pAddTs)
3892{
3893 tDot11fAddTSRequest addts = {{0}};
3894 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3895 tANI_U8 j;
3896 tANI_U16 i;
3897 tANI_U32 status;
3898
3899 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3900 {
3901 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3902 "with an Action of %d; this is not "
3903 "supported & is probably an error."),
3904 *( pFrame + 1 ) );
3905 return eSIR_FAILURE;
3906 }
3907
3908 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303909 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003910
3911 // delegate to the framesc-generated code,
3912 switch ( *pFrame )
3913 {
3914 case SIR_MAC_ACTION_QOS_MGMT:
3915 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3916 break;
3917 case SIR_MAC_ACTION_WME:
3918 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3919 break;
3920 default:
3921 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3922 "with a Category of %d; this is not"
3923 " supported & is probably an error."),
3924 *pFrame );
3925 return eSIR_FAILURE;
3926 }
3927
3928 if ( DOT11F_FAILED( status ) )
3929 {
3930 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05303931 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 status, nFrame);
3933 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3934 return eSIR_FAILURE;
3935 }
3936 else if ( DOT11F_WARNED( status ) )
3937 {
3938 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3939 "g an Add TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05303940 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 status, nFrame );
3942 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3943 }
3944
3945 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3946 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3947 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3948 {
3949 pAddTs->dialogToken = addts.DialogToken.token;
3950
3951 if ( addts.TSPEC.present )
3952 {
3953 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3954 }
3955 else
3956 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303957 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003958 return eSIR_FAILURE;
3959 }
3960
3961 if ( addts.num_TCLAS )
3962 {
3963 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
3964
3965 for ( i = 0U; i < addts.num_TCLAS; ++i )
3966 {
3967 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
3968 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303969 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003970 return eSIR_FAILURE;
3971 }
3972 }
3973 }
3974
3975 if ( addts.TCLASSPROC.present )
3976 {
3977 pAddTs->tclasProcPresent = 1;
3978 pAddTs->tclasProc = addts.TCLASSPROC.processing;
3979 }
3980
3981 if ( addts.WMMTSPEC.present )
3982 {
3983 pAddTs->wsmTspecPresent = 1;
3984 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
3985 }
3986
3987 if ( addts.num_WMMTCLAS )
3988 {
3989 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
3990 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
3991
3992 for ( i = pAddTs->numTclas; i < j; ++i )
3993 {
3994 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
3995 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303996 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 return eSIR_FAILURE;
3998 }
3999 }
4000 }
4001
4002 if ( addts.WMMTCLASPROC.present )
4003 {
4004 pAddTs->tclasProcPresent = 1;
4005 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4006 }
4007
4008 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4009 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304010 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 pAddTs->numTclas );
4012 return eSIR_FAILURE;
4013 }
4014 }
4015 else
4016 {
4017 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4018
4019 if ( wmmaddts.WMMTSPEC.present )
4020 {
4021 pAddTs->wmeTspecPresent = 1;
4022 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4023 }
4024 else
4025 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304026 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004027 return eSIR_FAILURE;
4028 }
4029 }
4030
4031 return eSIR_SUCCESS;
4032
4033} // End sirConvertAddtsReq2Struct.
4034
4035tSirRetStatus
4036sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
4037 tANI_U8 *pFrame,
4038 tANI_U32 nFrame,
4039 tSirAddtsRspInfo *pAddTs)
4040{
4041 tDot11fAddTSResponse addts = {{0}};
4042 tDot11fWMMAddTSResponse wmmaddts = {{0}};
4043 tANI_U8 j;
4044 tANI_U16 i;
4045 tANI_U32 status;
4046
4047 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
4048 {
4049 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4050 "with an Action of %d; this is not "
4051 "supported & is probably an error."),
4052 *( pFrame + 1 ) );
4053 return eSIR_FAILURE;
4054 }
4055
4056 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304057 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
4058 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
4059 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004060
4061
4062 // delegate to the framesc-generated code,
4063 switch ( *pFrame )
4064 {
4065 case SIR_MAC_ACTION_QOS_MGMT:
4066 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
4067 break;
4068 case SIR_MAC_ACTION_WME:
4069 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
4070 break;
4071 default:
4072 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4073 "with a Category of %d; this is not"
4074 " supported & is probably an error."),
4075 *pFrame );
4076 return eSIR_FAILURE;
4077 }
4078
4079 if ( DOT11F_FAILED( status ) )
4080 {
4081 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304082 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004083 status, nFrame);
4084 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4085 return eSIR_FAILURE;
4086 }
4087 else if ( DOT11F_WARNED( status ) )
4088 {
4089 limLog( pMac, LOGW, FL("There were warnings while unpackin"
4090 "g an Add TS Response frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304091 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004092 status, nFrame );
4093 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4094 }
4095
4096 // & "transliterate" from a 'tDot11fAddTSResponse' or a
4097 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
4098 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4099 {
4100 pAddTs->dialogToken = addts.DialogToken.token;
4101 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
4102
4103 if ( addts.TSDelay.present )
4104 {
4105 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
4106 }
4107
4108 // TS Delay is present iff status indicates its presence
4109 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
4110 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304111 limLog( pMac, LOGW, FL("Missing TSDelay IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 }
4113
4114 if ( addts.TSPEC.present )
4115 {
4116 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
4117 }
4118 else
4119 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304120 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004121 return eSIR_FAILURE;
4122 }
4123
4124 if ( addts.num_TCLAS )
4125 {
4126 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4127
4128 for ( i = 0U; i < addts.num_TCLAS; ++i )
4129 {
4130 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4131 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304132 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 return eSIR_FAILURE;
4134 }
4135 }
4136 }
4137
4138 if ( addts.TCLASSPROC.present )
4139 {
4140 pAddTs->tclasProcPresent = 1;
4141 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4142 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004143#ifdef FEATURE_WLAN_ESE
4144 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004145 {
4146 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304147 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004148 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004149 }
4150#endif
4151 if ( addts.Schedule.present )
4152 {
4153 pAddTs->schedulePresent = 1;
4154 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
4155 }
4156
4157 if ( addts.WMMSchedule.present )
4158 {
4159 pAddTs->schedulePresent = 1;
4160 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
4161 }
4162
4163 if ( addts.WMMTSPEC.present )
4164 {
4165 pAddTs->wsmTspecPresent = 1;
4166 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4167 }
4168
4169 if ( addts.num_WMMTCLAS )
4170 {
4171 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
4172 if ( SIR_MAC_TCLASIE_MAXNUM > j ) j = SIR_MAC_TCLASIE_MAXNUM;
4173
4174 for ( i = pAddTs->numTclas; i < j; ++i )
4175 {
4176 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4177 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304178 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004179 return eSIR_FAILURE;
4180 }
4181 }
4182 }
4183
4184 if ( addts.WMMTCLASPROC.present )
4185 {
4186 pAddTs->tclasProcPresent = 1;
4187 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4188 }
4189
4190 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4191 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304192 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 pAddTs->numTclas );
4194 return eSIR_FAILURE;
4195 }
4196 }
4197 else
4198 {
4199 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4200 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
4201
4202 if ( wmmaddts.WMMTSPEC.present )
4203 {
4204 pAddTs->wmeTspecPresent = 1;
4205 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4206 }
4207 else
4208 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304209 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004210 return eSIR_FAILURE;
4211 }
4212
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004213#ifdef FEATURE_WLAN_ESE
4214 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004215 {
4216 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304217 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004218 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004219 }
4220#endif
4221
4222 }
4223
4224 return eSIR_SUCCESS;
4225
4226} // End sirConvertAddtsRsp2Struct.
4227
4228tSirRetStatus
4229sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
4230 tANI_U8 *pFrame,
4231 tANI_U32 nFrame,
4232 tSirDeltsReqInfo *pDelTs)
4233{
4234 tDot11fDelTS delts = {{0}};
4235 tDot11fWMMDelTS wmmdelts = {{0}};
4236 tANI_U32 status;
4237
4238 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
4239 {
4240 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4241 "with an Action of %d; this is not "
4242 "supported & is probably an error."),
4243 *( pFrame + 1 ) );
4244 return eSIR_FAILURE;
4245 }
4246
4247 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304248 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004249
4250 // delegate to the framesc-generated code,
4251 switch ( *pFrame )
4252 {
4253 case SIR_MAC_ACTION_QOS_MGMT:
4254 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
4255 break;
4256 case SIR_MAC_ACTION_WME:
4257 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4258 break;
4259 default:
4260 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4261 "with a Category of %d; this is not"
4262 " supported & is probably an error."),
4263 *pFrame );
4264 return eSIR_FAILURE;
4265 }
4266
4267 if ( DOT11F_FAILED( status ) )
4268 {
4269 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304270 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 status, nFrame);
4272 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4273 return eSIR_FAILURE;
4274 }
4275 else if ( DOT11F_WARNED( status ) )
4276 {
4277 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4278 "g an Del TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304279 "%d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 status, nFrame );
4281 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4282 }
4283
4284 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4285 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4286 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4287 {
4288 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4289 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4290 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4291 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4292 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4293 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4294 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4295 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4296
4297 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4298 }
4299 else
4300 {
4301 if ( wmmdelts.WMMTSPEC.present )
4302 {
4303 pDelTs->wmeTspecPresent = 1;
4304 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4305 }
4306 else
4307 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304308 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004309 return eSIR_FAILURE;
4310 }
4311 }
4312
4313 return eSIR_SUCCESS;
4314
4315} // End sirConvertDeltsReq2Struct.
4316
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004317tSirRetStatus
4318sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4319 tANI_U8 *pFrame,
4320 tANI_U32 nFrame,
4321 tSirQosMapSet *pQosMapSet)
4322{
4323 tDot11fQosMapConfigure mapConfigure;
4324 tANI_U32 status;
4325 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
Sreelakshmi Konamki8a251602016-02-19 16:12:23 +05304326 if ( DOT11F_FAILED( status ) || !mapConfigure.QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004327 {
Sreelakshmi Konamki8a251602016-02-19 16:12:23 +05304328 dot11fLog(pMac, LOGE, FL("Failed to parse or QosMapSet not present(0x%08x, %d bytes):"),
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004329 status, nFrame);
4330 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4331 return eSIR_FAILURE;
4332 }
4333 else if ( DOT11F_WARNED( status ) )
4334 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304335 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 -07004336 status, nFrame );
4337 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4338 }
4339 pQosMapSet->present = mapConfigure.QosMapSet.present;
4340 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004341 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004342 return eSIR_SUCCESS;
4343}
Jeff Johnson295189b2012-06-20 16:38:30 -07004344
4345#ifdef ANI_SUPPORT_11H
4346tSirRetStatus
4347sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4348 tANI_U8 *pFrame,
4349 tpSirMacTpcReqActionFrame pTpcReqFrame,
4350 tANI_U32 nFrame)
4351{
4352 tDot11fTPCRequest req;
4353 tANI_U32 status;
4354
4355 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304356 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004357
4358 // delegate to the framesc-generated code,
4359 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4360 if ( DOT11F_FAILED( status ) )
4361 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304362 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004363 status, nFrame);
4364 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4365 return eSIR_FAILURE;
4366 }
4367 else if ( DOT11F_WARNED( status ) )
4368 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304369 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004370 status, nFrame );
4371 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4372 }
4373
4374 // & "transliterate" from a 'tDot11fTPCRequest' to a
4375 // 'tSirMacTpcReqActionFrame'...
4376 pTpcReqFrame->actionHeader.category = req.Category.category;
4377 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4378 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4379 if ( req.TPCRequest.present )
4380 {
4381 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4382 pTpcReqFrame->length = 0;
4383 }
4384 else
4385 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304386 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 return eSIR_FAILURE;
4388 }
4389
4390 return eSIR_SUCCESS;
4391
4392} // End sirConvertTpcReqFrame2Struct.
4393
4394
4395tSirRetStatus
4396sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4397 tANI_U8 *pFrame,
4398 tpSirMacMeasReqActionFrame pMeasReqFrame,
4399 tANI_U32 nFrame)
4400{
4401 tDot11fMeasurementRequest mr;
4402 tANI_U32 status;
4403
4404 // Zero-init our [out] parameter,
Sunkad, Anand Ningappabf1650a2016-02-08 12:08:13 +05304405 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(*pMeasReqFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004406
4407 // delegate to the framesc-generated code,
4408 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4409 if ( DOT11F_FAILED( status ) )
4410 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304411 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004412 status, nFrame);
4413 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4414 return eSIR_FAILURE;
4415 }
4416 else if ( DOT11F_WARNED( status ) )
4417 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304418 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 status, nFrame );
4420 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4421 }
4422
4423 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4424 // 'tpSirMacMeasReqActionFrame'...
4425 pMeasReqFrame->actionHeader.category = mr.Category.category;
4426 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4427 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4428
4429 if ( 0 == mr.num_MeasurementRequest )
4430 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304431 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004432 return eSIR_FAILURE;
4433 }
4434 else if ( 1 < mr.num_MeasurementRequest )
4435 {
4436 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4437 }
4438
4439 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4440 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4441 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4442 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4443 ( mr.MeasurementRequest[0].enable << 2 ) |
4444 ( mr.MeasurementRequest[0].request << 1 ) |
4445 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4446 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4447
4448 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4449
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304450 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004451 mr.MeasurementRequest[0].meas_start_time, 8 );
4452
4453 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4454
4455 return eSIR_SUCCESS;
4456
4457} // End sirConvertMeasReqFrame2Struct.
4458#endif
4459
4460
4461void
4462PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4463 tDot11fIETSPEC *pDot11f)
4464{
4465 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4466 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4467 pDot11f->direction = pOld->tsinfo.traffic.direction;
4468 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4469 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4470 pDot11f->psb = pOld->tsinfo.traffic.psb;
4471 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4472 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4473 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4474 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4475 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4476 */
4477 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4478 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4479 pDot11f->max_msdu_size = pOld->maxMsduSz;
4480 pDot11f->min_service_int = pOld->minSvcInterval;
4481 pDot11f->max_service_int = pOld->maxSvcInterval;
4482 pDot11f->inactivity_int = pOld->inactInterval;
4483 pDot11f->suspension_int = pOld->suspendInterval;
4484 pDot11f->service_start_time = pOld->svcStartTime;
4485 pDot11f->min_data_rate = pOld->minDataRate;
4486 pDot11f->mean_data_rate = pOld->meanDataRate;
4487 pDot11f->peak_data_rate = pOld->peakDataRate;
4488 pDot11f->burst_size = pOld->maxBurstSz;
4489 pDot11f->delay_bound = pOld->delayBound;
4490 pDot11f->min_phy_rate = pOld->minPhyRate;
4491 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4492 pDot11f->medium_time = pOld->mediumTime;
4493
4494 pDot11f->present = 1;
4495
4496} // End PopulateDot11fTSPEC.
4497
4498void
4499PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4500 tDot11fIEWMMTSPEC *pDot11f)
4501{
4502 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4503 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4504 pDot11f->direction = pOld->tsinfo.traffic.direction;
4505 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4506 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4507 pDot11f->psb = pOld->tsinfo.traffic.psb;
4508 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4509 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4510 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4511 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4512 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4513 */
4514 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4515 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4516 pDot11f->max_msdu_size = pOld->maxMsduSz;
4517 pDot11f->min_service_int = pOld->minSvcInterval;
4518 pDot11f->max_service_int = pOld->maxSvcInterval;
4519 pDot11f->inactivity_int = pOld->inactInterval;
4520 pDot11f->suspension_int = pOld->suspendInterval;
4521 pDot11f->service_start_time = pOld->svcStartTime;
4522 pDot11f->min_data_rate = pOld->minDataRate;
4523 pDot11f->mean_data_rate = pOld->meanDataRate;
4524 pDot11f->peak_data_rate = pOld->peakDataRate;
4525 pDot11f->burst_size = pOld->maxBurstSz;
4526 pDot11f->delay_bound = pOld->delayBound;
4527 pDot11f->min_phy_rate = pOld->minPhyRate;
4528 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4529 pDot11f->medium_time = pOld->mediumTime;
4530
4531 pDot11f->version = 1;
4532 pDot11f->present = 1;
4533
4534} // End PopulateDot11fWMMTSPEC.
4535
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004536#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004537
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004538// Fill the ESE version currently supported
4539void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004540{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004541 pESEVersion->present = 1;
4542 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004543}
4544
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004545// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004546// The State is Normal (1)
4547// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004548void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004549{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004550 pESERadMgmtCap->present = 1;
4551 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4552 pESERadMgmtCap->mbssid_mask = 0;
4553 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004554}
4555
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004556tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004557 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004558 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004559{
4560 int idx;
4561
4562 if ( pCCKMie->length )
4563 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004564 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004565 {
4566 pDot11f->present = 1;
4567 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004568 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004569 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4570 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4571 }
4572 }
4573
4574 return eSIR_SUCCESS;
4575
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004576} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004577
Jeff Johnson295189b2012-06-20 16:38:30 -07004578void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004579 tSirMacESETSRSIE *pOld,
4580 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004581 tANI_U8 rate_length)
4582{
4583 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304584 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 pDot11f->num_tsrates = rate_length;
4586 pDot11f->present = 1;
4587}
4588#endif
4589
4590
4591tSirRetStatus
4592PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4593 tSirTclasInfo *pOld,
4594 tDot11fIETCLAS *pDot11f)
4595{
4596 pDot11f->user_priority = pOld->tclas.userPrio;
4597 pDot11f->classifier_type = pOld->tclas.classifierType;
4598 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4599
4600 switch ( pDot11f->classifier_type )
4601 {
4602 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304603 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4604 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4605 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4606 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4608 break;
4609 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4610 pDot11f->info.IpParams.version = pOld->version;
4611 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4612 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304613 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304614 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304615 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4616 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304617 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304618 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004619 pDot11f->info.IpParams.params.IpV4Params.src_port =
4620 pOld->tclasParams.ipv4.srcPort;
4621 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4622 pOld->tclasParams.ipv4.dstPort;
4623 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4624 pOld->tclasParams.ipv4.dscp;
4625 pDot11f->info.IpParams.params.IpV4Params.proto =
4626 pOld->tclasParams.ipv4.protocol;
4627 pDot11f->info.IpParams.params.IpV4Params.reserved =
4628 pOld->tclasParams.ipv4.rsvd;
4629 }
4630 else
4631 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304632 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 IpV6Params.source,
4634 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304635 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004636 IpV6Params.dest,
4637 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4638 pDot11f->info.IpParams.params.IpV6Params.src_port =
4639 pOld->tclasParams.ipv6.srcPort;
4640 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4641 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304642 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 IpV6Params.flow_label,
4644 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4645 }
4646 break;
4647 case SIR_MAC_TCLASTYPE_8021DQ:
4648 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4649 break;
4650 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304651 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 pDot11f->classifier_type );
4653 return eSIR_FAILURE;
4654 }
4655
4656 pDot11f->present = 1;
4657
4658 return eSIR_SUCCESS;
4659
4660} // End PopulateDot11fTCLAS.
4661
4662tSirRetStatus
4663PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4664 tSirTclasInfo *pOld,
4665 tDot11fIEWMMTCLAS *pDot11f)
4666{
4667 pDot11f->version = 1;
4668 pDot11f->user_priority = pOld->tclas.userPrio;
4669 pDot11f->classifier_type = pOld->tclas.classifierType;
4670 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4671
4672 switch ( pDot11f->classifier_type )
4673 {
4674 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304675 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004676 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304677 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004678 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4679 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4680 break;
4681 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4682 pDot11f->info.IpParams.version = pOld->version;
4683 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4684 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304685 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004686 IpV4Params.source,
4687 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304688 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004689 IpV4Params.dest,
4690 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4691 pDot11f->info.IpParams.params.IpV4Params.src_port =
4692 pOld->tclasParams.ipv4.srcPort;
4693 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4694 pOld->tclasParams.ipv4.dstPort;
4695 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4696 pOld->tclasParams.ipv4.dscp;
4697 pDot11f->info.IpParams.params.IpV4Params.proto =
4698 pOld->tclasParams.ipv4.protocol;
4699 pDot11f->info.IpParams.params.IpV4Params.reserved =
4700 pOld->tclasParams.ipv4.rsvd;
4701 }
4702 else
4703 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304704 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004705 IpV6Params.source,
4706 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304707 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004708 IpV6Params.dest,
4709 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4710 pDot11f->info.IpParams.params.IpV6Params.src_port =
4711 pOld->tclasParams.ipv6.srcPort;
4712 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4713 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304714 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004715 IpV6Params.flow_label,
4716 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4717 }
4718 break;
4719 case SIR_MAC_TCLASTYPE_8021DQ:
4720 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4721 break;
4722 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304723 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004724 pDot11f->classifier_type );
4725 return eSIR_FAILURE;
4726 }
4727
4728 pDot11f->present = 1;
4729
4730 return eSIR_SUCCESS;
4731
4732} // End PopulateDot11fWMMTCLAS.
4733
Jeff Johnson295189b2012-06-20 16:38:30 -07004734
4735tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4736 tDot11fIEWscBeacon *pDot11f)
4737{
4738
4739 tANI_U32 wpsState;
4740
4741 pDot11f->Version.present = 1;
4742 pDot11f->Version.major = 0x01;
4743 pDot11f->Version.minor = 0x00;
4744
4745 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304746 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004747
4748 pDot11f->WPSState.present = 1;
4749 pDot11f->WPSState.state = (tANI_U8) wpsState;
4750
4751 pDot11f->APSetupLocked.present = 0;
4752
4753 pDot11f->SelectedRegistrar.present = 0;
4754
4755 pDot11f->DevicePasswordID.present = 0;
4756
4757 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4758
4759 pDot11f->UUID_E.present = 0;
4760
4761 pDot11f->RFBands.present = 0;
4762
4763 pDot11f->present = 1;
4764 return eSIR_SUCCESS;
4765}
4766
4767tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4768 tDot11fIEWscBeacon *pDot11f)
4769{
4770 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4771 tANI_U32 devicepasswdId;
4772
4773
4774 pDot11f->APSetupLocked.present = 1;
4775 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4776
4777 pDot11f->SelectedRegistrar.present = 1;
4778 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4779
4780 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304781 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07004782
4783 pDot11f->DevicePasswordID.present = 1;
4784 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4785
4786 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4787 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4788
4789 // UUID_E and RF Bands are applicable only for dual band AP
4790
4791 return eSIR_SUCCESS;
4792}
4793
4794tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4795 tDot11fIEWscBeacon *pDot11f)
4796{
4797 pDot11f->APSetupLocked.present = 0;
4798 pDot11f->SelectedRegistrar.present = 0;
4799 pDot11f->DevicePasswordID.present = 0;
4800 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4801
4802 return eSIR_SUCCESS;
4803}
Jeff Johnson295189b2012-06-20 16:38:30 -07004804tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4805{
4806
4807 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4808
4809 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4810
4811
4812 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4813 {
4814 pDot11f->present = 1;
4815 pDot11f->Version.present = 1;
4816 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4817 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4818 }
4819 else
4820 {
4821 pDot11f->present = 0;
4822 pDot11f->Version.present = 0;
4823 }
4824
4825 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4826 {
4827
4828 pDot11f->WPSState.present = 1;
4829 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4830 }
4831 else
4832 pDot11f->WPSState.present = 0;
4833
4834 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4835 {
4836 pDot11f->APSetupLocked.present = 1;
4837 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4838 }
4839 else
4840 pDot11f->APSetupLocked.present = 0;
4841
4842 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4843 {
4844 pDot11f->SelectedRegistrar.present = 1;
4845 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4846 }
4847 else
4848 pDot11f->SelectedRegistrar.present = 0;
4849
4850 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4851 {
4852 pDot11f->DevicePasswordID.present = 1;
4853 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4854 }
4855 else
4856 pDot11f->DevicePasswordID.present = 0;
4857
4858 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4859 {
4860 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4861 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4862 }
4863 else
4864 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4865
4866 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4867 {
4868 pDot11f->ResponseType.present = 1;
4869 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4870 }
4871 else
4872 pDot11f->ResponseType.present = 0;
4873
4874 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4875 {
4876 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304877 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004878 }
4879 else
4880 pDot11f->UUID_E.present = 0;
4881
4882 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4883 {
4884 pDot11f->Manufacturer.present = 1;
4885 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304886 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4887 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004888 }
4889 else
4890 pDot11f->Manufacturer.present = 0;
4891
4892 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4893 {
4894 pDot11f->ModelName.present = 1;
4895 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304896 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4897 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004898 }
4899 else
4900 pDot11f->ModelName.present = 0;
4901
4902 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4903 {
4904 pDot11f->ModelNumber.present = 1;
4905 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304906 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4907 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004908 }
4909 else
4910 pDot11f->ModelNumber.present = 0;
4911
4912 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4913 {
4914 pDot11f->SerialNumber.present = 1;
4915 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304916 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4917 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 }
4919 else
4920 pDot11f->SerialNumber.present = 0;
4921
4922 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4923 {
4924 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304925 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4926 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4928 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4929 }
4930 else
4931 pDot11f->PrimaryDeviceType.present = 0;
4932
4933 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4934 {
4935 pDot11f->DeviceName.present = 1;
4936 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304937 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4938 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004939 }
4940 else
4941 pDot11f->DeviceName.present = 0;
4942
4943 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4944 {
4945 pDot11f->ConfigMethods.present = 1;
4946 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4947 }
4948 else
4949 pDot11f->ConfigMethods.present = 0;
4950
4951
4952 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4953 {
4954 pDot11f->RFBands.present = 1;
4955 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4956 }
4957 else
4958 pDot11f->RFBands.present = 0;
4959
4960 return eSIR_SUCCESS;
4961}
4962tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
4963{
4964 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4965
4966 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4967
4968 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4969 {
4970 pDot11f->present = 1;
4971 pDot11f->Version.present = 1;
4972 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4973 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4974 }
4975 else
4976 {
4977 pDot11f->present = 0;
4978 pDot11f->Version.present = 0;
4979 }
4980
4981 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4982 {
4983 pDot11f->ResponseType.present = 1;
4984 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4985 }
4986 else
4987 pDot11f->ResponseType.present = 0;
4988
4989 return eSIR_SUCCESS;
4990}
4991
4992tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
4993{
4994
4995 tSirWPSBeaconIE *pSirWPSBeaconIE;
4996
4997 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
4998
4999
5000 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
5001 {
5002 pDot11f->present = 1;
5003 pDot11f->Version.present = 1;
5004 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
5005 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
5006 }
5007 else
5008 {
5009 pDot11f->present = 0;
5010 pDot11f->Version.present = 0;
5011 }
5012
5013 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
5014 {
5015
5016 pDot11f->WPSState.present = 1;
5017 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
5018 }
5019 else
5020 pDot11f->WPSState.present = 0;
5021
5022 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
5023 {
5024 pDot11f->APSetupLocked.present = 1;
5025 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
5026 }
5027 else
5028 pDot11f->APSetupLocked.present = 0;
5029
5030 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
5031 {
5032 pDot11f->SelectedRegistrar.present = 1;
5033 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
5034 }
5035 else
5036 pDot11f->SelectedRegistrar.present = 0;
5037
5038 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
5039 {
5040 pDot11f->DevicePasswordID.present = 1;
5041 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
5042 }
5043 else
5044 pDot11f->DevicePasswordID.present = 0;
5045
5046 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
5047 {
5048 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5049 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
5050 }
5051 else
5052 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5053
5054 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
5055 {
5056 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305057 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07005058 }
5059 else
5060 pDot11f->UUID_E.present = 0;
5061
5062
5063 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
5064 {
5065 pDot11f->RFBands.present = 1;
5066 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
5067 }
5068 else
5069 pDot11f->RFBands.present = 0;
5070
5071 return eSIR_SUCCESS;
5072}
Jeff Johnson295189b2012-06-20 16:38:30 -07005073tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
5074 tDot11fIEWscProbeRes *pDot11f)
5075{
5076 tANI_U32 cfgMethods;
5077 tANI_U32 cfgStrLen;
5078 tANI_U32 val;
5079 tANI_U32 wpsVersion, wpsState;
5080
5081
5082 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305083 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_VERSION );
Jeff Johnson295189b2012-06-20 16:38:30 -07005084
5085 pDot11f->Version.present = 1;
5086 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
5087 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
5088
5089 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305090 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07005091
5092 pDot11f->WPSState.present = 1;
5093 pDot11f->WPSState.state = (tANI_U8) wpsState;
5094
5095 pDot11f->APSetupLocked.present = 0;
5096
5097 pDot11f->SelectedRegistrar.present = 0;
5098
5099 pDot11f->DevicePasswordID.present = 0;
5100
5101 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5102
5103 pDot11f->ResponseType.present = 1;
5104 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
5105 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
5106 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5107 }
5108 else{
5109 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5110 }
5111
5112 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
5113 pDot11f->UUID_E.present = 1;
5114 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
5115 if (wlan_cfgGetStr(pMac,
5116 WNI_CFG_WPS_UUID,
5117 pDot11f->UUID_E.uuid,
5118 &cfgStrLen) != eSIR_SUCCESS)
5119 {
5120 *(pDot11f->UUID_E.uuid) = '\0';
5121 }
5122
5123 pDot11f->Manufacturer.present = 1;
5124 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
5125 if (wlan_cfgGetStr(pMac,
5126 WNI_CFG_MANUFACTURER_NAME,
5127 pDot11f->Manufacturer.name,
5128 &cfgStrLen) != eSIR_SUCCESS)
5129 {
5130 pDot11f->Manufacturer.num_name = 0;
5131 *(pDot11f->Manufacturer.name) = '\0';
5132 }
5133 else
5134 {
5135 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305136 pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005137 }
5138
5139 pDot11f->ModelName.present = 1;
5140 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
5141 if (wlan_cfgGetStr(pMac,
5142 WNI_CFG_MODEL_NAME,
5143 pDot11f->ModelName.text,
5144 &cfgStrLen) != eSIR_SUCCESS)
5145 {
5146 pDot11f->ModelName.num_text = 0;
5147 *(pDot11f->ModelName.text) = '\0';
5148 }
5149 else
5150 {
5151 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305152 pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005153 }
5154
5155 pDot11f->ModelNumber.present = 1;
5156 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
5157 if (wlan_cfgGetStr(pMac,
5158 WNI_CFG_MODEL_NUMBER,
5159 pDot11f->ModelNumber.text,
5160 &cfgStrLen) != eSIR_SUCCESS)
5161 {
5162 pDot11f->ModelNumber.num_text = 0;
5163 *(pDot11f->ModelNumber.text) = '\0';
5164 }
5165 else
5166 {
5167 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305168 pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005169 }
5170
5171 pDot11f->SerialNumber.present = 1;
5172 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
5173 if (wlan_cfgGetStr(pMac,
5174 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
5175 pDot11f->SerialNumber.text,
5176 &cfgStrLen) != eSIR_SUCCESS)
5177 {
5178 pDot11f->SerialNumber.num_text = 0;
5179 *(pDot11f->SerialNumber.text) = '\0';
5180 }
5181 else
5182 {
5183 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305184 pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005185 }
5186
5187 pDot11f->PrimaryDeviceType.present = 1;
5188
5189 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
5190 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305191 limLog(pMac, LOGP, FL("cfg get prim device category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005192 }
5193 else
5194 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
5195
5196 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
5197 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305198 limLog(pMac, LOGP, FL("cfg get prim device OUI failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005199 }
5200 else
5201 {
5202 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
5203 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
5204 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
5205 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
5206 }
5207
5208 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
5209 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305210 limLog(pMac, LOGP, FL("cfg get prim device sub category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005211 }
5212 else
5213 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
5214
5215 pDot11f->DeviceName.present = 1;
5216 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
5217 if (wlan_cfgGetStr(pMac,
5218 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
5219 pDot11f->DeviceName.text,
5220 &cfgStrLen) != eSIR_SUCCESS)
5221 {
5222 pDot11f->DeviceName.num_text = 0;
5223 *(pDot11f->DeviceName.text) = '\0';
5224 }
5225 else
5226 {
5227 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305228 pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005229 }
5230
5231 if (wlan_cfgGetInt(pMac,
5232 WNI_CFG_WPS_CFG_METHOD,
5233 &cfgMethods) != eSIR_SUCCESS)
5234 {
5235 pDot11f->ConfigMethods.present = 0;
5236 pDot11f->ConfigMethods.methods = 0;
5237 }
5238 else
5239 {
5240 pDot11f->ConfigMethods.present = 1;
5241 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
5242 }
5243
5244 pDot11f->RFBands.present = 0;
5245
5246 pDot11f->present = 1;
5247 return eSIR_SUCCESS;
5248}
5249
5250tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5251 tDot11fIEWscProbeRes *pDot11f)
5252{
5253 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
5254 tANI_U32 devicepasswdId;
5255
5256 pDot11f->APSetupLocked.present = 1;
5257 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5258
5259 pDot11f->SelectedRegistrar.present = 1;
5260 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5261
5262 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305263 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07005264
5265 pDot11f->DevicePasswordID.present = 1;
5266 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5267
5268 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5269 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5270
5271 // UUID_E and RF Bands are applicable only for dual band AP
5272
5273 return eSIR_SUCCESS;
5274}
5275
5276tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5277 tDot11fIEWscProbeRes *pDot11f)
5278{
5279 pDot11f->APSetupLocked.present = 0;
5280 pDot11f->SelectedRegistrar.present = 0;
5281 pDot11f->DevicePasswordID.present = 0;
5282 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5283
5284 return eSIR_SUCCESS;
5285}
5286
5287tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5288 tDot11fIEWscAssocRes *pDot11f,
5289 tpSirAssocReq pRcvdAssocReq)
5290{
5291 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5292 tANI_U8 *wscIe;
5293
5294
5295 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5296 if(wscIe != NULL)
5297 {
5298 // retreive WSC IE from given AssocReq
5299 dot11fUnpackIeWscAssocReq( pMac,
5300 wscIe + 2 + 4, // EID, length, OUI
5301 wscIe[ 1 ] - 4, // length without OUI
5302 &parsedWscAssocReq );
5303 pDot11f->present = 1;
5304 // version has to be 0x10
5305 pDot11f->Version.present = 1;
5306 pDot11f->Version.major = 0x1;
5307 pDot11f->Version.minor = 0x0;
5308
5309 pDot11f->ResponseType.present = 1;
5310
5311 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5312 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5313 {
5314 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5315 }
5316 else
5317 {
5318 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5319 }
5320 // Version infomration should be taken from our capability as well as peers
5321 // TODO: currently it takes from peers only
5322 if(parsedWscAssocReq.VendorExtension.present &&
5323 parsedWscAssocReq.VendorExtension.Version2.present)
5324 {
5325 pDot11f->VendorExtension.present = 1;
5326 pDot11f->VendorExtension.vendorId[0] = 0x00;
5327 pDot11f->VendorExtension.vendorId[1] = 0x37;
5328 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5329 pDot11f->VendorExtension.Version2.present = 1;
5330 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5331 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5332 }
5333 }
5334 return eSIR_SUCCESS;
5335}
5336
Jeff Johnson295189b2012-06-20 16:38:30 -07005337tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5338 tDot11fIEP2PAssocRes *pDot11f,
5339 tpSirAssocReq pRcvdAssocReq)
5340{
5341 tANI_U8 *p2pIe;
5342
5343 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5344 if(p2pIe != NULL)
5345 {
5346 pDot11f->present = 1;
5347 pDot11f->P2PStatus.present = 1;
5348 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5349 pDot11f->ExtendedListenTiming.present = 0;
5350 }
5351 return eSIR_SUCCESS;
5352}
Jeff Johnson295189b2012-06-20 16:38:30 -07005353
5354#if defined WLAN_FEATURE_VOWIFI
5355
5356tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5357 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5358{
5359 pDot11f->txPower = txPower;
5360 pDot11f->linkMargin = linkMargin;
5361 pDot11f->present = 1;
5362
5363 return eSIR_SUCCESS;
5364}
5365
5366tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5367{
5368
5369 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5370 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305371 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5372 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005373 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5374 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5375 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5376 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5377 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305378 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005379 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5380 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5381
5382 if( pBeaconReport->numIes )
5383 {
5384 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305385 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5386 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005387 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5388 }
5389
5390 return eSIR_SUCCESS;
5391
5392}
5393
5394tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5395{
5396 tpRRMCaps pRrmCaps;
5397
5398 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5399
5400 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5401 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5402 pDot11f->parallel = pRrmCaps->parallel ;
5403 pDot11f->repeated = pRrmCaps->repeated ;
5404 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5405 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5406 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5407 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5408 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5409 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5410 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5411 pDot11f->statistics = pRrmCaps->statistics ;
5412 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5413 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5414 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5415 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5416 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5417 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5418 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5419 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5420 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5421 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5422 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5423 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5424 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5425 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5426 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5427 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5428
5429 pDot11f->present = 1;
5430 return eSIR_SUCCESS;
5431}
5432#endif
5433
5434#if defined WLAN_FEATURE_VOWIFI_11R
5435void PopulateMDIE( tpAniSirGlobal pMac,
5436 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5437{
5438 pDot11f->present = 1;
5439 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5440
5441 // Plugfest fix
5442 pDot11f->overDSCap = (mdie[2] & 0x01);
5443 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5444
5445}
5446
5447void PopulateFTInfo( tpAniSirGlobal pMac,
5448 tDot11fIEFTInfo *pDot11f )
5449{
5450 pDot11f->present = 1;
5451 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5452 //All other info is zero.
5453
5454}
5455#endif
5456
5457void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5458 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5459{
5460 tANI_U8 num_supp = 0, num_ext = 0;
5461 tANI_U8 i,j;
5462
5463 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5464 {
5465 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5466 }
5467 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5468 {
5469 if( num_supp < 8 )
5470 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5471 else
5472 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5473 }
5474
5475 if( num_supp )
5476 {
5477 pSupp->num_rates = num_supp;
5478 pSupp->present = 1;
5479 }
5480 if( num_ext )
5481 {
5482 pExt->num_rates = num_ext;
5483 pExt->present = 1;
5484 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005485}
5486
5487void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5488 tDot11fIETimeoutInterval *pDot11f,
5489 tANI_U8 type, tANI_U32 value )
5490{
5491 pDot11f->present = 1;
5492 pDot11f->timeoutType = type;
5493 pDot11f->timeoutValue = value;
5494}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305495#ifdef SAP_AUTH_OFFLOAD
5496tSirRetStatus
5497sap_auth_offload_construct_rsn_opaque( tDot11fIERSN *pdot11f_rsn,
5498 tDot11fIERSNOpaque *pdot11f)
5499{
5500 tANI_U32 data_len=0;
5501 tANI_U8 *ptr;
5502 tANI_U32 element_len=0;
5503 tANI_U32 count=0;
5504 ptr = (tANI_U8 *)pdot11f->data;
5505 if (pdot11f_rsn->present)
5506 {
5507 pdot11f->present = pdot11f_rsn->present;
5508 element_len = sizeof(pdot11f_rsn->version);
5509 vos_mem_copy(ptr, &pdot11f_rsn->version, element_len);
5510 ptr += element_len;
5511 data_len += element_len;
5512 element_len = sizeof(pdot11f_rsn->gp_cipher_suite);
5513 vos_mem_copy(ptr, pdot11f_rsn->gp_cipher_suite, element_len);
5514 ptr += element_len;
5515 data_len += element_len;
5516
5517 if (pdot11f_rsn->pwise_cipher_suite_count)
5518 {
5519 element_len = sizeof(pdot11f_rsn->pwise_cipher_suite_count);
5520 vos_mem_copy(ptr,
5521 &pdot11f_rsn->pwise_cipher_suite_count,
5522 element_len);
5523 ptr += element_len;
5524 data_len += element_len;
5525 for (count = 0; count < pdot11f_rsn->pwise_cipher_suite_count;
5526 count++)
5527 {
5528 element_len = DOT11F_RSN_OUI_SIZE;
5529 vos_mem_copy(ptr,
5530 &pdot11f_rsn->pwise_cipher_suites[count][0],
5531 element_len);
5532 ptr += element_len;
5533 data_len += element_len;
5534 }
5535 }
5536
5537 if (pdot11f_rsn->akm_suite_count)
5538 {
5539 element_len = sizeof(pdot11f_rsn->akm_suite_count);
5540 vos_mem_copy(ptr, &pdot11f_rsn->akm_suite_count, element_len);
5541 ptr += element_len;
5542 data_len += element_len;
5543 for (count = 0; count < pdot11f_rsn->akm_suite_count; count++)
5544 {
5545 element_len = DOT11F_RSN_OUI_SIZE;
5546 vos_mem_copy(ptr,
5547 &pdot11f_rsn->akm_suites[count][0],
5548 element_len);
5549 ptr += element_len;
5550 data_len += element_len;
5551 }
5552 }
5553
5554 element_len = sizeof(pdot11f_rsn->RSN_Cap);
5555 vos_mem_copy(ptr, pdot11f_rsn->RSN_Cap, element_len);
5556 ptr += element_len;
5557 data_len += element_len;
5558 }
5559 pdot11f->num_data = data_len;
5560 return eSIR_SUCCESS;
5561}
5562
5563void
5564sap_auth_offload_update_rsn_ie( tpAniSirGlobal pmac,
5565 tDot11fIERSNOpaque *pdot11f)
5566{
5567 tDot11fIERSN *pdot11f_rsn;
5568 pdot11f_rsn = vos_mem_malloc(sizeof(tDot11fIERSN));
5569 vos_mem_set(pdot11f_rsn, sizeof(tDot11fIERSN), 0);
5570 /* Assign RSN IE for Software AP Authentication offload security */
5571 if (pmac->sap_auth_offload && pmac->sap_auth_offload_sec_type)
5572 {
5573 switch (pmac->sap_auth_offload_sec_type)
5574 {
5575 case eSIR_OFFLOAD_WPA2PSK_CCMP:
5576 /* Only Support one kind of Cipher Suit for
5577 * Software AP authentication offload
5578 */
5579 pdot11f_rsn->present = 1;
5580 pdot11f_rsn->version = 1;
5581 vos_mem_copy(pdot11f_rsn->gp_cipher_suite,
5582 &sirRSNOui[DOT11F_RSN_CSE_CCMP][0],
5583 DOT11F_RSN_OUI_SIZE);
5584 pdot11f_rsn->pwise_cipher_suite_count = 1;
5585 vos_mem_copy(&(pdot11f_rsn->pwise_cipher_suites[0][0]),
5586 &sirRSNOui[DOT11F_RSN_CSE_CCMP][0],
5587 DOT11F_RSN_OUI_SIZE);
5588 pdot11f_rsn->akm_suite_count = 1;
5589 vos_mem_copy(&(pdot11f_rsn->akm_suites[0][0]),
5590 &sirRSNOui[DOT11F_RSN_CSE_TKIP][0],
5591 DOT11F_RSN_OUI_SIZE);
5592 pdot11f_rsn->pmkid_count = 0;
5593 /* Construct RSN IE into RSNOpaque*/
5594 sap_auth_offload_construct_rsn_opaque(pdot11f_rsn, pdot11f);
5595 break;
5596 default:
5597 dot11fLog( pmac, LOGE,
5598 FL("The security type is not definied for "
5599 "Software AP authentication offload!\n"));
5600 break;
5601 }
5602 }
5603}
5604#endif /* SAP_AUTH_OFFLOAD */
5605
Abhishek Singh74037df2017-07-20 11:08:56 +05305606/**
5607 * sir_copy_hs20_ie() - Update HS 2.0 Information Element.
5608 * @dest: dest HS IE buffer to be updated
5609 * @src: src HS IE buffer
5610 *
5611 * Update HS2.0 IE info from src to dest
5612 *
5613 * Return: void
5614 */
5615void sir_copy_hs20_ie(tDot11fIEhs20vendor_ie *dest, tDot11fIEhs20vendor_ie *src)
5616{
5617 if (src->present) {
5618 vos_mem_copy(dest, src,
5619 sizeof(tDot11fIEhs20vendor_ie) -
5620 sizeof(src->hs_id));
5621 if (src->hs_id_present)
5622 vos_mem_copy(&dest->hs_id,
5623 &src->hs_id,
5624 sizeof(src->hs_id));
5625 }
5626}
5627
Jeff Johnson295189b2012-06-20 16:38:30 -07005628// parserApi.c ends here.