blob: 66fffcfd31d37ad02c8a5fa304012cc795ff3582 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
lifeng59144322019-03-20 18:05:26 +08002 * Copyright (c) 2012-2019 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
Abhishek Singh02605092017-10-25 14:06:12 +0530298void populate_dot11f_ext_chann_switch_ann(tpAniSirGlobal mac_ctx,
299 tDot11fIEext_chan_switch_ann *dot_11_ptr, tpPESession session_entry)
300{
301 offset_t ch_offset;
302
303 if (session_entry->gLimChannelSwitch.secondarySubBand >=
304 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED)
305 ch_offset = BW80;
306 else
307 ch_offset = session_entry->gLimChannelSwitch.secondarySubBand;
308
309 dot_11_ptr->switch_mode = session_entry->gLimChannelSwitch.switchMode;
310 dot_11_ptr->new_reg_class = limGetOPClassFromChannel(
311 mac_ctx->scan.countryCodeCurrent,
312 session_entry->gLimChannelSwitch.primaryChannel, ch_offset);
313 dot_11_ptr->new_channel = session_entry->gLimChannelSwitch.primaryChannel;
314 dot_11_ptr->switch_count = session_entry->gLimChannelSwitch.switchCount;
315 dot_11_ptr->present = 1;
316
317 limLog(mac_ctx, LOG1, FL("country:%s cb mode:%d width:%d reg:%d off:%d"),
318 mac_ctx->scan.countryCodeCurrent,
319 session_entry->gLimChannelSwitch.primaryChannel,
320 session_entry->gLimChannelSwitch.secondarySubBand,
321 dot_11_ptr->new_reg_class, ch_offset);
322}
323
Jeff Johnson295189b2012-06-20 16:38:30 -0700324void
325PopulateDot11fChanSwitchAnn(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700326 tDot11fIEChanSwitchAnn *pDot11f,
327 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700328{
Jeff Johnsone7245742012-09-05 17:12:55 -0700329 pDot11f->switchMode = psessionEntry->gLimChannelSwitch.switchMode;
330 pDot11f->newChannel = psessionEntry->gLimChannelSwitch.primaryChannel;
331 pDot11f->switchCount = ( tANI_U8 ) psessionEntry->gLimChannelSwitch.switchCount;
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
333 pDot11f->present = 1;
334} // End PopulateDot11fChanSwitchAnn.
335
336void
Abhishek Singh02605092017-10-25 14:06:12 +0530337PopulateDot11fsecChanOffset(tpAniSirGlobal pMac,
Abhishek Singh15431c42017-10-25 15:43:02 +0530338 tDot11fIEsec_chan_offset *pDot11f,
Jeff Johnsone7245742012-09-05 17:12:55 -0700339 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -0700340{
341 //Has to be updated on the cb state basis
342 pDot11f->secondaryChannelOffset =
Jeff Johnsone7245742012-09-05 17:12:55 -0700343 psessionEntry->gLimChannelSwitch.secondarySubBand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700344
345 pDot11f->present = 1;
346}
347
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700348#ifdef WLAN_FEATURE_11AC
349void
350PopulateDot11fWiderBWChanSwitchAnn(tpAniSirGlobal pMac,
351 tDot11fIEWiderBWChanSwitchAnn *pDot11f,
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -0700352 tpPESession psessionEntry)
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700353{
354 pDot11f->present = 1;
355 pDot11f->newChanWidth = psessionEntry->gLimWiderBWChannelSwitch.newChanWidth;
356 pDot11f->newCenterChanFreq0 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq0;
357 pDot11f->newCenterChanFreq1 = psessionEntry->gLimWiderBWChannelSwitch.newCenterChanFreq1;
Abhishek Singh02605092017-10-25 14:06:12 +0530358 limLog(pMac, LOG1, FL("wrapper: width:%d f0:%d f1:%d"),
359 pDot11f->newChanWidth, pDot11f->newCenterChanFreq0,
360 pDot11f->newCenterChanFreq1);
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700361}
362#endif
363
Jeff Johnson295189b2012-06-20 16:38:30 -0700364tSirRetStatus
365PopulateDot11fCountry(tpAniSirGlobal pMac,
366 tDot11fIECountry *pDot11f,
367 tpPESession psessionEntry)
368{
369 tANI_U32 len, maxlen, codelen;
370 tANI_U16 item;
371 tSirRetStatus nSirStatus;
372 tSirRFBand rfBand;
373 tANI_U8 temp[CFG_MAX_STR_LEN], code[3];
374
375 if (psessionEntry->lim11dEnabled )
376 {
377 limGetRfBand(pMac, &rfBand, psessionEntry);
378 if (rfBand == SIR_BAND_5_GHZ)
379 {
380 item = WNI_CFG_MAX_TX_POWER_5;
381 maxlen = WNI_CFG_MAX_TX_POWER_5_LEN;
382 }
383 else
384 {
385 item = WNI_CFG_MAX_TX_POWER_2_4;
386 maxlen = WNI_CFG_MAX_TX_POWER_2_4_LEN;
387 }
388
389 CFG_GET_STR( nSirStatus, pMac, item, temp, len, maxlen );
390
391 if ( 3 > len )
392 {
393 // no limit on tx power, cannot include the IE because at least
394 // one (channel,num,tx power) must be present
395 return eSIR_SUCCESS;
396 }
397
398 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_COUNTRY_CODE,
399 code, codelen, 3 );
400
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530401 vos_mem_copy( pDot11f->country, code, codelen );
Jeff Johnson295189b2012-06-20 16:38:30 -0700402
403 if(len > MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE)
404 {
Sushant Kaushik87787972015-09-11 16:05:00 +0530405 dot11fLog( pMac, LOGE, FL("len:%d is out of bounds, resetting."), len);
Jeff Johnson295189b2012-06-20 16:38:30 -0700406 len = MAX_SIZE_OF_TRIPLETS_IN_COUNTRY_IE;
407 }
408
409 pDot11f->num_triplets = ( tANI_U8 ) ( len / 3 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530410 vos_mem_copy( ( tANI_U8* )pDot11f->triplets, temp, len );
Jeff Johnson295189b2012-06-20 16:38:30 -0700411
412 pDot11f->present = 1;
413 }
414
415 return eSIR_SUCCESS;
416} // End PopulateDot11fCountry.
417
418tSirRetStatus
419PopulateDot11fDSParams(tpAniSirGlobal pMac,
420 tDot11fIEDSParams *pDot11f, tANI_U8 channel,
421 tpPESession psessionEntry)
422{
Abhishek Singh883b5a12015-10-08 12:22:25 +0530423 if (IS_24G_CH(channel))
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 {
425 // .11b/g mode PHY => Include the DS Parameter Set IE:
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 pDot11f->curr_channel = channel;
427 pDot11f->present = 1;
428 }
429
430 return eSIR_SUCCESS;
431} // End PopulateDot11fDSParams.
432
433#define SET_AIFSN(aifsn) (((aifsn) < 2) ? 2 : (aifsn))
434
435
436void
437PopulateDot11fEDCAParamSet(tpAniSirGlobal pMac,
438 tDot11fIEEDCAParamSet *pDot11f,
439 tpPESession psessionEntry)
440{
441
442 if ( psessionEntry->limQosEnabled )
443 {
444 //change to bitwise operation, after this is fixed in frames.
445 pDot11f->qos = (tANI_U8)(0xf0 & (psessionEntry->gLimEdcaParamSetCount << 4) );
446
447 // Fill each EDCA parameter set in order: be, bk, vi, vo
448 pDot11f->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
449 pDot11f->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
450 pDot11f->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
451 pDot11f->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
452 pDot11f->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
453 pDot11f->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
454
455 pDot11f->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
456 pDot11f->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
457 pDot11f->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
458 pDot11f->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
459 pDot11f->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
460 pDot11f->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
461
462 pDot11f->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
463 pDot11f->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
464 pDot11f->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
465 pDot11f->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
466 pDot11f->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
467 pDot11f->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
468
469 pDot11f->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
470 pDot11f->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
471 pDot11f->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
472 pDot11f->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
473 pDot11f->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
474 pDot11f->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
475
476 pDot11f->present = 1;
477 }
478
479} // End PopluateDot11fEDCAParamSet.
480
481tSirRetStatus
482PopulateDot11fERPInfo(tpAniSirGlobal pMac,
483 tDot11fIEERPInfo *pDot11f,
484 tpPESession psessionEntry)
485{
486 tSirRetStatus nSirStatus;
487 tANI_U32 val;
488 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
489
490 limGetRfBand(pMac, &rfBand, psessionEntry);
491 if(SIR_BAND_2_4_GHZ == rfBand)
492 {
493 pDot11f->present = 1;
494
495 val = psessionEntry->cfgProtection.fromllb;
496 if(!val ){
Sravan Kumar Kairamcebb2182016-01-25 20:50:11 +0530497 dot11fLog( pMac, LOG1, FL("11B protection not enabled. Not populating ERP IE %d" ),val );
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 return eSIR_SUCCESS;
499 }
500
501 if (psessionEntry->gLim11bParams.protectionEnabled)
502 {
503 pDot11f->non_erp_present = 1;
504 pDot11f->use_prot = 1;
505 }
506
507 if ( psessionEntry->gLimOlbcParams.protectionEnabled )
508 {
509 //FIXME_PROTECTION: we should be setting non_erp present also.
510 //check the test plan first.
511 pDot11f->use_prot = 1;
512 }
513
514
515 if((psessionEntry->gLimNoShortParams.numNonShortPreambleSta)
516 || !psessionEntry->beaconParams.fShortPreamble){
517 pDot11f->barker_preamble = 1;
518
519 }
520 // if protection always flag is set, advertise protection enabled
521 // regardless of legacy stations presence
522 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_11G_PROTECTION_ALWAYS, val );
523
524 if ( val )
525 {
526 pDot11f->use_prot = 1;
527 }
528 }
529
530 return eSIR_SUCCESS;
531} // End PopulateDot11fERPInfo.
532
533tSirRetStatus
534PopulateDot11fExtSuppRates(tpAniSirGlobal pMac, tANI_U8 nChannelNum,
535 tDot11fIEExtSuppRates *pDot11f,
536 tpPESession psessionEntry)
537{
538 tSirRetStatus nSirStatus;
539 tANI_U32 nRates = 0;
Sachin Ahujac772fd82015-09-08 17:12:19 +0530540 tANI_U8 rates[SIR_MAC_RATESET_EID_MAX];
Jeff Johnson295189b2012-06-20 16:38:30 -0700541
542 /* Use the ext rates present in session entry whenever nChannelNum is set to OPERATIONAL
543 else use the ext supported rate set from CFG, which is fixed and does not change dynamically and is used for
544 sending mgmt frames (lile probe req) which need to go out before any session is present.
545 */
546 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
547 {
548 if(psessionEntry != NULL)
549 {
550 nRates = psessionEntry->extRateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530551 vos_mem_copy( rates, psessionEntry->extRateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 nRates);
553 }
554 else
555 {
556 dot11fLog( pMac, LOGE, FL("no session context exists while"
Sushant Kaushik87787972015-09-11 16:05:00 +0530557 " populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 }
559 }
560 else if ( HIGHEST_24GHZ_CHANNEL_NUM >= nChannelNum )
561 {
562 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET,
563 rates, nRates, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN );
564 }
565
566 if ( 0 != nRates )
567 {
568 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530569 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 pDot11f->present = 1;
571 }
572
573 return eSIR_SUCCESS;
574
575} // End PopulateDot11fExtSuppRates.
576
577tSirRetStatus
578PopulateDot11fExtSuppRates1(tpAniSirGlobal pMac,
579 tANI_U8 nChannelNum,
580 tDot11fIEExtSuppRates *pDot11f)
581{
582 tANI_U32 nRates;
583 tSirRetStatus nSirStatus;
584 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
585
586 if ( 14 < nChannelNum )
587 {
588 pDot11f->present = 0;
589 return eSIR_SUCCESS;
590 }
591
592 // N.B. I have *no* idea why we're calling 'wlan_cfgGetStr' with an argument
593 // of WNI_CFG_SUPPORTED_RATES_11A here, but that's what was done
594 // previously & I'm afraid to change it!
595 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
596 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
597
598 if ( 0 != nRates )
599 {
600 pDot11f->num_rates = ( tANI_U8 ) nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +0530601 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 pDot11f->present = 1;
603 }
604
605 return eSIR_SUCCESS;
606} // PopulateDot11fExtSuppRates1.
607
608tSirRetStatus
609PopulateDot11fHTCaps(tpAniSirGlobal pMac,
Jeff Johnsone7245742012-09-05 17:12:55 -0700610 tpPESession psessionEntry,
611 tDot11fIEHTCaps *pDot11f)
Jeff Johnson295189b2012-06-20 16:38:30 -0700612{
613 tANI_U32 nCfgValue, nCfgLen;
614 tANI_U8 nCfgValue8;
615 tSirRetStatus nSirStatus;
616 tSirMacHTParametersInfo *pHTParametersInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 union {
618 tANI_U16 nCfgValue16;
619 tSirMacHTCapabilityInfo htCapInfo;
620 tSirMacExtendedHTCapabilityInfo extHtCapInfo;
621 } uHTCapabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700622
623 tSirMacTxBFCapabilityInfo *pTxBFCapabilityInfo;
624 tSirMacASCapabilityInfo *pASCapabilityInfo;
625
626 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_CAP_INFO, nCfgValue );
627
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
Jeff Johnson295189b2012-06-20 16:38:30 -0700629
Sridhar Selvaraj27707312017-08-31 12:26:36 +0530630 pDot11f->advCodingCap = uHTCapabilityInfo.htCapInfo.advCodingCap;
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 pDot11f->mimoPowerSave = uHTCapabilityInfo.htCapInfo.mimoPowerSave;
632 pDot11f->greenField = uHTCapabilityInfo.htCapInfo.greenField;
633 pDot11f->shortGI20MHz = uHTCapabilityInfo.htCapInfo.shortGI20MHz;
634 pDot11f->shortGI40MHz = uHTCapabilityInfo.htCapInfo.shortGI40MHz;
635 pDot11f->txSTBC = uHTCapabilityInfo.htCapInfo.txSTBC;
636 pDot11f->rxSTBC = uHTCapabilityInfo.htCapInfo.rxSTBC;
637 pDot11f->delayedBA = uHTCapabilityInfo.htCapInfo.delayedBA;
638 pDot11f->maximalAMSDUsize = uHTCapabilityInfo.htCapInfo.maximalAMSDUsize;
639 pDot11f->dsssCckMode40MHz = uHTCapabilityInfo.htCapInfo.dsssCckMode40MHz;
640 pDot11f->psmp = uHTCapabilityInfo.htCapInfo.psmp;
641 pDot11f->stbcControlFrame = uHTCapabilityInfo.htCapInfo.stbcControlFrame;
642 pDot11f->lsigTXOPProtection = uHTCapabilityInfo.htCapInfo.lsigTXOPProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700643
Jeff Johnsone7245742012-09-05 17:12:55 -0700644 // All sessionized entries will need the check below
645 if (psessionEntry == NULL) // Only in case of NO session
646 {
647 pDot11f->supportedChannelWidthSet = uHTCapabilityInfo.htCapInfo.supportedChannelWidthSet;
648 }
649 else
650 {
651 pDot11f->supportedChannelWidthSet = psessionEntry->htSupportedChannelWidthSet;
652 }
653
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 /* Ensure that shortGI40MHz is Disabled if supportedChannelWidthSet is
655 eHT_CHANNEL_WIDTH_20MHZ */
656 if(pDot11f->supportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ)
657 {
658 pDot11f->shortGI40MHz = 0;
659 }
660
Jeff Johnson295189b2012-06-20 16:38:30 -0700661
662
663 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_AMPDU_PARAMS, nCfgValue );
664
665 nCfgValue8 = ( tANI_U8 ) nCfgValue;
666 pHTParametersInfo = ( tSirMacHTParametersInfo* ) &nCfgValue8;
667
668 pDot11f->maxRxAMPDUFactor = pHTParametersInfo->maxRxAMPDUFactor;
669 pDot11f->mpduDensity = pHTParametersInfo->mpduDensity;
670 pDot11f->reserved1 = pHTParametersInfo->reserved;
671
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_MCS_SET,
673 pDot11f->supportedMCSSet, nCfgLen,
674 SIZE_OF_SUPPORTED_MCS_SET );
675
676
677 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_EXT_HT_CAP_INFO, nCfgValue );
678
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 uHTCapabilityInfo.nCfgValue16 = nCfgValue & 0xFFFF;
680
681 pDot11f->pco = uHTCapabilityInfo.extHtCapInfo.pco;
682 pDot11f->transitionTime = uHTCapabilityInfo.extHtCapInfo.transitionTime;
683 pDot11f->mcsFeedback = uHTCapabilityInfo.extHtCapInfo.mcsFeedback;
684
Jeff Johnson295189b2012-06-20 16:38:30 -0700685
686 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_TX_BF_CAP, nCfgValue );
687
688 pTxBFCapabilityInfo = ( tSirMacTxBFCapabilityInfo* ) &nCfgValue;
689 pDot11f->txBF = pTxBFCapabilityInfo->txBF;
690 pDot11f->rxStaggeredSounding = pTxBFCapabilityInfo->rxStaggeredSounding;
691 pDot11f->txStaggeredSounding = pTxBFCapabilityInfo->txStaggeredSounding;
692 pDot11f->rxZLF = pTxBFCapabilityInfo->rxZLF;
693 pDot11f->txZLF = pTxBFCapabilityInfo->txZLF;
694 pDot11f->implicitTxBF = pTxBFCapabilityInfo->implicitTxBF;
695 pDot11f->calibration = pTxBFCapabilityInfo->calibration;
696 pDot11f->explicitCSITxBF = pTxBFCapabilityInfo->explicitCSITxBF;
697 pDot11f->explicitUncompressedSteeringMatrix = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrix;
698 pDot11f->explicitBFCSIFeedback = pTxBFCapabilityInfo->explicitBFCSIFeedback;
699 pDot11f->explicitUncompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitUncompressedSteeringMatrixFeedback;
700 pDot11f->explicitCompressedSteeringMatrixFeedback = pTxBFCapabilityInfo->explicitCompressedSteeringMatrixFeedback;
701 pDot11f->csiNumBFAntennae = pTxBFCapabilityInfo->csiNumBFAntennae;
702 pDot11f->uncompressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->uncompressedSteeringMatrixBFAntennae;
703 pDot11f->compressedSteeringMatrixBFAntennae = pTxBFCapabilityInfo->compressedSteeringMatrixBFAntennae;
704
705 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_AS_CAP, nCfgValue );
706
707 nCfgValue8 = ( tANI_U8 ) nCfgValue;
708
709 pASCapabilityInfo = ( tSirMacASCapabilityInfo* ) &nCfgValue8;
710 pDot11f->antennaSelection = pASCapabilityInfo->antennaSelection;
711 pDot11f->explicitCSIFeedbackTx = pASCapabilityInfo->explicitCSIFeedbackTx;
712 pDot11f->antennaIndicesFeedbackTx = pASCapabilityInfo->antennaIndicesFeedbackTx;
713 pDot11f->explicitCSIFeedback = pASCapabilityInfo->explicitCSIFeedback;
714 pDot11f->antennaIndicesFeedback = pASCapabilityInfo->antennaIndicesFeedback;
715 pDot11f->rxAS = pASCapabilityInfo->rxAS;
716 pDot11f->txSoundingPPDUs = pASCapabilityInfo->txSoundingPPDUs;
717
718 pDot11f->present = 1;
719
720 return eSIR_SUCCESS;
721
722} // End PopulateDot11fHTCaps.
Jeff Johnsone7245742012-09-05 17:12:55 -0700723#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700724
Jeff Johnsone7245742012-09-05 17:12:55 -0700725void limLogVHTCap(tpAniSirGlobal pMac,
726 tDot11fIEVHTCaps *pDot11f)
727{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700728#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530729 limLog(pMac, LOG1, FL("maxMPDULen (2): %d"), pDot11f->maxMPDULen);
730 limLog(pMac, LOG1, FL("supportedChannelWidthSet (2): %d"), pDot11f->supportedChannelWidthSet);
731 limLog(pMac, LOG1, FL("ldpcCodingCap (1): %d"), pDot11f->ldpcCodingCap);
732 limLog(pMac, LOG1, FL("shortGI80MHz (1): %d"), pDot11f->shortGI80MHz);
733 limLog(pMac, LOG1, FL("shortGI160and80plus80MHz (1): %d"), pDot11f->shortGI160and80plus80MHz);
734 limLog(pMac, LOG1, FL("txSTBC (1): %d"), pDot11f->txSTBC);
735 limLog(pMac, LOG1, FL("rxSTBC (3): %d"), pDot11f->rxSTBC);
736 limLog(pMac, LOG1, FL("suBeamFormerCap (1): %d"), pDot11f->suBeamFormerCap);
737 limLog(pMac, LOG1, FL("suBeamformeeCap (1): %d"), pDot11f->suBeamformeeCap);
738 limLog(pMac, LOG1, FL("csnofBeamformerAntSup (3): %d"), pDot11f->csnofBeamformerAntSup);
739 limLog(pMac, LOG1, FL("numSoundingDim (3): %d"), pDot11f->numSoundingDim);
740 limLog(pMac, LOG1, FL("muBeamformerCap (1): %d"), pDot11f->muBeamformerCap);
741 limLog(pMac, LOG1, FL("muBeamformeeCap (1): %d"), pDot11f->muBeamformeeCap);
742 limLog(pMac, LOG1, FL("vhtTXOPPS (1): %d"), pDot11f->vhtTXOPPS);
743 limLog(pMac, LOG1, FL("htcVHTCap (1): %d"), pDot11f->htcVHTCap);
744 limLog(pMac, LOG1, FL("maxAMPDULenExp (3): %d"), pDot11f->maxAMPDULenExp);
745 limLog(pMac, LOG1, FL("vhtLinkAdaptCap (2): %d"), pDot11f->vhtLinkAdaptCap);
746 limLog(pMac, LOG1, FL("rxAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
747 limLog(pMac, LOG1, FL("txAntPattern (1): %d"), pDot11f->vhtLinkAdaptCap);
748 limLog(pMac, LOG1, FL("reserved1 (2): %d"), pDot11f->reserved1);
749 limLog(pMac, LOG1, FL("rxMCSMap (16): %d"), pDot11f->rxMCSMap);
750 limLog(pMac, LOG1, FL("rxHighSupDataRate (13): %d"), pDot11f->rxHighSupDataRate);
751 limLog(pMac, LOG1, FL("reserve (3): %d"), pDot11f->reserved2);
752 limLog(pMac, LOG1, FL("txMCSMap (16): %d"), pDot11f->txMCSMap);
753 limLog(pMac, LOG1, FL("txSupDataRate (13): %d"), pDot11f->txSupDataRate);
754 limLog(pMac, LOG1, FL("reserv (3): %d"), pDot11f->reserved3);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700755#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700756}
757
758void limLogVHTOperation(tpAniSirGlobal pMac,
759 tDot11fIEVHTOperation *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("chanCenterFreqSeg1: %d"), pDot11f->chanCenterFreqSeg1);
764 limLog(pMac, LOG1, FL("chanCenterFreqSeg2: %d"), pDot11f->chanCenterFreqSeg2);
765 limLog(pMac, LOG1, FL("basicMCSSet: %d"), pDot11f->basicMCSSet);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700766#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700767}
768
769void limLogVHTExtBssLoad(tpAniSirGlobal pMac,
770 tDot11fIEVHTExtBssLoad *pDot11f)
771{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700772#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530773 limLog(pMac, LOG1, FL("muMIMOCapStaCount : %d"), pDot11f->muMIMOCapStaCount);
774 limLog(pMac, LOG1, FL("ssUnderUtil: %d"), pDot11f->ssUnderUtil);
775 limLog(pMac, LOG1, FL("FortyMHzUtil: %d"), pDot11f->FortyMHzUtil);
776 limLog(pMac, LOG1, FL("EightyMHzUtil: %d"), pDot11f->EightyMHzUtil);
777 limLog(pMac, LOG1, FL("OneSixtyMHzUtil: %d"), pDot11f->OneSixtyMHzUtil);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700778#endif /* DUMP_MGMT_CNTNTS */
Jeff Johnsone7245742012-09-05 17:12:55 -0700779}
780
781
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700782void limLogOperatingMode( tpAniSirGlobal pMac,
783 tDot11fIEOperatingMode *pDot11f)
784{
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700785#ifdef DUMP_MGMT_CNTNTS
Sushant Kaushik87787972015-09-11 16:05:00 +0530786 limLog(pMac, LOG1, FL("ChanWidth : %d"), pDot11f->chanWidth);
787 limLog(pMac, LOG1, FL("reserved: %d"), pDot11f->reserved);
788 limLog(pMac, LOG1, FL("rxNSS: %d"), pDot11f->rxNSS);
789 limLog(pMac, LOG1, FL("rxNSS Type: %d"), pDot11f->rxNSSType);
Madan Mohan Koyyalamudi2208f7b2012-09-28 14:29:07 -0700790#endif /* DUMP_MGMT_CNTNTS */
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700791}
792
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700793void limLogQosMapSet(tpAniSirGlobal pMac, tSirQosMapSet *pQosMapSet)
794{
795 tANI_U8 i;
Agrawal Ashishacba1872015-11-30 12:31:41 +0530796 if (pQosMapSet->num_dscp_exceptions > 21)
797 pQosMapSet->num_dscp_exceptions = 21;
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -0700798 limLog(pMac, LOG1, FL("num of dscp exceptions : %d"),
799 pQosMapSet->num_dscp_exceptions);
800 for (i=0; i < pQosMapSet->num_dscp_exceptions; i++)
801 {
802 limLog(pMac, LOG1, FL("dscp value: %d"),
803 pQosMapSet->dscp_exceptions[i][0]);
804 limLog(pMac, LOG1, FL("User priority value: %d"),
805 pQosMapSet->dscp_exceptions[i][1]);
806 }
807 for (i=0;i<8;i++)
808 {
809 limLog(pMac, LOG1, FL("dscp low for up %d: %d"),i,
810 pQosMapSet->dscp_range[i][0]);
811 limLog(pMac, LOG1, FL("dscp high for up %d: %d"),i,
812 pQosMapSet->dscp_range[i][1]);
813 }
814}
Mohit Khanna7d5aeb22012-09-11 16:21:57 -0700815
Jeff Johnsone7245742012-09-05 17:12:55 -0700816tSirRetStatus
817PopulateDot11fVHTCaps(tpAniSirGlobal pMac,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530818 tDot11fIEVHTCaps *pDot11f,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530819 tANI_U8 nChannelNum,
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530820 tAniBool isProbeRspAssocRspBeacon)
Jeff Johnsone7245742012-09-05 17:12:55 -0700821{
822 tSirRetStatus nStatus;
823 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530824 tAniBool disableMcs9 = eSIR_FALSE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700825
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530826 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530827 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
828 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530829 else
830 disableMcs9 =
831 pMac->roam.configParam.channelBondingMode5GHz?
832 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700833 pDot11f->present = 1;
834
835 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MAX_MPDU_LENGTH, nCfgValue );
836 pDot11f->maxMPDULen = (nCfgValue & 0x0003);
837
838 nCfgValue = 0;
839 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SUPPORTED_CHAN_WIDTH_SET,
840 nCfgValue );
841 pDot11f->supportedChannelWidthSet = (nCfgValue & 0x0003);
842
843 nCfgValue = 0;
844 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LDPC_CODING_CAP, nCfgValue );
Sridhar Selvaraj27707312017-08-31 12:26:36 +0530845 pDot11f->ldpcCodingCap = (nCfgValue & 0x0001);
Jeff Johnsone7245742012-09-05 17:12:55 -0700846
847 nCfgValue = 0;
848 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_80MHZ, nCfgValue );
849 pDot11f->shortGI80MHz= (nCfgValue & 0x0001);
850
851 nCfgValue = 0;
852 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SHORT_GI_160_AND_80_PLUS_80MHZ,
853 nCfgValue );
854 pDot11f->shortGI160and80plus80MHz = (nCfgValue & 0x0001);
855
Deepthi Gowri0c1e1682015-06-19 12:57:53 +0530856 if (nChannelNum && (SIR_BAND_2_4_GHZ == limGetRFBand(nChannelNum)))
857 {
858 pDot11f->shortGI80MHz = 0;
859 pDot11f->shortGI160and80plus80MHz = 0;
860 }
861
Jeff Johnsone7245742012-09-05 17:12:55 -0700862 nCfgValue = 0;
863 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXSTBC, nCfgValue );
864 pDot11f->txSTBC = (nCfgValue & 0x0001);
865
866 nCfgValue = 0;
867 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RXSTBC, nCfgValue );
868 pDot11f->rxSTBC = (nCfgValue & 0x0007);
869
870 nCfgValue = 0;
871 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMER_CAP, nCfgValue );
872 pDot11f->suBeamFormerCap = (nCfgValue & 0x0001);
873
874 nCfgValue = 0;
875 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, nCfgValue );
876 pDot11f->suBeamformeeCap = (nCfgValue & 0x0001);
877
878 nCfgValue = 0;
879 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
880 nCfgValue );
881 pDot11f->csnofBeamformerAntSup = (nCfgValue & 0x0007);
882
883 nCfgValue = 0;
884 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_NUM_SOUNDING_DIMENSIONS,
885 nCfgValue );
886 pDot11f->numSoundingDim = (nCfgValue & 0x0007);
887
Abhishek Singh6d5d29c2014-07-03 14:25:22 +0530888 /* muBeamformerCap should be 0 for non AP and
889 * muBeamformeeCap should be 0 for AP
890 */
891 if(eSIR_TRUE == isProbeRspAssocRspBeacon)
892 {
893 nCfgValue = 0;
894 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMER_CAP, nCfgValue );
895 pDot11f->muBeamformerCap = (nCfgValue & 0x0001);
896 pDot11f->muBeamformeeCap = 0;
897 }
898 else
899 {
900 pDot11f->muBeamformerCap = 0;
901 nCfgValue = 0;
902 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, nCfgValue );
903 /* Enable only if FW and host both support the MU_MIMO feature
904 */
905 pDot11f->muBeamformeeCap = IS_MUMIMO_BFORMEE_CAPABLE ? (nCfgValue & 0x0001): 0;
906 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700907
908 nCfgValue = 0;
909 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TXOP_PS, nCfgValue );
910 pDot11f->vhtTXOPPS = (nCfgValue & 0x0001);
911
912 nCfgValue = 0;
913 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_HTC_VHTC_CAP, nCfgValue );
914 pDot11f->htcVHTCap = (nCfgValue & 0x0001);
915
916 nCfgValue = 0;
917 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_AMPDU_LEN_EXPONENT, nCfgValue );
918 pDot11f->maxAMPDULenExp = (nCfgValue & 0x0007);
919
920 nCfgValue = 0;
921 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_LINK_ADAPTATION_CAP, nCfgValue );
922 pDot11f->vhtLinkAdaptCap = (nCfgValue & 0x0003);
923
924 nCfgValue = 0;
925 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_ANT_PATTERN, nCfgValue );
926 pDot11f->rxAntPattern = nCfgValue;
927
928 nCfgValue = 0;
929 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_ANT_PATTERN, nCfgValue );
930 pDot11f->txAntPattern = nCfgValue;
931
932 pDot11f->reserved1= 0;
933
934 nCfgValue = 0;
935 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530936
937 if (eSIR_TRUE == disableMcs9)
938 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700939 pDot11f->rxMCSMap = (nCfgValue & 0x0000FFFF);
940
941 nCfgValue = 0;
942 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_RX_HIGHEST_SUPPORTED_DATA_RATE,
943 nCfgValue );
944 pDot11f->rxHighSupDataRate = (nCfgValue & 0x00001FFF);
945
946 pDot11f->reserved2= 0;
947
948 nCfgValue = 0;
949 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_MCS_MAP, nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530950
951 if (eSIR_TRUE == disableMcs9)
952 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -0700953 pDot11f->txMCSMap = (nCfgValue & 0x0000FFFF);
954
955 nCfgValue = 0;
956 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_TX_HIGHEST_SUPPORTED_DATA_RATE,
957 nCfgValue );
958 pDot11f->txSupDataRate = (nCfgValue & 0x00001FFF);
959
960 pDot11f->reserved3= 0;
961
962 limLogVHTCap(pMac, pDot11f);
963
964 return eSIR_SUCCESS;
965
966}
967
968tSirRetStatus
969PopulateDot11fVHTOperation(tpAniSirGlobal pMac,
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530970 tDot11fIEVHTOperation *pDot11f,
971 tANI_U8 nChannelNum)
Jeff Johnsone7245742012-09-05 17:12:55 -0700972{
973 tSirRetStatus nStatus;
974 tANI_U32 nCfgValue=0;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530975 tAniBool disableMcs9 = eSIR_FALSE;
976
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530977 if (nChannelNum <= SIR_11B_CHANNEL_END)
Sushant Kaushikb2c92a82015-07-16 15:24:26 +0530978 disableMcs9 = pMac->roam.configParam.channelBondingMode24GHz?
979 eSIR_FALSE:eSIR_TRUE;
Abhishek Singh33f76ea2015-06-04 12:27:30 +0530980 else
981 disableMcs9 =
982 pMac->roam.configParam.channelBondingMode5GHz?
983 eSIR_FALSE: eSIR_TRUE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700984
985 pDot11f->present = 1;
986
987 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_WIDTH, nCfgValue );
988 pDot11f->chanWidth = (tANI_U8)nCfgValue;
989
990 nCfgValue = 0;
991 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
992 nCfgValue );
993 pDot11f->chanCenterFreqSeg1 = (tANI_U8)nCfgValue;
994
995 nCfgValue = 0;
996 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT2,
997 nCfgValue );
998 pDot11f->chanCenterFreqSeg2 = (tANI_U8)nCfgValue;
999
1000 nCfgValue = 0;
1001 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_BASIC_MCS_SET,nCfgValue );
Abhishek Singh33f76ea2015-06-04 12:27:30 +05301002
1003 if (eSIR_TRUE == disableMcs9)
1004 nCfgValue = (nCfgValue & 0xFFFC) | 0x1;
Jeff Johnsone7245742012-09-05 17:12:55 -07001005 pDot11f->basicMCSSet = (tANI_U16)nCfgValue;
1006
1007 limLogVHTOperation(pMac,pDot11f);
1008
1009 return eSIR_SUCCESS;
1010
1011}
1012
1013tSirRetStatus
1014PopulateDot11fVHTExtBssLoad(tpAniSirGlobal pMac,
1015 tDot11fIEVHTExtBssLoad *pDot11f)
1016{
1017 tSirRetStatus nStatus;
1018 tANI_U32 nCfgValue=0;
1019
1020 pDot11f->present = 1;
1021
1022 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_MU_MIMO_CAP_STA_COUNT,
1023 nCfgValue );
1024 pDot11f->muMIMOCapStaCount = (tANI_U8)nCfgValue;
1025
1026 nCfgValue = 0;
1027 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_SS_UNDER_UTIL,nCfgValue );
1028 pDot11f->ssUnderUtil = (tANI_U8)nCfgValue;
1029
1030 nCfgValue=0;
1031 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_40MHZ_UTILIZATION,nCfgValue );
1032 pDot11f->FortyMHzUtil = (tANI_U8)nCfgValue;
1033
1034 nCfgValue=0;
1035 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_80MHZ_UTILIZATION,nCfgValue );
1036 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
1037
1038 nCfgValue=0;
1039 CFG_GET_INT( nStatus, pMac, WNI_CFG_VHT_160MHZ_UTILIZATION,nCfgValue );
1040 pDot11f->EightyMHzUtil = (tANI_U8)nCfgValue;
1041
1042 limLogVHTExtBssLoad(pMac,pDot11f);
1043
1044 return eSIR_SUCCESS;
1045}
1046
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301047#ifdef WLAN_FEATURE_AP_HT40_24G
1048tSirRetStatus
1049PopulateDot11fOBSSScanParameters(tpAniSirGlobal pMac,
1050 tDot11fIEOBSSScanParameters *pDot11f,
1051 tpPESession psessionEntry)
1052{
1053 pDot11f->present = 1;
1054
1055 pDot11f->obssScanPassiveDwell =
1056 psessionEntry->obssHT40ScanParam.OBSSScanPassiveDwellTime;
1057
1058 pDot11f->obssScanActiveDwell =
1059 psessionEntry->obssHT40ScanParam.OBSSScanActiveDwellTime;
1060
1061 pDot11f->bssChannelWidthTriggerScanInterval =
1062 psessionEntry->obssHT40ScanParam.BSSChannelWidthTriggerScanInterval;
1063
1064 pDot11f->obssScanPassiveTotalPerChannel =
1065 psessionEntry->obssHT40ScanParam.OBSSScanPassiveTotalPerChannel;
1066
1067 pDot11f->obssScanActiveTotalPerChannel =
1068 psessionEntry->obssHT40ScanParam.OBSSScanActiveTotalPerChannel;
1069
1070 pDot11f->bssWidthChannelTransitionDelayFactor =
1071 psessionEntry->obssHT40ScanParam.BSSWidthChannelTransitionDelayFactor;
1072
1073 pDot11f->obssScanActivityThreshold =
1074 psessionEntry->obssHT40ScanParam.OBSSScanActivityThreshold;
1075
1076 return eSIR_SUCCESS;
1077}
1078#endif
1079
Mohit Khanna4a70d262012-09-11 16:30:12 -07001080tSirRetStatus
1081PopulateDot11fExtCap(tpAniSirGlobal pMac,
Sandeep Puligilla60342762014-01-30 21:05:37 +05301082 tDot11fIEExtCap *pDot11f,
1083 tpPESession psessionEntry)
Mohit Khanna4a70d262012-09-11 16:30:12 -07001084{
Hu Wangc12631c2016-08-11 09:57:03 +08001085 struct s_ext_cap *p_ext_cap = (struct s_ext_cap *)pDot11f->bytes;
Sandeep Puligilla60342762014-01-30 21:05:37 +05301086
Sandeep Puligilla60342762014-01-30 21:05:37 +05301087#ifdef WLAN_FEATURE_11AC
Sushant Kaushikc25b4fc2015-09-16 16:42:34 +05301088 if (psessionEntry->vhtCapability &&
1089 psessionEntry->limSystemRole != eLIM_STA_IN_IBSS_ROLE )
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301090 {
Hu Wangc12631c2016-08-11 09:57:03 +08001091 p_ext_cap->operModeNotification = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301092 pDot11f->present = 1;
1093 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301094#endif
1095 /* while operating in 2.4GHz only then STA need to advertize
1096 the bss co-ex capability*/
1097 if (psessionEntry->currentOperChannel <= RF_CHAN_14)
1098 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301099#ifdef WLAN_FEATURE_AP_HT40_24G
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301100 if(((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1101 && pMac->roam.configParam.channelBondingMode24GHz)
1102 || pMac->roam.configParam.apHT40_24GEnabled)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301103#else
Hardik Kantilal Patelbca5b002015-01-19 15:30:18 +05301104 if((IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
1105 && pMac->roam.configParam.channelBondingMode24GHz)
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05301106#endif
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301107 {
Hu Wangc12631c2016-08-11 09:57:03 +08001108 p_ext_cap->bssCoexistMgmtSupport = 1;
Vinay Krishna Erannaa4935672014-07-15 20:34:25 +05301109 pDot11f->present = 1;
1110 }
Sandeep Puligilla60342762014-01-30 21:05:37 +05301111 }
Hu Wangc12631c2016-08-11 09:57:03 +08001112
Pragaspathi Thilagarajea4d8f72018-11-22 19:23:20 +05301113 p_ext_cap->fils_capability = 0;
1114
Hu Wangc12631c2016-08-11 09:57:03 +08001115 if (pDot11f->present)
1116 {
1117 /* Need to compute the num_bytes based on bits set */
1118 pDot11f->num_bytes = lim_compute_ext_cap_ie_length(pDot11f);
1119 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07001120 return eSIR_SUCCESS;
1121}
1122
1123tSirRetStatus
1124PopulateDot11fOperatingMode(tpAniSirGlobal pMac,
1125 tDot11fIEOperatingMode *pDot11f,
1126 tpPESession psessionEntry)
1127{
1128 pDot11f->present = 1;
1129
1130 pDot11f->chanWidth = psessionEntry->gLimOperatingMode.chanWidth;
1131 pDot11f->rxNSS = psessionEntry->gLimOperatingMode.rxNSS;
1132 pDot11f->rxNSSType = psessionEntry->gLimOperatingMode.rxNSSType;
1133
1134 return eSIR_SUCCESS;
1135}
Jeff Johnsone7245742012-09-05 17:12:55 -07001136
1137#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001138tSirRetStatus
1139PopulateDot11fHTInfo(tpAniSirGlobal pMac,
1140 tDot11fIEHTInfo *pDot11f,
1141 tpPESession psessionEntry )
Jeff Johnson295189b2012-06-20 16:38:30 -07001142{
1143 tANI_U32 nCfgValue, nCfgLen;
1144 tANI_U8 htInfoField1;
1145 tANI_U16 htInfoField2;
1146 tSirRetStatus nSirStatus;
1147 tSirMacHTInfoField1 *pHTInfoField1;
1148 tSirMacHTInfoField2 *pHTInfoField2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001149 union {
1150 tANI_U16 nCfgValue16;
1151 tSirMacHTInfoField3 infoField3;
1152 }uHTInfoField;
1153 union {
1154 tANI_U16 nCfgValue16;
1155 tSirMacHTInfoField2 infoField2;
1156 }uHTInfoField2={0};
Jeff Johnson295189b2012-06-20 16:38:30 -07001157
Jeff Johnson295189b2012-06-20 16:38:30 -07001158
1159 #if 0
1160 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_CURRENT_CHANNEL, nCfgValue );
1161 #endif // TO SUPPORT BT-AMP
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301162
1163 if (NULL == psessionEntry)
1164 {
1165 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301166 FL("Invalid session entry in PopulateDot11fHTInfo()"));)
Pratik Bhalgat91dfba72012-11-22 17:21:41 +05301167 return eSIR_FAILURE;
1168 }
1169
Jeff Johnson295189b2012-06-20 16:38:30 -07001170 pDot11f->primaryChannel = psessionEntry->currentOperChannel;
1171
1172 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD1, nCfgValue );
1173
1174 htInfoField1 = ( tANI_U8 ) nCfgValue;
1175
1176 pHTInfoField1 = ( tSirMacHTInfoField1* ) &htInfoField1;
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 pHTInfoField1->rifsMode = psessionEntry->beaconParams.fRIFSMode;
1178 pHTInfoField1->serviceIntervalGranularity = pMac->lim.gHTServiceIntervalGranularity;
1179
Jeff Johnsone7245742012-09-05 17:12:55 -07001180 if (psessionEntry == NULL)
1181 {
1182 PELOGE(limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05301183 FL("Keep the value retrieved from cfg for secondary channel offset and recommended Tx Width set"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07001184 }
1185 else
1186 {
1187 pHTInfoField1->secondaryChannelOffset = psessionEntry->htSecondaryChannelOffset;
1188 pHTInfoField1->recommendedTxWidthSet = psessionEntry->htRecommendedTxWidthSet;
1189 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001190
Madan Mohan Koyyalamudi33ef6a22012-10-30 17:44:43 -07001191 if((psessionEntry) && (psessionEntry->limSystemRole == eLIM_AP_ROLE)){
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1193
1194 uHTInfoField2.nCfgValue16 = nCfgValue & 0xFFFF; // this is added for fixing CRs on MDM9K platform - 257951, 259577
1195
1196 uHTInfoField2.infoField2.opMode = psessionEntry->htOperMode;
1197 uHTInfoField2.infoField2.nonGFDevicesPresent = psessionEntry->beaconParams.llnNonGFCoexist;
1198 uHTInfoField2.infoField2.obssNonHTStaPresent = psessionEntry->beaconParams.gHTObssMode; /*added for Obss */
1199
1200 uHTInfoField2.infoField2.reserved = 0;
1201
1202 }else{
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD2, nCfgValue );
1204
1205 htInfoField2 = ( tANI_U16 ) nCfgValue;
1206
1207 pHTInfoField2 = ( tSirMacHTInfoField2* ) &htInfoField2;
1208 pHTInfoField2->opMode = pMac->lim.gHTOperMode;
1209 pHTInfoField2->nonGFDevicesPresent = pMac->lim.gHTNonGFDevicesPresent;
1210 pHTInfoField2->obssNonHTStaPresent = pMac->lim.gHTObssMode; /*added for Obss */
1211
1212 pHTInfoField2->reserved = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001214
1215 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_HT_INFO_FIELD3, nCfgValue );
1216
1217
Jeff Johnson295189b2012-06-20 16:38:30 -07001218 uHTInfoField.nCfgValue16 = nCfgValue & 0xFFFF;
1219
1220
1221 uHTInfoField.infoField3.basicSTBCMCS = pMac->lim.gHTSTBCBasicMCS;
1222 uHTInfoField.infoField3.dualCTSProtection = pMac->lim.gHTDualCTSProtection;
1223 uHTInfoField.infoField3.secondaryBeacon = pMac->lim.gHTSecondaryBeacon;
1224 uHTInfoField.infoField3.lsigTXOPProtectionFullSupport = psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport;
1225 uHTInfoField.infoField3.pcoActive = pMac->lim.gHTPCOActive;
1226 uHTInfoField.infoField3.pcoPhase = pMac->lim.gHTPCOPhase;
1227 uHTInfoField.infoField3.reserved = 0;
1228
Jeff Johnson295189b2012-06-20 16:38:30 -07001229
1230 pDot11f->secondaryChannelOffset = pHTInfoField1->secondaryChannelOffset;
1231 pDot11f->recommendedTxWidthSet = pHTInfoField1->recommendedTxWidthSet;
1232 pDot11f->rifsMode = pHTInfoField1->rifsMode;
1233 pDot11f->controlledAccessOnly = pHTInfoField1->controlledAccessOnly;
1234 pDot11f->serviceIntervalGranularity = pHTInfoField1->serviceIntervalGranularity;
1235
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 pDot11f->opMode = uHTInfoField2.infoField2.opMode;
1237 pDot11f->nonGFDevicesPresent = uHTInfoField2.infoField2.nonGFDevicesPresent;
1238 pDot11f->obssNonHTStaPresent = uHTInfoField2.infoField2.obssNonHTStaPresent;
1239 pDot11f->reserved = uHTInfoField2.infoField2.reserved;
1240
Jeff Johnson295189b2012-06-20 16:38:30 -07001241
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 pDot11f->basicSTBCMCS = uHTInfoField.infoField3.basicSTBCMCS;
1243 pDot11f->dualCTSProtection = uHTInfoField.infoField3.dualCTSProtection;
1244 pDot11f->secondaryBeacon = uHTInfoField.infoField3.secondaryBeacon;
1245 pDot11f->lsigTXOPProtectionFullSupport = uHTInfoField.infoField3.lsigTXOPProtectionFullSupport;
1246 pDot11f->pcoActive = uHTInfoField.infoField3.pcoActive;
1247 pDot11f->pcoPhase = uHTInfoField.infoField3.pcoPhase;
1248 pDot11f->reserved2 = uHTInfoField.infoField3.reserved;
Jeff Johnson295189b2012-06-20 16:38:30 -07001249 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_BASIC_MCS_SET,
1250 pDot11f->basicMCSSet, nCfgLen,
1251 SIZE_OF_BASIC_MCS_SET );
1252
1253 pDot11f->present = 1;
1254
1255 return eSIR_SUCCESS;
1256
1257} // End PopulateDot11fHTInfo.
1258
1259void
1260PopulateDot11fIBSSParams(tpAniSirGlobal pMac,
1261 tDot11fIEIBSSParams *pDot11f, tpPESession psessionEntry)
1262{
1263 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1264 {
1265 pDot11f->present = 1;
1266 // ATIM duration is always set to 0
1267 pDot11f->atim = 0;
1268 }
1269
1270} // End PopulateDot11fIBSSParams.
1271
1272
1273#ifdef ANI_SUPPORT_11H
1274tSirRetStatus
1275PopulateDot11fMeasurementReport0(tpAniSirGlobal pMac,
1276 tpSirMacMeasReqActionFrame pReq,
1277 tDot11fIEMeasurementReport *pDot11f)
1278{
1279 pDot11f->token = pReq->measReqIE.measToken;
1280 pDot11f->late = 0;
1281 pDot11f->incapable = 0;
1282 pDot11f->refused = 1;
1283 pDot11f->type = SIR_MAC_BASIC_MEASUREMENT_TYPE;
1284
1285 pDot11f->present = 1;
1286
1287 return eSIR_SUCCESS;
1288
1289} // End PopulatedDot11fMeasurementReport0.
1290
1291tSirRetStatus
1292PopulateDot11fMeasurementReport1(tpAniSirGlobal pMac,
1293 tpSirMacMeasReqActionFrame pReq,
1294 tDot11fIEMeasurementReport *pDot11f)
1295{
1296 pDot11f->token = pReq->measReqIE.measToken;
1297 pDot11f->late = 0;
1298 pDot11f->incapable = 0;
1299 pDot11f->refused = 1;
1300 pDot11f->type = SIR_MAC_CCA_MEASUREMENT_TYPE;
1301
1302 pDot11f->present = 1;
1303
1304 return eSIR_SUCCESS;
1305
1306} // End PopulatedDot11fMeasurementReport1.
1307
1308tSirRetStatus
1309PopulateDot11fMeasurementReport2(tpAniSirGlobal pMac,
1310 tpSirMacMeasReqActionFrame pReq,
1311 tDot11fIEMeasurementReport *pDot11f)
1312{
1313 pDot11f->token = pReq->measReqIE.measToken;
1314 pDot11f->late = 0;
1315 pDot11f->incapable = 0;
1316 pDot11f->refused = 1;
1317 pDot11f->type = SIR_MAC_RPI_MEASUREMENT_TYPE;
1318
1319 pDot11f->present = 1;
1320
1321 return eSIR_SUCCESS;
1322
1323} // End PopulatedDot11fMeasurementReport2.
1324#endif
1325
1326void
1327PopulateDot11fPowerCaps(tpAniSirGlobal pMac,
1328 tDot11fIEPowerCaps *pCaps,
1329 tANI_U8 nAssocType,
1330 tpPESession psessionEntry)
1331{
1332 if (nAssocType == LIM_REASSOC)
1333 {
1334 pCaps->minTxPower = psessionEntry->pLimReAssocReq->powerCap.minTxPower;
1335 pCaps->maxTxPower = psessionEntry->pLimReAssocReq->powerCap.maxTxPower;
1336 }else
1337 {
1338 pCaps->minTxPower = psessionEntry->pLimJoinReq->powerCap.minTxPower;
1339 pCaps->maxTxPower = psessionEntry->pLimJoinReq->powerCap.maxTxPower;
1340
1341 }
1342
1343 pCaps->present = 1;
1344} // End PopulateDot11fPowerCaps.
1345
1346tSirRetStatus
1347PopulateDot11fPowerConstraints(tpAniSirGlobal pMac,
1348 tDot11fIEPowerConstraints *pDot11f)
1349{
1350 tANI_U32 cfg;
1351 tSirRetStatus nSirStatus;
1352
1353 CFG_GET_INT( nSirStatus, pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, cfg );
1354
1355 pDot11f->localPowerConstraints = ( tANI_U8 )cfg;
1356 pDot11f->present = 1;
1357
1358 return eSIR_SUCCESS;
1359} // End PopulateDot11fPowerConstraints.
1360
1361void
1362PopulateDot11fQOSCapsAp(tpAniSirGlobal pMac,
1363 tDot11fIEQOSCapsAp *pDot11f, tpPESession psessionEntry)
1364{
1365 pDot11f->count = psessionEntry->gLimEdcaParamSetCount;
1366 pDot11f->reserved = 0;
1367 pDot11f->txopreq = 0;
1368 pDot11f->qreq = 0;
1369 pDot11f->qack = 0;
1370 pDot11f->present = 1;
1371} // End PopulatedDot11fQOSCaps.
1372
1373void
1374PopulateDot11fQOSCapsStation(tpAniSirGlobal pMac,
1375 tDot11fIEQOSCapsStation *pDot11f)
1376{
1377 tANI_U32 val = 0;
1378
1379 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301380 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001381
1382 pDot11f->more_data_ack = 0;
1383 pDot11f->max_sp_length = (tANI_U8)val;
1384 pDot11f->qack = 0;
1385
1386 if (pMac->lim.gUapsdEnable)
1387 {
1388 pDot11f->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1389 pDot11f->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1390 pDot11f->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1391 pDot11f->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1392 }
1393 pDot11f->present = 1;
1394} // End PopulatedDot11fQOSCaps.
1395
1396tSirRetStatus
1397PopulateDot11fRSN(tpAniSirGlobal pMac,
1398 tpSirRSNie pRsnIe,
1399 tDot11fIERSN *pDot11f)
1400{
1401 tANI_U32 status;
1402 int idx;
1403
1404 if ( pRsnIe->length )
1405 {
1406 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1407 {
1408 status = dot11fUnpackIeRSN( pMac,
1409 pRsnIe->rsnIEdata + idx + 2, //EID, length
1410 pRsnIe->rsnIEdata[ idx + 1 ],
1411 pDot11f );
Pragaspathi Thilagaraj03e2ab12018-06-22 12:19:48 +05301412 if (!DOT11F_SUCCEEDED(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 {
1414 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fRS"
Sushant Kaushik87787972015-09-11 16:05:00 +05301415 "N (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 status );
1417 return eSIR_FAILURE;
1418 }
1419 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301420 "PopulateDot11fRSN."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001421 }
1422
1423 }
1424
1425 return eSIR_SUCCESS;
1426} // End PopulateDot11fRSN.
1427
1428tSirRetStatus PopulateDot11fRSNOpaque( tpAniSirGlobal pMac,
1429 tpSirRSNie pRsnIe,
1430 tDot11fIERSNOpaque *pDot11f )
1431{
1432 int idx;
1433
1434 if ( pRsnIe->length )
1435 {
1436 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_RSN ) ) )
1437 {
1438 pDot11f->present = 1;
1439 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301440 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 pRsnIe->rsnIEdata + idx + 2, // EID, len
1442 pRsnIe->rsnIEdata[ idx + 1 ] );
1443 }
1444 }
1445
1446 return eSIR_SUCCESS;
1447
1448} // End PopulateDot11fRSNOpaque.
1449
1450
1451
1452#if defined(FEATURE_WLAN_WAPI)
1453
1454tSirRetStatus
1455PopulateDot11fWAPI(tpAniSirGlobal pMac,
1456 tpSirRSNie pRsnIe,
1457 tDot11fIEWAPI *pDot11f)
1458 {
1459 tANI_U32 status;
1460 int idx;
1461
1462 if ( pRsnIe->length )
1463 {
1464 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1465 {
1466 status = dot11fUnpackIeWAPI( pMac,
1467 pRsnIe->rsnIEdata + idx + 2, //EID, length
1468 pRsnIe->rsnIEdata[ idx + 1 ],
1469 pDot11f );
1470 if ( DOT11F_FAILED( status ) )
1471 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301472 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWAPI (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 status );
1474 return eSIR_FAILURE;
1475 }
1476 dot11fLog( pMac, LOG2, FL("dot11fUnpackIeRSN returned 0x%08x in "
Sushant Kaushik87787972015-09-11 16:05:00 +05301477 "PopulateDot11fWAPI."), status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 }
1479 }
1480
1481 return eSIR_SUCCESS;
1482} // End PopulateDot11fWAPI.
1483
1484tSirRetStatus PopulateDot11fWAPIOpaque( tpAniSirGlobal pMac,
1485 tpSirRSNie pRsnIe,
1486 tDot11fIEWAPIOpaque *pDot11f )
1487{
1488 int idx;
1489
1490 if ( pRsnIe->length )
1491 {
1492 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WAPI ) ) )
1493 {
1494 pDot11f->present = 1;
1495 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ];
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301496 vos_mem_copy ( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 pRsnIe->rsnIEdata + idx + 2, // EID, len
1498 pRsnIe->rsnIEdata[ idx + 1 ] );
1499 }
1500 }
1501
1502 return eSIR_SUCCESS;
1503
1504} // End PopulateDot11fWAPIOpaque.
1505
1506
1507#endif //defined(FEATURE_WLAN_WAPI)
1508
1509void
1510PopulateDot11fSSID(tpAniSirGlobal pMac,
1511 tSirMacSSid *pInternal,
1512 tDot11fIESSID *pDot11f)
1513{
1514 pDot11f->present = 1;
1515 pDot11f->num_ssid = pInternal->length;
1516 if ( pInternal->length )
1517 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301518 vos_mem_copy( ( tANI_U8* )pDot11f->ssid, ( tANI_U8* )&pInternal->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 pInternal->length );
1520 }
1521} // End PopulateDot11fSSID.
1522
1523tSirRetStatus
1524PopulateDot11fSSID2(tpAniSirGlobal pMac,
1525 tDot11fIESSID *pDot11f)
1526{
1527 tANI_U32 nCfg;
1528 tSirRetStatus nSirStatus;
1529
1530 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SSID, pDot11f->ssid, nCfg, 32 );
1531 pDot11f->num_ssid = ( tANI_U8 )nCfg;
1532 pDot11f->present = 1;
1533 return eSIR_SUCCESS;
1534} // End PopulateDot11fSSID2.
1535
1536void
1537PopulateDot11fSchedule(tSirMacScheduleIE *pSchedule,
1538 tDot11fIESchedule *pDot11f)
1539{
1540 pDot11f->aggregation = pSchedule->info.aggregation;
1541 pDot11f->tsid = pSchedule->info.tsid;
1542 pDot11f->direction = pSchedule->info.direction;
1543 pDot11f->reserved = pSchedule->info.rsvd;
1544 pDot11f->service_start_time = pSchedule->svcStartTime;
1545 pDot11f->service_interval = pSchedule->svcInterval;
1546 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1547 pDot11f->spec_interval = pSchedule->specInterval;
1548
1549 pDot11f->present = 1;
1550} // End PopulateDot11fSchedule.
1551
1552void
1553PopulateDot11fSuppChannels(tpAniSirGlobal pMac,
1554 tDot11fIESuppChannels *pDot11f,
1555 tANI_U8 nAssocType,
1556 tpPESession psessionEntry)
1557{
1558 tANI_U8 i;
1559 tANI_U8 *p;
1560
1561 if (nAssocType == LIM_REASSOC)
1562 {
1563 p = ( tANI_U8* )psessionEntry->pLimReAssocReq->supportedChannels.channelList;
1564 pDot11f->num_bands = psessionEntry->pLimReAssocReq->supportedChannels.numChnl;
1565 }else
1566 {
1567 p = ( tANI_U8* )psessionEntry->pLimJoinReq->supportedChannels.channelList;
1568 pDot11f->num_bands = psessionEntry->pLimJoinReq->supportedChannels.numChnl;
1569 }
1570 for ( i = 0U; i < pDot11f->num_bands; ++i, ++p)
1571 {
1572 pDot11f->bands[i][0] = *p;
1573 pDot11f->bands[i][1] = 1;
1574 }
1575
1576 pDot11f->present = 1;
1577
1578} // End PopulateDot11fSuppChannels.
1579
1580tSirRetStatus
1581PopulateDot11fSuppRates(tpAniSirGlobal pMac,
1582 tANI_U8 nChannelNum,
1583 tDot11fIESuppRates *pDot11f,tpPESession psessionEntry)
1584{
1585 tSirRetStatus nSirStatus;
1586 tANI_U32 nRates;
1587 tANI_U8 rates[SIR_MAC_MAX_NUMBER_OF_RATES];
1588
1589 /* Use the operational rates present in session entry whenever nChannelNum is set to OPERATIONAL
1590 else use the supported rate set from CFG, which is fixed and does not change dynamically and is used for
1591 sending mgmt frames (lile probe req) which need to go out before any session is present.
1592 */
1593 if(POPULATE_DOT11F_RATES_OPERATIONAL == nChannelNum )
1594 {
1595 #if 0
1596 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_OPERATIONAL_RATE_SET,
1597 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1598 #endif //TO SUPPORT BT-AMP
1599 if(psessionEntry != NULL)
1600 {
1601 nRates = psessionEntry->rateSet.numRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301602 vos_mem_copy( rates, psessionEntry->rateSet.rate,
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 nRates);
1604 }
1605 else
1606 {
Sushant Kaushik87787972015-09-11 16:05:00 +05301607 dot11fLog( pMac, LOGE, FL("no session context exists while populating Operational Rate Set"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 nRates = 0;
1609 }
1610 }
1611 else if ( 14 >= nChannelNum )
1612 {
1613 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11B,
1614 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1615 }
1616 else
1617 {
1618 CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A,
1619 rates, nRates, SIR_MAC_MAX_NUMBER_OF_RATES );
1620 }
1621
1622 if ( 0 != nRates )
1623 {
1624 pDot11f->num_rates = ( tANI_U8 )nRates;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05301625 vos_mem_copy( pDot11f->rates, rates, nRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 pDot11f->present = 1;
1627 }
1628
1629 return eSIR_SUCCESS;
1630
1631} // End PopulateDot11fSuppRates.
1632
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301633/**
1634 * PopulateDot11fRatesTdls() - populate supported rates and
1635 * extended supported rates IE.
1636 * @p_mac gloabl - header.
1637 * @p_supp_rates - pointer to supported rates IE
1638 * @p_ext_supp_rates - pointer to extended supported rates IE
1639 *
1640 * This function populates the supported rates and extended supported
1641 * rates IE based in the STA capability. If the number of rates
1642 * supported is less than MAX_NUM_SUPPORTED_RATES, only supported rates
1643 * IE is populated.
1644 *
1645 * Return: tSirRetStatus eSIR_SUCCESS on Success and eSIR_FAILURE
1646 * on failure.
1647 */
1648
1649tSirRetStatus
1650PopulateDot11fRatesTdls(tpAniSirGlobal p_mac,
1651 tDot11fIESuppRates *p_supp_rates,
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301652 tDot11fIEExtSuppRates *p_ext_supp_rates,
1653 tANI_U8 curr_oper_channel)
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301654{
1655 tSirMacRateSet temp_rateset;
1656 tSirMacRateSet temp_rateset2;
1657 uint32_t val, i;
1658 uint32_t self_dot11mode = 0;
1659
1660 wlan_cfgGetInt(p_mac, WNI_CFG_DOT11_MODE, &self_dot11mode);
1661
1662 /**
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301663 * Include 11b rates only when the device configured
1664 * in auto, 11a/b/g or 11b_only and also if current base
1665 * channel is 5 GHz then no need to advertise the 11b rates.
1666 * If devices to move 2.4GHz off-channel then they can communicate
1667 * in 11g rates i.e. (6, 9, 12, 18, 24, 36 and 54).
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301668 */
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301669 limLog(p_mac, LOG1, FL("Current operating channel %d self_dot11mode = %d"),
1670 curr_oper_channel, self_dot11mode);
1671
1672 if ((curr_oper_channel <= SIR_11B_CHANNEL_END) &&
1673 ((self_dot11mode == WNI_CFG_DOT11_MODE_ALL) ||
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301674 (self_dot11mode == WNI_CFG_DOT11_MODE_11A) ||
1675 (self_dot11mode == WNI_CFG_DOT11_MODE_11AC) ||
1676 (self_dot11mode == WNI_CFG_DOT11_MODE_11N) ||
1677 (self_dot11mode == WNI_CFG_DOT11_MODE_11G) ||
Masti, Narayanraddicc203f62015-12-24 14:41:29 +05301678 (self_dot11mode == WNI_CFG_DOT11_MODE_11B)))
Masti, Narayanraddi4b359dd2015-02-03 15:49:29 +05301679 {
1680 val = WNI_CFG_SUPPORTED_RATES_11B_LEN;
1681 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11B,
1682 (tANI_U8 *)&temp_rateset.rate, &val);
1683 temp_rateset.numRates = (tANI_U8) val;
1684 }
1685 else
1686 {
1687 temp_rateset.numRates = 0;
1688 }
1689
1690 /* Include 11a rates when the device configured in non-11b mode */
1691 if (!IS_DOT11_MODE_11B(self_dot11mode))
1692 {
1693 val = WNI_CFG_SUPPORTED_RATES_11A_LEN;
1694 wlan_cfgGetStr(p_mac, WNI_CFG_SUPPORTED_RATES_11A,
1695 (tANI_U8 *)&temp_rateset2.rate, &val);
1696 temp_rateset2.numRates = (tANI_U8) val;
1697 }
1698 else
1699 {
1700 temp_rateset2.numRates = 0;
1701 }
1702
1703 if ((temp_rateset.numRates + temp_rateset2.numRates) >
1704 SIR_MAC_MAX_NUMBER_OF_RATES)
1705 {
1706 limLog(p_mac, LOGP, FL("more than %d rates in CFG"),
1707 SIR_MAC_MAX_NUMBER_OF_RATES);
1708 return eSIR_FAILURE;
1709 }
1710
1711 /**
1712 * copy all rates in temp_rateset,
1713 * there are SIR_MAC_MAX_NUMBER_OF_RATES rates max
1714 */
1715 for (i = 0; i < temp_rateset2.numRates; i++)
1716 temp_rateset.rate[i + temp_rateset.numRates] =
1717 temp_rateset2.rate[i];
1718
1719 temp_rateset.numRates += temp_rateset2.numRates;
1720
1721 if (temp_rateset.numRates <= MAX_NUM_SUPPORTED_RATES)
1722 {
1723 p_supp_rates->num_rates = temp_rateset.numRates;
1724 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1725 p_supp_rates->num_rates);
1726 p_supp_rates->present = 1;
1727 }
1728 else /* Populate extended capability as well */
1729 {
1730 p_supp_rates->num_rates = MAX_NUM_SUPPORTED_RATES;
1731 vos_mem_copy(p_supp_rates->rates, temp_rateset.rate,
1732 p_supp_rates->num_rates);
1733 p_supp_rates->present = 1;
1734 p_ext_supp_rates->num_rates = temp_rateset.numRates -
1735 MAX_NUM_SUPPORTED_RATES;
1736 vos_mem_copy(p_ext_supp_rates->rates,
1737 (tANI_U8 *)temp_rateset.rate +
1738 MAX_NUM_SUPPORTED_RATES,
1739 p_ext_supp_rates->num_rates);
1740 p_ext_supp_rates->present = 1;
1741 }
1742
1743 return eSIR_SUCCESS;
1744
1745} /* End PopulateDot11fRatesTdls */
1746
Jeff Johnson295189b2012-06-20 16:38:30 -07001747tSirRetStatus
1748PopulateDot11fTPCReport(tpAniSirGlobal pMac,
1749 tDot11fIETPCReport *pDot11f,
1750 tpPESession psessionEntry)
1751{
1752 tANI_U16 staid, txPower;
1753 tSirRetStatus nSirStatus;
1754
1755 nSirStatus = limGetMgmtStaid( pMac, &staid, psessionEntry);
1756 if ( eSIR_SUCCESS != nSirStatus )
1757 {
1758 dot11fLog( pMac, LOG1, FL("Failed to get the STAID in Populat"
1759 "eDot11fTPCReport; limGetMgmtStaid "
Sushant Kaushik87787972015-09-11 16:05:00 +05301760 "returned status %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001761 nSirStatus );
1762 return eSIR_FAILURE;
1763 }
1764
1765 // FramesToDo: This function was "misplaced" in the move to Gen4_TVM...
1766 // txPower = halGetRateToPwrValue( pMac, staid, pMac->lim.gLimCurrentChannelId, isBeacon );
1767 txPower = 0;
1768 pDot11f->tx_power = ( tANI_U8 )txPower;
1769 pDot11f->link_margin = 0;
1770 pDot11f->present = 1;
1771
1772 return eSIR_SUCCESS;
1773} // End PopulateDot11fTPCReport.
1774
1775
1776void PopulateDot11fTSInfo(tSirMacTSInfo *pInfo,
1777 tDot11fFfTSInfo *pDot11f)
1778{
1779 pDot11f->traffic_type = pInfo->traffic.trafficType;
1780 pDot11f->tsid = pInfo->traffic.tsid;
1781 pDot11f->direction = pInfo->traffic.direction;
1782 pDot11f->access_policy = pInfo->traffic.accessPolicy;
1783 pDot11f->aggregation = pInfo->traffic.aggregation;
1784 pDot11f->psb = pInfo->traffic.psb;
1785 pDot11f->user_priority = pInfo->traffic.userPrio;
1786 pDot11f->tsinfo_ack_pol = pInfo->traffic.ackPolicy;
1787 pDot11f->schedule = pInfo->schedule.schedule;
1788} // End PopulatedDot11fTSInfo.
1789
1790void PopulateDot11fWMM(tpAniSirGlobal pMac,
1791 tDot11fIEWMMInfoAp *pInfo,
1792 tDot11fIEWMMParams *pParams,
1793 tDot11fIEWMMCaps *pCaps,
1794 tpPESession psessionEntry)
1795{
1796 if ( psessionEntry->limWmeEnabled )
1797 {
1798 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1799 {
1800 //if ( ! sirIsPropCapabilityEnabled( pMac, SIR_MAC_PROP_CAPABILITY_WME ) )
1801 {
1802 PopulateDot11fWMMInfoAp( pMac, pInfo, psessionEntry );
1803 }
1804 }
1805 else
1806 {
1807 {
1808 PopulateDot11fWMMParams( pMac, pParams, psessionEntry);
1809 }
1810
1811 if ( psessionEntry->limWsmEnabled )
1812 {
1813 PopulateDot11fWMMCaps( pCaps );
1814 }
1815 }
1816 }
1817} // End PopulateDot11fWMM.
1818
1819void PopulateDot11fWMMCaps(tDot11fIEWMMCaps *pCaps)
1820{
1821 pCaps->version = SIR_MAC_OUI_VERSION_1;
1822 pCaps->qack = 0;
1823 pCaps->queue_request = 1;
1824 pCaps->txop_request = 0;
1825 pCaps->more_ack = 0;
1826 pCaps->present = 1;
1827} // End PopulateDot11fWmmCaps.
1828
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001829#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001830void PopulateDot11fReAssocTspec(tpAniSirGlobal pMac, tDot11fReAssocRequest *pReassoc, tpPESession psessionEntry)
1831{
1832 tANI_U8 numTspecs = 0, idx;
1833 tTspecInfo *pTspec = NULL;
1834
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001835 numTspecs = psessionEntry->pLimReAssocReq->eseTspecInfo.numTspecs;
1836 pTspec = &psessionEntry->pLimReAssocReq->eseTspecInfo.tspec[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 pReassoc->num_WMMTSPEC = numTspecs;
1838 if (numTspecs) {
1839 for (idx=0; idx<numTspecs; idx++) {
1840 PopulateDot11fWMMTSPEC(&pTspec->tspec, &pReassoc->WMMTSPEC[idx]);
Sachin Ahujab0308c62014-07-01 17:02:54 +05301841 pTspec->tspec.mediumTime = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 pTspec++;
1843 }
1844 }
1845}
1846#endif
1847
1848void PopulateDot11fWMMInfoAp(tpAniSirGlobal pMac, tDot11fIEWMMInfoAp *pInfo,
1849 tpPESession psessionEntry)
1850{
1851 pInfo->version = SIR_MAC_OUI_VERSION_1;
1852
1853 /* WMM Specification 3.1.3, 3.2.3
1854 * An IBSS staion shall always use its default WMM parameters.
1855 */
1856 if ( eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
1857 {
1858 pInfo->param_set_count = 0;
1859 pInfo->uapsd = 0;
1860 }
1861 else
1862 {
1863 pInfo->param_set_count = ( 0xf & psessionEntry->gLimEdcaParamSetCount );
Jeff Johnson295189b2012-06-20 16:38:30 -07001864 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
1865 pInfo->uapsd = ( 0x1 & psessionEntry->apUapsdEnable );
1866 }
1867 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 pInfo->uapsd = ( 0x1 & pMac->lim.gUapsdEnable );
1869 }
1870 pInfo->present = 1;
1871}
1872
1873void PopulateDot11fWMMInfoStation(tpAniSirGlobal pMac, tDot11fIEWMMInfoStation *pInfo)
1874{
1875 tANI_U32 val = 0;
1876
Sachin Ahujab3a1a152014-11-11 22:14:10 +05301877 limLog(pMac, LOG1, FL("populate WMM IE in Setup Request Frame"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001878 pInfo->version = SIR_MAC_OUI_VERSION_1;
1879 pInfo->acvo_uapsd = LIM_UAPSD_GET(ACVO, pMac->lim.gUapsdPerAcBitmask);
1880 pInfo->acvi_uapsd = LIM_UAPSD_GET(ACVI, pMac->lim.gUapsdPerAcBitmask);
1881 pInfo->acbk_uapsd = LIM_UAPSD_GET(ACBK, pMac->lim.gUapsdPerAcBitmask);
1882 pInfo->acbe_uapsd = LIM_UAPSD_GET(ACBE, pMac->lim.gUapsdPerAcBitmask);
1883
1884 if(wlan_cfgGetInt(pMac, WNI_CFG_MAX_SP_LENGTH, &val) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05301885 PELOGE(limLog(pMac, LOGE, FL("could not retrieve Max SP Length "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001886 pInfo->max_sp_length = (tANI_U8)val;
1887 pInfo->present = 1;
1888}
1889
Jeff Johnson295189b2012-06-20 16:38:30 -07001890void PopulateDot11fWMMParams(tpAniSirGlobal pMac,
1891 tDot11fIEWMMParams *pParams,
1892 tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07001893{
1894 pParams->version = SIR_MAC_OUI_VERSION_1;
1895
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 if(psessionEntry->limSystemRole == eLIM_AP_ROLE)
1897 pParams->qosInfo =
1898 (psessionEntry->apUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1899 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001900 pParams->qosInfo =
1901 (pMac->lim.gUapsdEnable << 7) | ((tANI_U8)(0x0f & psessionEntry->gLimEdcaParamSetCount));
1902
1903 // Fill each EDCA parameter set in order: be, bk, vi, vo
1904 pParams->acbe_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[0].aci.aifsn) );
1905 pParams->acbe_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[0].aci.acm );
1906 pParams->acbe_aci = ( 0x3 & SIR_MAC_EDCAACI_BESTEFFORT );
1907 pParams->acbe_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.min );
1908 pParams->acbe_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[0].cw.max );
1909 pParams->acbe_txoplimit = psessionEntry->gLimEdcaParamsBC[0].txoplimit;
1910
1911 pParams->acbk_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[1].aci.aifsn) );
1912 pParams->acbk_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[1].aci.acm );
1913 pParams->acbk_aci = ( 0x3 & SIR_MAC_EDCAACI_BACKGROUND );
1914 pParams->acbk_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.min );
1915 pParams->acbk_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[1].cw.max );
1916 pParams->acbk_txoplimit = psessionEntry->gLimEdcaParamsBC[1].txoplimit;
1917
Jeff Johnson295189b2012-06-20 16:38:30 -07001918 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1919 pParams->acvi_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].aci.aifsn );
1920 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001921 pParams->acvi_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[2].aci.aifsn) );
1922
1923
1924
1925 pParams->acvi_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[2].aci.acm );
1926 pParams->acvi_aci = ( 0x3 & SIR_MAC_EDCAACI_VIDEO );
1927 pParams->acvi_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.min );
1928 pParams->acvi_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[2].cw.max );
1929 pParams->acvi_txoplimit = psessionEntry->gLimEdcaParamsBC[2].txoplimit;
1930
Jeff Johnson295189b2012-06-20 16:38:30 -07001931 if(psessionEntry->limSystemRole == eLIM_AP_ROLE )
1932 pParams->acvo_aifsn = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].aci.aifsn );
1933 else
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 pParams->acvo_aifsn = ( 0xf & SET_AIFSN(psessionEntry->gLimEdcaParamsBC[3].aci.aifsn) );
1935
1936 pParams->acvo_acm = ( 0x1 & psessionEntry->gLimEdcaParamsBC[3].aci.acm );
1937 pParams->acvo_aci = ( 0x3 & SIR_MAC_EDCAACI_VOICE );
1938 pParams->acvo_acwmin = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.min );
1939 pParams->acvo_acwmax = ( 0xf & psessionEntry->gLimEdcaParamsBC[3].cw.max );
1940 pParams->acvo_txoplimit = psessionEntry->gLimEdcaParamsBC[3].txoplimit;
1941
1942 pParams->present = 1;
1943
1944} // End PopulateDot11fWMMParams.
1945
1946void PopulateDot11fWMMSchedule(tSirMacScheduleIE *pSchedule,
1947 tDot11fIEWMMSchedule *pDot11f)
1948{
1949 pDot11f->version = 1;
1950 pDot11f->aggregation = pSchedule->info.aggregation;
1951 pDot11f->tsid = pSchedule->info.tsid;
1952 pDot11f->direction = pSchedule->info.direction;
1953 pDot11f->reserved = pSchedule->info.rsvd;
1954 pDot11f->service_start_time = pSchedule->svcStartTime;
1955 pDot11f->service_interval = pSchedule->svcInterval;
1956 pDot11f->max_service_dur = pSchedule->maxSvcDuration;
1957 pDot11f->spec_interval = pSchedule->specInterval;
1958
1959 pDot11f->present = 1;
1960} // End PopulateDot11fWMMSchedule.
1961
1962tSirRetStatus
1963PopulateDot11fWPA(tpAniSirGlobal pMac,
1964 tpSirRSNie pRsnIe,
1965 tDot11fIEWPA *pDot11f)
1966{
1967 tANI_U32 status;
1968 int idx;
1969
1970 if ( pRsnIe->length )
1971 {
1972 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
1973 {
1974 status = dot11fUnpackIeWPA( pMac,
1975 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, length, OUI
1976 pRsnIe->rsnIEdata[ idx + 1 ] - 4, // OUI
1977 pDot11f );
1978 if ( DOT11F_FAILED( status ) )
1979 {
1980 dot11fLog( pMac, LOGE, FL("Parse failure in PopulateDot11fWP"
Sushant Kaushik87787972015-09-11 16:05:00 +05301981 "A (0x%08x)."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001982 status );
1983 return eSIR_FAILURE;
1984 }
1985 }
1986 }
1987
1988 return eSIR_SUCCESS;
1989} // End PopulateDot11fWPA.
1990
1991
1992
1993tSirRetStatus PopulateDot11fWPAOpaque( tpAniSirGlobal pMac,
1994 tpSirRSNie pRsnIe,
1995 tDot11fIEWPAOpaque *pDot11f )
1996{
1997 int idx;
1998
1999 if ( pRsnIe->length )
2000 {
2001 if( 0 <= ( idx = FindIELocation( pMac, pRsnIe, DOT11F_EID_WPA ) ) )
2002 {
2003 pDot11f->present = 1;
2004 pDot11f->num_data = pRsnIe->rsnIEdata[ idx + 1 ] - 4;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302005 vos_mem_copy( pDot11f->data,
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 pRsnIe->rsnIEdata + idx + 2 + 4, // EID, len, OUI
2007 pRsnIe->rsnIEdata[ idx + 1 ] - 4 ); // OUI
2008 }
2009 }
2010
2011 return eSIR_SUCCESS;
2012
2013} // End PopulateDot11fWPAOpaque.
2014
2015////////////////////////////////////////////////////////////////////////
2016
2017tSirRetStatus
2018sirGetCfgPropCaps(tpAniSirGlobal pMac, tANI_U16 *caps)
2019{
2020#if 0
2021 tANI_U32 val;
2022
2023 *caps = 0;
2024 if (wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &val)
2025 != eSIR_SUCCESS)
2026 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302027 limLog(pMac, LOGP, FL("could not retrieve PropFeature enabled flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 return eSIR_FAILURE;
2029 }
2030 if (wlan_cfgGetInt(pMac, WNI_CFG_PROP_CAPABILITY, &val) != eSIR_SUCCESS)
2031 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302032 limLog(pMac, LOGP, FL("could not retrieve PROP_CAPABLITY flag"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 return eSIR_FAILURE;
2034 }
2035
2036 *caps = (tANI_U16) val;
2037#endif
2038 return eSIR_SUCCESS;
2039}
2040
2041tSirRetStatus
2042sirConvertProbeReqFrame2Struct(tpAniSirGlobal pMac,
2043 tANI_U8 *pFrame,
2044 tANI_U32 nFrame,
2045 tpSirProbeReq pProbeReq)
2046{
2047 tANI_U32 status;
2048 tDot11fProbeRequest pr;
2049
2050 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302051 vos_mem_set( (tANI_U8*)pProbeReq, sizeof(tSirProbeReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002052
2053 // delegate to the framesc-generated code,
2054 status = dot11fUnpackProbeRequest(pMac, pFrame, nFrame, &pr);
2055 if ( DOT11F_FAILED( status ) )
2056 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302057 limLog(pMac, LOGE, FL("Failed to parse a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 status, nFrame);
2059 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2060 return eSIR_FAILURE;
2061 }
2062 else if ( DOT11F_WARNED( status ) )
2063 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302064 limLog( pMac, LOGW, FL("There were warnings while unpacking a Probe Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 status, nFrame );
2066 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2067 }
2068
2069 // & "transliterate" from a 'tDot11fProbeRequestto' a 'tSirProbeReq'...
2070 if ( ! pr.SSID.present )
2071 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302072 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002073 }
2074 else
2075 {
2076 pProbeReq->ssidPresent = 1;
2077 ConvertSSID( pMac, &pProbeReq->ssId, &pr.SSID );
2078 }
2079
2080 if ( ! pr.SuppRates.present )
2081 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302082 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 return eSIR_FAILURE;
2084 }
2085 else
2086 {
2087 pProbeReq->suppRatesPresent = 1;
2088 ConvertSuppRates( pMac, &pProbeReq->supportedRates, &pr.SuppRates );
2089 }
2090
2091 if ( pr.ExtSuppRates.present )
2092 {
2093 pProbeReq->extendedRatesPresent = 1;
2094 ConvertExtSuppRates( pMac, &pProbeReq->extendedRates, &pr.ExtSuppRates );
2095 }
2096
2097 if ( pr.HTCaps.present )
2098 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302099 vos_mem_copy( &pProbeReq->HTCaps, &pr.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 }
2101
2102 if ( pr.WscProbeReq.present )
2103 {
2104 pProbeReq->wscIePresent = 1;
Rajesh Babu Prathipatiddbe2892014-07-01 18:57:16 +05302105 vos_mem_copy(&pProbeReq->probeReqWscIeInfo, &pr.WscProbeReq, sizeof(tDot11fIEWscProbeReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002107#ifdef WLAN_FEATURE_11AC
2108 if ( pr.VHTCaps.present )
2109 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302110 vos_mem_copy( &pProbeReq->VHTCaps, &pr.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002111 }
2112#endif
2113
Jeff Johnson295189b2012-06-20 16:38:30 -07002114
2115 if ( pr.P2PProbeReq.present )
2116 {
2117 pProbeReq->p2pIePresent = 1;
2118 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002119
Jeff Johnson295189b2012-06-20 16:38:30 -07002120 return eSIR_SUCCESS;
2121
2122} // End sirConvertProbeReqFrame2Struct.
2123
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302124/* function ValidateAndRectifyIEs checks for the malformed frame.
2125 * The frame would contain fixed IEs of 12 bytes follwed by Variable IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302126 * (Tagged elements).
2127 * Every Tagged IE has tag number, tag length and data. Tag length indicates
2128 * the size of data in bytes.
2129 * This function checks for size of Frame recived with the sum of all IEs.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302130 * And also rectifies missing optional fields in IE.
2131 *
2132 * NOTE : Presently this function rectifies RSN capability in RSN IE, can
2133 * extended to rectify other optional fields in other IEs.
2134 *
2135 */
2136tSirRetStatus ValidateAndRectifyIEs(tpAniSirGlobal pMac,
2137 tANI_U8 *pMgmtFrame,
2138 tANI_U32 nFrameBytes,
2139 tANI_U32 *nMissingRsnBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302140{
2141 tANI_U32 length = SIZE_OF_FIXED_PARAM;
2142 tANI_U8 *refFrame;
2143
2144 // Frame contains atleast one IE
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302145 if (nFrameBytes > (SIZE_OF_FIXED_PARAM + 2))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302146 {
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302147 while (length < nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302148 {
2149 /*refFrame points to next IE */
2150 refFrame = pMgmtFrame + length;
2151 length += (tANI_U32)(SIZE_OF_TAG_PARAM_NUM + SIZE_OF_TAG_PARAM_LEN
2152 + (*(refFrame + SIZE_OF_TAG_PARAM_NUM)));
2153 }
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302154 if (length != nFrameBytes)
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302155 {
2156 /* Workaround : Some APs may not include RSN Capability but
2157 * the length of which is included in RSN IE length.
2158 * this may cause in updating RSN Capability with junk value.
2159 * To avoid this, add RSN Capability value with default value.
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302160 * Going further we can have such workaround for other IEs
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302161 */
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302162 if ((*refFrame == RSNIEID) &&
2163 (length == (nFrameBytes + RSNIE_CAPABILITY_LEN)))
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302164 {
2165 //Assume RSN Capability as 00
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302166 vos_mem_set( ( tANI_U8* ) (pMgmtFrame + (nFrameBytes)),
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302167 RSNIE_CAPABILITY_LEN, DEFAULT_RSNIE_CAP_VAL );
Rashmi Ramanna2b55dc12014-06-10 22:56:20 +05302168 *nMissingRsnBytes = RSNIE_CAPABILITY_LEN;
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302169 limLog(pMac, LOG1,
Sushant Kaushik87787972015-09-11 16:05:00 +05302170 FL("Added RSN Capability to the RSNIE as 0x00 0x00"));
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302171
2172 return eHAL_STATUS_SUCCESS;
Hu Wangfcc5e132016-03-04 10:34:24 +08002173 } else {
2174 /* Workaround: Some APs may add extra 0x00 padding after IEs.
2175 * Return true to allow these probe response frames proceed.
2176 */
2177 if (nFrameBytes - length > 0) {
2178 tANI_U32 i;
2179 tANI_BOOLEAN zero_padding = VOS_TRUE;
2180
2181 for (i = length; i < nFrameBytes; i ++) {
2182 if (pMgmtFrame[i-1] != 0x0) {
2183 zero_padding = VOS_FALSE;
2184 break;
2185 }
2186 }
2187
2188 if (zero_padding) {
2189 return eHAL_STATUS_SUCCESS;
2190 }
2191 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302192 }
Hu Wangfcc5e132016-03-04 10:34:24 +08002193
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302194 return eSIR_FAILURE;
2195 }
2196 }
Rashmi Ramanna6922be02014-05-29 19:37:58 +05302197 return eHAL_STATUS_SUCCESS;
2198}
2199
Jeff Johnson295189b2012-06-20 16:38:30 -07002200tSirRetStatus sirConvertProbeFrame2Struct(tpAniSirGlobal pMac,
2201 tANI_U8 *pFrame,
2202 tANI_U32 nFrame,
2203 tpSirProbeRespBeacon pProbeResp)
2204{
2205 tANI_U32 status;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002206 tDot11fProbeResponse *pr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002207
2208 // Ok, zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302209 vos_mem_set( ( tANI_U8* )pProbeResp, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002210
Abhishek Singhc75726d2015-04-13 14:44:14 +05302211 pr = vos_mem_vmalloc(sizeof(tDot11fProbeResponse));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302212 if ( NULL == pr )
2213 status = eHAL_STATUS_FAILURE;
2214 else
2215 status = eHAL_STATUS_SUCCESS;
2216 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07002217 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302218 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002219 return eSIR_FAILURE;
2220 }
2221
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302222 vos_mem_set( ( tANI_U8* )pr, sizeof(tDot11fProbeResponse), 0 );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002223
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07002225 status = dot11fUnpackProbeResponse( pMac, pFrame, nFrame, pr );
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 if ( DOT11F_FAILED( status ) )
2227 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302228 limLog(pMac, LOGE, FL("Failed to parse a Probe Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 status, nFrame);
2230 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05302231 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 return eSIR_FAILURE;
2233 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002234
2235 // & "transliterate" from a 'tDot11fProbeResponse' to a 'tSirProbeRespBeacon'...
2236
2237 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302238 vos_mem_copy( ( tANI_U8* )pProbeResp->timeStamp, ( tANI_U8* )&pr->TimeStamp,
2239 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002240
2241 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07002242 pProbeResp->beaconInterval = pr->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002243
2244 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07002245 pProbeResp->capabilityInfo.ess = pr->Capabilities.ess;
2246 pProbeResp->capabilityInfo.ibss = pr->Capabilities.ibss;
2247 pProbeResp->capabilityInfo.cfPollable = pr->Capabilities.cfPollable;
2248 pProbeResp->capabilityInfo.cfPollReq = pr->Capabilities.cfPollReq;
2249 pProbeResp->capabilityInfo.privacy = pr->Capabilities.privacy;
2250 pProbeResp->capabilityInfo.shortPreamble = pr->Capabilities.shortPreamble;
2251 pProbeResp->capabilityInfo.pbcc = pr->Capabilities.pbcc;
2252 pProbeResp->capabilityInfo.channelAgility = pr->Capabilities.channelAgility;
2253 pProbeResp->capabilityInfo.spectrumMgt = pr->Capabilities.spectrumMgt;
2254 pProbeResp->capabilityInfo.qos = pr->Capabilities.qos;
2255 pProbeResp->capabilityInfo.shortSlotTime = pr->Capabilities.shortSlotTime;
2256 pProbeResp->capabilityInfo.apsd = pr->Capabilities.apsd;
2257 pProbeResp->capabilityInfo.rrm = pr->Capabilities.rrm;
2258 pProbeResp->capabilityInfo.dsssOfdm = pr->Capabilities.dsssOfdm;
2259 pProbeResp->capabilityInfo.delayedBA = pr->Capabilities.delayedBA;
2260 pProbeResp->capabilityInfo.immediateBA = pr->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002261
Jeff Johnson32d95a32012-09-10 13:15:23 -07002262 if ( ! pr->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302264 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 }
2266 else
2267 {
2268 pProbeResp->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002269 ConvertSSID( pMac, &pProbeResp->ssId, &pr->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 }
2271
Jeff Johnson32d95a32012-09-10 13:15:23 -07002272 if ( ! pr->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302274 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002275 }
2276 else
2277 {
2278 pProbeResp->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002279 ConvertSuppRates( pMac, &pProbeResp->supportedRates, &pr->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 }
2281
Jeff Johnson32d95a32012-09-10 13:15:23 -07002282 if ( pr->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 {
2284 pProbeResp->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002285 ConvertExtSuppRates( pMac, &pProbeResp->extendedRates, &pr->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 }
2287
2288
Jeff Johnson32d95a32012-09-10 13:15:23 -07002289 if ( pr->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 {
2291 pProbeResp->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002292 ConvertCFParams( pMac, &pProbeResp->cfParamSet, &pr->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 }
2294
Jeff Johnson32d95a32012-09-10 13:15:23 -07002295 if ( pr->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 {
2297 pProbeResp->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002298 ConvertCountry( pMac, &pProbeResp->countryInfoParam, &pr->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07002299 }
2300
Jeff Johnson32d95a32012-09-10 13:15:23 -07002301 if ( pr->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 {
2303 pProbeResp->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002304 ConvertEDCAParam( pMac, &pProbeResp->edcaParams, &pr->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07002305 }
2306
Jeff Johnson32d95a32012-09-10 13:15:23 -07002307 if ( pr->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002308 {
2309 pProbeResp->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302310 vos_mem_copy( &pProbeResp->channelSwitchIE, &pr->ChanSwitchAnn,
Abhishek Singh15431c42017-10-25 15:43:02 +05302311 sizeof(tDot11fIEChanSwitchAnn) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 }
2313
Abhishek Singh15431c42017-10-25 15:43:02 +05302314 if ( pr->sec_chan_offset.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302316 pProbeResp->sec_chan_offset_present = 1;
Abhishek Singh15431c42017-10-25 15:43:02 +05302317 vos_mem_copy ( &pProbeResp->sec_chan_offset, &pr->sec_chan_offset,
2318 sizeof(tDot11fIEsec_chan_offset) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002319 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05302320 if (pr->ext_chan_switch_ann.present)
2321 {
2322 pProbeResp->ecsa_present = 1;
2323 vos_mem_copy(&pProbeResp->ext_chan_switch_ann,
2324 &pr->ext_chan_switch_ann,
2325 sizeof(tDot11fIEext_chan_switch_ann));
2326 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002327
Jeff Johnson32d95a32012-09-10 13:15:23 -07002328 if( pr->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002329 {
2330 pProbeResp->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302331 vos_mem_copy( &pProbeResp->tpcReport, &pr->TPCReport, sizeof(tDot11fIETPCReport));
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 }
2333
Jeff Johnson32d95a32012-09-10 13:15:23 -07002334 if( pr->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 {
2336 pProbeResp->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302337 vos_mem_copy( &pProbeResp->localPowerConstraint, &pr->PowerConstraints,
2338 sizeof(tDot11fIEPowerConstraints));
Jeff Johnson295189b2012-06-20 16:38:30 -07002339 }
2340
Jeff Johnson32d95a32012-09-10 13:15:23 -07002341 if ( pr->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002342 {
2343 pProbeResp->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302344 vos_mem_copy( &pProbeResp->quietIE, &pr->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 }
2346
Jeff Johnson32d95a32012-09-10 13:15:23 -07002347 if ( pr->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302349 vos_mem_copy( &pProbeResp->HTCaps, &pr->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 }
2351
Jeff Johnson32d95a32012-09-10 13:15:23 -07002352 if ( pr->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302354 vos_mem_copy( &pProbeResp->HTInfo, &pr->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002355 }
2356
Jeff Johnson32d95a32012-09-10 13:15:23 -07002357 if ( pr->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 {
2359 pProbeResp->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002360 pProbeResp->channelNumber = pr->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002362 else if(pr->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07002364 pProbeResp->channelNumber = pr->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07002365 }
2366
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002367 if ( pr->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 {
2369 pProbeResp->rsnPresent = 1;
Chet Lanctot4b9abd72013-06-27 11:14:56 -07002370 ConvertRSNOpaque( pMac, &pProbeResp->rsn, &pr->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002371 }
2372
Jeff Johnson32d95a32012-09-10 13:15:23 -07002373 if ( pr->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 {
2375 pProbeResp->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002376 ConvertWPA( pMac, &pProbeResp->wpa, &pr->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 }
2378
Jeff Johnson32d95a32012-09-10 13:15:23 -07002379 if ( pr->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002380 {
2381 pProbeResp->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002382 ConvertWMMParams( pMac, &pProbeResp->edcaParams, &pr->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05302383 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Probe Response Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07002384 __printWMMParams(pMac, &pr->WMMParams);)
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 }
2386
Jeff Johnson32d95a32012-09-10 13:15:23 -07002387 if ( pr->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 {
2389 pProbeResp->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05302390 PELOG1(limLog(pMac, LOG1, FL("WMM Information Element present in Probe Response Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002391 }
2392
Jeff Johnson32d95a32012-09-10 13:15:23 -07002393 if ( pr->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002394 {
2395 pProbeResp->wsmCapablePresent = 1;
2396 }
2397
2398
Jeff Johnson32d95a32012-09-10 13:15:23 -07002399 if ( pr->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002400 {
2401 pProbeResp->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07002402 ConvertERPInfo( pMac, &pProbeResp->erpIEInfo, &pr->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 }
2404
2405#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07002406 if (pr->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002407 {
2408 // MobilityDomain
2409 pProbeResp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302410 vos_mem_copy( (tANI_U8 *)&(pProbeResp->mdie[0]), (tANI_U8 *)&(pr->MobilityDomain.MDID),
2411 sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07002412 pProbeResp->mdie[2] = ((pr->MobilityDomain.overDSCap << 0) | (pr->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07002413#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Sushant Kaushik87787972015-09-11 16:05:00 +05302414 limLog(pMac, LOG2, FL("mdie=%02x%02x%02x"), (unsigned int)pProbeResp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 (unsigned int)pProbeResp->mdie[1], (unsigned int)pProbeResp->mdie[2]);
2416#endif
2417 }
2418#endif
2419
Kapil Gupta04ab1992016-06-26 13:36:51 +05302420#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_ROAM_SCAN_OFFLOAD)
Jeff Johnson32d95a32012-09-10 13:15:23 -07002421 if (pr->QBSSLoad.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002422 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302423 vos_mem_copy(&pProbeResp->QBSSLoad, &pr->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 }
2425#endif
Jeff Johnson32d95a32012-09-10 13:15:23 -07002426 if (pr->P2PProbeRes.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302428 vos_mem_copy( &pProbeResp->P2PProbeRes, &pr->P2PProbeRes,
Jeff Johnson295189b2012-06-20 16:38:30 -07002429 sizeof(tDot11fIEP2PProbeRes) );
2430 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002431#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07002432 if ( pr->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002433 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302434 vos_mem_copy( &pProbeResp->VHTCaps, &pr->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002435 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002436 if ( pr->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002437 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302438 vos_mem_copy( &pProbeResp->VHTOperation, &pr->VHTOperation, sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002439 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07002440 if ( pr->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002441 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302442 vos_mem_copy( &pProbeResp->VHTExtBssLoad, &pr->VHTExtBssLoad, sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07002443 }
2444#endif
Abhishek Singh74037df2017-07-20 11:08:56 +05302445 sir_copy_hs20_ie(&pProbeResp->hs20vendor_ie, &pr->hs20vendor_ie);
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05302446
Abhishek Singhc75726d2015-04-13 14:44:14 +05302447 vos_mem_vfree(pr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 return eSIR_SUCCESS;
2449
2450} // End sirConvertProbeFrame2Struct.
2451
2452tSirRetStatus
2453sirConvertAssocReqFrame2Struct(tpAniSirGlobal pMac,
2454 tANI_U8 *pFrame,
2455 tANI_U32 nFrame,
2456 tpSirAssocReq pAssocReq)
2457{
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002458 tDot11fAssocRequest *ar;
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 tANI_U32 status;
2460
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302461 ar = vos_mem_malloc(sizeof(tDot11fAssocRequest));
2462 if ( NULL == ar )
2463 status = eHAL_STATUS_FAILURE;
2464 else
2465 status = eHAL_STATUS_SUCCESS;
2466 if (!HAL_STATUS_SUCCESS(status))
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002467 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302468 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002469 return eSIR_FAILURE;
2470 }
2471 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302472 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
2473 vos_mem_set( ( tANI_U8* )ar, sizeof( tDot11fAssocRequest ), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002474
2475 // delegate to the framesc-generated code,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002476 status = dot11fUnpackAssocRequest( pMac, pFrame, nFrame, ar );
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 if ( DOT11F_FAILED( status ) )
2478 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302479 limLog(pMac, LOGE, FL("Failed to parse an Association Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 status, nFrame);
2481 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302482 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 return eSIR_FAILURE;
2484 }
2485 else if ( DOT11F_WARNED( status ) )
2486 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302487 limLog( pMac, LOGW, FL("There were warnings while unpacking an Assoication Request (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 status, nFrame );
2489 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2490 }
2491
2492 // & "transliterate" from a 'tDot11fAssocRequest' to a 'tSirAssocReq'...
2493
2494 // make sure this is seen as an assoc request
2495 pAssocReq->reassocRequest = 0;
2496
2497 // Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002498 pAssocReq->capabilityInfo.ess = ar->Capabilities.ess;
2499 pAssocReq->capabilityInfo.ibss = ar->Capabilities.ibss;
2500 pAssocReq->capabilityInfo.cfPollable = ar->Capabilities.cfPollable;
2501 pAssocReq->capabilityInfo.cfPollReq = ar->Capabilities.cfPollReq;
2502 pAssocReq->capabilityInfo.privacy = ar->Capabilities.privacy;
2503 pAssocReq->capabilityInfo.shortPreamble = ar->Capabilities.shortPreamble;
2504 pAssocReq->capabilityInfo.pbcc = ar->Capabilities.pbcc;
2505 pAssocReq->capabilityInfo.channelAgility = ar->Capabilities.channelAgility;
2506 pAssocReq->capabilityInfo.spectrumMgt = ar->Capabilities.spectrumMgt;
2507 pAssocReq->capabilityInfo.qos = ar->Capabilities.qos;
2508 pAssocReq->capabilityInfo.shortSlotTime = ar->Capabilities.shortSlotTime;
2509 pAssocReq->capabilityInfo.apsd = ar->Capabilities.apsd;
2510 pAssocReq->capabilityInfo.rrm = ar->Capabilities.rrm;
2511 pAssocReq->capabilityInfo.dsssOfdm = ar->Capabilities.dsssOfdm;
2512 pAssocReq->capabilityInfo.delayedBA = ar->Capabilities.delayedBA;
2513 pAssocReq->capabilityInfo.immediateBA = ar->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07002514
2515 // Listen Interval
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002516 pAssocReq->listenInterval = ar->ListenInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07002517
2518 // SSID
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002519 if ( ar->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 {
2521 pAssocReq->ssidPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002522 ConvertSSID( pMac, &pAssocReq->ssId, &ar->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 }
2524
2525 // Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002526 if ( ar->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 {
2528 pAssocReq->suppRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002529 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002530 }
2531
2532 // Extended Supported Rates
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002533 if ( ar->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002534 {
2535 pAssocReq->extendedRatesPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002536 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates, &ar->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07002537 }
2538
2539 // QOS Capabilities:
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002540 if ( ar->QOSCapsStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002541 {
2542 pAssocReq->qosCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002543 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar->QOSCapsStation );
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 }
2545
2546 // WPA
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002547 if ( ar->WPAOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 {
2549 pAssocReq->wpaPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002550 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar->WPAOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002551 }
2552
2553 // RSN
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002554 if ( ar->RSNOpaque.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 {
2556 pAssocReq->rsnPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002557 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar->RSNOpaque );
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 }
2559
2560 // WSC IE
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002561 if (ar->WscIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002562 {
2563 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002564 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar->WscIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 }
2566
2567
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002568 if(ar->P2PIEOpaque.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 {
2570 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002571 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar->P2PIEOpaque);
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002573#ifdef WLAN_FEATURE_WFD
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002574 if(ar->WFDIEOpaque.present)
Jeff Johnsone7245742012-09-05 17:12:55 -07002575 {
2576 pAssocReq->addIEPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002577 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar->WFDIEOpaque);
Jeff Johnsone7245742012-09-05 17:12:55 -07002578 }
2579#endif
2580
Jeff Johnson295189b2012-06-20 16:38:30 -07002581 // Power Capabilities
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002582 if ( ar->PowerCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 {
2584 pAssocReq->powerCapabilityPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002585 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar->PowerCaps );
Jeff Johnson295189b2012-06-20 16:38:30 -07002586 }
2587
2588 // Supported Channels
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002589 if ( ar->SuppChannels.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 {
2591 pAssocReq->supportedChannelsPresent = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002592 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar->SuppChannels );
Jeff Johnson295189b2012-06-20 16:38:30 -07002593 }
2594
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002595 if ( ar->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302597 vos_mem_copy( &pAssocReq->HTCaps, &ar->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002598 }
2599
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002600 if ( ar->WMMInfoStation.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07002601 {
2602 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302603 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar->WMMInfoStation,
2604 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002605
2606 }
2607
2608
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002609 if ( ar->WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
Jeff Johnson295189b2012-06-20 16:38:30 -07002610
2611 if ( ! pAssocReq->ssidPresent )
2612 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302613 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302614 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 return eSIR_FAILURE;
2616 }
2617
2618 if ( !pAssocReq->suppRatesPresent && !pAssocReq->extendedRatesPresent )
2619 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302620 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302621 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 return eSIR_FAILURE;
2623 }
2624
Jeff Johnsone7245742012-09-05 17:12:55 -07002625#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002626 if ( ar->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07002627 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302628 vos_mem_copy( &pAssocReq->VHTCaps, &ar->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05302629 limLog( pMac, LOGW, FL("Received Assoc Req with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002630 limLogVHTCap( pMac, &pAssocReq->VHTCaps);
2631 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -07002632 if ( ar->OperatingMode.present )
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002633 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302634 vos_mem_copy( &pAssocReq->operMode, &ar->OperatingMode, sizeof (tDot11fIEOperatingMode));
Sushant Kaushik87787972015-09-11 16:05:00 +05302635 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07002636 limLogOperatingMode( pMac, &pAssocReq->operMode);
2637 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002638#endif
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302639 vos_mem_free(ar);
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 return eSIR_SUCCESS;
2641
2642} // End sirConvertAssocReqFrame2Struct.
2643
2644tSirRetStatus
2645sirConvertAssocRespFrame2Struct(tpAniSirGlobal pMac,
2646 tANI_U8 *pFrame,
2647 tANI_U32 nFrame,
2648 tpSirAssocRsp pAssocRsp)
2649{
2650 static tDot11fAssocResponse ar;
2651 tANI_U32 status;
2652 tANI_U8 cnt =0;
2653
2654 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302655 vos_mem_set( ( tANI_U8* )pAssocRsp, sizeof(tSirAssocRsp), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002656
2657 // delegate to the framesc-generated code,
2658 status = dot11fUnpackAssocResponse( pMac, pFrame, nFrame, &ar);
2659 if ( DOT11F_FAILED( status ) )
2660 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302661 limLog(pMac, LOGE, FL("Failed to parse an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 status, nFrame);
2663 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2664 return eSIR_FAILURE;
2665 }
2666 else if ( DOT11F_WARNED( status ) )
2667 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302668 limLog( pMac, LOGW, FL("There were warnings while unpacking an Association Response (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 status, nFrame );
2670 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2671 }
2672
2673 // & "transliterate" from a 'tDot11fAssocResponse' a 'tSirAssocRsp'...
2674
2675 // Capabilities
2676 pAssocRsp->capabilityInfo.ess = ar.Capabilities.ess;
2677 pAssocRsp->capabilityInfo.ibss = ar.Capabilities.ibss;
2678 pAssocRsp->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2679 pAssocRsp->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2680 pAssocRsp->capabilityInfo.privacy = ar.Capabilities.privacy;
2681 pAssocRsp->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2682 pAssocRsp->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2683 pAssocRsp->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2684 pAssocRsp->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2685 pAssocRsp->capabilityInfo.qos = ar.Capabilities.qos;
2686 pAssocRsp->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2687 pAssocRsp->capabilityInfo.apsd = ar.Capabilities.apsd;
2688 pAssocRsp->capabilityInfo.rrm = ar.Capabilities.rrm;
2689 pAssocRsp->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2690 pAssocRsp->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2691 pAssocRsp->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2692
2693 pAssocRsp->statusCode = ar.Status.status;
2694 pAssocRsp->aid = ar.AID.associd;
2695
2696 if ( ! ar.SuppRates.present )
2697 {
2698 pAssocRsp->suppRatesPresent = 0;
Sushant Kaushik87787972015-09-11 16:05:00 +05302699 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 }
2701 else
2702 {
2703 pAssocRsp->suppRatesPresent = 1;
2704 ConvertSuppRates( pMac, &pAssocRsp->supportedRates, &ar.SuppRates );
2705 }
2706
2707 if ( ar.ExtSuppRates.present )
2708 {
2709 pAssocRsp->extendedRatesPresent = 1;
2710 ConvertExtSuppRates( pMac, &pAssocRsp->extendedRates, &ar.ExtSuppRates );
2711 }
2712
2713 if ( ar.EDCAParamSet.present )
2714 {
2715 pAssocRsp->edcaPresent = 1;
2716 ConvertEDCAParam( pMac, &pAssocRsp->edca, &ar.EDCAParamSet );
2717 }
Atul Mittalbceb4a12014-11-27 18:50:19 +05302718 if (ar.ExtCap.present)
2719 {
Hu Wangc12631c2016-08-11 09:57:03 +08002720 struct s_ext_cap *p_ext_cap;
Atul Mittalbceb4a12014-11-27 18:50:19 +05302721 vos_mem_copy(&pAssocRsp->ExtCap, &ar.ExtCap, sizeof(tDot11fIEExtCap));
Hu Wangc12631c2016-08-11 09:57:03 +08002722
2723 p_ext_cap = (struct s_ext_cap *)&pAssocRsp->ExtCap.bytes;
Atul Mittalbceb4a12014-11-27 18:50:19 +05302724 limLog(pMac, LOG1,
2725 FL("ExtCap is present, TDLSChanSwitProhibited: %d"),
Hu Wangc12631c2016-08-11 09:57:03 +08002726 p_ext_cap->TDLSChanSwitProhibited);
Atul Mittalbceb4a12014-11-27 18:50:19 +05302727 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002728 if ( ar.WMMParams.present )
2729 {
2730 pAssocRsp->wmeEdcaPresent = 1;
2731 ConvertWMMParams( pMac, &pAssocRsp->edca, &ar.WMMParams);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002732 limLog(pMac, LOG1, FL("WMM Parameter Element present in Association Response Frame!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002733 __printWMMParams(pMac, &ar.WMMParams);
2734 }
2735
2736 if ( ar.HTCaps.present )
2737 {
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302738 limLog(pMac, LOG1, FL("Received Assoc Response with HT Cap"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302739 vos_mem_copy( &pAssocRsp->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 }
2741
2742 if ( ar.HTInfo.present )
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302743 { limLog(pMac, LOG1, FL("Received Assoc Response with HT Info"));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302744 vos_mem_copy( &pAssocRsp->HTInfo, &ar.HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 }
2746
2747#ifdef WLAN_FEATURE_VOWIFI_11R
2748 if (ar.MobilityDomain.present)
2749 {
2750 // MobilityDomain
2751 pAssocRsp->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302752 vos_mem_copy( (tANI_U8 *)&(pAssocRsp->mdie[0]), (tANI_U8 *)&(ar.MobilityDomain.MDID),
2753 sizeof(tANI_U16) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 pAssocRsp->mdie[2] = ((ar.MobilityDomain.overDSCap << 0) | (ar.MobilityDomain.resourceReqCap << 1));
2755#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002756 limLog(pMac, LOG1, FL("new mdie=%02x%02x%02x"), (unsigned int)pAssocRsp->mdie[0],
Jeff Johnson295189b2012-06-20 16:38:30 -07002757 (unsigned int)pAssocRsp->mdie[1], (unsigned int)pAssocRsp->mdie[2]);
2758#endif
2759 }
2760
2761 if ( ar.FTInfo.present )
2762 {
2763#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002764 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 -07002765 ar.FTInfo.R0KH_ID.present,
2766 ar.FTInfo.R1KH_ID.present);
2767#endif
2768 pAssocRsp->ftinfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302769 vos_mem_copy( &pAssocRsp->FTInfo, &ar.FTInfo, sizeof(tDot11fIEFTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 }
2771#endif
2772
2773#ifdef WLAN_FEATURE_VOWIFI_11R
Padma, Santhosh Kumar13e80082017-07-19 12:56:53 +05302774 if (ar.num_RICDataDesc && ar.num_RICDataDesc <= 2) {
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 for (cnt=0; cnt < ar.num_RICDataDesc; cnt++) {
2776 if (ar.RICDataDesc[cnt].present) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302777 vos_mem_copy( &pAssocRsp->RICData[cnt], &ar.RICDataDesc[cnt],
2778 sizeof(tDot11fIERICDataDesc));
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 }
2780 }
2781 pAssocRsp->num_RICData = ar.num_RICDataDesc;
2782 pAssocRsp->ricPresent = TRUE;
2783 }
2784#endif
2785
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002786#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 if (ar.num_WMMTSPEC) {
2788 pAssocRsp->num_tspecs = ar.num_WMMTSPEC;
2789 for (cnt=0; cnt < ar.num_WMMTSPEC; cnt++) {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302790 vos_mem_copy( &pAssocRsp->TSPECInfo[cnt], &ar.WMMTSPEC[cnt],
2791 (sizeof(tDot11fIEWMMTSPEC)*ar.num_WMMTSPEC));
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 }
2793 pAssocRsp->tspecPresent = TRUE;
2794 }
2795
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002796 if(ar.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 {
2798 pAssocRsp->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302799 vos_mem_copy(&pAssocRsp->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002800 &ar.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 }
2802#endif
2803
Jeff Johnsone7245742012-09-05 17:12:55 -07002804#ifdef WLAN_FEATURE_11AC
2805 if ( ar.VHTCaps.present )
2806 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302807 vos_mem_copy( &pAssocRsp->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002808 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Cap"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002809 limLogVHTCap(pMac, &pAssocRsp->VHTCaps);
2810 }
2811 if ( ar.VHTOperation.present )
2812 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302813 vos_mem_copy( &pAssocRsp->VHTOperation, &ar.VHTOperation, sizeof( tDot11fIEVHTOperation) );
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07002814 limLog( pMac, LOG1, FL("Received Assoc Response with VHT Operation"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002815 limLogVHTOperation(pMac, &pAssocRsp->VHTOperation);
2816 }
2817#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302818 if(ar.OBSSScanParameters.present)
2819 {
2820 vos_mem_copy( &pAssocRsp->OBSSScanParameters, &ar.OBSSScanParameters,
2821 sizeof( tDot11fIEOBSSScanParameters));
2822 }
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002823 if ( ar.QosMapSet.present )
2824 {
Kumar Anand82c009f2014-05-29 00:29:42 -07002825 pAssocRsp->QosMapSet.present = 1;
2826 ConvertQosMapsetFrame( pMac, &pAssocRsp->QosMapSet, &ar.QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002827 limLog( pMac, LOG1, FL("Received Assoc Response with Qos Map Set"));
Kumar Anand82c009f2014-05-29 00:29:42 -07002828 limLogQosMapSet(pMac, &pAssocRsp->QosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07002829 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002830 return eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07002831} // End sirConvertAssocRespFrame2Struct.
2832
2833tSirRetStatus
2834sirConvertReassocReqFrame2Struct(tpAniSirGlobal pMac,
2835 tANI_U8 *pFrame,
2836 tANI_U32 nFrame,
2837 tpSirAssocReq pAssocReq)
2838{
2839 static tDot11fReAssocRequest ar;
2840 tANI_U32 status;
2841
2842 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302843 vos_mem_set( ( tANI_U8* )pAssocReq, sizeof(tSirAssocReq), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07002844
2845 // delegate to the framesc-generated code,
2846 status = dot11fUnpackReAssocRequest( pMac, pFrame, nFrame, &ar );
2847 if ( DOT11F_FAILED( status ) )
2848 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302849 limLog(pMac, LOGE, FL("Failed to parse a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 status, nFrame);
2851 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2852 return eSIR_FAILURE;
2853 }
2854 else if ( DOT11F_WARNED( status ) )
2855 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302856 limLog( pMac, LOGW, FL("There were warnings while unpacking a Re-association Request (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002857 status, nFrame );
2858 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
2859 }
2860
2861 // & "transliterate" from a 'tDot11fReAssocRequest' to a 'tSirAssocReq'...
2862
2863 // make sure this is seen as a re-assoc request
2864 pAssocReq->reassocRequest = 1;
2865
2866 // Capabilities
2867 pAssocReq->capabilityInfo.ess = ar.Capabilities.ess;
2868 pAssocReq->capabilityInfo.ibss = ar.Capabilities.ibss;
2869 pAssocReq->capabilityInfo.cfPollable = ar.Capabilities.cfPollable;
2870 pAssocReq->capabilityInfo.cfPollReq = ar.Capabilities.cfPollReq;
2871 pAssocReq->capabilityInfo.privacy = ar.Capabilities.privacy;
2872 pAssocReq->capabilityInfo.shortPreamble = ar.Capabilities.shortPreamble;
2873 pAssocReq->capabilityInfo.pbcc = ar.Capabilities.pbcc;
2874 pAssocReq->capabilityInfo.channelAgility = ar.Capabilities.channelAgility;
2875 pAssocReq->capabilityInfo.spectrumMgt = ar.Capabilities.spectrumMgt;
2876 pAssocReq->capabilityInfo.qos = ar.Capabilities.qos;
2877 pAssocReq->capabilityInfo.shortSlotTime = ar.Capabilities.shortSlotTime;
2878 pAssocReq->capabilityInfo.apsd = ar.Capabilities.apsd;
2879 pAssocReq->capabilityInfo.rrm = ar.Capabilities.rrm;
2880 pAssocReq->capabilityInfo.dsssOfdm = ar.Capabilities.dsssOfdm;
2881 pAssocReq->capabilityInfo.delayedBA = ar.Capabilities.delayedBA;
2882 pAssocReq->capabilityInfo.immediateBA = ar.Capabilities.immediateBA;
2883
2884 // Listen Interval
2885 pAssocReq->listenInterval = ar.ListenInterval.interval;
2886
2887 // SSID
2888 if ( ar.SSID.present )
2889 {
2890 pAssocReq->ssidPresent = 1;
2891 ConvertSSID( pMac, &pAssocReq->ssId, &ar.SSID );
2892 }
2893
2894 // Supported Rates
2895 if ( ar.SuppRates.present )
2896 {
2897 pAssocReq->suppRatesPresent = 1;
2898 ConvertSuppRates( pMac, &pAssocReq->supportedRates, &ar.SuppRates );
2899 }
2900
2901 // Extended Supported Rates
2902 if ( ar.ExtSuppRates.present )
2903 {
2904 pAssocReq->extendedRatesPresent = 1;
2905 ConvertExtSuppRates( pMac, &pAssocReq->extendedRates,
2906 &ar.ExtSuppRates );
2907 }
2908
2909 // QOS Capabilities:
2910 if ( ar.QOSCapsStation.present )
2911 {
2912 pAssocReq->qosCapabilityPresent = 1;
2913 ConvertQOSCapsStation( pMac, &pAssocReq->qosCapability, &ar.QOSCapsStation );
2914 }
2915
2916 // WPA
2917 if ( ar.WPAOpaque.present )
2918 {
2919 pAssocReq->wpaPresent = 1;
2920 ConvertWPAOpaque( pMac, &pAssocReq->wpa, &ar.WPAOpaque );
2921 }
2922
2923 // RSN
2924 if ( ar.RSNOpaque.present )
2925 {
2926 pAssocReq->rsnPresent = 1;
2927 ConvertRSNOpaque( pMac, &pAssocReq->rsn, &ar.RSNOpaque );
2928 }
2929
2930
2931 // Power Capabilities
2932 if ( ar.PowerCaps.present )
2933 {
2934 pAssocReq->powerCapabilityPresent = 1;
2935 ConvertPowerCaps( pMac, &pAssocReq->powerCapability, &ar.PowerCaps );
2936 }
2937
2938 // Supported Channels
2939 if ( ar.SuppChannels.present )
2940 {
2941 pAssocReq->supportedChannelsPresent = 1;
2942 ConvertSuppChannels( pMac, &pAssocReq->supportedChannels, &ar.SuppChannels );
2943 }
2944
2945 if ( ar.HTCaps.present )
2946 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302947 vos_mem_copy( &pAssocReq->HTCaps, &ar.HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 }
2949
2950 if ( ar.WMMInfoStation.present )
2951 {
2952 pAssocReq->wmeInfoPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302953 vos_mem_copy( &pAssocReq->WMMInfoStation, &ar.WMMInfoStation,
2954 sizeof( tDot11fIEWMMInfoStation ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002955
2956 }
2957
2958 if ( ar.WMMCaps.present ) pAssocReq->wsmCapablePresent = 1;
2959
2960 if ( ! pAssocReq->ssidPresent )
2961 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302962 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without SSID IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 return eSIR_FAILURE;
2964 }
2965
2966 if ( ! pAssocReq->suppRatesPresent && ! pAssocReq->extendedRatesPresent )
2967 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302968 PELOG2(limLog(pMac, LOG2, FL("Received Assoc without supp rate IE."));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 return eSIR_FAILURE;
2970 }
2971
2972 // Why no call to 'updateAssocReqFromPropCapability' here, like
2973 // there is in 'sirConvertAssocReqFrame2Struct'?
2974
2975 // WSC IE
2976 if (ar.WscIEOpaque.present)
2977 {
2978 pAssocReq->addIEPresent = 1;
2979 ConvertWscOpaque(pMac, &pAssocReq->addIE, &ar.WscIEOpaque);
2980 }
2981
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 if(ar.P2PIEOpaque.present)
2983 {
2984 pAssocReq->addIEPresent = 1;
2985 ConvertP2POpaque( pMac, &pAssocReq->addIE, &ar.P2PIEOpaque);
2986 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002987
Jeff Johnsone7245742012-09-05 17:12:55 -07002988#ifdef WLAN_FEATURE_WFD
2989 if(ar.WFDIEOpaque.present)
2990 {
2991 pAssocReq->addIEPresent = 1;
2992 ConvertWFDOpaque( pMac, &pAssocReq->addIE, &ar.WFDIEOpaque);
2993 }
2994#endif
2995
2996#ifdef WLAN_FEATURE_11AC
2997 if ( ar.VHTCaps.present )
2998 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05302999 vos_mem_copy( &pAssocReq->VHTCaps, &ar.VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003000 }
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07003001 if ( ar.OperatingMode.present )
3002 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303003 vos_mem_copy( &pAssocReq->operMode, &ar.OperatingMode, sizeof( tDot11fIEOperatingMode ) );
Sushant Kaushik87787972015-09-11 16:05:00 +05303004 limLog( pMac, LOGW, FL("Received Assoc Req with Operating Mode IE"));
Mohit Khanna7d5aeb22012-09-11 16:21:57 -07003005 limLogOperatingMode( pMac, &pAssocReq->operMode);
3006 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003007#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 return eSIR_SUCCESS;
3009
3010} // End sirConvertReassocReqFrame2Struct.
3011
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003012
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003013#if defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003014tSirRetStatus
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003015sirFillBeaconMandatoryIEforEseBcnReport(tpAniSirGlobal pMac,
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003016 tANI_U8 *pPayload,
3017 const tANI_U32 nPayload,
3018 tANI_U8 **outIeBuf,
3019 tANI_U32 *pOutIeLen)
3020{
3021 tDot11fBeaconIEs *pBies = NULL;
3022 tANI_U32 status = eHAL_STATUS_SUCCESS;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003023 tSirRetStatus retStatus = eSIR_SUCCESS;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003024 tSirEseBcnReportMandatoryIe eseBcnReportMandatoryIe;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003025
3026 /* To store how many bytes are required to be allocated
3027 for Bcn report mandatory Ies */
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003028 tANI_U16 numBytes = 0, freeBytes = 0;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003029 tANI_U8 *pos = NULL;
3030
3031 // Zero-init our [out] parameter,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003032 vos_mem_set( (tANI_U8*)&eseBcnReportMandatoryIe, sizeof(eseBcnReportMandatoryIe), 0 );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003033 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3034 if ( NULL == pBies )
3035 status = eHAL_STATUS_FAILURE;
3036 else
3037 status = eHAL_STATUS_SUCCESS;
3038 if (!HAL_STATUS_SUCCESS(status))
3039 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303040 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003041 return eSIR_FAILURE;
3042 }
Hu Wangc12631c2016-08-11 09:57:03 +08003043 vos_mem_zero(pBies, sizeof(tDot11fBeaconIEs));
3044
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003045 // delegate to the framesc-generated code,
3046 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3047
3048 if ( DOT11F_FAILED( status ) )
3049 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303050 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003051 status, nPayload);
3052 vos_mem_free(pBies);
3053 return eSIR_FAILURE;
3054 }
3055 else if ( DOT11F_WARNED( status ) )
3056 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303057 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003058 status, nPayload );
3059 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3060 }
3061
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003062 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'eseBcnReportMandatoryIe'...
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003063 if ( !pBies->SSID.present )
3064 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303065 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003066 }
3067 else
3068 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003069 eseBcnReportMandatoryIe.ssidPresent = 1;
3070 ConvertSSID( pMac, &eseBcnReportMandatoryIe.ssId, &pBies->SSID );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003071 /* 1 for EID, 1 for length and length bytes */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003072 numBytes += 1 + 1 + eseBcnReportMandatoryIe.ssId.length;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003073 }
3074
3075 if ( !pBies->SuppRates.present )
3076 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303077 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003078 }
3079 else
3080 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003081 eseBcnReportMandatoryIe.suppRatesPresent = 1;
3082 ConvertSuppRates( pMac, &eseBcnReportMandatoryIe.supportedRates, &pBies->SuppRates );
3083 numBytes += 1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003084 }
3085
3086 if ( pBies->FHParamSet.present)
3087 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003088 eseBcnReportMandatoryIe.fhParamPresent = 1;
3089 ConvertFHParams( pMac, &eseBcnReportMandatoryIe.fhParamSet, &pBies->FHParamSet );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003090 numBytes += 1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX;
3091 }
3092
3093 if ( pBies->DSParams.present )
3094 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003095 eseBcnReportMandatoryIe.dsParamsPresent = 1;
3096 eseBcnReportMandatoryIe.dsParamSet.channelNumber = pBies->DSParams.curr_channel;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003097 numBytes += 1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX;
3098 }
3099
3100 if ( pBies->CFParams.present )
3101 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003102 eseBcnReportMandatoryIe.cfPresent = 1;
3103 ConvertCFParams( pMac, &eseBcnReportMandatoryIe.cfParamSet, &pBies->CFParams );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003104 numBytes += 1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX;
3105 }
3106
3107 if ( pBies->IBSSParams.present )
3108 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003109 eseBcnReportMandatoryIe.ibssParamPresent = 1;
3110 eseBcnReportMandatoryIe.ibssParamSet.atim = pBies->IBSSParams.atim;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003111 numBytes += 1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3112 }
3113
3114 if ( pBies->TIM.present )
3115 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003116 eseBcnReportMandatoryIe.timPresent = 1;
3117 eseBcnReportMandatoryIe.tim.dtimCount = pBies->TIM.dtim_count;
3118 eseBcnReportMandatoryIe.tim.dtimPeriod = pBies->TIM.dtim_period;
3119 eseBcnReportMandatoryIe.tim.bitmapControl = pBies->TIM.bmpctl;
3120 /* As per the ESE spec, May truncate and report first 4 octets only */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003121 numBytes += 1 + 1 + SIR_MAC_TIM_EID_MIN;
3122 }
3123
3124 if ( pBies->RRMEnabledCap.present )
3125 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003126 eseBcnReportMandatoryIe.rrmPresent = 1;
3127 vos_mem_copy( &eseBcnReportMandatoryIe.rmEnabledCapabilities, &pBies->RRMEnabledCap, sizeof( tDot11fIERRMEnabledCap ) );
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003128 numBytes += 1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3129 }
3130
3131 *outIeBuf = vos_mem_malloc(numBytes);
3132 if (NULL == *outIeBuf)
3133 {
3134 limLog(pMac, LOGP, FL("Memory Allocation failure"));
3135 vos_mem_free(pBies);
3136 return eSIR_FAILURE;
3137 }
3138 pos = *outIeBuf;
3139 *pOutIeLen = numBytes;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003140 freeBytes = numBytes;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003141
3142 /* Start filling the output Ie with Mandatory IE information */
3143 /* Fill SSID IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003144 if (eseBcnReportMandatoryIe.ssidPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003145 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003146 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.ssId.length))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003147 {
3148 limLog(pMac, LOGP, FL("Insufficient memory to copy SSID"));
3149 retStatus = eSIR_FAILURE;
3150 goto err_bcnrep;
3151 }
3152 *pos = SIR_MAC_SSID_EID;
3153 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003154 *pos = eseBcnReportMandatoryIe.ssId.length;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003155 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003156 vos_mem_copy(pos, (tANI_U8*)eseBcnReportMandatoryIe.ssId.ssId,
3157 eseBcnReportMandatoryIe.ssId.length);
3158 pos += eseBcnReportMandatoryIe.ssId.length;
3159 freeBytes -= (1 + 1 + eseBcnReportMandatoryIe.ssId.length);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003160 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003161
3162 /* Fill Supported Rates IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003163 if (eseBcnReportMandatoryIe.suppRatesPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003164 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003165 if (freeBytes < (1 + 1 + eseBcnReportMandatoryIe.supportedRates.numRates))
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003166 {
3167 limLog(pMac, LOGP, FL("Insufficient memory to copy Rates IE"));
3168 retStatus = eSIR_FAILURE;
3169 goto err_bcnrep;
3170 }
Hanumantha Reddy Pothula0de10802016-02-11 17:29:27 +05303171 if (eseBcnReportMandatoryIe.supportedRates.numRates <=
3172 SIR_MAC_RATESET_EID_MAX) {
3173 *pos = SIR_MAC_RATESET_EID;
3174 pos++;
3175 *pos = eseBcnReportMandatoryIe.supportedRates.numRates;
3176 pos++;
3177 vos_mem_copy(pos,
3178 (tANI_U8*)eseBcnReportMandatoryIe.supportedRates.rate,
3179 eseBcnReportMandatoryIe.supportedRates.numRates);
3180 pos += eseBcnReportMandatoryIe.supportedRates.numRates;
3181 freeBytes -= (1 + 1 +
3182 eseBcnReportMandatoryIe.supportedRates.numRates);
3183 }
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003184 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003185
3186 /* Fill FH Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003187 if (eseBcnReportMandatoryIe.fhParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003188 {
3189 if (freeBytes < (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX))
3190 {
3191 limLog(pMac, LOGP, FL("Insufficient memory to copy FHIE"));
3192 retStatus = eSIR_FAILURE;
3193 goto err_bcnrep;
3194 }
3195 *pos = SIR_MAC_FH_PARAM_SET_EID;
3196 pos++;
3197 *pos = SIR_MAC_FH_PARAM_SET_EID_MAX;
3198 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003199 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.fhParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003200 SIR_MAC_FH_PARAM_SET_EID_MAX);
3201 pos += SIR_MAC_FH_PARAM_SET_EID_MAX;
3202 freeBytes -= (1 + 1 + SIR_MAC_FH_PARAM_SET_EID_MAX);
3203 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003204
3205 /* Fill DS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003206 if (eseBcnReportMandatoryIe.dsParamsPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003207 {
3208 if (freeBytes < (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX))
3209 {
3210 limLog(pMac, LOGP, FL("Insufficient memory to copy DS IE"));
3211 retStatus = eSIR_FAILURE;
3212 goto err_bcnrep;
3213 }
3214 *pos = SIR_MAC_DS_PARAM_SET_EID;
3215 pos++;
3216 *pos = SIR_MAC_DS_PARAM_SET_EID_MAX;
3217 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003218 *pos = eseBcnReportMandatoryIe.dsParamSet.channelNumber;
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003219 pos += SIR_MAC_DS_PARAM_SET_EID_MAX;
3220 freeBytes -= (1 + 1 + SIR_MAC_DS_PARAM_SET_EID_MAX);
3221 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003222
3223 /* Fill CF Parameter set */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003224 if (eseBcnReportMandatoryIe.cfPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003225 {
3226 if (freeBytes < (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX))
3227 {
3228 limLog(pMac, LOGP, FL("Insufficient memory to copy CF IE"));
3229 retStatus = eSIR_FAILURE;
3230 goto err_bcnrep;
3231 }
3232 *pos = SIR_MAC_CF_PARAM_SET_EID;
3233 pos++;
3234 *pos = SIR_MAC_CF_PARAM_SET_EID_MAX;
3235 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003236 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.cfParamSet,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003237 SIR_MAC_CF_PARAM_SET_EID_MAX);
3238 pos += SIR_MAC_CF_PARAM_SET_EID_MAX;
3239 freeBytes -= (1 + 1 + SIR_MAC_CF_PARAM_SET_EID_MAX);
3240 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003241
3242 /* Fill IBSS Parameter set IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003243 if (eseBcnReportMandatoryIe.ibssParamPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003244 {
3245 if (freeBytes < (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX))
3246 {
3247 limLog(pMac, LOGP, FL("Insufficient memory to copy IBSS IE"));
3248 retStatus = eSIR_FAILURE;
3249 goto err_bcnrep;
3250 }
3251 *pos = SIR_MAC_IBSS_PARAM_SET_EID;
3252 pos++;
3253 *pos = SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3254 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003255 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.ibssParamSet.atim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003256 SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3257 pos += SIR_MAC_IBSS_PARAM_SET_EID_MAX;
3258 freeBytes -= (1 + 1 + SIR_MAC_IBSS_PARAM_SET_EID_MAX);
3259 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003260
3261 /* Fill TIM IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003262 if (eseBcnReportMandatoryIe.timPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003263 {
3264 if (freeBytes < (1 + 1 + SIR_MAC_TIM_EID_MIN))
3265 {
3266 limLog(pMac, LOGP, FL("Insufficient memory to copy TIM IE"));
3267 retStatus = eSIR_FAILURE;
3268 goto err_bcnrep;
3269 }
3270 *pos = SIR_MAC_TIM_EID;
3271 pos++;
3272 *pos = SIR_MAC_TIM_EID_MIN;
3273 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003274 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.tim,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003275 SIR_MAC_TIM_EID_MIN);
3276 pos += SIR_MAC_TIM_EID_MIN;
3277 freeBytes -= (1 + 1 + SIR_MAC_TIM_EID_MIN);
3278 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003279
3280 /* Fill RM Capability IE */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003281 if (eseBcnReportMandatoryIe.rrmPresent)
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003282 {
3283 if (freeBytes < (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX))
3284 {
3285 limLog(pMac, LOGP, FL("Insufficient memory to copy RRM IE"));
3286 retStatus = eSIR_FAILURE;
3287 goto err_bcnrep;
3288 }
3289 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID;
3290 pos++;
3291 *pos = SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX;
3292 pos++;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003293 vos_mem_copy(pos, (tANI_U8*)&eseBcnReportMandatoryIe.rmEnabledCapabilities,
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003294 SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3295 freeBytes -= (1 + 1 + SIR_MAC_RM_ENABLED_CAPABILITY_EID_MAX);
3296 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003297
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003298 if (freeBytes != 0)
3299 {
3300 limLog(pMac, LOGP, FL("Mismatch in allocation and copying of IE in Bcn Rep"));
3301 retStatus = eSIR_FAILURE;
3302 }
3303
3304err_bcnrep:
3305 /* The message counter would not be incremented in case of
3306 * returning failure and hence next time, this function gets
3307 * called, it would be using the same msg ctr for a different
3308 * BSS.So, it is good to clear the memory allocated for a BSS
3309 * that is returning failure.On success, the caller would take
3310 * care of freeing up the memory*/
3311 if (retStatus == eSIR_FAILURE)
3312 {
3313 vos_mem_free(*outIeBuf);
3314 *outIeBuf = NULL;
3315 }
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003316 vos_mem_free(pBies);
Varun Reddy Yeturucf02bc22013-12-06 18:18:50 -08003317 return retStatus;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003318}
3319
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003320#endif /* FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08003321
Jeff Johnson295189b2012-06-20 16:38:30 -07003322tSirRetStatus
3323sirParseBeaconIE(tpAniSirGlobal pMac,
3324 tpSirProbeRespBeacon pBeaconStruct,
3325 tANI_U8 *pPayload,
3326 tANI_U32 nPayload)
3327{
3328 tDot11fBeaconIEs *pBies;
3329 tANI_U32 status;
3330
3331 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303332 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003333
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303334 pBies = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
3335 if ( NULL == pBies )
3336 status = eHAL_STATUS_FAILURE;
3337 else
3338 status = eHAL_STATUS_SUCCESS;
3339 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303341 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07003342 return eSIR_FAILURE;
3343 }
Hu Wangc12631c2016-08-11 09:57:03 +08003344 vos_mem_zero(pBies, sizeof(tDot11fBeaconIEs));
3345
Jeff Johnson295189b2012-06-20 16:38:30 -07003346 // delegate to the framesc-generated code,
3347 status = dot11fUnpackBeaconIEs( pMac, pPayload, nPayload, pBies );
3348
3349 if ( DOT11F_FAILED( status ) )
3350 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303351 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 status, nPayload);
3353 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303354 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 return eSIR_FAILURE;
3356 }
3357 else if ( DOT11F_WARNED( status ) )
3358 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303359 limLog( pMac, LOGW, FL("There were warnings while unpacking Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 status, nPayload );
3361 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
3362 }
3363
3364 // & "transliterate" from a 'tDot11fBeaconIEs' to a 'tSirProbeRespBeacon'...
3365 if ( ! pBies->SSID.present )
3366 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303367 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 }
3369 else
3370 {
3371 pBeaconStruct->ssidPresent = 1;
3372 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBies->SSID );
3373 }
3374
3375 if ( ! pBies->SuppRates.present )
3376 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303377 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 }
3379 else
3380 {
3381 pBeaconStruct->suppRatesPresent = 1;
3382 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBies->SuppRates );
3383 }
3384
3385 if ( pBies->ExtSuppRates.present )
3386 {
3387 pBeaconStruct->extendedRatesPresent = 1;
3388 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBies->ExtSuppRates );
3389 }
3390
3391 if ( pBies->CFParams.present )
3392 {
3393 pBeaconStruct->cfPresent = 1;
3394 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBies->CFParams );
3395 }
3396
3397 if ( pBies->TIM.present )
3398 {
3399 pBeaconStruct->timPresent = 1;
3400 ConvertTIM( pMac, &pBeaconStruct->tim, &pBies->TIM );
3401 }
3402
3403 if ( pBies->Country.present )
3404 {
3405 pBeaconStruct->countryInfoPresent = 1;
3406 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBies->Country );
3407 }
3408
3409 // 11h IEs
3410 if(pBies->TPCReport.present)
3411 {
3412 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303413 vos_mem_copy( &pBeaconStruct->tpcReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 &pBies->TPCReport,
3415 sizeof( tDot11fIETPCReport));
3416 }
3417
3418 if(pBies->PowerConstraints.present)
3419 {
3420 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303421 vos_mem_copy( &pBeaconStruct->localPowerConstraint,
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 &pBies->PowerConstraints,
3423 sizeof(tDot11fIEPowerConstraints));
3424 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003425#ifdef FEATURE_WLAN_ESE
3426 if(pBies->ESETxmitPower.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003427 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003428 pBeaconStruct->eseTxPwr.present = 1;
3429 pBeaconStruct->eseTxPwr.power_limit = pBies->ESETxmitPower.power_limit;
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 }
3431 if (pBies->QBSSLoad.present)
3432 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303433 vos_mem_copy( &pBeaconStruct->QBSSLoad, &pBies->QBSSLoad, sizeof(tDot11fIEQBSSLoad));
Jeff Johnson295189b2012-06-20 16:38:30 -07003434 }
3435#endif
3436
3437 if ( pBies->EDCAParamSet.present )
3438 {
3439 pBeaconStruct->edcaPresent = 1;
3440 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBies->EDCAParamSet );
3441 }
3442
3443 // QOS Capabilities:
3444 if ( pBies->QOSCapsAp.present )
3445 {
3446 pBeaconStruct->qosCapabilityPresent = 1;
3447 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBies->QOSCapsAp );
3448 }
3449
3450
3451
3452 if ( pBies->ChanSwitchAnn.present )
3453 {
3454 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303455 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBies->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 sizeof(tDot11fIEChanSwitchAnn));
3457 }
3458
Abhishek Singh15431c42017-10-25 15:43:02 +05303459 if ( pBies->sec_chan_offset.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003460 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303461 pBeaconStruct->sec_chan_offset_present= 1;
Abhishek Singh15431c42017-10-25 15:43:02 +05303462 vos_mem_copy( &pBeaconStruct->sec_chan_offset, &pBies->sec_chan_offset,
3463 sizeof(tDot11fIEsec_chan_offset));
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303465 if (pBies->ext_chan_switch_ann.present)
3466 {
3467 pBeaconStruct->ecsa_present = 1;
3468 vos_mem_copy(&pBeaconStruct->ext_chan_switch_ann,
3469 &pBies->ext_chan_switch_ann,
3470 sizeof(tDot11fIEext_chan_switch_ann));
3471 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003472
3473 if ( pBies->Quiet.present )
3474 {
3475 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303476 vos_mem_copy( &pBeaconStruct->quietIE, &pBies->Quiet, sizeof(tDot11fIEQuiet) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 }
3478
3479 if ( pBies->HTCaps.present )
3480 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303481 vos_mem_copy( &pBeaconStruct->HTCaps, &pBies->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003482 }
3483
3484 if ( pBies->HTInfo.present )
3485 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303486 vos_mem_copy( &pBeaconStruct->HTInfo, &pBies->HTInfo, sizeof( tDot11fIEHTInfo ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003487 }
3488
3489 if ( pBies->DSParams.present )
3490 {
3491 pBeaconStruct->dsParamsPresent = 1;
3492 pBeaconStruct->channelNumber = pBies->DSParams.curr_channel;
3493 }
3494 else if(pBies->HTInfo.present)
3495 {
3496 pBeaconStruct->channelNumber = pBies->HTInfo.primaryChannel;
3497 }
3498
3499 if ( pBies->RSN.present )
3500 {
3501 pBeaconStruct->rsnPresent = 1;
3502 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBies->RSN );
3503 }
3504
3505 if ( pBies->WPA.present )
3506 {
3507 pBeaconStruct->wpaPresent = 1;
3508 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBies->WPA );
3509 }
3510
3511 if ( pBies->WMMParams.present )
3512 {
3513 pBeaconStruct->wmeEdcaPresent = 1;
3514 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBies->WMMParams );
3515 }
3516
3517 if ( pBies->WMMInfoAp.present )
3518 {
3519 pBeaconStruct->wmeInfoPresent = 1;
3520 }
3521
3522 if ( pBies->WMMCaps.present )
3523 {
3524 pBeaconStruct->wsmCapablePresent = 1;
3525 }
3526
3527
3528 if ( pBies->ERPInfo.present )
3529 {
3530 pBeaconStruct->erpPresent = 1;
3531 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBies->ERPInfo );
3532 }
3533
Jeff Johnsone7245742012-09-05 17:12:55 -07003534#ifdef WLAN_FEATURE_11AC
3535 if ( pBies->VHTCaps.present )
3536 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303537 pBeaconStruct->VHTCaps.present = 1;
3538 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBies->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003539 }
3540 if ( pBies->VHTOperation.present )
3541 {
3542 pBeaconStruct->VHTOperation.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303543 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBies->VHTOperation,
3544 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003545 }
3546 if ( pBies->VHTExtBssLoad.present )
3547 {
3548 pBeaconStruct->VHTExtBssLoad.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303549 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBies->VHTExtBssLoad,
3550 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003551 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003552 if( pBies->OperatingMode.present)
3553 {
3554 pBeaconStruct->OperatingMode.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303555 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBies->OperatingMode,
3556 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003557 }
3558
Jeff Johnsone7245742012-09-05 17:12:55 -07003559#endif
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303560 if (pBies->ExtCap.present )
3561 {
3562 pBeaconStruct->ExtCap.present = 1;
3563 vos_mem_copy( &pBeaconStruct->ExtCap, &pBies->ExtCap,
3564 sizeof(tDot11fIEExtCap));
3565 }
Abhishek Singh74037df2017-07-20 11:08:56 +05303566 sir_copy_hs20_ie(&pBeaconStruct->hs20vendor_ie, &pBies->hs20vendor_ie);
3567
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303568 vos_mem_free(pBies);
Jeff Johnson295189b2012-06-20 16:38:30 -07003569
Jeff Johnsone7245742012-09-05 17:12:55 -07003570
Jeff Johnson295189b2012-06-20 16:38:30 -07003571 return eSIR_SUCCESS;
3572
3573} // End sirParseBeaconIE.
3574
3575tSirRetStatus
3576sirConvertBeaconFrame2Struct(tpAniSirGlobal pMac,
3577 tANI_U8 *pFrame,
3578 tpSirProbeRespBeacon pBeaconStruct)
3579{
Jeff Johnson32d95a32012-09-10 13:15:23 -07003580 tDot11fBeacon *pBeacon;
Jeff Johnson295189b2012-06-20 16:38:30 -07003581 tANI_U32 status, nPayload;
3582 tANI_U8 *pPayload;
3583 tpSirMacMgmtHdr pHdr;
3584 tANI_U8 mappedRXCh;
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003585 tANI_U8 rfBand;
Jeff Johnson295189b2012-06-20 16:38:30 -07003586
3587 pPayload = WDA_GET_RX_MPDU_DATA( pFrame );
3588 nPayload = WDA_GET_RX_PAYLOAD_LEN( pFrame );
3589 pHdr = WDA_GET_RX_MAC_HEADER( pFrame );
3590 mappedRXCh = WDA_GET_RX_CH( pFrame );
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003591 rfBand = WDA_GET_RX_RFBAND( pFrame );
Jeff Johnson295189b2012-06-20 16:38:30 -07003592
3593 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303594 vos_mem_set( ( tANI_U8* )pBeaconStruct, sizeof(tSirProbeRespBeacon), 0 );
3595
Abhishek Singhc75726d2015-04-13 14:44:14 +05303596 pBeacon = vos_mem_vmalloc(sizeof(tDot11fBeacon));
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303597 if ( NULL == pBeacon )
3598 status = eHAL_STATUS_FAILURE;
3599 else
3600 status = eHAL_STATUS_SUCCESS;
3601 if (!HAL_STATUS_SUCCESS(status))
Jeff Johnson32d95a32012-09-10 13:15:23 -07003602 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303603 limLog(pMac, LOGE, FL("Failed to allocate memory") );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003604 return eSIR_FAILURE;
3605 }
3606
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303607 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003608
3609 // get the MAC address out of the BD,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303610 vos_mem_copy( pBeaconStruct->bssid, pHdr->sa, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003611
3612 // delegate to the framesc-generated code,
Jeff Johnson32d95a32012-09-10 13:15:23 -07003613 status = dot11fUnpackBeacon( pMac, pPayload, nPayload, pBeacon );
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 if ( DOT11F_FAILED( status ) )
3615 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303616 limLog(pMac, LOGE, FL("Failed to parse Beacon IEs (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003617 status, nPayload);
3618 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pPayload, nPayload);)
Abhishek Singhc75726d2015-04-13 14:44:14 +05303619 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003620 return eSIR_FAILURE;
3621 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003622
3623 // & "transliterate" from a 'tDot11fBeacon' to a 'tSirProbeRespBeacon'...
3624 // Timestamp
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303625 vos_mem_copy( ( tANI_U8* )pBeaconStruct->timeStamp, ( tANI_U8* )&pBeacon->TimeStamp,
3626 sizeof(tSirMacTimeStamp) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003627
3628 // Beacon Interval
Jeff Johnson32d95a32012-09-10 13:15:23 -07003629 pBeaconStruct->beaconInterval = pBeacon->BeaconInterval.interval;
Jeff Johnson295189b2012-06-20 16:38:30 -07003630
3631 // Capabilities
Jeff Johnson32d95a32012-09-10 13:15:23 -07003632 pBeaconStruct->capabilityInfo.ess = pBeacon->Capabilities.ess;
3633 pBeaconStruct->capabilityInfo.ibss = pBeacon->Capabilities.ibss;
3634 pBeaconStruct->capabilityInfo.cfPollable = pBeacon->Capabilities.cfPollable;
3635 pBeaconStruct->capabilityInfo.cfPollReq = pBeacon->Capabilities.cfPollReq;
3636 pBeaconStruct->capabilityInfo.privacy = pBeacon->Capabilities.privacy;
3637 pBeaconStruct->capabilityInfo.shortPreamble = pBeacon->Capabilities.shortPreamble;
3638 pBeaconStruct->capabilityInfo.pbcc = pBeacon->Capabilities.pbcc;
3639 pBeaconStruct->capabilityInfo.channelAgility = pBeacon->Capabilities.channelAgility;
3640 pBeaconStruct->capabilityInfo.spectrumMgt = pBeacon->Capabilities.spectrumMgt;
3641 pBeaconStruct->capabilityInfo.qos = pBeacon->Capabilities.qos;
3642 pBeaconStruct->capabilityInfo.shortSlotTime = pBeacon->Capabilities.shortSlotTime;
3643 pBeaconStruct->capabilityInfo.apsd = pBeacon->Capabilities.apsd;
3644 pBeaconStruct->capabilityInfo.rrm = pBeacon->Capabilities.rrm;
3645 pBeaconStruct->capabilityInfo.dsssOfdm = pBeacon->Capabilities.dsssOfdm;
3646 pBeaconStruct->capabilityInfo.delayedBA = pBeacon->Capabilities.delayedBA;
3647 pBeaconStruct->capabilityInfo.immediateBA = pBeacon->Capabilities.immediateBA;
Jeff Johnson295189b2012-06-20 16:38:30 -07003648
Jeff Johnson32d95a32012-09-10 13:15:23 -07003649 if ( ! pBeacon->SSID.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303651 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE SSID not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 }
3653 else
3654 {
3655 pBeaconStruct->ssidPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003656 ConvertSSID( pMac, &pBeaconStruct->ssId, &pBeacon->SSID );
Jeff Johnson295189b2012-06-20 16:38:30 -07003657 }
3658
Jeff Johnson32d95a32012-09-10 13:15:23 -07003659 if ( ! pBeacon->SuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303661 PELOGW(limLog(pMac, LOGW, FL("Mandatory IE Supported Rates not present!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003662 }
3663 else
3664 {
3665 pBeaconStruct->suppRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003666 ConvertSuppRates( pMac, &pBeaconStruct->supportedRates, &pBeacon->SuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003667 }
3668
Jeff Johnson32d95a32012-09-10 13:15:23 -07003669 if ( pBeacon->ExtSuppRates.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003670 {
3671 pBeaconStruct->extendedRatesPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003672 ConvertExtSuppRates( pMac, &pBeaconStruct->extendedRates, &pBeacon->ExtSuppRates );
Jeff Johnson295189b2012-06-20 16:38:30 -07003673 }
3674
3675
Jeff Johnson32d95a32012-09-10 13:15:23 -07003676 if ( pBeacon->CFParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003677 {
3678 pBeaconStruct->cfPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003679 ConvertCFParams( pMac, &pBeaconStruct->cfParamSet, &pBeacon->CFParams );
Jeff Johnson295189b2012-06-20 16:38:30 -07003680 }
3681
Jeff Johnson32d95a32012-09-10 13:15:23 -07003682 if ( pBeacon->TIM.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 {
3684 pBeaconStruct->timPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003685 ConvertTIM( pMac, &pBeaconStruct->tim, &pBeacon->TIM );
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 }
3687
Jeff Johnson32d95a32012-09-10 13:15:23 -07003688 if ( pBeacon->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003689 {
3690 pBeaconStruct->countryInfoPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003691 ConvertCountry( pMac, &pBeaconStruct->countryInfoParam, &pBeacon->Country );
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 }
3693
3694 // QOS Capabilities:
Jeff Johnson32d95a32012-09-10 13:15:23 -07003695 if ( pBeacon->QOSCapsAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 {
3697 pBeaconStruct->qosCapabilityPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003698 ConvertQOSCaps( pMac, &pBeaconStruct->qosCapability, &pBeacon->QOSCapsAp );
Jeff Johnson295189b2012-06-20 16:38:30 -07003699 }
3700
Jeff Johnson32d95a32012-09-10 13:15:23 -07003701 if ( pBeacon->EDCAParamSet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003702 {
3703 pBeaconStruct->edcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003704 ConvertEDCAParam( pMac, &pBeaconStruct->edcaParams, &pBeacon->EDCAParamSet );
Jeff Johnson295189b2012-06-20 16:38:30 -07003705 }
3706
Jeff Johnson32d95a32012-09-10 13:15:23 -07003707 if ( pBeacon->ChanSwitchAnn.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003708 {
3709 pBeaconStruct->channelSwitchPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303710 vos_mem_copy( &pBeaconStruct->channelSwitchIE, &pBeacon->ChanSwitchAnn,
Jeff Johnson295189b2012-06-20 16:38:30 -07003711 sizeof(tDot11fIEChanSwitchAnn) );
3712 }
Abhishek Singh15431c42017-10-25 15:43:02 +05303713 if ( pBeacon->sec_chan_offset.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 {
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303715 pBeaconStruct->sec_chan_offset_present = 1;
Abhishek Singh15431c42017-10-25 15:43:02 +05303716 vos_mem_copy(&pBeaconStruct->sec_chan_offset, &pBeacon->sec_chan_offset,
3717 sizeof(tDot11fIEsec_chan_offset));
Jeff Johnson295189b2012-06-20 16:38:30 -07003718 }
Abhishek Singh39ae47e2017-10-30 17:39:50 +05303719 if (pBeacon->ext_chan_switch_ann.present)
3720 {
3721 pBeaconStruct->ecsa_present = 1;
3722 vos_mem_copy(&pBeaconStruct->ext_chan_switch_ann,
3723 &pBeacon->ext_chan_switch_ann,
3724 sizeof(tDot11fIEext_chan_switch_ann));
3725 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003726
Jeff Johnson32d95a32012-09-10 13:15:23 -07003727 if( pBeacon->TPCReport.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 {
3729 pBeaconStruct->tpcReportPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303730 vos_mem_copy( &pBeaconStruct->tpcReport, &pBeacon->TPCReport,
Jeff Johnson295189b2012-06-20 16:38:30 -07003731 sizeof(tDot11fIETPCReport));
3732 }
3733
Jeff Johnson32d95a32012-09-10 13:15:23 -07003734 if( pBeacon->PowerConstraints.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003735 {
3736 pBeaconStruct->powerConstraintPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303737 vos_mem_copy( &pBeaconStruct->localPowerConstraint, &pBeacon->PowerConstraints,
Jeff Johnson295189b2012-06-20 16:38:30 -07003738 sizeof(tDot11fIEPowerConstraints));
3739 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003740
3741 if ( pBeacon->Quiet.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003742 {
3743 pBeaconStruct->quietIEPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303744 vos_mem_copy( &pBeaconStruct->quietIE, &pBeacon->Quiet, sizeof(tDot11fIEQuiet));
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 }
3746
Jeff Johnson32d95a32012-09-10 13:15:23 -07003747 if ( pBeacon->HTCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303749 vos_mem_copy( &pBeaconStruct->HTCaps, &pBeacon->HTCaps, sizeof( tDot11fIEHTCaps ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 }
3751
Jeff Johnson32d95a32012-09-10 13:15:23 -07003752 if ( pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303754 vos_mem_copy( &pBeaconStruct->HTInfo, &pBeacon->HTInfo, sizeof( tDot11fIEHTInfo) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003755
3756 }
3757
Jeff Johnson32d95a32012-09-10 13:15:23 -07003758 if ( pBeacon->DSParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 {
3760 pBeaconStruct->dsParamsPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003761 pBeaconStruct->channelNumber = pBeacon->DSParams.curr_channel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003762 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003763 else if(pBeacon->HTInfo.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003764 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07003765 pBeaconStruct->channelNumber = pBeacon->HTInfo.primaryChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 }
3767 else
3768 {
Kiran Kumar Lokere79540f92013-04-25 17:32:16 -07003769 if ((!rfBand) || IS_5G_BAND(rfBand))
3770 pBeaconStruct->channelNumber = limUnmapChannel(mappedRXCh);
3771 else if (IS_24G_BAND(rfBand))
3772 pBeaconStruct->channelNumber = mappedRXCh;
3773 else
3774 {
3775 /*Only 0, 1, 2 are expected values for RF band from FW
3776 * if FW fixes are not present then rf band value will
3777 * be 0, else either 1 or 2 are expected from FW, 3 is
3778 * not expected from FW */
3779 PELOGE(limLog(pMac, LOGE,
3780 FL("Channel info is not present in Beacon and"
3781 " mapping is not done correctly"));)
3782 pBeaconStruct->channelNumber = mappedRXCh;
3783 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 }
3785
Jeff Johnson32d95a32012-09-10 13:15:23 -07003786 if ( pBeacon->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 {
3788 pBeaconStruct->rsnPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003789 ConvertRSN( pMac, &pBeaconStruct->rsn, &pBeacon->RSN );
Jeff Johnson295189b2012-06-20 16:38:30 -07003790 }
3791
Jeff Johnson32d95a32012-09-10 13:15:23 -07003792 if ( pBeacon->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 {
3794 pBeaconStruct->wpaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003795 ConvertWPA( pMac, &pBeaconStruct->wpa, &pBeacon->WPA );
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 }
3797
Jeff Johnson32d95a32012-09-10 13:15:23 -07003798 if ( pBeacon->WMMParams.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003799 {
3800 pBeaconStruct->wmeEdcaPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003801 ConvertWMMParams( pMac, &pBeaconStruct->edcaParams, &pBeacon->WMMParams );
Sushant Kaushik87787972015-09-11 16:05:00 +05303802 PELOG1(limLog(pMac, LOG1, FL("WMM Parameter present in Beacon Frame!"));
Jeff Johnson32d95a32012-09-10 13:15:23 -07003803 __printWMMParams(pMac, &pBeacon->WMMParams); )
Jeff Johnson295189b2012-06-20 16:38:30 -07003804 }
3805
Jeff Johnson32d95a32012-09-10 13:15:23 -07003806 if ( pBeacon->WMMInfoAp.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003807 {
3808 pBeaconStruct->wmeInfoPresent = 1;
Sushant Kaushik87787972015-09-11 16:05:00 +05303809 PELOG1(limLog(pMac, LOG1, FL("WMM Info present in Beacon Frame!"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003810 }
3811
Jeff Johnson32d95a32012-09-10 13:15:23 -07003812 if ( pBeacon->WMMCaps.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003813 {
3814 pBeaconStruct->wsmCapablePresent = 1;
3815 }
3816
Jeff Johnson32d95a32012-09-10 13:15:23 -07003817 if ( pBeacon->ERPInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 {
3819 pBeaconStruct->erpPresent = 1;
Jeff Johnson32d95a32012-09-10 13:15:23 -07003820 ConvertERPInfo( pMac, &pBeaconStruct->erpIEInfo, &pBeacon->ERPInfo );
Jeff Johnson295189b2012-06-20 16:38:30 -07003821 }
3822
3823#ifdef WLAN_FEATURE_VOWIFI_11R
Jeff Johnson32d95a32012-09-10 13:15:23 -07003824 if (pBeacon->MobilityDomain.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07003825 {
3826 // MobilityDomain
3827 pBeaconStruct->mdiePresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303828 vos_mem_copy( (tANI_U8 *)&(pBeaconStruct->mdie[0]),
3829 (tANI_U8 *)&(pBeacon->MobilityDomain.MDID), sizeof(tANI_U16) );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003830 pBeaconStruct->mdie[2] = ((pBeacon->MobilityDomain.overDSCap << 0) | (pBeacon->MobilityDomain.resourceReqCap << 1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003831
3832 }
3833#endif
3834
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003835#ifdef FEATURE_WLAN_ESE
3836 if (pBeacon->ESETxmitPower.present)
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303837 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003838 //ESE Tx Power
3839 pBeaconStruct->eseTxPwr.present = 1;
3840 vos_mem_copy(&pBeaconStruct->eseTxPwr,
3841 &pBeacon->ESETxmitPower,
3842 sizeof(tDot11fIEESETxmitPower));
Madan Mohan Koyyalamudi016117f2013-08-06 16:42:11 +05303843 }
3844#endif
3845
Jeff Johnsone7245742012-09-05 17:12:55 -07003846#ifdef WLAN_FEATURE_11AC
Jeff Johnson32d95a32012-09-10 13:15:23 -07003847 if ( pBeacon->VHTCaps.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003848 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303849 vos_mem_copy( &pBeaconStruct->VHTCaps, &pBeacon->VHTCaps, sizeof( tDot11fIEVHTCaps ) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003850 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003851 if ( pBeacon->VHTOperation.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003852 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303853 vos_mem_copy( &pBeaconStruct->VHTOperation, &pBeacon->VHTOperation,
3854 sizeof( tDot11fIEVHTOperation) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003855 }
Jeff Johnson32d95a32012-09-10 13:15:23 -07003856 if ( pBeacon->VHTExtBssLoad.present )
Jeff Johnsone7245742012-09-05 17:12:55 -07003857 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303858 vos_mem_copy( &pBeaconStruct->VHTExtBssLoad, &pBeacon->VHTExtBssLoad,
3859 sizeof( tDot11fIEVHTExtBssLoad) );
Jeff Johnsone7245742012-09-05 17:12:55 -07003860 }
Mohit Khanna4a70d262012-09-11 16:30:12 -07003861 if(pBeacon->OperatingMode.present)
3862 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303863 vos_mem_copy( &pBeaconStruct->OperatingMode, &pBeacon->OperatingMode,
3864 sizeof( tDot11fIEOperatingMode) );
Mohit Khanna4a70d262012-09-11 16:30:12 -07003865 }
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003866 if(pBeacon->WiderBWChanSwitchAnn.present)
3867 {
3868 pBeaconStruct->WiderBWChanSwitchAnnPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303869 vos_mem_copy( &pBeaconStruct->WiderBWChanSwitchAnn, &pBeacon->WiderBWChanSwitchAnn,
3870 sizeof( tDot11fIEWiderBWChanSwitchAnn));
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07003871 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003872#endif
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05303873 if(pBeacon->OBSSScanParameters.present)
3874 {
3875 vos_mem_copy( &pBeaconStruct->OBSSScanParameters,
3876 &pBeacon->OBSSScanParameters,
3877 sizeof( tDot11fIEOBSSScanParameters));
3878 }
Abhishek Singh74037df2017-07-20 11:08:56 +05303879 sir_copy_hs20_ie(&pBeaconStruct->hs20vendor_ie, &pBeacon->hs20vendor_ie);
Agrawal Ashish5ac89da2015-10-26 19:08:47 +05303880
Abhishek Singhc75726d2015-04-13 14:44:14 +05303881 vos_mem_vfree(pBeacon);
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 return eSIR_SUCCESS;
3883
3884} // End sirConvertBeaconFrame2Struct.
3885
3886tSirRetStatus
3887sirConvertAuthFrame2Struct(tpAniSirGlobal pMac,
3888 tANI_U8 *pFrame,
3889 tANI_U32 nFrame,
3890 tpSirMacAuthFrameBody pAuth)
3891{
3892 static tDot11fAuthentication auth;
3893 tANI_U32 status;
3894
3895 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303896 vos_mem_set( ( tANI_U8* )pAuth, sizeof(tSirMacAuthFrameBody), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003897
3898 // delegate to the framesc-generated code,
3899 status = dot11fUnpackAuthentication( pMac, pFrame, nFrame, &auth );
3900 if ( DOT11F_FAILED( status ) )
3901 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303902 limLog(pMac, LOGE, FL("Failed to parse an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003903 status, nFrame);
3904 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3905 return eSIR_FAILURE;
3906 }
3907 else if ( DOT11F_WARNED( status ) )
3908 {
Sushant Kaushik87787972015-09-11 16:05:00 +05303909 limLog( pMac, LOGW, FL("There were warnings while unpacking an Authentication frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003910 status, nFrame );
3911 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3912 }
3913
3914 // & "transliterate" from a 'tDot11fAuthentication' to a 'tSirMacAuthFrameBody'...
3915 pAuth->authAlgoNumber = auth.AuthAlgo.algo;
3916 pAuth->authTransactionSeqNumber = auth.AuthSeqNo.no;
3917 pAuth->authStatusCode = auth.Status.status;
3918
3919 if ( auth.ChallengeText.present )
3920 {
3921 pAuth->type = SIR_MAC_CHALLENGE_TEXT_EID;
3922 pAuth->length = auth.ChallengeText.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303923 vos_mem_copy( pAuth->challengeText, auth.ChallengeText.text, auth.ChallengeText.num_text );
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 }
3925
3926 return eSIR_SUCCESS;
3927
3928} // End sirConvertAuthFrame2Struct.
3929
3930tSirRetStatus
3931sirConvertAddtsReq2Struct(tpAniSirGlobal pMac,
3932 tANI_U8 *pFrame,
3933 tANI_U32 nFrame,
3934 tSirAddtsReqInfo *pAddTs)
3935{
3936 tDot11fAddTSRequest addts = {{0}};
3937 tDot11fWMMAddTSRequest wmmaddts = {{0}};
3938 tANI_U8 j;
3939 tANI_U16 i;
3940 tANI_U32 status;
3941
3942 if ( SIR_MAC_QOS_ADD_TS_REQ != *( pFrame + 1 ) )
3943 {
3944 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3945 "with an Action of %d; this is not "
3946 "supported & is probably an error."),
3947 *( pFrame + 1 ) );
3948 return eSIR_FAILURE;
3949 }
3950
3951 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05303952 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07003953
3954 // delegate to the framesc-generated code,
3955 switch ( *pFrame )
3956 {
3957 case SIR_MAC_ACTION_QOS_MGMT:
3958 status = dot11fUnpackAddTSRequest( pMac, pFrame, nFrame, &addts );
3959 break;
3960 case SIR_MAC_ACTION_WME:
3961 status = dot11fUnpackWMMAddTSRequest( pMac, pFrame, nFrame, &wmmaddts );
3962 break;
3963 default:
3964 limLog( pMac, LOGE, FL("sirConvertAddtsReq2Struct invoked "
3965 "with a Category of %d; this is not"
3966 " supported & is probably an error."),
3967 *pFrame );
3968 return eSIR_FAILURE;
3969 }
3970
3971 if ( DOT11F_FAILED( status ) )
3972 {
3973 limLog(pMac, LOGE, FL("Failed to parse an Add TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05303974 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003975 status, nFrame);
3976 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3977 return eSIR_FAILURE;
3978 }
3979 else if ( DOT11F_WARNED( status ) )
3980 {
3981 limLog( pMac, LOGW, FL("There were warnings while unpackin"
3982 "g an Add TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05303983 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003984 status, nFrame );
3985 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
3986 }
3987
3988 // & "transliterate" from a 'tDot11fAddTSRequest' or a
3989 // 'tDot11WMMAddTSRequest' to a 'tSirMacAddtsReqInfo'...
3990 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
3991 {
3992 pAddTs->dialogToken = addts.DialogToken.token;
3993
3994 if ( addts.TSPEC.present )
3995 {
3996 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
3997 }
3998 else
3999 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304000 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Request.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 return eSIR_FAILURE;
4002 }
4003
4004 if ( addts.num_TCLAS )
4005 {
4006 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4007
4008 for ( i = 0U; i < addts.num_TCLAS; ++i )
4009 {
4010 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4011 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304012 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004013 return eSIR_FAILURE;
4014 }
4015 }
4016 }
4017
4018 if ( addts.TCLASSPROC.present )
4019 {
4020 pAddTs->tclasProcPresent = 1;
4021 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4022 }
4023
4024 if ( addts.WMMTSPEC.present )
4025 {
4026 pAddTs->wsmTspecPresent = 1;
4027 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4028 }
4029
4030 if ( addts.num_WMMTCLAS )
4031 {
4032 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
lifeng59144322019-03-20 18:05:26 +08004033 if ( SIR_MAC_TCLASIE_MAXNUM < j ) j = SIR_MAC_TCLASIE_MAXNUM;
Jeff Johnson295189b2012-06-20 16:38:30 -07004034
4035 for ( i = pAddTs->numTclas; i < j; ++i )
4036 {
4037 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4038 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304039 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 return eSIR_FAILURE;
4041 }
4042 }
4043 }
4044
4045 if ( addts.WMMTCLASPROC.present )
4046 {
4047 pAddTs->tclasProcPresent = 1;
4048 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4049 }
4050
4051 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4052 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304053 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004054 pAddTs->numTclas );
4055 return eSIR_FAILURE;
4056 }
4057 }
4058 else
4059 {
4060 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4061
4062 if ( wmmaddts.WMMTSPEC.present )
4063 {
4064 pAddTs->wmeTspecPresent = 1;
4065 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4066 }
4067 else
4068 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304069 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 return eSIR_FAILURE;
4071 }
4072 }
4073
4074 return eSIR_SUCCESS;
4075
4076} // End sirConvertAddtsReq2Struct.
4077
4078tSirRetStatus
4079sirConvertAddtsRsp2Struct(tpAniSirGlobal pMac,
4080 tANI_U8 *pFrame,
4081 tANI_U32 nFrame,
4082 tSirAddtsRspInfo *pAddTs)
4083{
4084 tDot11fAddTSResponse addts = {{0}};
4085 tDot11fWMMAddTSResponse wmmaddts = {{0}};
4086 tANI_U8 j;
4087 tANI_U16 i;
4088 tANI_U32 status;
4089
4090 if ( SIR_MAC_QOS_ADD_TS_RSP != *( pFrame + 1 ) )
4091 {
4092 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4093 "with an Action of %d; this is not "
4094 "supported & is probably an error."),
4095 *( pFrame + 1 ) );
4096 return eSIR_FAILURE;
4097 }
4098
4099 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304100 vos_mem_set( ( tANI_U8* )pAddTs, sizeof(tSirAddtsRspInfo), 0 );
4101 vos_mem_set( ( tANI_U8* )&addts, sizeof(tDot11fAddTSResponse), 0 );
4102 vos_mem_set( ( tANI_U8* )&wmmaddts, sizeof(tDot11fWMMAddTSResponse), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004103
4104
4105 // delegate to the framesc-generated code,
4106 switch ( *pFrame )
4107 {
4108 case SIR_MAC_ACTION_QOS_MGMT:
4109 status = dot11fUnpackAddTSResponse( pMac, pFrame, nFrame, &addts );
4110 break;
4111 case SIR_MAC_ACTION_WME:
4112 status = dot11fUnpackWMMAddTSResponse( pMac, pFrame, nFrame, &wmmaddts );
4113 break;
4114 default:
4115 limLog( pMac, LOGE, FL("sirConvertAddtsRsp2Struct invoked "
4116 "with a Category of %d; this is not"
4117 " supported & is probably an error."),
4118 *pFrame );
4119 return eSIR_FAILURE;
4120 }
4121
4122 if ( DOT11F_FAILED( status ) )
4123 {
4124 limLog(pMac, LOGE, FL("Failed to parse an Add TS Response f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304125 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004126 status, nFrame);
4127 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4128 return eSIR_FAILURE;
4129 }
4130 else if ( DOT11F_WARNED( status ) )
4131 {
4132 limLog( pMac, LOGW, FL("There were warnings while unpackin"
4133 "g an Add TS Response frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304134 "%d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004135 status, nFrame );
4136 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4137 }
4138
4139 // & "transliterate" from a 'tDot11fAddTSResponse' or a
4140 // 'tDot11WMMAddTSResponse' to a 'tSirMacAddtsRspInfo'...
4141 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4142 {
4143 pAddTs->dialogToken = addts.DialogToken.token;
4144 pAddTs->status = ( tSirMacStatusCodes )addts.Status.status;
4145
4146 if ( addts.TSDelay.present )
4147 {
4148 ConvertTSDelay( pMac, &pAddTs->delay, &addts.TSDelay );
4149 }
4150
4151 // TS Delay is present iff status indicates its presence
4152 if ( eSIR_MAC_TS_NOT_CREATED_STATUS == pAddTs->status && ! addts.TSDelay.present )
4153 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304154 limLog( pMac, LOGW, FL("Missing TSDelay IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 }
4156
4157 if ( addts.TSPEC.present )
4158 {
4159 ConvertTSPEC( pMac, &pAddTs->tspec, &addts.TSPEC );
4160 }
4161 else
4162 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304163 limLog( pMac, LOGE, FL("Mandatory TSPEC element missing in Add TS Response.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004164 return eSIR_FAILURE;
4165 }
4166
4167 if ( addts.num_TCLAS )
4168 {
4169 pAddTs->numTclas = (tANI_U8)addts.num_TCLAS;
4170
4171 for ( i = 0U; i < addts.num_TCLAS; ++i )
4172 {
4173 if ( eSIR_SUCCESS != ConvertTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.TCLAS[i] ) ) )
4174 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304175 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004176 return eSIR_FAILURE;
4177 }
4178 }
4179 }
4180
4181 if ( addts.TCLASSPROC.present )
4182 {
4183 pAddTs->tclasProcPresent = 1;
4184 pAddTs->tclasProc = addts.TCLASSPROC.processing;
4185 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004186#ifdef FEATURE_WLAN_ESE
4187 if(addts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004188 {
4189 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304190 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004191 &addts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 }
4193#endif
4194 if ( addts.Schedule.present )
4195 {
4196 pAddTs->schedulePresent = 1;
4197 ConvertSchedule( pMac, &pAddTs->schedule, &addts.Schedule );
4198 }
4199
4200 if ( addts.WMMSchedule.present )
4201 {
4202 pAddTs->schedulePresent = 1;
4203 ConvertWMMSchedule( pMac, &pAddTs->schedule, &addts.WMMSchedule );
4204 }
4205
4206 if ( addts.WMMTSPEC.present )
4207 {
4208 pAddTs->wsmTspecPresent = 1;
4209 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &addts.WMMTSPEC );
4210 }
4211
4212 if ( addts.num_WMMTCLAS )
4213 {
4214 j = (tANI_U8)(pAddTs->numTclas + addts.num_WMMTCLAS);
lifeng59144322019-03-20 18:05:26 +08004215 if ( SIR_MAC_TCLASIE_MAXNUM < j ) j = SIR_MAC_TCLASIE_MAXNUM;
Jeff Johnson295189b2012-06-20 16:38:30 -07004216
4217 for ( i = pAddTs->numTclas; i < j; ++i )
4218 {
4219 if ( eSIR_SUCCESS != ConvertWMMTCLAS( pMac, &( pAddTs->tclasInfo[i] ), &( addts.WMMTCLAS[i] ) ) )
4220 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304221 limLog( pMac, LOGE, FL("Failed to convert a TCLAS IE.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 return eSIR_FAILURE;
4223 }
4224 }
4225 }
4226
4227 if ( addts.WMMTCLASPROC.present )
4228 {
4229 pAddTs->tclasProcPresent = 1;
4230 pAddTs->tclasProc = addts.WMMTCLASPROC.processing;
4231 }
4232
4233 if ( 1 < pAddTs->numTclas && ( ! pAddTs->tclasProcPresent ) )
4234 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304235 limLog( pMac, LOGE, FL("%d TCLAS IE but not TCLASPROC IE."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004236 pAddTs->numTclas );
4237 return eSIR_FAILURE;
4238 }
4239 }
4240 else
4241 {
4242 pAddTs->dialogToken = wmmaddts.DialogToken.token;
4243 pAddTs->status = ( tSirMacStatusCodes )wmmaddts.StatusCode.statusCode;
4244
4245 if ( wmmaddts.WMMTSPEC.present )
4246 {
4247 pAddTs->wmeTspecPresent = 1;
4248 ConvertWMMTSPEC( pMac, &pAddTs->tspec, &wmmaddts.WMMTSPEC );
4249 }
4250 else
4251 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304252 limLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 return eSIR_FAILURE;
4254 }
4255
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004256#ifdef FEATURE_WLAN_ESE
4257 if(wmmaddts.ESETrafStrmMet.present)
Jeff Johnson295189b2012-06-20 16:38:30 -07004258 {
4259 pAddTs->tsmPresent = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304260 vos_mem_copy(&pAddTs->tsmIE.tsid,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004261 &wmmaddts.ESETrafStrmMet.tsid,sizeof(tSirMacESETSMIE));
Jeff Johnson295189b2012-06-20 16:38:30 -07004262 }
4263#endif
4264
4265 }
4266
4267 return eSIR_SUCCESS;
4268
4269} // End sirConvertAddtsRsp2Struct.
4270
4271tSirRetStatus
4272sirConvertDeltsReq2Struct(tpAniSirGlobal pMac,
4273 tANI_U8 *pFrame,
4274 tANI_U32 nFrame,
4275 tSirDeltsReqInfo *pDelTs)
4276{
4277 tDot11fDelTS delts = {{0}};
4278 tDot11fWMMDelTS wmmdelts = {{0}};
4279 tANI_U32 status;
4280
4281 if ( SIR_MAC_QOS_DEL_TS_REQ != *( pFrame + 1 ) )
4282 {
4283 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4284 "with an Action of %d; this is not "
4285 "supported & is probably an error."),
4286 *( pFrame + 1 ) );
4287 return eSIR_FAILURE;
4288 }
4289
4290 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304291 vos_mem_set( ( tANI_U8* )pDelTs, sizeof(tSirDeltsReqInfo), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004292
4293 // delegate to the framesc-generated code,
4294 switch ( *pFrame )
4295 {
4296 case SIR_MAC_ACTION_QOS_MGMT:
4297 status = dot11fUnpackDelTS( pMac, pFrame, nFrame, &delts );
4298 break;
4299 case SIR_MAC_ACTION_WME:
4300 status = dot11fUnpackWMMDelTS( pMac, pFrame, nFrame, &wmmdelts );
4301 break;
4302 default:
4303 limLog( pMac, LOGE, FL("sirConvertDeltsRsp2Struct invoked "
4304 "with a Category of %d; this is not"
4305 " supported & is probably an error."),
4306 *pFrame );
4307 return eSIR_FAILURE;
4308 }
4309
4310 if ( DOT11F_FAILED( status ) )
4311 {
4312 limLog(pMac, LOGE, FL("Failed to parse an Del TS Request f"
Sushant Kaushik87787972015-09-11 16:05:00 +05304313 "rame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004314 status, nFrame);
4315 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4316 return eSIR_FAILURE;
4317 }
4318 else if ( DOT11F_WARNED( status ) )
4319 {
4320 dot11fLog( pMac, LOGW, FL("There were warnings while unpackin"
4321 "g an Del TS Request frame (0x%08x,"
Sushant Kaushik87787972015-09-11 16:05:00 +05304322 "%d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004323 status, nFrame );
4324 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4325 }
4326
4327 // & "transliterate" from a 'tDot11fDelTSResponse' or a
4328 // 'tDot11WMMDelTSResponse' to a 'tSirMacDeltsReqInfo'...
4329 if ( SIR_MAC_ACTION_QOS_MGMT == *pFrame )
4330 {
4331 pDelTs->tsinfo.traffic.trafficType = (tANI_U16)delts.TSInfo.traffic_type;
4332 pDelTs->tsinfo.traffic.tsid = (tANI_U16)delts.TSInfo.tsid;
4333 pDelTs->tsinfo.traffic.direction = (tANI_U16)delts.TSInfo.direction;
4334 pDelTs->tsinfo.traffic.accessPolicy = (tANI_U16)delts.TSInfo.access_policy;
4335 pDelTs->tsinfo.traffic.aggregation = (tANI_U16)delts.TSInfo.aggregation;
4336 pDelTs->tsinfo.traffic.psb = (tANI_U16)delts.TSInfo.psb;
4337 pDelTs->tsinfo.traffic.userPrio = (tANI_U16)delts.TSInfo.user_priority;
4338 pDelTs->tsinfo.traffic.ackPolicy = (tANI_U16)delts.TSInfo.tsinfo_ack_pol;
4339
4340 pDelTs->tsinfo.schedule.schedule = (tANI_U8)delts.TSInfo.schedule;
4341 }
4342 else
4343 {
4344 if ( wmmdelts.WMMTSPEC.present )
4345 {
4346 pDelTs->wmeTspecPresent = 1;
4347 ConvertWMMTSPEC( pMac, &pDelTs->tspec, &wmmdelts.WMMTSPEC );
4348 }
4349 else
4350 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304351 dot11fLog( pMac, LOGE, FL("Mandatory WME TSPEC element missing!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004352 return eSIR_FAILURE;
4353 }
4354 }
4355
4356 return eSIR_SUCCESS;
4357
4358} // End sirConvertDeltsReq2Struct.
4359
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004360tSirRetStatus
4361sirConvertQosMapConfigureFrame2Struct(tpAniSirGlobal pMac,
4362 tANI_U8 *pFrame,
4363 tANI_U32 nFrame,
4364 tSirQosMapSet *pQosMapSet)
4365{
4366 tDot11fQosMapConfigure mapConfigure;
4367 tANI_U32 status;
4368 status = dot11fUnpackQosMapConfigure(pMac, pFrame, nFrame, &mapConfigure);
Sreelakshmi Konamki8a251602016-02-19 16:12:23 +05304369 if ( DOT11F_FAILED( status ) || !mapConfigure.QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004370 {
Sreelakshmi Konamki8a251602016-02-19 16:12:23 +05304371 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 -07004372 status, nFrame);
4373 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4374 return eSIR_FAILURE;
4375 }
4376 else if ( DOT11F_WARNED( status ) )
4377 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304378 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 -07004379 status, nFrame );
4380 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4381 }
4382 pQosMapSet->present = mapConfigure.QosMapSet.present;
4383 ConvertQosMapsetFrame(pMac->hHdd, pQosMapSet, &mapConfigure.QosMapSet);
Kumar Anand82c009f2014-05-29 00:29:42 -07004384 limLogQosMapSet(pMac, pQosMapSet);
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -07004385 return eSIR_SUCCESS;
4386}
Jeff Johnson295189b2012-06-20 16:38:30 -07004387
4388#ifdef ANI_SUPPORT_11H
4389tSirRetStatus
4390sirConvertTpcReqFrame2Struct(tpAniSirGlobal pMac,
4391 tANI_U8 *pFrame,
4392 tpSirMacTpcReqActionFrame pTpcReqFrame,
4393 tANI_U32 nFrame)
4394{
4395 tDot11fTPCRequest req;
4396 tANI_U32 status;
4397
4398 // Zero-init our [out] parameter,
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304399 vos_mem_set( ( tANI_U8* )pTpcReqFrame, sizeof(tSirMacTpcReqActionFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004400
4401 // delegate to the framesc-generated code,
4402 status = dot11fUnpackTPCRequest( pMac, pFrame, nFrame, &req );
4403 if ( DOT11F_FAILED( status ) )
4404 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304405 dot11fLog(pMac, LOGE, FL("Failed to parse a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 status, nFrame);
4407 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4408 return eSIR_FAILURE;
4409 }
4410 else if ( DOT11F_WARNED( status ) )
4411 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304412 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a TPC Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 status, nFrame );
4414 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4415 }
4416
4417 // & "transliterate" from a 'tDot11fTPCRequest' to a
4418 // 'tSirMacTpcReqActionFrame'...
4419 pTpcReqFrame->actionHeader.category = req.Category.category;
4420 pTpcReqFrame->actionHeader.actionID = req.Action.action;
4421 pTpcReqFrame->actionHeader.dialogToken = req.DialogToken.token;
4422 if ( req.TPCRequest.present )
4423 {
4424 pTpcReqFrame->type = DOT11F_EID_TPCREQUEST;
4425 pTpcReqFrame->length = 0;
4426 }
4427 else
4428 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304429 dot11fLog( pMac, LOGW, FL("!!!Rcv TPC Req of inalid type!") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004430 return eSIR_FAILURE;
4431 }
4432
4433 return eSIR_SUCCESS;
4434
4435} // End sirConvertTpcReqFrame2Struct.
4436
4437
4438tSirRetStatus
4439sirConvertMeasReqFrame2Struct(tpAniSirGlobal pMac,
4440 tANI_U8 *pFrame,
4441 tpSirMacMeasReqActionFrame pMeasReqFrame,
4442 tANI_U32 nFrame)
4443{
4444 tDot11fMeasurementRequest mr;
4445 tANI_U32 status;
4446
4447 // Zero-init our [out] parameter,
Sunkad, Anand Ningappabf1650a2016-02-08 12:08:13 +05304448 vos_mem_set( ( tANI_U8* )pMeasReqFrame, sizeof(*pMeasReqFrame), 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004449
4450 // delegate to the framesc-generated code,
4451 status = dot11fUnpackMeasurementRequest( pMac, pFrame, nFrame, &mr );
4452 if ( DOT11F_FAILED( status ) )
4453 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304454 dot11fLog(pMac, LOGE, FL("Failed to parse a Measurement Request frame (0x%08x, %d bytes):"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004455 status, nFrame);
4456 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4457 return eSIR_FAILURE;
4458 }
4459 else if ( DOT11F_WARNED( status ) )
4460 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304461 dot11fLog( pMac, LOGW, FL("There were warnings while unpacking a Measurement Request frame (0x%08x, %d bytes)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 status, nFrame );
4463 PELOG2(sirDumpBuf(pMac, SIR_DBG_MODULE_ID, LOG2, pFrame, nFrame);)
4464 }
4465
4466 // & "transliterate" from a 'tDot11fMeasurementRequest' to a
4467 // 'tpSirMacMeasReqActionFrame'...
4468 pMeasReqFrame->actionHeader.category = mr.Category.category;
4469 pMeasReqFrame->actionHeader.actionID = mr.Action.action;
4470 pMeasReqFrame->actionHeader.dialogToken = mr.DialogToken.token;
4471
4472 if ( 0 == mr.num_MeasurementRequest )
4473 {
Sushant Kaushik87787972015-09-11 16:05:00 +05304474 dot11fLog( pMac, LOGE, FL("Missing mandatory IE in Measurement Request Frame.") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004475 return eSIR_FAILURE;
4476 }
4477 else if ( 1 < mr.num_MeasurementRequest )
4478 {
4479 limLog( pMac, LOGW, FL("Warning: dropping extra Measurement Request IEs!") );
4480 }
4481
4482 pMeasReqFrame->measReqIE.type = DOT11F_EID_MEASUREMENTREQUEST;
4483 pMeasReqFrame->measReqIE.length = DOT11F_IE_MEASUREMENTREQUEST_MIN_LEN;
4484 pMeasReqFrame->measReqIE.measToken = mr.MeasurementRequest[0].measurement_token;
4485 pMeasReqFrame->measReqIE.measReqMode = ( mr.MeasurementRequest[0].reserved << 3 ) |
4486 ( mr.MeasurementRequest[0].enable << 2 ) |
4487 ( mr.MeasurementRequest[0].request << 1 ) |
4488 ( mr.MeasurementRequest[0].report /*<< 0*/ );
4489 pMeasReqFrame->measReqIE.measType = mr.MeasurementRequest[0].measurement_type;
4490
4491 pMeasReqFrame->measReqIE.measReqField.channelNumber = mr.MeasurementRequest[0].channel_no;
4492
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304493 vos_mem_copy( pMeasReqFrame->measReqIE.measReqField.measStartTime,
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 mr.MeasurementRequest[0].meas_start_time, 8 );
4495
4496 pMeasReqFrame->measReqIE.measReqField.measDuration = mr.MeasurementRequest[0].meas_duration;
4497
4498 return eSIR_SUCCESS;
4499
4500} // End sirConvertMeasReqFrame2Struct.
4501#endif
4502
4503
4504void
4505PopulateDot11fTSPEC(tSirMacTspecIE *pOld,
4506 tDot11fIETSPEC *pDot11f)
4507{
4508 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4509 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4510 pDot11f->direction = pOld->tsinfo.traffic.direction;
4511 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4512 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4513 pDot11f->psb = pOld->tsinfo.traffic.psb;
4514 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4515 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4516 pDot11f->schedule = pOld->tsinfo.schedule.schedule;
4517 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4518 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4519 */
4520 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4521 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4522 pDot11f->max_msdu_size = pOld->maxMsduSz;
4523 pDot11f->min_service_int = pOld->minSvcInterval;
4524 pDot11f->max_service_int = pOld->maxSvcInterval;
4525 pDot11f->inactivity_int = pOld->inactInterval;
4526 pDot11f->suspension_int = pOld->suspendInterval;
4527 pDot11f->service_start_time = pOld->svcStartTime;
4528 pDot11f->min_data_rate = pOld->minDataRate;
4529 pDot11f->mean_data_rate = pOld->meanDataRate;
4530 pDot11f->peak_data_rate = pOld->peakDataRate;
4531 pDot11f->burst_size = pOld->maxBurstSz;
4532 pDot11f->delay_bound = pOld->delayBound;
4533 pDot11f->min_phy_rate = pOld->minPhyRate;
4534 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4535 pDot11f->medium_time = pOld->mediumTime;
4536
4537 pDot11f->present = 1;
4538
4539} // End PopulateDot11fTSPEC.
4540
4541void
4542PopulateDot11fWMMTSPEC(tSirMacTspecIE *pOld,
4543 tDot11fIEWMMTSPEC *pDot11f)
4544{
4545 pDot11f->traffic_type = pOld->tsinfo.traffic.trafficType;
4546 pDot11f->tsid = pOld->tsinfo.traffic.tsid;
4547 pDot11f->direction = pOld->tsinfo.traffic.direction;
4548 pDot11f->access_policy = pOld->tsinfo.traffic.accessPolicy;
4549 pDot11f->aggregation = pOld->tsinfo.traffic.aggregation;
4550 pDot11f->psb = pOld->tsinfo.traffic.psb;
4551 pDot11f->user_priority = pOld->tsinfo.traffic.userPrio;
4552 pDot11f->tsinfo_ack_pol = pOld->tsinfo.traffic.ackPolicy;
4553 pDot11f->burst_size_defn = pOld->tsinfo.traffic.burstSizeDefn;
4554 /* As defined in IEEE 802.11-2007, section 7.3.2.30
4555 * Nominal MSDU size: Bit[0:14]=Size, Bit[15]=Fixed
4556 */
4557 pDot11f->size = ( pOld->nomMsduSz & 0x7fff );
4558 pDot11f->fixed = ( pOld->nomMsduSz & 0x8000 ) ? 1 : 0;
4559 pDot11f->max_msdu_size = pOld->maxMsduSz;
4560 pDot11f->min_service_int = pOld->minSvcInterval;
4561 pDot11f->max_service_int = pOld->maxSvcInterval;
4562 pDot11f->inactivity_int = pOld->inactInterval;
4563 pDot11f->suspension_int = pOld->suspendInterval;
4564 pDot11f->service_start_time = pOld->svcStartTime;
4565 pDot11f->min_data_rate = pOld->minDataRate;
4566 pDot11f->mean_data_rate = pOld->meanDataRate;
4567 pDot11f->peak_data_rate = pOld->peakDataRate;
4568 pDot11f->burst_size = pOld->maxBurstSz;
4569 pDot11f->delay_bound = pOld->delayBound;
4570 pDot11f->min_phy_rate = pOld->minPhyRate;
4571 pDot11f->surplus_bw_allowance = pOld->surplusBw;
4572 pDot11f->medium_time = pOld->mediumTime;
4573
4574 pDot11f->version = 1;
4575 pDot11f->present = 1;
4576
4577} // End PopulateDot11fWMMTSPEC.
4578
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004579#if defined(FEATURE_WLAN_ESE)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004580
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004581// Fill the ESE version currently supported
4582void PopulateDot11fESEVersion(tDot11fIEESEVersion *pESEVersion)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004583{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004584 pESEVersion->present = 1;
4585 pESEVersion->version = ESE_VERSION_SUPPORTED;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004586}
4587
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004588// Fill the ESE ie for the station.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004589// The State is Normal (1)
4590// The MBSSID for station is set to 0.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004591void PopulateDot11fESERadMgmtCap(tDot11fIEESERadMgmtCap *pESERadMgmtCap)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004592{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004593 pESERadMgmtCap->present = 1;
4594 pESERadMgmtCap->mgmt_state = RM_STATE_NORMAL;
4595 pESERadMgmtCap->mbssid_mask = 0;
4596 pESERadMgmtCap->reserved = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004597}
4598
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004599tSirRetStatus PopulateDot11fESECckmOpaque( tpAniSirGlobal pMac,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004600 tpSirCCKMie pCCKMie,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004601 tDot11fIEESECckmOpaque *pDot11f )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004602{
4603 int idx;
4604
4605 if ( pCCKMie->length )
4606 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004607 if( 0 <= ( idx = FindIELocation( pMac, (tpSirRSNie)pCCKMie, DOT11F_EID_ESECCKMOPAQUE ) ) )
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004608 {
4609 pDot11f->present = 1;
4610 pDot11f->num_data = pCCKMie->cckmIEdata[ idx + 1 ] - 4; // Dont include OUI
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08004611 vos_mem_copy(pDot11f->data,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004612 pCCKMie->cckmIEdata + idx + 2 + 4, // EID, len, OUI
4613 pCCKMie->cckmIEdata[ idx + 1 ] - 4 ); // Skip OUI
4614 }
4615 }
4616
4617 return eSIR_SUCCESS;
4618
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004619} // End PopulateDot11fESECckmOpaque.
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004620
Jeff Johnson295189b2012-06-20 16:38:30 -07004621void PopulateDot11TSRSIE(tpAniSirGlobal pMac,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004622 tSirMacESETSRSIE *pOld,
4623 tDot11fIEESETrafStrmRateSet *pDot11f,
Jeff Johnson295189b2012-06-20 16:38:30 -07004624 tANI_U8 rate_length)
4625{
4626 pDot11f->tsid = pOld->tsid;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304627 vos_mem_copy(pDot11f->tsrates, pOld->rates,rate_length);
Jeff Johnson295189b2012-06-20 16:38:30 -07004628 pDot11f->num_tsrates = rate_length;
4629 pDot11f->present = 1;
4630}
4631#endif
4632
4633
4634tSirRetStatus
4635PopulateDot11fTCLAS(tpAniSirGlobal pMac,
4636 tSirTclasInfo *pOld,
4637 tDot11fIETCLAS *pDot11f)
4638{
4639 pDot11f->user_priority = pOld->tclas.userPrio;
4640 pDot11f->classifier_type = pOld->tclas.classifierType;
4641 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4642
4643 switch ( pDot11f->classifier_type )
4644 {
4645 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304646 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
4647 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
4648 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
4649 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004650 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4651 break;
4652 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4653 pDot11f->info.IpParams.version = pOld->version;
4654 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4655 {
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304656 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304657 IpV4Params.source,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304658 pOld->tclasParams.ipv4.srcIpAddr, 4 );
4659 vos_mem_copy( pDot11f->info.IpParams.params.
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304660 IpV4Params.dest,
Arun Kumar Khandavalli95586012014-02-25 12:09:40 +05304661 pOld->tclasParams.ipv4.dstIpAddr, 4 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004662 pDot11f->info.IpParams.params.IpV4Params.src_port =
4663 pOld->tclasParams.ipv4.srcPort;
4664 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4665 pOld->tclasParams.ipv4.dstPort;
4666 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4667 pOld->tclasParams.ipv4.dscp;
4668 pDot11f->info.IpParams.params.IpV4Params.proto =
4669 pOld->tclasParams.ipv4.protocol;
4670 pDot11f->info.IpParams.params.IpV4Params.reserved =
4671 pOld->tclasParams.ipv4.rsvd;
4672 }
4673 else
4674 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304675 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004676 IpV6Params.source,
4677 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304678 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004679 IpV6Params.dest,
4680 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4681 pDot11f->info.IpParams.params.IpV6Params.src_port =
4682 pOld->tclasParams.ipv6.srcPort;
4683 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4684 pOld->tclasParams.ipv6.dstPort;
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 IpV6Params.flow_label,
4687 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4688 }
4689 break;
4690 case SIR_MAC_TCLASTYPE_8021DQ:
4691 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4692 break;
4693 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304694 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004695 pDot11f->classifier_type );
4696 return eSIR_FAILURE;
4697 }
4698
4699 pDot11f->present = 1;
4700
4701 return eSIR_SUCCESS;
4702
4703} // End PopulateDot11fTCLAS.
4704
4705tSirRetStatus
4706PopulateDot11fWMMTCLAS(tpAniSirGlobal pMac,
4707 tSirTclasInfo *pOld,
4708 tDot11fIEWMMTCLAS *pDot11f)
4709{
4710 pDot11f->version = 1;
4711 pDot11f->user_priority = pOld->tclas.userPrio;
4712 pDot11f->classifier_type = pOld->tclas.classifierType;
4713 pDot11f->classifier_mask = pOld->tclas.classifierMask;
4714
4715 switch ( pDot11f->classifier_type )
4716 {
4717 case SIR_MAC_TCLASTYPE_ETHERNET:
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304718 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.source,
Jeff Johnson295189b2012-06-20 16:38:30 -07004719 ( tANI_U8* )&pOld->tclasParams.eth.srcAddr, 6 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304720 vos_mem_copy( ( tANI_U8* )&pDot11f->info.EthParams.dest,
Jeff Johnson295189b2012-06-20 16:38:30 -07004721 ( tANI_U8* )&pOld->tclasParams.eth.dstAddr, 6 );
4722 pDot11f->info.EthParams.type = pOld->tclasParams.eth.type;
4723 break;
4724 case SIR_MAC_TCLASTYPE_TCPUDPIP:
4725 pDot11f->info.IpParams.version = pOld->version;
4726 if ( SIR_MAC_TCLAS_IPV4 == pDot11f->info.IpParams.version )
4727 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304728 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004729 IpV4Params.source,
4730 ( tANI_U8* )pOld->tclasParams.ipv4.srcIpAddr, 4 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304731 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004732 IpV4Params.dest,
4733 ( tANI_U8* )pOld->tclasParams.ipv4.dstIpAddr, 4 );
4734 pDot11f->info.IpParams.params.IpV4Params.src_port =
4735 pOld->tclasParams.ipv4.srcPort;
4736 pDot11f->info.IpParams.params.IpV4Params.dest_port =
4737 pOld->tclasParams.ipv4.dstPort;
4738 pDot11f->info.IpParams.params.IpV4Params.DSCP =
4739 pOld->tclasParams.ipv4.dscp;
4740 pDot11f->info.IpParams.params.IpV4Params.proto =
4741 pOld->tclasParams.ipv4.protocol;
4742 pDot11f->info.IpParams.params.IpV4Params.reserved =
4743 pOld->tclasParams.ipv4.rsvd;
4744 }
4745 else
4746 {
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304747 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004748 IpV6Params.source,
4749 ( tANI_U8* )pOld->tclasParams.ipv6.srcIpAddr, 16 );
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304750 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004751 IpV6Params.dest,
4752 ( tANI_U8* )pOld->tclasParams.ipv6.dstIpAddr, 16 );
4753 pDot11f->info.IpParams.params.IpV6Params.src_port =
4754 pOld->tclasParams.ipv6.srcPort;
4755 pDot11f->info.IpParams.params.IpV6Params.dest_port =
4756 pOld->tclasParams.ipv6.dstPort;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304757 vos_mem_copy( ( tANI_U8* )&pDot11f->info.IpParams.params.
Jeff Johnson295189b2012-06-20 16:38:30 -07004758 IpV6Params.flow_label,
4759 ( tANI_U8* )pOld->tclasParams.ipv6.flowLabel, 3 );
4760 }
4761 break;
4762 case SIR_MAC_TCLASTYPE_8021DQ:
4763 pDot11f->info.Params8021dq.tag_type = pOld->tclasParams.t8021dq.tag;
4764 break;
4765 default:
Sushant Kaushik87787972015-09-11 16:05:00 +05304766 limLog( pMac, LOGE, FL("Bad TCLAS type %d in PopulateDot11fTCLAS."),
Jeff Johnson295189b2012-06-20 16:38:30 -07004767 pDot11f->classifier_type );
4768 return eSIR_FAILURE;
4769 }
4770
4771 pDot11f->present = 1;
4772
4773 return eSIR_SUCCESS;
4774
4775} // End PopulateDot11fWMMTCLAS.
4776
Jeff Johnson295189b2012-06-20 16:38:30 -07004777
4778tSirRetStatus PopulateDot11fWsc(tpAniSirGlobal pMac,
4779 tDot11fIEWscBeacon *pDot11f)
4780{
4781
4782 tANI_U32 wpsState;
4783
4784 pDot11f->Version.present = 1;
4785 pDot11f->Version.major = 0x01;
4786 pDot11f->Version.minor = 0x00;
4787
4788 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304789 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07004790
4791 pDot11f->WPSState.present = 1;
4792 pDot11f->WPSState.state = (tANI_U8) wpsState;
4793
4794 pDot11f->APSetupLocked.present = 0;
4795
4796 pDot11f->SelectedRegistrar.present = 0;
4797
4798 pDot11f->DevicePasswordID.present = 0;
4799
4800 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4801
4802 pDot11f->UUID_E.present = 0;
4803
4804 pDot11f->RFBands.present = 0;
4805
4806 pDot11f->present = 1;
4807 return eSIR_SUCCESS;
4808}
4809
4810tSirRetStatus PopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4811 tDot11fIEWscBeacon *pDot11f)
4812{
4813 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
4814 tANI_U32 devicepasswdId;
4815
4816
4817 pDot11f->APSetupLocked.present = 1;
4818 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
4819
4820 pDot11f->SelectedRegistrar.present = 1;
4821 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
4822
4823 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05304824 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07004825
4826 pDot11f->DevicePasswordID.present = 1;
4827 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
4828
4829 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4830 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
4831
4832 // UUID_E and RF Bands are applicable only for dual band AP
4833
4834 return eSIR_SUCCESS;
4835}
4836
4837tSirRetStatus DePopulateDot11fWscRegistrarInfo(tpAniSirGlobal pMac,
4838 tDot11fIEWscBeacon *pDot11f)
4839{
4840 pDot11f->APSetupLocked.present = 0;
4841 pDot11f->SelectedRegistrar.present = 0;
4842 pDot11f->DevicePasswordID.present = 0;
4843 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4844
4845 return eSIR_SUCCESS;
4846}
Jeff Johnson295189b2012-06-20 16:38:30 -07004847tSirRetStatus PopulateDot11fProbeResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscProbeRes *pDot11f, tpPESession psessionEntry)
4848{
4849
4850 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
4851
4852 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
4853
4854
4855 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
4856 {
4857 pDot11f->present = 1;
4858 pDot11f->Version.present = 1;
4859 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
4860 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
4861 }
4862 else
4863 {
4864 pDot11f->present = 0;
4865 pDot11f->Version.present = 0;
4866 }
4867
4868 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_STATE_PRESENT)
4869 {
4870
4871 pDot11f->WPSState.present = 1;
4872 pDot11f->WPSState.state = (tANI_U8)pSirWPSProbeRspIE->wpsState;
4873 }
4874 else
4875 pDot11f->WPSState.present = 0;
4876
4877 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_APSETUPLOCK_PRESENT)
4878 {
4879 pDot11f->APSetupLocked.present = 1;
4880 pDot11f->APSetupLocked.fLocked = pSirWPSProbeRspIE->APSetupLocked;
4881 }
4882 else
4883 pDot11f->APSetupLocked.present = 0;
4884
4885 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRA_PRESENT)
4886 {
4887 pDot11f->SelectedRegistrar.present = 1;
4888 pDot11f->SelectedRegistrar.selected = pSirWPSProbeRspIE->SelectedRegistra;
4889 }
4890 else
4891 pDot11f->SelectedRegistrar.present = 0;
4892
4893 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICEPASSWORDID_PRESENT)
4894 {
4895 pDot11f->DevicePasswordID.present = 1;
4896 pDot11f->DevicePasswordID.id = pSirWPSProbeRspIE->DevicePasswordID;
4897 }
4898 else
4899 pDot11f->DevicePasswordID.present = 0;
4900
4901 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SELECTEDREGISTRACFGMETHOD_PRESENT)
4902 {
4903 pDot11f->SelectedRegistrarConfigMethods.present = 1;
4904 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSProbeRspIE->SelectedRegistraCfgMethod;
4905 }
4906 else
4907 pDot11f->SelectedRegistrarConfigMethods.present = 0;
4908
4909 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
4910 {
4911 pDot11f->ResponseType.present = 1;
4912 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
4913 }
4914 else
4915 pDot11f->ResponseType.present = 0;
4916
4917 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_UUIDE_PRESENT)
4918 {
4919 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304920 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSProbeRspIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 }
4922 else
4923 pDot11f->UUID_E.present = 0;
4924
4925 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MANUFACTURE_PRESENT)
4926 {
4927 pDot11f->Manufacturer.present = 1;
4928 pDot11f->Manufacturer.num_name = pSirWPSProbeRspIE->Manufacture.num_name;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304929 vos_mem_copy(pDot11f->Manufacturer.name, pSirWPSProbeRspIE->Manufacture.name,
4930 pSirWPSProbeRspIE->Manufacture.num_name);
Jeff Johnson295189b2012-06-20 16:38:30 -07004931 }
4932 else
4933 pDot11f->Manufacturer.present = 0;
4934
4935 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4936 {
4937 pDot11f->ModelName.present = 1;
4938 pDot11f->ModelName.num_text = pSirWPSProbeRspIE->ModelName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304939 vos_mem_copy(pDot11f->ModelName.text, pSirWPSProbeRspIE->ModelName.text,
4940 pDot11f->ModelName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004941 }
4942 else
4943 pDot11f->ModelName.present = 0;
4944
4945 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_MODELNUMBER_PRESENT)
4946 {
4947 pDot11f->ModelNumber.present = 1;
4948 pDot11f->ModelNumber.num_text = pSirWPSProbeRspIE->ModelNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304949 vos_mem_copy(pDot11f->ModelNumber.text, pSirWPSProbeRspIE->ModelNumber.text,
4950 pDot11f->ModelNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004951 }
4952 else
4953 pDot11f->ModelNumber.present = 0;
4954
4955 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_SERIALNUMBER_PRESENT)
4956 {
4957 pDot11f->SerialNumber.present = 1;
4958 pDot11f->SerialNumber.num_text = pSirWPSProbeRspIE->SerialNumber.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304959 vos_mem_copy(pDot11f->SerialNumber.text, pSirWPSProbeRspIE->SerialNumber.text,
4960 pDot11f->SerialNumber.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004961 }
4962 else
4963 pDot11f->SerialNumber.present = 0;
4964
4965 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_PRIMARYDEVICETYPE_PRESENT)
4966 {
4967 pDot11f->PrimaryDeviceType.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304968 vos_mem_copy(pDot11f->PrimaryDeviceType.oui, pSirWPSProbeRspIE->PrimaryDeviceOUI,
4969 sizeof(pSirWPSProbeRspIE->PrimaryDeviceOUI));
Jeff Johnson295189b2012-06-20 16:38:30 -07004970 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16)pSirWPSProbeRspIE->PrimaryDeviceCategory;
4971 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16)pSirWPSProbeRspIE->DeviceSubCategory;
4972 }
4973 else
4974 pDot11f->PrimaryDeviceType.present = 0;
4975
4976 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_DEVICENAME_PRESENT)
4977 {
4978 pDot11f->DeviceName.present = 1;
4979 pDot11f->DeviceName.num_text = pSirWPSProbeRspIE->DeviceName.num_text;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05304980 vos_mem_copy(pDot11f->DeviceName.text, pSirWPSProbeRspIE->DeviceName.text,
4981 pDot11f->DeviceName.num_text);
Jeff Johnson295189b2012-06-20 16:38:30 -07004982 }
4983 else
4984 pDot11f->DeviceName.present = 0;
4985
4986 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_CONFIGMETHODS_PRESENT)
4987 {
4988 pDot11f->ConfigMethods.present = 1;
4989 pDot11f->ConfigMethods.methods = pSirWPSProbeRspIE->ConfigMethod;
4990 }
4991 else
4992 pDot11f->ConfigMethods.present = 0;
4993
4994
4995 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RF_BANDS_PRESENT)
4996 {
4997 pDot11f->RFBands.present = 1;
4998 pDot11f->RFBands.bands = pSirWPSProbeRspIE->RFBand;
4999 }
5000 else
5001 pDot11f->RFBands.present = 0;
5002
5003 return eSIR_SUCCESS;
5004}
5005tSirRetStatus PopulateDot11fAssocResWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscAssocRes *pDot11f, tpPESession psessionEntry)
5006{
5007 tSirWPSProbeRspIE *pSirWPSProbeRspIE;
5008
5009 pSirWPSProbeRspIE = &psessionEntry->APWPSIEs.SirWPSProbeRspIE;
5010
5011 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
5012 {
5013 pDot11f->present = 1;
5014 pDot11f->Version.present = 1;
5015 pDot11f->Version.major = (tANI_U8) ((pSirWPSProbeRspIE->Version & 0xF0)>>4);
5016 pDot11f->Version.minor = (tANI_U8) (pSirWPSProbeRspIE->Version & 0x0F);
5017 }
5018 else
5019 {
5020 pDot11f->present = 0;
5021 pDot11f->Version.present = 0;
5022 }
5023
5024 if(pSirWPSProbeRspIE->FieldPresent & SIR_WPS_PROBRSP_RESPONSETYPE_PRESENT)
5025 {
5026 pDot11f->ResponseType.present = 1;
5027 pDot11f->ResponseType.resType = pSirWPSProbeRspIE->ResponseType;
5028 }
5029 else
5030 pDot11f->ResponseType.present = 0;
5031
5032 return eSIR_SUCCESS;
5033}
5034
5035tSirRetStatus PopulateDot11fBeaconWPSIEs(tpAniSirGlobal pMac, tDot11fIEWscBeacon *pDot11f, tpPESession psessionEntry)
5036{
5037
5038 tSirWPSBeaconIE *pSirWPSBeaconIE;
5039
5040 pSirWPSBeaconIE = &psessionEntry->APWPSIEs.SirWPSBeaconIE;
5041
5042
5043 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_PROBRSP_VER_PRESENT)
5044 {
5045 pDot11f->present = 1;
5046 pDot11f->Version.present = 1;
5047 pDot11f->Version.major = (tANI_U8) ((pSirWPSBeaconIE->Version & 0xF0)>>4);
5048 pDot11f->Version.minor = (tANI_U8) (pSirWPSBeaconIE->Version & 0x0F);
5049 }
5050 else
5051 {
5052 pDot11f->present = 0;
5053 pDot11f->Version.present = 0;
5054 }
5055
5056 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_STATE_PRESENT)
5057 {
5058
5059 pDot11f->WPSState.present = 1;
5060 pDot11f->WPSState.state = (tANI_U8)pSirWPSBeaconIE->wpsState;
5061 }
5062 else
5063 pDot11f->WPSState.present = 0;
5064
5065 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_APSETUPLOCK_PRESENT)
5066 {
5067 pDot11f->APSetupLocked.present = 1;
5068 pDot11f->APSetupLocked.fLocked = pSirWPSBeaconIE->APSetupLocked;
5069 }
5070 else
5071 pDot11f->APSetupLocked.present = 0;
5072
5073 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRA_PRESENT)
5074 {
5075 pDot11f->SelectedRegistrar.present = 1;
5076 pDot11f->SelectedRegistrar.selected = pSirWPSBeaconIE->SelectedRegistra;
5077 }
5078 else
5079 pDot11f->SelectedRegistrar.present = 0;
5080
5081 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_DEVICEPASSWORDID_PRESENT)
5082 {
5083 pDot11f->DevicePasswordID.present = 1;
5084 pDot11f->DevicePasswordID.id = pSirWPSBeaconIE->DevicePasswordID;
5085 }
5086 else
5087 pDot11f->DevicePasswordID.present = 0;
5088
5089 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_SELECTEDREGISTRACFGMETHOD_PRESENT)
5090 {
5091 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5092 pDot11f->SelectedRegistrarConfigMethods.methods = pSirWPSBeaconIE->SelectedRegistraCfgMethod;
5093 }
5094 else
5095 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5096
5097 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_UUIDE_PRESENT)
5098 {
5099 pDot11f->UUID_E.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305100 vos_mem_copy(pDot11f->UUID_E.uuid, pSirWPSBeaconIE->UUID_E, WNI_CFG_WPS_UUID_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07005101 }
5102 else
5103 pDot11f->UUID_E.present = 0;
5104
5105
5106 if(pSirWPSBeaconIE->FieldPresent & SIR_WPS_BEACON_RF_BANDS_PRESENT)
5107 {
5108 pDot11f->RFBands.present = 1;
5109 pDot11f->RFBands.bands = pSirWPSBeaconIE->RFBand;
5110 }
5111 else
5112 pDot11f->RFBands.present = 0;
5113
5114 return eSIR_SUCCESS;
5115}
Jeff Johnson295189b2012-06-20 16:38:30 -07005116tSirRetStatus PopulateDot11fWscInProbeRes(tpAniSirGlobal pMac,
5117 tDot11fIEWscProbeRes *pDot11f)
5118{
5119 tANI_U32 cfgMethods;
5120 tANI_U32 cfgStrLen;
5121 tANI_U32 val;
5122 tANI_U32 wpsVersion, wpsState;
5123
5124
5125 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_VERSION, &wpsVersion) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305126 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_VERSION );
Jeff Johnson295189b2012-06-20 16:38:30 -07005127
5128 pDot11f->Version.present = 1;
5129 pDot11f->Version.major = (tANI_U8) ((wpsVersion & 0xF0)>>4);
5130 pDot11f->Version.minor = (tANI_U8) (wpsVersion & 0x0F);
5131
5132 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_STATE, &wpsState) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305133 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_STATE );
Jeff Johnson295189b2012-06-20 16:38:30 -07005134
5135 pDot11f->WPSState.present = 1;
5136 pDot11f->WPSState.state = (tANI_U8) wpsState;
5137
5138 pDot11f->APSetupLocked.present = 0;
5139
5140 pDot11f->SelectedRegistrar.present = 0;
5141
5142 pDot11f->DevicePasswordID.present = 0;
5143
5144 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5145
5146 pDot11f->ResponseType.present = 1;
5147 if ((pMac->lim.wscIeInfo.reqType == REQ_TYPE_REGISTRAR) ||
5148 (pMac->lim.wscIeInfo.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR)){
5149 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5150 }
5151 else{
5152 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5153 }
5154
5155 /* UUID is a 16 byte long binary. Still use wlan_cfgGetStr to get it. */
5156 pDot11f->UUID_E.present = 1;
5157 cfgStrLen = WNI_CFG_WPS_UUID_LEN;
5158 if (wlan_cfgGetStr(pMac,
5159 WNI_CFG_WPS_UUID,
5160 pDot11f->UUID_E.uuid,
5161 &cfgStrLen) != eSIR_SUCCESS)
5162 {
5163 *(pDot11f->UUID_E.uuid) = '\0';
5164 }
5165
5166 pDot11f->Manufacturer.present = 1;
5167 cfgStrLen = WNI_CFG_MANUFACTURER_NAME_LEN - 1;
5168 if (wlan_cfgGetStr(pMac,
5169 WNI_CFG_MANUFACTURER_NAME,
5170 pDot11f->Manufacturer.name,
5171 &cfgStrLen) != eSIR_SUCCESS)
5172 {
5173 pDot11f->Manufacturer.num_name = 0;
5174 *(pDot11f->Manufacturer.name) = '\0';
5175 }
5176 else
5177 {
5178 pDot11f->Manufacturer.num_name = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305179 pDot11f->Manufacturer.name[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005180 }
5181
5182 pDot11f->ModelName.present = 1;
5183 cfgStrLen = WNI_CFG_MODEL_NAME_LEN - 1;
5184 if (wlan_cfgGetStr(pMac,
5185 WNI_CFG_MODEL_NAME,
5186 pDot11f->ModelName.text,
5187 &cfgStrLen) != eSIR_SUCCESS)
5188 {
5189 pDot11f->ModelName.num_text = 0;
5190 *(pDot11f->ModelName.text) = '\0';
5191 }
5192 else
5193 {
5194 pDot11f->ModelName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305195 pDot11f->ModelName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005196 }
5197
5198 pDot11f->ModelNumber.present = 1;
5199 cfgStrLen = WNI_CFG_MODEL_NUMBER_LEN - 1;
5200 if (wlan_cfgGetStr(pMac,
5201 WNI_CFG_MODEL_NUMBER,
5202 pDot11f->ModelNumber.text,
5203 &cfgStrLen) != eSIR_SUCCESS)
5204 {
5205 pDot11f->ModelNumber.num_text = 0;
5206 *(pDot11f->ModelNumber.text) = '\0';
5207 }
5208 else
5209 {
5210 pDot11f->ModelNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305211 pDot11f->ModelNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005212 }
5213
5214 pDot11f->SerialNumber.present = 1;
5215 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_VERSION_LEN - 1;
5216 if (wlan_cfgGetStr(pMac,
5217 WNI_CFG_MANUFACTURER_PRODUCT_VERSION,
5218 pDot11f->SerialNumber.text,
5219 &cfgStrLen) != eSIR_SUCCESS)
5220 {
5221 pDot11f->SerialNumber.num_text = 0;
5222 *(pDot11f->SerialNumber.text) = '\0';
5223 }
5224 else
5225 {
5226 pDot11f->SerialNumber.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305227 pDot11f->SerialNumber.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005228 }
5229
5230 pDot11f->PrimaryDeviceType.present = 1;
5231
5232 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PRIMARY_DEVICE_CATEGORY, &val) != eSIR_SUCCESS)
5233 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305234 limLog(pMac, LOGP, FL("cfg get prim device category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005235 }
5236 else
5237 pDot11f->PrimaryDeviceType.primary_category = (tANI_U16) val;
5238
5239 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_PIMARY_DEVICE_OUI, &val) != eSIR_SUCCESS)
5240 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305241 limLog(pMac, LOGP, FL("cfg get prim device OUI failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005242 }
5243 else
5244 {
5245 *(pDot11f->PrimaryDeviceType.oui) = (tANI_U8)((val >> 24)& 0xff);
5246 *(pDot11f->PrimaryDeviceType.oui+1) = (tANI_U8)((val >> 16)& 0xff);
5247 *(pDot11f->PrimaryDeviceType.oui+2) = (tANI_U8)((val >> 8)& 0xff);
5248 *(pDot11f->PrimaryDeviceType.oui+3) = (tANI_U8)((val & 0xff));
5249 }
5250
5251 if (wlan_cfgGetInt(pMac, WNI_CFG_WPS_DEVICE_SUB_CATEGORY, &val) != eSIR_SUCCESS)
5252 {
Sushant Kaushik87787972015-09-11 16:05:00 +05305253 limLog(pMac, LOGP, FL("cfg get prim device sub category failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005254 }
5255 else
5256 pDot11f->PrimaryDeviceType.sub_category = (tANI_U16) val;
5257
5258 pDot11f->DeviceName.present = 1;
5259 cfgStrLen = WNI_CFG_MANUFACTURER_PRODUCT_NAME_LEN - 1;
5260 if (wlan_cfgGetStr(pMac,
5261 WNI_CFG_MANUFACTURER_PRODUCT_NAME,
5262 pDot11f->DeviceName.text,
5263 &cfgStrLen) != eSIR_SUCCESS)
5264 {
5265 pDot11f->DeviceName.num_text = 0;
5266 *(pDot11f->DeviceName.text) = '\0';
5267 }
5268 else
5269 {
5270 pDot11f->DeviceName.num_text = (tANI_U8) (cfgStrLen & 0x000000FF);
Sushant Kaushik4fed1e32015-02-21 12:43:46 +05305271 pDot11f->DeviceName.text[cfgStrLen - 1] = '\0';
Jeff Johnson295189b2012-06-20 16:38:30 -07005272 }
5273
5274 if (wlan_cfgGetInt(pMac,
5275 WNI_CFG_WPS_CFG_METHOD,
5276 &cfgMethods) != eSIR_SUCCESS)
5277 {
5278 pDot11f->ConfigMethods.present = 0;
5279 pDot11f->ConfigMethods.methods = 0;
5280 }
5281 else
5282 {
5283 pDot11f->ConfigMethods.present = 1;
5284 pDot11f->ConfigMethods.methods = (tANI_U16) (cfgMethods & 0x0000FFFF);
5285 }
5286
5287 pDot11f->RFBands.present = 0;
5288
5289 pDot11f->present = 1;
5290 return eSIR_SUCCESS;
5291}
5292
5293tSirRetStatus PopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5294 tDot11fIEWscProbeRes *pDot11f)
5295{
5296 const struct sLimWscIeInfo *const pWscIeInfo = &(pMac->lim.wscIeInfo);
5297 tANI_U32 devicepasswdId;
5298
5299 pDot11f->APSetupLocked.present = 1;
5300 pDot11f->APSetupLocked.fLocked = pWscIeInfo->apSetupLocked;
5301
5302 pDot11f->SelectedRegistrar.present = 1;
5303 pDot11f->SelectedRegistrar.selected = pWscIeInfo->selectedRegistrar;
5304
5305 if (wlan_cfgGetInt(pMac, (tANI_U16) WNI_CFG_WPS_DEVICE_PASSWORD_ID, &devicepasswdId) != eSIR_SUCCESS)
Sushant Kaushik87787972015-09-11 16:05:00 +05305306 limLog(pMac, LOGP,"Failed to cfg get id %d", WNI_CFG_WPS_DEVICE_PASSWORD_ID );
Jeff Johnson295189b2012-06-20 16:38:30 -07005307
5308 pDot11f->DevicePasswordID.present = 1;
5309 pDot11f->DevicePasswordID.id = (tANI_U16) devicepasswdId;
5310
5311 pDot11f->SelectedRegistrarConfigMethods.present = 1;
5312 pDot11f->SelectedRegistrarConfigMethods.methods = pWscIeInfo->selectedRegistrarConfigMethods;
5313
5314 // UUID_E and RF Bands are applicable only for dual band AP
5315
5316 return eSIR_SUCCESS;
5317}
5318
5319tSirRetStatus DePopulateDot11fWscRegistrarInfoInProbeRes(tpAniSirGlobal pMac,
5320 tDot11fIEWscProbeRes *pDot11f)
5321{
5322 pDot11f->APSetupLocked.present = 0;
5323 pDot11f->SelectedRegistrar.present = 0;
5324 pDot11f->DevicePasswordID.present = 0;
5325 pDot11f->SelectedRegistrarConfigMethods.present = 0;
5326
5327 return eSIR_SUCCESS;
5328}
5329
5330tSirRetStatus PopulateDot11fAssocResWscIE(tpAniSirGlobal pMac,
5331 tDot11fIEWscAssocRes *pDot11f,
5332 tpSirAssocReq pRcvdAssocReq)
5333{
5334 tDot11fIEWscAssocReq parsedWscAssocReq = { 0, };
5335 tANI_U8 *wscIe;
5336
5337
5338 wscIe = limGetWscIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5339 if(wscIe != NULL)
5340 {
5341 // retreive WSC IE from given AssocReq
5342 dot11fUnpackIeWscAssocReq( pMac,
5343 wscIe + 2 + 4, // EID, length, OUI
5344 wscIe[ 1 ] - 4, // length without OUI
5345 &parsedWscAssocReq );
5346 pDot11f->present = 1;
5347 // version has to be 0x10
5348 pDot11f->Version.present = 1;
5349 pDot11f->Version.major = 0x1;
5350 pDot11f->Version.minor = 0x0;
5351
5352 pDot11f->ResponseType.present = 1;
5353
5354 if ((parsedWscAssocReq.RequestType.reqType == REQ_TYPE_REGISTRAR) ||
5355 (parsedWscAssocReq.RequestType.reqType == REQ_TYPE_WLAN_MANAGER_REGISTRAR))
5356 {
5357 pDot11f->ResponseType.resType = RESP_TYPE_ENROLLEE_OPEN_8021X;
5358 }
5359 else
5360 {
5361 pDot11f->ResponseType.resType = RESP_TYPE_AP;
5362 }
5363 // Version infomration should be taken from our capability as well as peers
5364 // TODO: currently it takes from peers only
5365 if(parsedWscAssocReq.VendorExtension.present &&
5366 parsedWscAssocReq.VendorExtension.Version2.present)
5367 {
5368 pDot11f->VendorExtension.present = 1;
5369 pDot11f->VendorExtension.vendorId[0] = 0x00;
5370 pDot11f->VendorExtension.vendorId[1] = 0x37;
5371 pDot11f->VendorExtension.vendorId[2] = 0x2A;
5372 pDot11f->VendorExtension.Version2.present = 1;
5373 pDot11f->VendorExtension.Version2.major = parsedWscAssocReq.VendorExtension.Version2.major;
5374 pDot11f->VendorExtension.Version2.minor = parsedWscAssocReq.VendorExtension.Version2.minor;
5375 }
5376 }
5377 return eSIR_SUCCESS;
5378}
5379
Jeff Johnson295189b2012-06-20 16:38:30 -07005380tSirRetStatus PopulateDot11AssocResP2PIE(tpAniSirGlobal pMac,
5381 tDot11fIEP2PAssocRes *pDot11f,
5382 tpSirAssocReq pRcvdAssocReq)
5383{
5384 tANI_U8 *p2pIe;
5385
5386 p2pIe = limGetP2pIEPtr(pMac, pRcvdAssocReq->addIE.addIEdata, pRcvdAssocReq->addIE.length);
5387 if(p2pIe != NULL)
5388 {
5389 pDot11f->present = 1;
5390 pDot11f->P2PStatus.present = 1;
5391 pDot11f->P2PStatus.status = eSIR_SUCCESS;
5392 pDot11f->ExtendedListenTiming.present = 0;
5393 }
5394 return eSIR_SUCCESS;
5395}
Jeff Johnson295189b2012-06-20 16:38:30 -07005396
5397#if defined WLAN_FEATURE_VOWIFI
5398
5399tSirRetStatus PopulateDot11fWFATPC( tpAniSirGlobal pMac,
5400 tDot11fIEWFATPC *pDot11f, tANI_U8 txPower, tANI_U8 linkMargin )
5401{
5402 pDot11f->txPower = txPower;
5403 pDot11f->linkMargin = linkMargin;
5404 pDot11f->present = 1;
5405
5406 return eSIR_SUCCESS;
5407}
5408
5409tSirRetStatus PopulateDot11fBeaconReport( tpAniSirGlobal pMac, tDot11fIEMeasurementReport *pDot11f, tSirMacBeaconReport *pBeaconReport )
5410{
5411
5412 pDot11f->report.Beacon.regClass = pBeaconReport->regClass;
5413 pDot11f->report.Beacon.channel = pBeaconReport->channel;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305414 vos_mem_copy( pDot11f->report.Beacon.meas_start_time, pBeaconReport->measStartTime,
5415 sizeof(pDot11f->report.Beacon.meas_start_time) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005416 pDot11f->report.Beacon.meas_duration = pBeaconReport->measDuration;
5417 pDot11f->report.Beacon.condensed_PHY = pBeaconReport->phyType;
5418 pDot11f->report.Beacon.reported_frame_type = !pBeaconReport->bcnProbeRsp;
5419 pDot11f->report.Beacon.RCPI = pBeaconReport->rcpi;
5420 pDot11f->report.Beacon.RSNI = pBeaconReport->rsni;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305421 vos_mem_copy( pDot11f->report.Beacon.BSSID, pBeaconReport->bssid, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07005422 pDot11f->report.Beacon.antenna_id = pBeaconReport->antennaId;
5423 pDot11f->report.Beacon.parent_TSF = pBeaconReport->parentTSF;
5424
5425 if( pBeaconReport->numIes )
5426 {
5427 pDot11f->report.Beacon.BeaconReportFrmBody.present = 1;
Bansidhar Gopalachari0a96a382013-07-24 16:55:34 +05305428 vos_mem_copy( pDot11f->report.Beacon.BeaconReportFrmBody.reportedFields,
5429 pBeaconReport->Ies, pBeaconReport->numIes );
Jeff Johnson295189b2012-06-20 16:38:30 -07005430 pDot11f->report.Beacon.BeaconReportFrmBody.num_reportedFields = pBeaconReport->numIes;
5431 }
5432
5433 return eSIR_SUCCESS;
5434
5435}
5436
5437tSirRetStatus PopulateDot11fRRMIe( tpAniSirGlobal pMac, tDot11fIERRMEnabledCap *pDot11f, tpPESession psessionEntry )
5438{
5439 tpRRMCaps pRrmCaps;
5440
5441 pRrmCaps = rrmGetCapabilities( pMac, psessionEntry );
5442
5443 pDot11f->LinkMeasurement = pRrmCaps->LinkMeasurement ;
5444 pDot11f->NeighborRpt = pRrmCaps->NeighborRpt ;
5445 pDot11f->parallel = pRrmCaps->parallel ;
5446 pDot11f->repeated = pRrmCaps->repeated ;
5447 pDot11f->BeaconPassive = pRrmCaps->BeaconPassive ;
5448 pDot11f->BeaconActive = pRrmCaps->BeaconActive ;
5449 pDot11f->BeaconTable = pRrmCaps->BeaconTable ;
5450 pDot11f->BeaconRepCond = pRrmCaps->BeaconRepCond ;
5451 pDot11f->FrameMeasurement = pRrmCaps->FrameMeasurement ;
5452 pDot11f->ChannelLoad = pRrmCaps->ChannelLoad ;
5453 pDot11f->NoiseHistogram = pRrmCaps->NoiseHistogram ;
5454 pDot11f->statistics = pRrmCaps->statistics ;
5455 pDot11f->LCIMeasurement = pRrmCaps->LCIMeasurement ;
5456 pDot11f->LCIAzimuth = pRrmCaps->LCIAzimuth ;
5457 pDot11f->TCMCapability = pRrmCaps->TCMCapability ;
5458 pDot11f->triggeredTCM = pRrmCaps->triggeredTCM ;
5459 pDot11f->APChanReport = pRrmCaps->APChanReport ;
5460 pDot11f->RRMMIBEnabled = pRrmCaps->RRMMIBEnabled ;
5461 pDot11f->operatingChanMax = pRrmCaps->operatingChanMax ;
5462 pDot11f->nonOperatinChanMax = pRrmCaps->nonOperatingChanMax ;
5463 pDot11f->MeasurementPilot = pRrmCaps->MeasurementPilot ;
5464 pDot11f->MeasurementPilotEnabled = pRrmCaps->MeasurementPilotEnabled ;
5465 pDot11f->NeighborTSFOffset = pRrmCaps->NeighborTSFOffset ;
5466 pDot11f->RCPIMeasurement = pRrmCaps->RCPIMeasurement ;
5467 pDot11f->RSNIMeasurement = pRrmCaps->RSNIMeasurement ;
5468 pDot11f->BssAvgAccessDelay = pRrmCaps->BssAvgAccessDelay ;
5469 pDot11f->BSSAvailAdmission = pRrmCaps->BSSAvailAdmission ;
5470 pDot11f->AntennaInformation = pRrmCaps->AntennaInformation ;
5471
5472 pDot11f->present = 1;
5473 return eSIR_SUCCESS;
5474}
5475#endif
5476
5477#if defined WLAN_FEATURE_VOWIFI_11R
5478void PopulateMDIE( tpAniSirGlobal pMac,
5479 tDot11fIEMobilityDomain *pDot11f, tANI_U8 mdie[SIR_MDIE_SIZE] )
5480{
5481 pDot11f->present = 1;
5482 pDot11f->MDID = (tANI_U16)((mdie[1] << 8) | (mdie[0]));
5483
5484 // Plugfest fix
5485 pDot11f->overDSCap = (mdie[2] & 0x01);
5486 pDot11f->resourceReqCap = ((mdie[2] >> 1) & 0x01);
5487
5488}
5489
5490void PopulateFTInfo( tpAniSirGlobal pMac,
5491 tDot11fIEFTInfo *pDot11f )
5492{
5493 pDot11f->present = 1;
5494 pDot11f->IECount = 0; //TODO: put valid data during reassoc.
5495 //All other info is zero.
5496
5497}
5498#endif
5499
5500void PopulateDot11fAssocRspRates ( tpAniSirGlobal pMac, tDot11fIESuppRates *pSupp,
5501 tDot11fIEExtSuppRates *pExt, tANI_U16 *_11bRates, tANI_U16 *_11aRates )
5502{
5503 tANI_U8 num_supp = 0, num_ext = 0;
5504 tANI_U8 i,j;
5505
5506 for( i = 0 ; (i < SIR_NUM_11B_RATES && _11bRates[i]) ; i++, num_supp++ )
5507 {
5508 pSupp->rates[num_supp] = (tANI_U8)_11bRates[i];
5509 }
5510 for( j = 0 ; (j < SIR_NUM_11A_RATES && _11aRates[j]) ; j++ )
5511 {
5512 if( num_supp < 8 )
5513 pSupp->rates[num_supp++] = (tANI_U8)_11aRates[j];
5514 else
5515 pExt->rates[num_ext++] = (tANI_U8)_11aRates[j];
5516 }
5517
5518 if( num_supp )
5519 {
5520 pSupp->num_rates = num_supp;
5521 pSupp->present = 1;
5522 }
5523 if( num_ext )
5524 {
5525 pExt->num_rates = num_ext;
5526 pExt->present = 1;
5527 }
Chet Lanctot8cecea22014-02-11 19:09:36 -08005528}
5529
5530void PopulateDot11fTimeoutInterval( tpAniSirGlobal pMac,
5531 tDot11fIETimeoutInterval *pDot11f,
5532 tANI_U8 type, tANI_U32 value )
5533{
5534 pDot11f->present = 1;
5535 pDot11f->timeoutType = type;
5536 pDot11f->timeoutValue = value;
5537}
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305538#ifdef SAP_AUTH_OFFLOAD
5539tSirRetStatus
5540sap_auth_offload_construct_rsn_opaque( tDot11fIERSN *pdot11f_rsn,
5541 tDot11fIERSNOpaque *pdot11f)
5542{
5543 tANI_U32 data_len=0;
5544 tANI_U8 *ptr;
5545 tANI_U32 element_len=0;
5546 tANI_U32 count=0;
5547 ptr = (tANI_U8 *)pdot11f->data;
5548 if (pdot11f_rsn->present)
5549 {
5550 pdot11f->present = pdot11f_rsn->present;
5551 element_len = sizeof(pdot11f_rsn->version);
5552 vos_mem_copy(ptr, &pdot11f_rsn->version, element_len);
5553 ptr += element_len;
5554 data_len += element_len;
5555 element_len = sizeof(pdot11f_rsn->gp_cipher_suite);
5556 vos_mem_copy(ptr, pdot11f_rsn->gp_cipher_suite, element_len);
5557 ptr += element_len;
5558 data_len += element_len;
5559
5560 if (pdot11f_rsn->pwise_cipher_suite_count)
5561 {
5562 element_len = sizeof(pdot11f_rsn->pwise_cipher_suite_count);
5563 vos_mem_copy(ptr,
5564 &pdot11f_rsn->pwise_cipher_suite_count,
5565 element_len);
5566 ptr += element_len;
5567 data_len += element_len;
5568 for (count = 0; count < pdot11f_rsn->pwise_cipher_suite_count;
5569 count++)
5570 {
5571 element_len = DOT11F_RSN_OUI_SIZE;
5572 vos_mem_copy(ptr,
5573 &pdot11f_rsn->pwise_cipher_suites[count][0],
5574 element_len);
5575 ptr += element_len;
5576 data_len += element_len;
5577 }
5578 }
5579
Pragaspathi Thilagarajd1b02df2018-06-26 17:08:05 +05305580 if (pdot11f_rsn->akm_suite_cnt)
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305581 {
Pragaspathi Thilagarajd1b02df2018-06-26 17:08:05 +05305582 element_len = sizeof(pdot11f_rsn->akm_suite_cnt);
5583 vos_mem_copy(ptr, &pdot11f_rsn->akm_suite_cnt, element_len);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305584 ptr += element_len;
5585 data_len += element_len;
Pragaspathi Thilagarajd1b02df2018-06-26 17:08:05 +05305586 for (count = 0; count < pdot11f_rsn->akm_suite_cnt; count++)
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305587 {
5588 element_len = DOT11F_RSN_OUI_SIZE;
5589 vos_mem_copy(ptr,
Pragaspathi Thilagarajd1b02df2018-06-26 17:08:05 +05305590 &pdot11f_rsn->akm_suite[count][0],
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305591 element_len);
5592 ptr += element_len;
5593 data_len += element_len;
5594 }
5595 }
5596
5597 element_len = sizeof(pdot11f_rsn->RSN_Cap);
5598 vos_mem_copy(ptr, pdot11f_rsn->RSN_Cap, element_len);
5599 ptr += element_len;
5600 data_len += element_len;
5601 }
5602 pdot11f->num_data = data_len;
5603 return eSIR_SUCCESS;
5604}
5605
5606void
Pragaspathi Thilagarajda4477a2018-09-14 15:56:58 +05305607sap_auth_offload_update_rsn_ie(tpAniSirGlobal pmac,
5608 tDot11fIERSNOpaque *pdot11f)
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305609{
5610 tDot11fIERSN *pdot11f_rsn;
5611 pdot11f_rsn = vos_mem_malloc(sizeof(tDot11fIERSN));
gaurank kathpalia392e4452018-02-26 15:40:30 +05305612 if (!pdot11f_rsn) {
5613 dot11fLog(pmac, LOGE,
5614 FL("Memory allocation failes for RSN IE"));
5615 return;
5616 }
5617
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305618 vos_mem_set(pdot11f_rsn, sizeof(tDot11fIERSN), 0);
5619 /* Assign RSN IE for Software AP Authentication offload security */
5620 if (pmac->sap_auth_offload && pmac->sap_auth_offload_sec_type)
5621 {
5622 switch (pmac->sap_auth_offload_sec_type)
5623 {
5624 case eSIR_OFFLOAD_WPA2PSK_CCMP:
5625 /* Only Support one kind of Cipher Suit for
5626 * Software AP authentication offload
5627 */
5628 pdot11f_rsn->present = 1;
5629 pdot11f_rsn->version = 1;
5630 vos_mem_copy(pdot11f_rsn->gp_cipher_suite,
5631 &sirRSNOui[DOT11F_RSN_CSE_CCMP][0],
5632 DOT11F_RSN_OUI_SIZE);
5633 pdot11f_rsn->pwise_cipher_suite_count = 1;
5634 vos_mem_copy(&(pdot11f_rsn->pwise_cipher_suites[0][0]),
5635 &sirRSNOui[DOT11F_RSN_CSE_CCMP][0],
5636 DOT11F_RSN_OUI_SIZE);
Pragaspathi Thilagarajd1b02df2018-06-26 17:08:05 +05305637 pdot11f_rsn->akm_suite_cnt = 1;
5638 vos_mem_copy(&(pdot11f_rsn->akm_suite[0][0]),
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305639 &sirRSNOui[DOT11F_RSN_CSE_TKIP][0],
5640 DOT11F_RSN_OUI_SIZE);
5641 pdot11f_rsn->pmkid_count = 0;
5642 /* Construct RSN IE into RSNOpaque*/
5643 sap_auth_offload_construct_rsn_opaque(pdot11f_rsn, pdot11f);
5644 break;
5645 default:
5646 dot11fLog( pmac, LOGE,
5647 FL("The security type is not definied for "
5648 "Software AP authentication offload!\n"));
5649 break;
5650 }
5651 }
Pragaspathi Thilagarajda4477a2018-09-14 15:56:58 +05305652 vos_mem_free(pdot11f_rsn);
Agrawal Ashisha8e8a722016-10-18 19:07:45 +05305653}
5654#endif /* SAP_AUTH_OFFLOAD */
5655
Abhishek Singh74037df2017-07-20 11:08:56 +05305656/**
5657 * sir_copy_hs20_ie() - Update HS 2.0 Information Element.
5658 * @dest: dest HS IE buffer to be updated
5659 * @src: src HS IE buffer
5660 *
5661 * Update HS2.0 IE info from src to dest
5662 *
5663 * Return: void
5664 */
5665void sir_copy_hs20_ie(tDot11fIEhs20vendor_ie *dest, tDot11fIEhs20vendor_ie *src)
5666{
5667 if (src->present) {
5668 vos_mem_copy(dest, src,
5669 sizeof(tDot11fIEhs20vendor_ie) -
5670 sizeof(src->hs_id));
5671 if (src->hs_id_present)
5672 vos_mem_copy(&dest->hs_id,
5673 &src->hs_id,
5674 sizeof(src->hs_id));
5675 }
5676}
5677
Jeff Johnson295189b2012-06-20 16:38:30 -07005678// parserApi.c ends here.