blob: 916caffc4a1d213e3f9a018279c4d0d0a5e9f18e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhishek Singh550aa8c2017-10-30 17:34:53 +05302 * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
Chet Lanctot4c986162013-05-08 13:59:56 -070027
Jeff Johnson295189b2012-06-20 16:38:30 -070028/** ------------------------------------------------------------------------- *
29 ------------------------------------------------------------------------- *
30
31
32 \file csrUtil.c
33
34 Implementation supporting routines for CSR.
Jeff Johnson295189b2012-06-20 16:38:30 -070035 ========================================================================== */
36
Jeff Johnson295189b2012-06-20 16:38:30 -070037
Jeff Johnson295189b2012-06-20 16:38:30 -070038#include "aniGlobal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070039
40#include "palApi.h"
41#include "csrSupport.h"
42#include "csrInsideApi.h"
43#include "smsDebug.h"
44#include "smeQosInternal.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070045#include "wlan_qct_wda.h"
46
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080047#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -070048#include "vos_utils.h"
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080049#include "csrEse.h"
50#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD*/
Jeff Johnson295189b2012-06-20 16:38:30 -070051tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ] = {
52 { 0x00, 0x50, 0xf2, 0x00 },
53 { 0x00, 0x50, 0xf2, 0x01 },
54 { 0x00, 0x50, 0xf2, 0x02 },
55 { 0x00, 0x50, 0xf2, 0x03 },
56 { 0x00, 0x50, 0xf2, 0x04 },
57 { 0x00, 0x50, 0xf2, 0x05 },
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080058#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070059 { 0x00, 0x40, 0x96, 0x00 }, // CCKM
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080060#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -070061};
62
63tANI_U8 csrRSNOui[][ CSR_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
Chet Lanctot4c986162013-05-08 13:59:56 -070070 { 0x00, 0x40, 0x96, 0x00 }, // CCKM
Abhishek Singhae408032014-09-25 17:22:04 +053071 { 0x00, 0x0F, 0xAC, 0x06 }, // BIP (encryption type) or RSN-PSK-SHA256 (authentication type)
72 /* RSN-8021X-SHA256 (authentication type) */
73 { 0x00, 0x0F, 0xAC, 0x05 }
Jeff Johnson295189b2012-06-20 16:38:30 -070074};
75
76#ifdef FEATURE_WLAN_WAPI
Kaushik, Sushantfe230152014-04-08 14:37:47 +053077tANI_U8 csrWapiOui[CSR_WAPI_OUI_ROW_SIZE][ CSR_WAPI_OUI_SIZE ] = {
Jeff Johnson295189b2012-06-20 16:38:30 -070078 { 0x00, 0x14, 0x72, 0x00 }, // Reserved
79 { 0x00, 0x14, 0x72, 0x01 }, // WAI certificate or SMS4
80 { 0x00, 0x14, 0x72, 0x02 } // WAI PSK
81};
82#endif /* FEATURE_WLAN_WAPI */
83tANI_U8 csrWmeInfoOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
84tANI_U8 csrWmeParmOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
85
86static tCsrIELenInfo gCsrIELengthTable[] = {
87/* 000 */ { SIR_MAC_SSID_EID_MIN, SIR_MAC_SSID_EID_MAX },
88/* 001 */ { SIR_MAC_RATESET_EID_MIN, SIR_MAC_RATESET_EID_MAX },
89/* 002 */ { SIR_MAC_FH_PARAM_SET_EID_MIN, SIR_MAC_FH_PARAM_SET_EID_MAX },
90/* 003 */ { SIR_MAC_DS_PARAM_SET_EID_MIN, SIR_MAC_DS_PARAM_SET_EID_MAX },
91/* 004 */ { SIR_MAC_CF_PARAM_SET_EID_MIN, SIR_MAC_CF_PARAM_SET_EID_MAX },
92/* 005 */ { SIR_MAC_TIM_EID_MIN, SIR_MAC_TIM_EID_MAX },
93/* 006 */ { SIR_MAC_IBSS_PARAM_SET_EID_MIN, SIR_MAC_IBSS_PARAM_SET_EID_MAX },
94/* 007 */ { SIR_MAC_COUNTRY_EID_MIN, SIR_MAC_COUNTRY_EID_MAX },
95/* 008 */ { SIR_MAC_FH_PARAMS_EID_MIN, SIR_MAC_FH_PARAMS_EID_MAX },
96/* 009 */ { SIR_MAC_FH_PATTERN_EID_MIN, SIR_MAC_FH_PATTERN_EID_MAX },
97/* 010 */ { SIR_MAC_REQUEST_EID_MIN, SIR_MAC_REQUEST_EID_MAX },
98/* 011 */ { SIR_MAC_QBSS_LOAD_EID_MIN, SIR_MAC_QBSS_LOAD_EID_MAX },
99/* 012 */ { SIR_MAC_EDCA_PARAM_SET_EID_MIN, SIR_MAC_EDCA_PARAM_SET_EID_MAX },
100/* 013 */ { SIR_MAC_TSPEC_EID_MIN, SIR_MAC_TSPEC_EID_MAX },
101/* 014 */ { SIR_MAC_TCLAS_EID_MIN, SIR_MAC_TCLAS_EID_MAX },
102/* 015 */ { SIR_MAC_QOS_SCHEDULE_EID_MIN, SIR_MAC_QOS_SCHEDULE_EID_MAX },
103/* 016 */ { SIR_MAC_CHALLENGE_TEXT_EID_MIN, SIR_MAC_CHALLENGE_TEXT_EID_MAX },
104/* 017 */ { 0, 255 },
105/* 018 */ { 0, 255 },
106/* 019 */ { 0, 255 },
107/* 020 */ { 0, 255 },
108/* 021 */ { 0, 255 },
109/* 022 */ { 0, 255 },
110/* 023 */ { 0, 255 },
111/* 024 */ { 0, 255 },
112/* 025 */ { 0, 255 },
113/* 026 */ { 0, 255 },
114/* 027 */ { 0, 255 },
115/* 028 */ { 0, 255 },
116/* 029 */ { 0, 255 },
117/* 030 */ { 0, 255 },
118/* 031 */ { 0, 255 },
119/* 032 */ { SIR_MAC_PWR_CONSTRAINT_EID_MIN, SIR_MAC_PWR_CONSTRAINT_EID_MAX },
120/* 033 */ { SIR_MAC_PWR_CAPABILITY_EID_MIN, SIR_MAC_PWR_CAPABILITY_EID_MAX },
121/* 034 */ { SIR_MAC_TPC_REQ_EID_MIN, SIR_MAC_TPC_REQ_EID_MAX },
122/* 035 */ { SIR_MAC_TPC_RPT_EID_MIN, SIR_MAC_TPC_RPT_EID_MAX },
123/* 036 */ { SIR_MAC_SPRTD_CHNLS_EID_MIN, SIR_MAC_SPRTD_CHNLS_EID_MAX },
124/* 037 */ { SIR_MAC_CHNL_SWITCH_ANN_EID_MIN, SIR_MAC_CHNL_SWITCH_ANN_EID_MAX },
125/* 038 */ { SIR_MAC_MEAS_REQ_EID_MIN, SIR_MAC_MEAS_REQ_EID_MAX },
126/* 039 */ { SIR_MAC_MEAS_RPT_EID_MIN, SIR_MAC_MEAS_RPT_EID_MAX },
127/* 040 */ { SIR_MAC_QUIET_EID_MIN, SIR_MAC_QUIET_EID_MAX },
128/* 041 */ { SIR_MAC_IBSS_DFS_EID_MIN, SIR_MAC_IBSS_DFS_EID_MAX },
129/* 042 */ { SIR_MAC_ERP_INFO_EID_MIN, SIR_MAC_ERP_INFO_EID_MAX },
130/* 043 */ { SIR_MAC_TS_DELAY_EID_MIN, SIR_MAC_TS_DELAY_EID_MAX },
131/* 044 */ { SIR_MAC_TCLAS_PROC_EID_MIN, SIR_MAC_TCLAS_PROC_EID_MAX },
132/* 045 */ { SIR_MAC_QOS_ACTION_EID_MIN, SIR_MAC_QOS_ACTION_EID_MAX },
133/* 046 */ { SIR_MAC_QOS_CAPABILITY_EID_MIN, SIR_MAC_QOS_CAPABILITY_EID_MAX },
134/* 047 */ { 0, 255 },
135/* 048 */ { SIR_MAC_RSN_EID_MIN, SIR_MAC_RSN_EID_MAX },
136/* 049 */ { 0, 255 },
137/* 050 */ { SIR_MAC_EXTENDED_RATE_EID_MIN, SIR_MAC_EXTENDED_RATE_EID_MAX },
138/* 051 */ { 0, 255 },
139/* 052 */ { 0, 255 },
140/* 053 */ { 0, 255 },
141/* 054 */ { 0, 255 },
142/* 055 */ { 0, 255 },
143/* 056 */ { 0, 255 },
144/* 057 */ { 0, 255 },
145/* 058 */ { 0, 255 },
146/* 059 */ { 0, 255 },
147/* 060 */ { 0, 255 },
148/* 061 */ { 0, 255 },
149/* 062 */ { 0, 255 },
150/* 063 */ { 0, 255 },
151/* 064 */ { 0, 255 },
152/* 065 */ { 0, 255 },
153/* 066 */ { 0, 255 },
154/* 067 */ { 0, 255 },
155#ifdef FEATURE_WLAN_WAPI
156/* 068 */ { DOT11F_EID_WAPI, DOT11F_IE_WAPI_MAX_LEN },
157#else
158/* 068 */ { 0, 255 },
159#endif /* FEATURE_WLAN_WAPI */
160/* 069 */ { 0, 255 },
161/* 070 */ { 0, 255 },
162/* 071 */ { 0, 255 },
163/* 072 */ { 0, 255 },
164/* 073 */ { 0, 255 },
165/* 074 */ { 0, 255 },
166/* 075 */ { 0, 255 },
167/* 076 */ { 0, 255 },
168/* 077 */ { 0, 255 },
169/* 078 */ { 0, 255 },
170/* 079 */ { 0, 255 },
171/* 080 */ { 0, 255 },
172/* 081 */ { 0, 255 },
173/* 082 */ { 0, 255 },
174/* 083 */ { 0, 255 },
175/* 084 */ { 0, 255 },
176/* 085 */ { 0, 255 },
177/* 086 */ { 0, 255 },
178/* 087 */ { 0, 255 },
179/* 088 */ { 0, 255 },
180/* 089 */ { 0, 255 },
181/* 090 */ { 0, 255 },
182/* 091 */ { 0, 255 },
183/* 092 */ { 0, 255 },
184/* 093 */ { 0, 255 },
185/* 094 */ { 0, 255 },
186/* 095 */ { 0, 255 },
187/* 096 */ { 0, 255 },
188/* 097 */ { 0, 255 },
189/* 098 */ { 0, 255 },
190/* 099 */ { 0, 255 },
191/* 100 */ { 0, 255 },
192/* 101 */ { 0, 255 },
193/* 102 */ { 0, 255 },
194/* 103 */ { 0, 255 },
195/* 104 */ { 0, 255 },
196/* 105 */ { 0, 255 },
197/* 106 */ { 0, 255 },
198/* 107 */ { 0, 255 },
199/* 108 */ { 0, 255 },
200/* 109 */ { 0, 255 },
201/* 110 */ { 0, 255 },
202/* 111 */ { 0, 255 },
203/* 112 */ { 0, 255 },
204/* 113 */ { 0, 255 },
205/* 114 */ { 0, 255 },
206/* 115 */ { 0, 255 },
207/* 116 */ { 0, 255 },
208/* 117 */ { 0, 255 },
209/* 118 */ { 0, 255 },
210/* 119 */ { 0, 255 },
211/* 120 */ { 0, 255 },
212/* 121 */ { 0, 255 },
213/* 122 */ { 0, 255 },
214/* 123 */ { 0, 255 },
215/* 124 */ { 0, 255 },
216/* 125 */ { 0, 255 },
217/* 126 */ { 0, 255 },
218/* 127 */ { 0, 255 },
219/* 128 */ { 0, 255 },
220/* 129 */ { 0, 255 },
221/* 130 */ { 0, 255 },
222/* 131 */ { 0, 255 },
223/* 132 */ { 0, 255 },
224/* 133 */ { 0, 255 },
225/* 134 */ { 0, 255 },
226/* 135 */ { 0, 255 },
227/* 136 */ { 0, 255 },
228/* 137 */ { 0, 255 },
229/* 138 */ { 0, 255 },
230/* 139 */ { 0, 255 },
231/* 140 */ { 0, 255 },
232/* 141 */ { 0, 255 },
233/* 142 */ { 0, 255 },
234/* 143 */ { 0, 255 },
235/* 144 */ { 0, 255 },
236/* 145 */ { 0, 255 },
237/* 146 */ { 0, 255 },
238/* 147 */ { 0, 255 },
239/* 148 */ { 0, 255 },
240/* 149 */ { 0, 255 },
241/* 150 */ { 0, 255 },
242/* 151 */ { 0, 255 },
243/* 152 */ { 0, 255 },
244/* 153 */ { 0, 255 },
245/* 154 */ { 0, 255 },
246/* 155 */ { 0, 255 },
247/* 156 */ { 0, 255 },
248/* 157 */ { 0, 255 },
249/* 158 */ { 0, 255 },
250/* 159 */ { 0, 255 },
251/* 160 */ { 0, 255 },
252/* 161 */ { 0, 255 },
253/* 162 */ { 0, 255 },
254/* 163 */ { 0, 255 },
255/* 164 */ { 0, 255 },
256/* 165 */ { 0, 255 },
257/* 166 */ { 0, 255 },
258/* 167 */ { 0, 255 },
259/* 168 */ { 0, 255 },
260/* 169 */ { 0, 255 },
261/* 170 */ { 0, 255 },
262/* 171 */ { 0, 255 },
263/* 172 */ { 0, 255 },
264/* 173 */ { 0, 255 },
265/* 174 */ { 0, 255 },
266/* 175 */ { 0, 255 },
267/* 176 */ { 0, 255 },
268/* 177 */ { 0, 255 },
269/* 178 */ { 0, 255 },
270/* 179 */ { 0, 255 },
271/* 180 */ { 0, 255 },
272/* 181 */ { 0, 255 },
273/* 182 */ { 0, 255 },
274/* 183 */ { 0, 255 },
275/* 184 */ { 0, 255 },
276/* 185 */ { 0, 255 },
277/* 186 */ { 0, 255 },
278/* 187 */ { 0, 255 },
279/* 188 */ { 0, 255 },
280/* 189 */ { 0, 255 },
281/* 190 */ { 0, 255 },
282/* 191 */ { 0, 255 },
283/* 192 */ { 0, 255 },
284/* 193 */ { 0, 255 },
285/* 194 */ { 0, 255 },
286/* 195 */ { 0, 255 },
287/* 196 */ { 0, 255 },
288/* 197 */ { 0, 255 },
289/* 198 */ { 0, 255 },
290/* 199 */ { 0, 255 },
291/* 200 */ { 0, 255 },
292/* 201 */ { 0, 255 },
293/* 202 */ { 0, 255 },
294/* 203 */ { 0, 255 },
295/* 204 */ { 0, 255 },
296/* 205 */ { 0, 255 },
297/* 206 */ { 0, 255 },
298/* 207 */ { 0, 255 },
299/* 208 */ { 0, 255 },
300/* 209 */ { 0, 255 },
301/* 210 */ { 0, 255 },
302/* 211 */ { 0, 255 },
303/* 212 */ { 0, 255 },
304/* 213 */ { 0, 255 },
305/* 214 */ { 0, 255 },
306/* 215 */ { 0, 255 },
307/* 216 */ { 0, 255 },
308/* 217 */ { 0, 255 },
309/* 218 */ { 0, 255 },
310/* 219 */ { 0, 255 },
311/* 220 */ { 0, 255 },
312/* 221 */ { SIR_MAC_WPA_EID_MIN, SIR_MAC_WPA_EID_MAX },
313/* 222 */ { 0, 255 },
314/* 223 */ { 0, 255 },
315/* 224 */ { 0, 255 },
316/* 225 */ { 0, 255 },
317/* 226 */ { 0, 255 },
318/* 227 */ { 0, 255 },
319/* 228 */ { 0, 255 },
320/* 229 */ { 0, 255 },
321/* 230 */ { 0, 255 },
322/* 231 */ { 0, 255 },
323/* 232 */ { 0, 255 },
324/* 233 */ { 0, 255 },
325/* 234 */ { 0, 255 },
326/* 235 */ { 0, 255 },
327/* 236 */ { 0, 255 },
328/* 237 */ { 0, 255 },
329/* 238 */ { 0, 255 },
330/* 239 */ { 0, 255 },
331/* 240 */ { 0, 255 },
332/* 241 */ { 0, 255 },
333/* 242 */ { 0, 255 },
334/* 243 */ { 0, 255 },
335/* 244 */ { 0, 255 },
336/* 245 */ { 0, 255 },
337/* 246 */ { 0, 255 },
338/* 247 */ { 0, 255 },
339/* 248 */ { 0, 255 },
340/* 249 */ { 0, 255 },
341/* 250 */ { 0, 255 },
342/* 251 */ { 0, 255 },
343/* 252 */ { 0, 255 },
344/* 253 */ { 0, 255 },
345/* 254 */ { 0, 255 },
346/* 255 */ { SIR_MAC_ANI_WORKAROUND_EID_MIN, SIR_MAC_ANI_WORKAROUND_EID_MAX }
347};
348
349#if 0
350//Don't not insert entry into the table, put it to the end. If you have to insert, make sure it is also
351//reflected in eCsrCountryIndex
352static tCsrCountryInfo gCsrCountryInfo[eCSR_NUM_COUNTRY_INDEX] =
353{
354 {REG_DOMAIN_FCC, {'U', 'S', ' '}}, //USA/******The "US" MUST be at index 0*******/
355 {REG_DOMAIN_WORLD, {'A', 'D', ' '}}, //ANDORRA
356 {REG_DOMAIN_WORLD, {'A', 'E', ' '}}, //UAE
357 {REG_DOMAIN_WORLD, {'A', 'F', ' '}}, //AFGHANISTAN
358 {REG_DOMAIN_WORLD, {'A', 'G', ' '}}, //ANTIGUA AND BARBUDA
359 {REG_DOMAIN_WORLD, {'A', 'I', ' '}}, //ANGUILLA
360 {REG_DOMAIN_HI_5GHZ, {'A', 'L', ' '}}, //ALBANIA
361 {REG_DOMAIN_WORLD, {'A', 'M', ' '}}, //ARMENIA
362 {REG_DOMAIN_WORLD, {'A', 'N', ' '}}, //NETHERLANDS ANTILLES
363 {REG_DOMAIN_WORLD, {'A', 'O', ' '}}, //ANGOLA
364 {REG_DOMAIN_WORLD, {'A', 'Q', ' '}}, //ANTARCTICA
365 {REG_DOMAIN_HI_5GHZ, {'A', 'R', ' '}}, //ARGENTINA
366 {REG_DOMAIN_FCC, {'A', 'S', ' '}}, //AMERICAN SOMOA
367 {REG_DOMAIN_ETSI, {'A', 'T', ' '}}, //AUSTRIA
368 {REG_DOMAIN_ETSI, {'A', 'U', ' '}}, //AUSTRALIA
369 {REG_DOMAIN_WORLD, {'A', 'W', ' '}}, //ARUBA
370 {REG_DOMAIN_WORLD, {'A', 'X', ' '}}, //ALAND ISLANDS
371 {REG_DOMAIN_WORLD, {'A', 'Z', ' '}}, //AZERBAIJAN
372 {REG_DOMAIN_WORLD, {'B', 'A', ' '}}, //BOSNIA AND HERZEGOVINA
373 {REG_DOMAIN_WORLD, {'B', 'B', ' '}}, //BARBADOS
374 {REG_DOMAIN_WORLD, {'B', 'D', ' '}}, //BANGLADESH
375 {REG_DOMAIN_ETSI, {'B', 'E', ' '}}, //BELGIUM
376 {REG_DOMAIN_WORLD, {'B', 'F', ' '}}, //BURKINA FASO
377 {REG_DOMAIN_HI_5GHZ, {'B', 'G', ' '}}, //BULGARIA
378 {REG_DOMAIN_WORLD, {'B', 'H', ' '}}, //BAHRAIN
379 {REG_DOMAIN_WORLD, {'B', 'I', ' '}}, //BURUNDI
380 {REG_DOMAIN_WORLD, {'B', 'J', ' '}}, //BENIN
381 {REG_DOMAIN_WORLD, {'B', 'L', ' '}}, //SAINT BARTHELEMY
382 {REG_DOMAIN_ETSI, {'B', 'M', ' '}}, //BERMUDA
383 {REG_DOMAIN_WORLD, {'B', 'N', ' '}}, //BRUNEI DARUSSALAM
384 {REG_DOMAIN_WORLD, {'B', 'O', ' '}}, //BOLIVIA
385 {REG_DOMAIN_WORLD, {'B', 'R', ' '}}, //BRAZIL
386 {REG_DOMAIN_WORLD, {'B', 'S', ' '}}, //BAHAMAS
387 {REG_DOMAIN_WORLD, {'B', 'T', ' '}}, //BHUTAN
388 {REG_DOMAIN_WORLD, {'B', 'V', ' '}}, //BOUVET ISLAND
389 {REG_DOMAIN_WORLD, {'B', 'W', ' '}}, //BOTSWANA
390 {REG_DOMAIN_WORLD, {'B', 'Y', ' '}}, //BELARUS
391 {REG_DOMAIN_WORLD, {'B', 'Z', ' '}}, //BELIZE
392 {REG_DOMAIN_FCC, {'C', 'A', ' '}}, //CANADA
393 {REG_DOMAIN_WORLD, {'C', 'C', ' '}}, //COCOS (KEELING) ISLANDS
394 {REG_DOMAIN_WORLD, {'C', 'D', ' '}}, //CONGO, THE DEMOCRATIC REPUBLIC OF THE
395 {REG_DOMAIN_WORLD, {'C', 'F', ' '}}, //CENTRAL AFRICAN REPUBLIC
396 {REG_DOMAIN_WORLD, {'C', 'G', ' '}}, //CONGO
397 {REG_DOMAIN_ETSI, {'C', 'H', ' '}}, //SWITZERLAND
398 {REG_DOMAIN_WORLD, {'C', 'I', ' '}}, //COTE D'IVOIRE
399 {REG_DOMAIN_WORLD, {'C', 'K', ' '}}, //COOK ISLANDS
400 {REG_DOMAIN_WORLD, {'C', 'L', ' '}}, //CHILE
401 {REG_DOMAIN_WORLD, {'C', 'M', ' '}}, //CAMEROON
402 {REG_DOMAIN_HI_5GHZ, {'C', 'N', ' '}}, //CHINA
403 {REG_DOMAIN_WORLD, {'C', 'O', ' '}}, //COLOMBIA
404 {REG_DOMAIN_WORLD, {'C', 'R', ' '}}, //COSTA RICA
405 {REG_DOMAIN_WORLD, {'C', 'U', ' '}}, //CUBA
406 {REG_DOMAIN_WORLD, {'C', 'V', ' '}}, //CAPE VERDE
407 {REG_DOMAIN_WORLD, {'C', 'X', ' '}}, //CHRISTMAS ISLAND
408 {REG_DOMAIN_WORLD, {'C', 'Y', ' '}}, //CYPRUS
409 {REG_DOMAIN_HI_5GHZ, {'C', 'Z', ' '}}, //CZECH REPUBLIC
410 {REG_DOMAIN_ETSI, {'D', 'E', ' '}}, //GERMANY
411 {REG_DOMAIN_WORLD, {'D', 'J', ' '}}, //DJIBOUTI
412 {REG_DOMAIN_ETSI, {'D', 'K', ' '}}, //DENMARK
413 {REG_DOMAIN_WORLD, {'D', 'M', ' '}}, //DOMINICA
414 {REG_DOMAIN_WORLD, {'D', 'O', ' '}}, //DOMINICAN REPUBLIC
415 {REG_DOMAIN_WORLD, {'D', 'Z', ' '}}, //ALGERIA
416 {REG_DOMAIN_WORLD, {'E', 'C', ' '}}, //ECUADOR
417 {REG_DOMAIN_HI_5GHZ, {'E', 'E', ' '}}, //ESTONIA
418 {REG_DOMAIN_WORLD, {'E', 'G', ' '}}, //EGYPT
419 {REG_DOMAIN_WORLD, {'E', 'H', ' '}}, //WESTERN SAHARA
420 {REG_DOMAIN_WORLD, {'E', 'R', ' '}}, //ERITREA
421 {REG_DOMAIN_ETSI, {'E', 'S', ' '}}, //SPAIN
422 {REG_DOMAIN_WORLD, {'E', 'T', ' '}}, //ETHIOPIA
423 {REG_DOMAIN_WORLD, {'F', 'I', ' '}}, //FINLAND
424 {REG_DOMAIN_WORLD, {'F', 'J', ' '}}, //FIJI
425 {REG_DOMAIN_WORLD, {'F', 'K', ' '}}, //FALKLAND ISLANDS (MALVINAS)
426 {REG_DOMAIN_WORLD, {'F', 'M', ' '}}, //MICRONESIA, FEDERATED STATES OF
427 {REG_DOMAIN_WORLD, {'F', 'O', ' '}}, //FAROE ISLANDS
428 {REG_DOMAIN_ETSI, {'F', 'R', ' '}}, //FRANCE
429 {REG_DOMAIN_WORLD, {'G', 'A', ' '}}, //GABON
430 {REG_DOMAIN_ETSI, {'G', 'B', ' '}}, //UNITED KINGDOM
431 {REG_DOMAIN_WORLD, {'G', 'D', ' '}}, //GRENADA
432 {REG_DOMAIN_HI_5GHZ, {'G', 'E', ' '}}, //GEORGIA
433 {REG_DOMAIN_WORLD, {'G', 'F', ' '}}, //FRENCH GUIANA
434 {REG_DOMAIN_ETSI, {'G', 'G', ' '}}, //GUERNSEY
435 {REG_DOMAIN_WORLD, {'G', 'H', ' '}}, //GHANA
436 {REG_DOMAIN_WORLD, {'G', 'I', ' '}}, //GIBRALTAR
437 {REG_DOMAIN_WORLD, {'G', 'L', ' '}}, //GREENLAND
438 {REG_DOMAIN_WORLD, {'G', 'M', ' '}}, //GAMBIA
439 {REG_DOMAIN_WORLD, {'G', 'N', ' '}}, //GUINEA
440 {REG_DOMAIN_WORLD, {'G', 'P', ' '}}, //GUADELOUPE
441 {REG_DOMAIN_WORLD, {'G', 'Q', ' '}}, //EQUATORIAL GUINEA
442 {REG_DOMAIN_ETSI, {'G', 'R', ' '}}, //GREECE
443 {REG_DOMAIN_WORLD, {'G', 'S', ' '}}, //SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
444 {REG_DOMAIN_WORLD, {'G', 'T', ' '}}, //GUATEMALA
445 {REG_DOMAIN_WORLD, {'G', 'U', ' '}}, //GUAM
446 {REG_DOMAIN_WORLD, {'G', 'W', ' '}}, //GUINEA-BISSAU
447 {REG_DOMAIN_WORLD, {'G', 'Y', ' '}}, //GUYANA
448 {REG_DOMAIN_WORLD, {'H', 'K', ' '}}, //HONGKONG
449 {REG_DOMAIN_WORLD, {'H', 'M', ' '}}, //HEARD ISLAND AND MCDONALD ISLANDS
450 {REG_DOMAIN_WORLD, {'H', 'N', ' '}}, //HONDURAS
451 {REG_DOMAIN_HI_5GHZ, {'H', 'R', ' '}}, //CROATIA
452 {REG_DOMAIN_WORLD, {'H', 'T', ' '}}, //HAITI
453 {REG_DOMAIN_HI_5GHZ, {'H', 'U', ' '}}, //HUNGARY
454 {REG_DOMAIN_APAC, {'I', 'D', ' '}}, //INDONESIA
455 {REG_DOMAIN_ETSI, {'I', 'E', ' '}}, //IRELAND
456 {REG_DOMAIN_WORLD, {'I', 'L', ' '}}, //ISREAL
457 {REG_DOMAIN_ETSI, {'I', 'M', ' '}}, //ISLE OF MAN
458 {REG_DOMAIN_WORLD, {'I', 'N', ' '}}, //INDIA
459 {REG_DOMAIN_ETSI, {'I', 'O', ' '}}, //BRITISH INDIAN OCEAN TERRITORY
460 {REG_DOMAIN_WORLD, {'I', 'Q', ' '}}, //IRAQ
461 {REG_DOMAIN_WORLD, {'I', 'R', ' '}}, //IRAN, ISLAMIC REPUBLIC OF
462 {REG_DOMAIN_WORLD, {'I', 'S', ' '}}, //ICELAND
463 {REG_DOMAIN_ETSI, {'I', 'T', ' '}}, //ITALY
464 {REG_DOMAIN_ETSI, {'J', 'E', ' '}}, //JERSEY
465 {REG_DOMAIN_WORLD, {'J', 'M', ' '}}, //JAMAICA
466 {REG_DOMAIN_WORLD, {'J', 'O', ' '}}, //JORDAN
467 {REG_DOMAIN_JAPAN, {'J', 'P', ' '}}, //JAPAN
468 {REG_DOMAIN_WORLD, {'K', 'E', ' '}}, //KENYA
469 {REG_DOMAIN_WORLD, {'K', 'G', ' '}}, //KYRGYZSTAN
470 {REG_DOMAIN_WORLD, {'K', 'H', ' '}}, //CAMBODIA
471 {REG_DOMAIN_WORLD, {'K', 'I', ' '}}, //KIRIBATI
472 {REG_DOMAIN_WORLD, {'K', 'M', ' '}}, //COMOROS
473 {REG_DOMAIN_WORLD, {'K', 'N', ' '}}, //SAINT KITTS AND NEVIS
474 {REG_DOMAIN_KOREA, {'K', 'P', ' '}}, //KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
475 {REG_DOMAIN_KOREA, {'K', 'R', ' '}}, //KOREA, REPUBLIC OF
476 {REG_DOMAIN_WORLD, {'K', 'W', ' '}}, //KUWAIT
477 {REG_DOMAIN_WORLD, {'K', 'Y', ' '}}, //CAYMAN ISLANDS
478 {REG_DOMAIN_WORLD, {'K', 'Z', ' '}}, //KAZAKHSTAN
479 {REG_DOMAIN_WORLD, {'L', 'A', ' '}}, //LAO PEOPLE'S DEMOCRATIC REPUBLIC
480 {REG_DOMAIN_WORLD, {'L', 'B', ' '}}, //LEBANON
481 {REG_DOMAIN_WORLD, {'L', 'C', ' '}}, //SAINT LUCIA
482 {REG_DOMAIN_ETSI, {'L', 'I', ' '}}, //LIECHTENSTEIN
483 {REG_DOMAIN_WORLD, {'L', 'K', ' '}}, //SRI LANKA
484 {REG_DOMAIN_WORLD, {'L', 'R', ' '}}, //LIBERIA
485 {REG_DOMAIN_WORLD, {'L', 'S', ' '}}, //LESOTHO
486 {REG_DOMAIN_HI_5GHZ, {'L', 'T', ' '}}, //LITHUANIA
487 {REG_DOMAIN_ETSI, {'L', 'U', ' '}}, //LUXEMBOURG
488 {REG_DOMAIN_HI_5GHZ, {'L', 'V', ' '}}, //LATVIA
489 {REG_DOMAIN_WORLD, {'L', 'Y', ' '}}, //LIBYAN ARAB JAMAHIRIYA
490 {REG_DOMAIN_WORLD, {'M', 'A', ' '}}, //MOROCCO
491 {REG_DOMAIN_ETSI, {'M', 'C', ' '}}, //MONACO
492 {REG_DOMAIN_WORLD, {'M', 'D', ' '}}, //MOLDOVA, REPUBLIC OF
493 {REG_DOMAIN_WORLD, {'M', 'E', ' '}}, //MONTENEGRO
494 {REG_DOMAIN_WORLD, {'M', 'G', ' '}}, //MADAGASCAR
495 {REG_DOMAIN_WORLD, {'M', 'H', ' '}}, //MARSHALL ISLANDS
496 {REG_DOMAIN_WORLD, {'M', 'K', ' '}}, //MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
497 {REG_DOMAIN_WORLD, {'M', 'L', ' '}}, //MALI
498 {REG_DOMAIN_WORLD, {'M', 'M', ' '}}, //MYANMAR
499 {REG_DOMAIN_HI_5GHZ, {'M', 'N', ' '}}, //MONGOLIA
500 {REG_DOMAIN_WORLD, {'M', 'O', ' '}}, //MACAO
501 {REG_DOMAIN_WORLD, {'M', 'P', ' '}}, //NORTHERN MARIANA ISLANDS
502 {REG_DOMAIN_WORLD, {'M', 'Q', ' '}}, //MARTINIQUE
503 {REG_DOMAIN_WORLD, {'M', 'R', ' '}}, //MAURITANIA
504 {REG_DOMAIN_WORLD, {'M', 'S', ' '}}, //MONTSERRAT
505 {REG_DOMAIN_WORLD, {'M', 'T', ' '}}, //MALTA
506 {REG_DOMAIN_WORLD, {'M', 'U', ' '}}, //MAURITIUS
507 {REG_DOMAIN_WORLD, {'M', 'V', ' '}}, //MALDIVES
508 {REG_DOMAIN_WORLD, {'M', 'W', ' '}}, //MALAWI
509 {REG_DOMAIN_WORLD, {'M', 'X', ' '}}, //MEXICO
510 {REG_DOMAIN_HI_5GHZ, {'M', 'Y', ' '}}, //MALAYSIA
511 {REG_DOMAIN_WORLD, {'M', 'Z', ' '}}, //MOZAMBIQUE
512 {REG_DOMAIN_WORLD, {'N', 'A', ' '}}, //NAMIBIA
513 {REG_DOMAIN_WORLD, {'N', 'C', ' '}}, //NEW CALEDONIA
514 {REG_DOMAIN_WORLD, {'N', 'E', ' '}}, //NIGER
515 {REG_DOMAIN_WORLD, {'N', 'F', ' '}}, //NORFOLD ISLAND
516 {REG_DOMAIN_WORLD, {'N', 'G', ' '}}, //NIGERIA
517 {REG_DOMAIN_WORLD, {'N', 'I', ' '}}, //NICARAGUA
518 {REG_DOMAIN_ETSI, {'N', 'L', ' '}}, //NETHERLANDS
519 {REG_DOMAIN_WORLD, {'N', 'O', ' '}}, //NORWAY
520 {REG_DOMAIN_WORLD, {'N', 'P', ' '}}, //NEPAL
521 {REG_DOMAIN_WORLD, {'N', 'R', ' '}}, //NAURU
522 {REG_DOMAIN_WORLD, {'N', 'U', ' '}}, //NIUE
523 {REG_DOMAIN_ETSI, {'N', 'Z', ' '}}, //NEW ZEALAND
524 {REG_DOMAIN_WORLD, {'O', 'M', ' '}}, //OMAN
525 {REG_DOMAIN_WORLD, {'P', 'A', ' '}}, //PANAMA
526 {REG_DOMAIN_WORLD, {'P', 'E', ' '}}, //PERU
527 {REG_DOMAIN_WORLD, {'P', 'F', ' '}}, //FRENCH POLYNESIA
528 {REG_DOMAIN_WORLD, {'P', 'G', ' '}}, //PAPUA NEW GUINEA
529 {REG_DOMAIN_WORLD, {'P', 'H', ' '}}, //PHILIPPINES
530 {REG_DOMAIN_WORLD, {'P', 'K', ' '}}, //PAKISTAN
531 {REG_DOMAIN_WORLD, {'P', 'L', ' '}}, //POLAND
532 {REG_DOMAIN_WORLD, {'P', 'M', ' '}}, //SAINT PIERRE AND MIQUELON
533 {REG_DOMAIN_WORLD, {'P', 'N', ' '}}, //PITCAIRN
534 {REG_DOMAIN_FCC, {'P', 'R', ' '}}, //PUERTO RICO
535 {REG_DOMAIN_WORLD, {'P', 'S', ' '}}, //PALESTINIAN TERRITORY, OCCUPIED
536 {REG_DOMAIN_ETSI, {'P', 'T', ' '}}, //PORTUGAL
537 {REG_DOMAIN_WORLD, {'P', 'W', ' '}}, //PALAU
538 {REG_DOMAIN_WORLD, {'P', 'Y', ' '}}, //PARAGUAY
539 {REG_DOMAIN_WORLD, {'Q', 'A', ' '}}, //QATAR
540 {REG_DOMAIN_WORLD, {'R', 'E', ' '}}, //REUNION
541 {REG_DOMAIN_HI_5GHZ, {'R', 'O', ' '}}, //ROMANIA
542 {REG_DOMAIN_HI_5GHZ, {'R', 'S', ' '}}, //SERBIA
543 {REG_DOMAIN_WORLD, {'R', 'U', ' '}}, //RUSSIA
544 {REG_DOMAIN_WORLD, {'R', 'W', ' '}}, //RWANDA
545 {REG_DOMAIN_WORLD, {'S', 'A', ' '}}, //SAUDI ARABIA
546 {REG_DOMAIN_WORLD, {'S', 'B', ' '}}, //SOLOMON ISLANDS
547 {REG_DOMAIN_ETSI, {'S', 'C', ' '}}, //SEYCHELLES
548 {REG_DOMAIN_WORLD, {'S', 'D', ' '}}, //SUDAN
549 {REG_DOMAIN_ETSI, {'S', 'E', ' '}}, //SWEDEN
550 {REG_DOMAIN_APAC, {'S', 'G', ' '}}, //SINGAPORE
551 {REG_DOMAIN_WORLD, {'S', 'H', ' '}}, //SAINT HELENA
552 {REG_DOMAIN_HI_5GHZ, {'S', 'I', ' '}}, //SLOVENNIA
553 {REG_DOMAIN_WORLD, {'S', 'J', ' '}}, //SVALBARD AND JAN MAYEN
554 {REG_DOMAIN_HI_5GHZ, {'S', 'K', ' '}}, //SLOVAKIA
555 {REG_DOMAIN_WORLD, {'S', 'L', ' '}}, //SIERRA LEONE
556 {REG_DOMAIN_WORLD, {'S', 'M', ' '}}, //SAN MARINO
557 {REG_DOMAIN_WORLD, {'S', 'N', ' '}}, //SENEGAL
558 {REG_DOMAIN_WORLD, {'S', 'O', ' '}}, //SOMALIA
559 {REG_DOMAIN_WORLD, {'S', 'R', ' '}}, //SURINAME
560 {REG_DOMAIN_WORLD, {'S', 'T', ' '}}, //SAO TOME AND PRINCIPE
561 {REG_DOMAIN_WORLD, {'S', 'V', ' '}}, //EL SALVADOR
562 {REG_DOMAIN_WORLD, {'S', 'Y', ' '}}, //SYRIAN ARAB REPUBLIC
563 {REG_DOMAIN_WORLD, {'S', 'Z', ' '}}, //SWAZILAND
564 {REG_DOMAIN_WORLD, {'T', 'C', ' '}}, //TURKS AND CAICOS ISLANDS
565 {REG_DOMAIN_WORLD, {'T', 'D', ' '}}, //CHAD
566 {REG_DOMAIN_WORLD, {'T', 'F', ' '}}, //FRENCH SOUTHERN TERRITORIES
567 {REG_DOMAIN_WORLD, {'T', 'G', ' '}}, //TOGO
568 {REG_DOMAIN_WORLD, {'T', 'H', ' '}}, //THAILAND
569 {REG_DOMAIN_WORLD, {'T', 'J', ' '}}, //TAJIKISTAN
570 {REG_DOMAIN_WORLD, {'T', 'K', ' '}}, //TOKELAU
571 {REG_DOMAIN_WORLD, {'T', 'L', ' '}}, //TIMOR-LESTE
572 {REG_DOMAIN_WORLD, {'T', 'M', ' '}}, //TURKMENISTAN
573 {REG_DOMAIN_WORLD, {'T', 'N', ' '}}, //TUNISIA
574 {REG_DOMAIN_WORLD, {'T', 'O', ' '}}, //TONGA
575 {REG_DOMAIN_WORLD, {'T', 'R', ' '}}, //TURKEY
576 {REG_DOMAIN_WORLD, {'T', 'T', ' '}}, //TRINIDAD AND TOBAGO
577 {REG_DOMAIN_WORLD, {'T', 'V', ' '}}, //TUVALU
578 {REG_DOMAIN_HI_5GHZ, {'T', 'W', ' '}}, //TAIWAN, PROVINCE OF CHINA
579 {REG_DOMAIN_WORLD, {'T', 'Z', ' '}}, //TANZANIA, UNITED REPUBLIC OF
580 {REG_DOMAIN_HI_5GHZ, {'U', 'A', ' '}}, //UKRAINE
581 {REG_DOMAIN_WORLD, {'U', 'G', ' '}}, //UGANDA
582 {REG_DOMAIN_FCC, {'U', 'M', ' '}}, //UNITED STATES MINOR OUTLYING ISLANDS
583 {REG_DOMAIN_WORLD, {'U', 'Y', ' '}}, //URUGUAY
584 {REG_DOMAIN_HI_5GHZ, {'U', 'Z', ' '}}, //UZBEKISTAN
585 {REG_DOMAIN_ETSI, {'V', 'A', ' '}}, //HOLY SEE (VATICAN CITY STATE)
586 {REG_DOMAIN_WORLD, {'V', 'C', ' '}}, //SAINT VINCENT AND THE GRENADINES
587 {REG_DOMAIN_HI_5GHZ, {'V', 'E', ' '}}, //VENEZUELA
588 {REG_DOMAIN_ETSI, {'V', 'G', ' '}}, //VIRGIN ISLANDS, BRITISH
589 {REG_DOMAIN_FCC, {'V', 'I', ' '}}, //VIRGIN ISLANDS, US
590 {REG_DOMAIN_WORLD, {'V', 'N', ' '}}, //VIET NAM
591 {REG_DOMAIN_WORLD, {'V', 'U', ' '}}, //VANUATU
592 {REG_DOMAIN_WORLD, {'W', 'F', ' '}}, //WALLIS AND FUTUNA
593 {REG_DOMAIN_WORLD, {'W', 'S', ' '}}, //SOMOA
594 {REG_DOMAIN_WORLD, {'Y', 'E', ' '}}, //YEMEN
595 {REG_DOMAIN_WORLD, {'Y', 'T', ' '}}, //MAYOTTE
596 {REG_DOMAIN_WORLD, {'Z', 'A', ' '}}, //SOUTH AFRICA
597 {REG_DOMAIN_WORLD, {'Z', 'M', ' '}}, //ZAMBIA
598 {REG_DOMAIN_WORLD, {'Z', 'W', ' '}}, //ZIMBABWE
599
600 {REG_DOMAIN_KOREA, {'K', '1', ' '}}, //Korea alternate 1
601 {REG_DOMAIN_KOREA, {'K', '2', ' '}}, //Korea alternate 2
602 {REG_DOMAIN_KOREA, {'K', '3', ' '}}, //Korea alternate 3
603 {REG_DOMAIN_KOREA, {'K', '4', ' '}}, //Korea alternate 4
604};
605
606
607//The channels listed here doesn't mean they are valid channels for certain domain. They are here only to present
608//whether they should be passive scanned.
609tCsrDomainChnInfo gCsrDomainChnInfo[NUM_REG_DOMAINS] =
610{
611 //REG_DOMAIN_FCC
612 {
613 REG_DOMAIN_FCC,
614 45, //Num channels
615 //Channels
616 {
617 //5GHz
618 //5180 - 5240
619 {36, eSIR_ACTIVE_SCAN},
620 {40, eSIR_ACTIVE_SCAN},
621 {44, eSIR_ACTIVE_SCAN},
622 {48, eSIR_ACTIVE_SCAN},
623 //5250 to 5350
624 {52, eSIR_PASSIVE_SCAN},
625 {56, eSIR_PASSIVE_SCAN},
626 {60, eSIR_PASSIVE_SCAN},
627 {64, eSIR_PASSIVE_SCAN},
628 //5470 to 5725
629 {100, eSIR_PASSIVE_SCAN},
630 {104, eSIR_PASSIVE_SCAN},
631 {108, eSIR_PASSIVE_SCAN},
632 {112, eSIR_PASSIVE_SCAN},
633 {116, eSIR_PASSIVE_SCAN},
634 {120, eSIR_PASSIVE_SCAN},
635 {124, eSIR_PASSIVE_SCAN},
636 {128, eSIR_PASSIVE_SCAN},
637 {132, eSIR_PASSIVE_SCAN},
638 {136, eSIR_PASSIVE_SCAN},
639 {140, eSIR_PASSIVE_SCAN},
640 //5745 - 5825
641 {149, eSIR_ACTIVE_SCAN},
642 {153, eSIR_ACTIVE_SCAN},
643 {157, eSIR_ACTIVE_SCAN},
644 {161, eSIR_ACTIVE_SCAN},
645 {165, eSIR_ACTIVE_SCAN},
646 //4.9GHz
647 //4920 - 5080
648 {240, eSIR_ACTIVE_SCAN},
649 {244, eSIR_ACTIVE_SCAN},
650 {248, eSIR_ACTIVE_SCAN},
651 {252, eSIR_ACTIVE_SCAN},
652 {208, eSIR_ACTIVE_SCAN},
653 {212, eSIR_ACTIVE_SCAN},
654 {216, eSIR_ACTIVE_SCAN},
655 //2,4GHz
656 {1, eSIR_ACTIVE_SCAN},
657 {2, eSIR_ACTIVE_SCAN},
658 {3, eSIR_ACTIVE_SCAN},
659 {4, eSIR_ACTIVE_SCAN},
660 {5, eSIR_ACTIVE_SCAN},
661 {6, eSIR_ACTIVE_SCAN},
662 {7, eSIR_ACTIVE_SCAN},
663 {8, eSIR_ACTIVE_SCAN},
664 {9, eSIR_ACTIVE_SCAN},
665 {10, eSIR_ACTIVE_SCAN},
666 {11, eSIR_ACTIVE_SCAN},
667 {12, eSIR_ACTIVE_SCAN},
668 {13, eSIR_ACTIVE_SCAN},
669 {14, eSIR_ACTIVE_SCAN},
670 }
671 },
672 //REG_DOMAIN_ETSI
673 {
674 REG_DOMAIN_ETSI,
675 45, //Num channels
676 //Channels
677 {
678 //5GHz
679 //5180 - 5240
680 {36, eSIR_ACTIVE_SCAN},
681 {40, eSIR_ACTIVE_SCAN},
682 {44, eSIR_ACTIVE_SCAN},
683 {48, eSIR_ACTIVE_SCAN},
684 //5250 to 5350
685 {52, eSIR_PASSIVE_SCAN},
686 {56, eSIR_PASSIVE_SCAN},
687 {60, eSIR_PASSIVE_SCAN},
688 {64, eSIR_PASSIVE_SCAN},
689 //5470 to 5725
690 {100, eSIR_PASSIVE_SCAN},
691 {104, eSIR_PASSIVE_SCAN},
692 {108, eSIR_PASSIVE_SCAN},
693 {112, eSIR_PASSIVE_SCAN},
694 {116, eSIR_PASSIVE_SCAN},
695 {120, eSIR_PASSIVE_SCAN},
696 {124, eSIR_PASSIVE_SCAN},
697 {128, eSIR_PASSIVE_SCAN},
698 {132, eSIR_PASSIVE_SCAN},
699 {136, eSIR_PASSIVE_SCAN},
700 {140, eSIR_PASSIVE_SCAN},
701 //5745 - 5825
702 {149, eSIR_ACTIVE_SCAN},
703 {153, eSIR_ACTIVE_SCAN},
704 {157, eSIR_ACTIVE_SCAN},
705 {161, eSIR_ACTIVE_SCAN},
706 {165, eSIR_ACTIVE_SCAN},
707 //4.9GHz
708 //4920 - 5080
709 {240, eSIR_ACTIVE_SCAN},
710 {244, eSIR_ACTIVE_SCAN},
711 {248, eSIR_ACTIVE_SCAN},
712 {252, eSIR_ACTIVE_SCAN},
713 {208, eSIR_ACTIVE_SCAN},
714 {212, eSIR_ACTIVE_SCAN},
715 {216, eSIR_ACTIVE_SCAN},
716 //2,4GHz
717 {1, eSIR_ACTIVE_SCAN},
718 {2, eSIR_ACTIVE_SCAN},
719 {3, eSIR_ACTIVE_SCAN},
720 {4, eSIR_ACTIVE_SCAN},
721 {5, eSIR_ACTIVE_SCAN},
722 {6, eSIR_ACTIVE_SCAN},
723 {7, eSIR_ACTIVE_SCAN},
724 {8, eSIR_ACTIVE_SCAN},
725 {9, eSIR_ACTIVE_SCAN},
726 {10, eSIR_ACTIVE_SCAN},
727 {11, eSIR_ACTIVE_SCAN},
728 {12, eSIR_ACTIVE_SCAN},
729 {13, eSIR_ACTIVE_SCAN},
730 {14, eSIR_ACTIVE_SCAN},
731 }
732 },
733 //REG_DOMAIN_JAPAN
734 {
735 REG_DOMAIN_JAPAN,
736 45, //Num channels
737 //Channels
738 {
739 //5GHz
740 //5180 - 5240
741 {36, eSIR_ACTIVE_SCAN},
742 {40, eSIR_ACTIVE_SCAN},
743 {44, eSIR_ACTIVE_SCAN},
744 {48, eSIR_ACTIVE_SCAN},
745 //5250 to 5350
746 {52, eSIR_PASSIVE_SCAN},
747 {56, eSIR_PASSIVE_SCAN},
748 {60, eSIR_PASSIVE_SCAN},
749 {64, eSIR_PASSIVE_SCAN},
750 //5470 to 5725
751 {100, eSIR_PASSIVE_SCAN},
752 {104, eSIR_PASSIVE_SCAN},
753 {108, eSIR_PASSIVE_SCAN},
754 {112, eSIR_PASSIVE_SCAN},
755 {116, eSIR_PASSIVE_SCAN},
756 {120, eSIR_PASSIVE_SCAN},
757 {124, eSIR_PASSIVE_SCAN},
758 {128, eSIR_PASSIVE_SCAN},
759 {132, eSIR_PASSIVE_SCAN},
760 {136, eSIR_PASSIVE_SCAN},
761 {140, eSIR_PASSIVE_SCAN},
762 //5745 - 5825
763 {149, eSIR_ACTIVE_SCAN},
764 {153, eSIR_ACTIVE_SCAN},
765 {157, eSIR_ACTIVE_SCAN},
766 {161, eSIR_ACTIVE_SCAN},
767 {165, eSIR_ACTIVE_SCAN},
768 //4.9GHz
769 //4920 - 5080
770 {240, eSIR_ACTIVE_SCAN},
771 {244, eSIR_ACTIVE_SCAN},
772 {248, eSIR_ACTIVE_SCAN},
773 {252, eSIR_ACTIVE_SCAN},
774 {208, eSIR_ACTIVE_SCAN},
775 {212, eSIR_ACTIVE_SCAN},
776 {216, eSIR_ACTIVE_SCAN},
777 //2,4GHz
778 {1, eSIR_ACTIVE_SCAN},
779 {2, eSIR_ACTIVE_SCAN},
780 {3, eSIR_ACTIVE_SCAN},
781 {4, eSIR_ACTIVE_SCAN},
782 {5, eSIR_ACTIVE_SCAN},
783 {6, eSIR_ACTIVE_SCAN},
784 {7, eSIR_ACTIVE_SCAN},
785 {8, eSIR_ACTIVE_SCAN},
786 {9, eSIR_ACTIVE_SCAN},
787 {10, eSIR_ACTIVE_SCAN},
788 {11, eSIR_ACTIVE_SCAN},
789 {12, eSIR_ACTIVE_SCAN},
790 {13, eSIR_ACTIVE_SCAN},
791 {14, eSIR_ACTIVE_SCAN},
792 }
793 },
794 //REG_DOMAIN_WORLD
795 {
796 REG_DOMAIN_WORLD,
797 45, //Num channels
798 //Channels
799 {
800 //5GHz
801 //5180 - 5240
802 {36, eSIR_ACTIVE_SCAN},
803 {40, eSIR_ACTIVE_SCAN},
804 {44, eSIR_ACTIVE_SCAN},
805 {48, eSIR_ACTIVE_SCAN},
806 //5250 to 5350
807 {52, eSIR_ACTIVE_SCAN},
808 {56, eSIR_ACTIVE_SCAN},
809 {60, eSIR_ACTIVE_SCAN},
810 {64, eSIR_ACTIVE_SCAN},
811 //5470 to 5725
812 {100, eSIR_ACTIVE_SCAN},
813 {104, eSIR_ACTIVE_SCAN},
814 {108, eSIR_ACTIVE_SCAN},
815 {112, eSIR_ACTIVE_SCAN},
816 {116, eSIR_ACTIVE_SCAN},
817 {120, eSIR_ACTIVE_SCAN},
818 {124, eSIR_ACTIVE_SCAN},
819 {128, eSIR_ACTIVE_SCAN},
820 {132, eSIR_ACTIVE_SCAN},
821 {136, eSIR_ACTIVE_SCAN},
822 {140, eSIR_ACTIVE_SCAN},
823 //5745 - 5825
824 {149, eSIR_ACTIVE_SCAN},
825 {153, eSIR_ACTIVE_SCAN},
826 {157, eSIR_ACTIVE_SCAN},
827 {161, eSIR_ACTIVE_SCAN},
828 {165, eSIR_ACTIVE_SCAN},
829 //4.9GHz
830 //4920 - 5080
831 {240, eSIR_ACTIVE_SCAN},
832 {244, eSIR_ACTIVE_SCAN},
833 {248, eSIR_ACTIVE_SCAN},
834 {252, eSIR_ACTIVE_SCAN},
835 {208, eSIR_ACTIVE_SCAN},
836 {212, eSIR_ACTIVE_SCAN},
837 {216, eSIR_ACTIVE_SCAN},
838 //2,4GHz
839 {1, eSIR_ACTIVE_SCAN},
840 {2, eSIR_ACTIVE_SCAN},
841 {3, eSIR_ACTIVE_SCAN},
842 {4, eSIR_ACTIVE_SCAN},
843 {5, eSIR_ACTIVE_SCAN},
844 {6, eSIR_ACTIVE_SCAN},
845 {7, eSIR_ACTIVE_SCAN},
846 {8, eSIR_ACTIVE_SCAN},
847 {9, eSIR_ACTIVE_SCAN},
848 {10, eSIR_ACTIVE_SCAN},
849 {11, eSIR_ACTIVE_SCAN},
850 {12, eSIR_ACTIVE_SCAN},
851 {13, eSIR_ACTIVE_SCAN},
852 {14, eSIR_ACTIVE_SCAN},
853 }
854 },
855 //REG_DOMAIN_N_AMER_EXC_FCC
856 {
857 REG_DOMAIN_N_AMER_EXC_FCC,
858 45, //Num channels
859 //Channels
860 {
861 //5GHz
862 //5180 - 5240
863 {36, eSIR_ACTIVE_SCAN},
864 {40, eSIR_ACTIVE_SCAN},
865 {44, eSIR_ACTIVE_SCAN},
866 {48, eSIR_ACTIVE_SCAN},
867 //5250 to 5350
868 {52, eSIR_PASSIVE_SCAN},
869 {56, eSIR_PASSIVE_SCAN},
870 {60, eSIR_PASSIVE_SCAN},
871 {64, eSIR_PASSIVE_SCAN},
872 //5470 to 5725
873 {100, eSIR_ACTIVE_SCAN},
874 {104, eSIR_ACTIVE_SCAN},
875 {108, eSIR_ACTIVE_SCAN},
876 {112, eSIR_ACTIVE_SCAN},
877 {116, eSIR_ACTIVE_SCAN},
878 {120, eSIR_ACTIVE_SCAN},
879 {124, eSIR_ACTIVE_SCAN},
880 {128, eSIR_ACTIVE_SCAN},
881 {132, eSIR_ACTIVE_SCAN},
882 {136, eSIR_ACTIVE_SCAN},
883 {140, eSIR_ACTIVE_SCAN},
884 //5745 - 5825
885 {149, eSIR_ACTIVE_SCAN},
886 {153, eSIR_ACTIVE_SCAN},
887 {157, eSIR_ACTIVE_SCAN},
888 {161, eSIR_ACTIVE_SCAN},
889 {165, eSIR_ACTIVE_SCAN},
890 //4.9GHz
891 //4920 - 5080
892 {240, eSIR_ACTIVE_SCAN},
893 {244, eSIR_ACTIVE_SCAN},
894 {248, eSIR_ACTIVE_SCAN},
895 {252, eSIR_ACTIVE_SCAN},
896 {208, eSIR_ACTIVE_SCAN},
897 {212, eSIR_ACTIVE_SCAN},
898 {216, eSIR_ACTIVE_SCAN},
899 //2,4GHz
900 {1, eSIR_ACTIVE_SCAN},
901 {2, eSIR_ACTIVE_SCAN},
902 {3, eSIR_ACTIVE_SCAN},
903 {4, eSIR_ACTIVE_SCAN},
904 {5, eSIR_ACTIVE_SCAN},
905 {6, eSIR_ACTIVE_SCAN},
906 {7, eSIR_ACTIVE_SCAN},
907 {8, eSIR_ACTIVE_SCAN},
908 {9, eSIR_ACTIVE_SCAN},
909 {10, eSIR_ACTIVE_SCAN},
910 {11, eSIR_ACTIVE_SCAN},
911 {12, eSIR_ACTIVE_SCAN},
912 {13, eSIR_ACTIVE_SCAN},
913 {14, eSIR_ACTIVE_SCAN},
914 }
915 },
916 //REG_DOMAIN_APAC
917 {
918 REG_DOMAIN_APAC,
919 45, //Num channels
920 //Channels
921 {
922 //5GHz
923 //5180 - 5240
924 {36, eSIR_ACTIVE_SCAN},
925 {40, eSIR_ACTIVE_SCAN},
926 {44, eSIR_ACTIVE_SCAN},
927 {48, eSIR_ACTIVE_SCAN},
928 //5250 to 5350
929 {52, eSIR_PASSIVE_SCAN},
930 {56, eSIR_PASSIVE_SCAN},
931 {60, eSIR_PASSIVE_SCAN},
932 {64, eSIR_PASSIVE_SCAN},
933 //5470 to 5725
934 {100, eSIR_ACTIVE_SCAN},
935 {104, eSIR_ACTIVE_SCAN},
936 {108, eSIR_ACTIVE_SCAN},
937 {112, eSIR_ACTIVE_SCAN},
938 {116, eSIR_ACTIVE_SCAN},
939 {120, eSIR_ACTIVE_SCAN},
940 {124, eSIR_ACTIVE_SCAN},
941 {128, eSIR_ACTIVE_SCAN},
942 {132, eSIR_ACTIVE_SCAN},
943 {136, eSIR_ACTIVE_SCAN},
944 {140, eSIR_ACTIVE_SCAN},
945 //5745 - 5825
946 {149, eSIR_ACTIVE_SCAN},
947 {153, eSIR_ACTIVE_SCAN},
948 {157, eSIR_ACTIVE_SCAN},
949 {161, eSIR_ACTIVE_SCAN},
950 {165, eSIR_ACTIVE_SCAN},
951 //4.9GHz
952 //4920 - 5080
953 {240, eSIR_ACTIVE_SCAN},
954 {244, eSIR_ACTIVE_SCAN},
955 {248, eSIR_ACTIVE_SCAN},
956 {252, eSIR_ACTIVE_SCAN},
957 {208, eSIR_ACTIVE_SCAN},
958 {212, eSIR_ACTIVE_SCAN},
959 {216, eSIR_ACTIVE_SCAN},
960 //2,4GHz
961 {1, eSIR_ACTIVE_SCAN},
962 {2, eSIR_ACTIVE_SCAN},
963 {3, eSIR_ACTIVE_SCAN},
964 {4, eSIR_ACTIVE_SCAN},
965 {5, eSIR_ACTIVE_SCAN},
966 {6, eSIR_ACTIVE_SCAN},
967 {7, eSIR_ACTIVE_SCAN},
968 {8, eSIR_ACTIVE_SCAN},
969 {9, eSIR_ACTIVE_SCAN},
970 {10, eSIR_ACTIVE_SCAN},
971 {11, eSIR_ACTIVE_SCAN},
972 {12, eSIR_ACTIVE_SCAN},
973 {13, eSIR_ACTIVE_SCAN},
974 {14, eSIR_ACTIVE_SCAN},
975 }
976 },
977 //REG_DOMAIN_KOREA
978 {
979 REG_DOMAIN_KOREA,
980 45, //Num channels
981 //Channels
982 {
983 //5GHz
984 //5180 - 5240
985 {36, eSIR_ACTIVE_SCAN},
986 {40, eSIR_ACTIVE_SCAN},
987 {44, eSIR_ACTIVE_SCAN},
988 {48, eSIR_ACTIVE_SCAN},
989 //5250 to 5350
990 {52, eSIR_PASSIVE_SCAN},
991 {56, eSIR_PASSIVE_SCAN},
992 {60, eSIR_PASSIVE_SCAN},
993 {64, eSIR_PASSIVE_SCAN},
994 //5470 to 5725
995 {100, eSIR_PASSIVE_SCAN},
996 {104, eSIR_PASSIVE_SCAN},
997 {108, eSIR_PASSIVE_SCAN},
998 {112, eSIR_PASSIVE_SCAN},
999 {116, eSIR_PASSIVE_SCAN},
1000 {120, eSIR_PASSIVE_SCAN},
1001 {124, eSIR_PASSIVE_SCAN},
1002 {128, eSIR_PASSIVE_SCAN},
1003 {132, eSIR_PASSIVE_SCAN},
1004 {136, eSIR_PASSIVE_SCAN},
1005 {140, eSIR_PASSIVE_SCAN},
1006 //5745 - 5825
1007 {149, eSIR_ACTIVE_SCAN},
1008 {153, eSIR_ACTIVE_SCAN},
1009 {157, eSIR_ACTIVE_SCAN},
1010 {161, eSIR_ACTIVE_SCAN},
1011 {165, eSIR_ACTIVE_SCAN},
1012 //4.9GHz
1013 //4920 - 5080
1014 {240, eSIR_ACTIVE_SCAN},
1015 {244, eSIR_ACTIVE_SCAN},
1016 {248, eSIR_ACTIVE_SCAN},
1017 {252, eSIR_ACTIVE_SCAN},
1018 {208, eSIR_ACTIVE_SCAN},
1019 {212, eSIR_ACTIVE_SCAN},
1020 {216, eSIR_ACTIVE_SCAN},
1021 //2,4GHz
1022 {1, eSIR_ACTIVE_SCAN},
1023 {2, eSIR_ACTIVE_SCAN},
1024 {3, eSIR_ACTIVE_SCAN},
1025 {4, eSIR_ACTIVE_SCAN},
1026 {5, eSIR_ACTIVE_SCAN},
1027 {6, eSIR_ACTIVE_SCAN},
1028 {7, eSIR_ACTIVE_SCAN},
1029 {8, eSIR_ACTIVE_SCAN},
1030 {9, eSIR_ACTIVE_SCAN},
1031 {10, eSIR_ACTIVE_SCAN},
1032 {11, eSIR_ACTIVE_SCAN},
1033 {12, eSIR_ACTIVE_SCAN},
1034 {13, eSIR_ACTIVE_SCAN},
1035 {14, eSIR_ACTIVE_SCAN},
1036 }
1037 },
1038 //REG_DOMAIN_HI_5GHZ
1039 {
1040 REG_DOMAIN_HI_5GHZ,
1041 45, //Num channels
1042 //Channels
1043 {
1044 //5GHz
1045 //5180 - 5240
1046 {36, eSIR_ACTIVE_SCAN},
1047 {40, eSIR_ACTIVE_SCAN},
1048 {44, eSIR_ACTIVE_SCAN},
1049 {48, eSIR_ACTIVE_SCAN},
1050 //5250 to 5350
1051 {52, eSIR_ACTIVE_SCAN},
1052 {56, eSIR_ACTIVE_SCAN},
1053 {60, eSIR_ACTIVE_SCAN},
1054 {64, eSIR_ACTIVE_SCAN},
1055 //5470 to 5725
1056 {100, eSIR_ACTIVE_SCAN},
1057 {104, eSIR_ACTIVE_SCAN},
1058 {108, eSIR_ACTIVE_SCAN},
1059 {112, eSIR_ACTIVE_SCAN},
1060 {116, eSIR_ACTIVE_SCAN},
1061 {120, eSIR_ACTIVE_SCAN},
1062 {124, eSIR_ACTIVE_SCAN},
1063 {128, eSIR_ACTIVE_SCAN},
1064 {132, eSIR_ACTIVE_SCAN},
1065 {136, eSIR_ACTIVE_SCAN},
1066 {140, eSIR_ACTIVE_SCAN},
1067 //5745 - 5825
1068 {149, eSIR_ACTIVE_SCAN},
1069 {153, eSIR_ACTIVE_SCAN},
1070 {157, eSIR_ACTIVE_SCAN},
1071 {161, eSIR_ACTIVE_SCAN},
1072 {165, eSIR_ACTIVE_SCAN},
1073 //4.9GHz
1074 //4920 - 5080
1075 {240, eSIR_ACTIVE_SCAN},
1076 {244, eSIR_ACTIVE_SCAN},
1077 {248, eSIR_ACTIVE_SCAN},
1078 {252, eSIR_ACTIVE_SCAN},
1079 {208, eSIR_ACTIVE_SCAN},
1080 {212, eSIR_ACTIVE_SCAN},
1081 {216, eSIR_ACTIVE_SCAN},
1082 //2,4GHz
1083 {1, eSIR_ACTIVE_SCAN},
1084 {2, eSIR_ACTIVE_SCAN},
1085 {3, eSIR_ACTIVE_SCAN},
1086 {4, eSIR_ACTIVE_SCAN},
1087 {5, eSIR_ACTIVE_SCAN},
1088 {6, eSIR_ACTIVE_SCAN},
1089 {7, eSIR_ACTIVE_SCAN},
1090 {8, eSIR_ACTIVE_SCAN},
1091 {9, eSIR_ACTIVE_SCAN},
1092 {10, eSIR_ACTIVE_SCAN},
1093 {11, eSIR_ACTIVE_SCAN},
1094 {12, eSIR_ACTIVE_SCAN},
1095 {13, eSIR_ACTIVE_SCAN},
1096 {14, eSIR_ACTIVE_SCAN},
1097 }
1098 },
1099 //REG_DOMAIN_NO_5GHZ
1100 {
1101 REG_DOMAIN_NO_5GHZ,
1102 45, //Num channels
1103 //Channels
1104 {
1105 //5GHz
1106 //5180 - 5240
1107 {36, eSIR_ACTIVE_SCAN},
1108 {40, eSIR_ACTIVE_SCAN},
1109 {44, eSIR_ACTIVE_SCAN},
1110 {48, eSIR_ACTIVE_SCAN},
1111 //5250 to 5350
1112 {52, eSIR_ACTIVE_SCAN},
1113 {56, eSIR_ACTIVE_SCAN},
1114 {60, eSIR_ACTIVE_SCAN},
1115 {64, eSIR_ACTIVE_SCAN},
1116 //5470 to 5725
1117 {100, eSIR_ACTIVE_SCAN},
1118 {104, eSIR_ACTIVE_SCAN},
1119 {108, eSIR_ACTIVE_SCAN},
1120 {112, eSIR_ACTIVE_SCAN},
1121 {116, eSIR_ACTIVE_SCAN},
1122 {120, eSIR_ACTIVE_SCAN},
1123 {124, eSIR_ACTIVE_SCAN},
1124 {128, eSIR_ACTIVE_SCAN},
1125 {132, eSIR_ACTIVE_SCAN},
1126 {136, eSIR_ACTIVE_SCAN},
1127 {140, eSIR_ACTIVE_SCAN},
1128 //5745 - 5825
1129 {149, eSIR_ACTIVE_SCAN},
1130 {153, eSIR_ACTIVE_SCAN},
1131 {157, eSIR_ACTIVE_SCAN},
1132 {161, eSIR_ACTIVE_SCAN},
1133 {165, eSIR_ACTIVE_SCAN},
1134 //4.9GHz
1135 //4920 - 5080
1136 {240, eSIR_ACTIVE_SCAN},
1137 {244, eSIR_ACTIVE_SCAN},
1138 {248, eSIR_ACTIVE_SCAN},
1139 {252, eSIR_ACTIVE_SCAN},
1140 {208, eSIR_ACTIVE_SCAN},
1141 {212, eSIR_ACTIVE_SCAN},
1142 {216, eSIR_ACTIVE_SCAN},
1143 //2,4GHz
1144 {1, eSIR_ACTIVE_SCAN},
1145 {2, eSIR_ACTIVE_SCAN},
1146 {3, eSIR_ACTIVE_SCAN},
1147 {4, eSIR_ACTIVE_SCAN},
1148 {5, eSIR_ACTIVE_SCAN},
1149 {6, eSIR_ACTIVE_SCAN},
1150 {7, eSIR_ACTIVE_SCAN},
1151 {8, eSIR_ACTIVE_SCAN},
1152 {9, eSIR_ACTIVE_SCAN},
1153 {10, eSIR_ACTIVE_SCAN},
1154 {11, eSIR_ACTIVE_SCAN},
1155 {12, eSIR_ACTIVE_SCAN},
1156 {13, eSIR_ACTIVE_SCAN},
1157 {14, eSIR_ACTIVE_SCAN},
1158 }
1159 },
1160};
1161#endif
1162
1163extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS];
1164
Jeff Johnson295189b2012-06-20 16:38:30 -07001165////////////////////////////////////////////////////////////////////////
1166
1167/**
1168 * \var gPhyRatesSuppt
1169 *
1170 * \brief Rate support lookup table
1171 *
1172 *
1173 * This is a lookup table indexing rates & configuration parameters to
1174 * support. Given a rate (in unites of 0.5Mpbs) & three booleans (MIMO
1175 * Enabled, Channel Bonding Enabled, & Concatenation Enabled), one can
1176 * determine whether the given rate is supported by computing two
1177 * indices. The first maps the rate to table row as indicated below
1178 * (i.e. eHddSuppRate_6Mbps maps to row zero, eHddSuppRate_9Mbps to row
1179 * 1, and so on). Index two can be computed like so:
1180 *
1181 * \code
1182 idx2 = ( fEsf ? 0x4 : 0x0 ) |
1183 ( fCb ? 0x2 : 0x0 ) |
1184 ( fMimo ? 0x1 : 0x0 );
1185 * \endcode
1186 *
1187 *
1188 * Given that:
1189 *
1190 \code
1191 fSupported = gPhyRatesSuppt[idx1][idx2];
1192 \endcode
1193 *
1194 *
1195 * This table is based on the document "PHY Supported Rates.doc". This
1196 * table is permissive in that a rate is reflected as being supported
1197 * even when turning off an enabled feature would be required. For
1198 * instance, "PHY Supported Rates" lists 42Mpbs as unsupported when CB,
1199 * ESF, & MIMO are all on. However, if we turn off either of CB or
1200 * MIMO, it then becomes supported. Therefore, we mark it as supported
1201 * even in index 7 of this table.
1202 *
1203 *
1204 */
1205
1206static const tANI_BOOLEAN gPhyRatesSuppt[24][8] = {
1207
1208 // SSF SSF SSF SSF ESF ESF ESF ESF
1209 // SIMO MIMO SIMO MIMO SIMO MIMO SIMO MIMO
1210 // No CB No CB CB CB No CB No CB CB CB
1211 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 6Mbps
1212 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 9Mbps
1213 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 12Mbps
1214 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 18Mbps
1215 { FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE }, // 20Mbps
1216 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 24Mbps
1217 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 36Mbps
1218 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 40Mbps
1219 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 42Mbps
1220 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 48Mbps
1221 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 54Mbps
1222 { FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 72Mbps
1223 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 80Mbps
1224 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 84Mbps
1225 { FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 96Mbps
1226 { FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 108Mbps
1227 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 120Mbps
1228 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 126Mbps
1229 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 144Mbps
1230 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 160Mbps
1231 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 168Mbps
1232 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 192Mbps
1233 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 216Mbps
1234 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 240Mbps
1235
1236};
1237
1238#define CASE_RETURN_STR(n) case (n): return (#n)
1239
1240const char *
1241get_eRoamCmdStatus_str(eRoamCmdStatus val)
1242{
1243 switch (val)
1244 {
1245 CASE_RETURN_STR(eCSR_ROAM_CANCELLED);
Konamki, Sreelakshmib9c45712015-07-29 11:48:19 +05301246 CASE_RETURN_STR(eCSR_ROAM_FAILED);
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 CASE_RETURN_STR(eCSR_ROAM_ROAMING_START);
1248 CASE_RETURN_STR(eCSR_ROAM_ROAMING_COMPLETION);
Konamki, Sreelakshmib9c45712015-07-29 11:48:19 +05301249 CASE_RETURN_STR(eCSR_ROAM_CONNECT_COMPLETION);
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_START);
1251 CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_COMPLETION);
1252 CASE_RETURN_STR(eCSR_ROAM_DISASSOCIATED);
1253 CASE_RETURN_STR(eCSR_ROAM_SHOULD_ROAM);
1254 CASE_RETURN_STR(eCSR_ROAM_SCAN_FOUND_NEW_BSS);
1255 CASE_RETURN_STR(eCSR_ROAM_LOSTLINK);
Konamki, Sreelakshmib9c45712015-07-29 11:48:19 +05301256 CASE_RETURN_STR(eCSR_ROAM_LOSTLINK_DETECTED);
1257 CASE_RETURN_STR(eCSR_ROAM_MIC_ERROR_IND);
1258 CASE_RETURN_STR(eCSR_ROAM_IBSS_IND);
1259 CASE_RETURN_STR(eCSR_ROAM_CONNECT_STATUS_UPDATE);
1260 CASE_RETURN_STR(eCSR_ROAM_GEN_INFO);
1261 CASE_RETURN_STR(eCSR_ROAM_SET_KEY_COMPLETE);
1262 CASE_RETURN_STR(eCSR_ROAM_REMOVE_KEY_COMPLETE);
1263 CASE_RETURN_STR(eCSR_ROAM_IBSS_LEAVE);
1264 CASE_RETURN_STR(eCSR_ROAM_WDS_IND);
1265 CASE_RETURN_STR(eCSR_ROAM_INFRA_IND);
1266 CASE_RETURN_STR(eCSR_ROAM_WPS_PBC_PROBE_REQ_IND);
1267#ifdef WLAN_FEATURE_VOWIFI_11R
1268 CASE_RETURN_STR(eCSR_ROAM_FT_RESPONSE);
1269#endif
1270 CASE_RETURN_STR(eCSR_ROAM_FT_START);
Konamki, Sreelakshmib9c45712015-07-29 11:48:19 +05301271 CASE_RETURN_STR(eCSR_ROAM_REMAIN_CHAN_READY);
1272 CASE_RETURN_STR(eCSR_ROAM_SEND_ACTION_CNF);
1273 CASE_RETURN_STR(eCSR_ROAM_SESSION_OPENED);
1274 CASE_RETURN_STR(eCSR_ROAM_FT_REASSOC_FAILED);
1275#ifdef FEATURE_WLAN_LFR
1276 CASE_RETURN_STR(eCSR_ROAM_PMK_NOTIFY);
1277#endif
1278#ifdef FEATURE_WLAN_LFR_METRICS
1279 CASE_RETURN_STR(eCSR_ROAM_PREAUTH_INIT_NOTIFY);
1280 CASE_RETURN_STR(eCSR_ROAM_PREAUTH_STATUS_SUCCESS);
1281 CASE_RETURN_STR(eCSR_ROAM_PREAUTH_STATUS_FAILURE);
1282 CASE_RETURN_STR(eCSR_ROAM_HANDOVER_SUCCESS);
1283#endif
1284#ifdef FEATURE_WLAN_TDLS
1285 CASE_RETURN_STR(eCSR_ROAM_TDLS_STATUS_UPDATE);
1286 CASE_RETURN_STR(eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND);
1287#endif
1288 CASE_RETURN_STR(eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS);
1289 CASE_RETURN_STR(eCSR_ROAM_SEND_P2P_STOP_BSS);
1290#ifdef WLAN_FEATURE_11W
1291 CASE_RETURN_STR(eCSR_ROAM_UNPROT_MGMT_FRAME_IND);
1292#endif
1293#ifdef WLAN_FEATURE_RMC
1294 CASE_RETURN_STR(eCSR_ROAM_IBSS_PEER_INFO_COMPLETE);
1295#endif
1296#ifdef WLAN_FEATURE_AP_HT40_24G
1297 CASE_RETURN_STR(eCSR_ROAM_2040_COEX_INFO_IND);
1298#endif
1299#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
1300 CASE_RETURN_STR(eCSR_ROAM_TSM_IE_IND);
1301 CASE_RETURN_STR(eCSR_ROAM_CCKM_PREAUTH_NOTIFY);
1302 CASE_RETURN_STR(eCSR_ROAM_ESE_ADJ_AP_REPORT_IND);
1303 CASE_RETURN_STR(eCSR_ROAM_ESE_BCN_REPORT_IND);
1304#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
1305 CASE_RETURN_STR(eCSR_ROAM_UPDATE_MAX_RATE_IND);
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05301306 CASE_RETURN_STR(eCSR_ROAM_LOST_LINK_PARAMS_IND);
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301307 CASE_RETURN_STR(eCSR_ROAM_ECSA_BCN_TX_IND);
1308 CASE_RETURN_STR(eCSR_ROAM_ECSA_CHAN_CHANGE_RSP);
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 default:
1310 return "unknown";
1311 }
1312}
1313
1314const char *
1315get_eCsrRoamResult_str(eCsrRoamResult val)
1316{
1317 switch (val)
1318 {
1319 CASE_RETURN_STR(eCSR_ROAM_RESULT_NONE);
1320 CASE_RETURN_STR(eCSR_ROAM_RESULT_FAILURE);
1321 CASE_RETURN_STR(eCSR_ROAM_RESULT_ASSOCIATED);
1322 CASE_RETURN_STR(eCSR_ROAM_RESULT_NOT_ASSOCIATED);
1323 CASE_RETURN_STR(eCSR_ROAM_RESULT_MIC_FAILURE);
1324 CASE_RETURN_STR(eCSR_ROAM_RESULT_FORCED);
1325 CASE_RETURN_STR(eCSR_ROAM_RESULT_DISASSOC_IND);
1326 CASE_RETURN_STR(eCSR_ROAM_RESULT_DEAUTH_IND);
1327 CASE_RETURN_STR(eCSR_ROAM_RESULT_CAP_CHANGED);
1328 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_CONNECT);
1329 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_INACTIVE);
1330 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_NEW_PEER);
1331 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_COALESCED);
1332 default:
1333 return "unknown";
1334 }
1335}
1336
1337
1338
1339tANI_BOOLEAN csrGetBssIdBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tCsrBssid *pBssId )
1340{
Kiet Lam64c1b492013-07-12 13:56:44 +05301341 vos_mem_copy(pBssId, &pSirBssDesc->bssId[ 0 ], sizeof(tCsrBssid));
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 return( TRUE );
1343}
1344
1345
1346tANI_BOOLEAN csrIsBssIdEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1, tSirBssDescription *pSirBssDesc2 )
1347{
1348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1349 tANI_BOOLEAN fEqual = FALSE;
1350 tCsrBssid bssId1;
1351 tCsrBssid bssId2;
1352
1353 do {
1354 if ( !pSirBssDesc1 ) break;
1355 if ( !pSirBssDesc2 ) break;
1356
1357 if ( !csrGetBssIdBssDesc( pMac, pSirBssDesc1, &bssId1 ) ) break;
1358 if ( !csrGetBssIdBssDesc( pMac, pSirBssDesc2, &bssId2 ) ) break;
1359
1360 //sirCompareMacAddr
1361 fEqual = csrIsMacAddressEqual(pMac, &bssId1, &bssId2);
1362
1363 } while( 0 );
1364
1365 return( fEqual );
1366}
1367
1368tANI_BOOLEAN csrIsConnStateConnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
1369{
1370 return( eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED == pMac->roam.roamSession[sessionId].connectState );
1371}
1372
1373tANI_BOOLEAN csrIsConnStateDisconnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
1374{
1375 return( eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState );
1376}
1377
1378tANI_BOOLEAN csrIsConnStateConnectedInfra( tpAniSirGlobal pMac, tANI_U32 sessionId )
1379{
1380 return( eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == pMac->roam.roamSession[sessionId].connectState );
1381}
1382
1383tANI_BOOLEAN csrIsConnStateConnected( tpAniSirGlobal pMac, tANI_U32 sessionId )
1384{
1385 if( csrIsConnStateConnectedIbss( pMac, sessionId ) || csrIsConnStateConnectedInfra( pMac, sessionId ) || csrIsConnStateConnectedWds( pMac, sessionId) )
1386 return TRUE;
1387 else
1388 return FALSE;
1389}
1390
1391tANI_BOOLEAN csrIsConnStateInfra( tpAniSirGlobal pMac, tANI_U32 sessionId )
1392{
1393 return( csrIsConnStateConnectedInfra( pMac, sessionId ) );
1394}
1395
1396tANI_BOOLEAN csrIsConnStateIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
1397{
1398 return( csrIsConnStateConnectedIbss( pMac, sessionId ) || csrIsConnStateDisconnectedIbss( pMac, sessionId ) );
1399}
1400
1401
1402tANI_BOOLEAN csrIsConnStateConnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
1403{
1404 return( eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED == pMac->roam.roamSession[sessionId].connectState );
1405}
1406
Jeff Johnson295189b2012-06-20 16:38:30 -07001407tANI_BOOLEAN csrIsConnStateConnectedInfraAp( tpAniSirGlobal pMac, tANI_U32 sessionId )
1408{
1409 return( (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == pMac->roam.roamSession[sessionId].connectState) ||
1410 (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState ) );
1411}
Jeff Johnson295189b2012-06-20 16:38:30 -07001412
1413tANI_BOOLEAN csrIsConnStateDisconnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
1414{
1415 return( eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState );
1416}
1417
1418tANI_BOOLEAN csrIsConnStateWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
1419{
1420 return( csrIsConnStateConnectedWds( pMac, sessionId ) ||
1421 csrIsConnStateDisconnectedWds( pMac, sessionId ) );
1422}
1423
Jeff Johnsone7245742012-09-05 17:12:55 -07001424tANI_BOOLEAN csrIsConnStateAp( tpAniSirGlobal pMac, tANI_U32 sessionId )
1425{
1426 tCsrRoamSession *pSession;
1427 pSession = CSR_GET_SESSION(pMac, sessionId);
1428 if (!pSession)
1429 return eANI_BOOLEAN_FALSE;
1430 if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
1431 {
1432 return eANI_BOOLEAN_TRUE;
1433 }
1434 return eANI_BOOLEAN_FALSE;
1435}
1436
Jeff Johnson295189b2012-06-20 16:38:30 -07001437tANI_BOOLEAN csrIsAnySessionInConnectState( tpAniSirGlobal pMac )
1438{
1439 tANI_U32 i;
1440 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1441
1442 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1443 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001444 if( CSR_IS_SESSION_VALID( pMac, i ) &&
1445 ( csrIsConnStateInfra( pMac, i )
1446 || csrIsConnStateIbss( pMac, i )
1447 || csrIsConnStateAp( pMac, i) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001448 {
1449 fRc = eANI_BOOLEAN_TRUE;
1450 break;
1451 }
1452 }
1453
1454 return ( fRc );
1455}
1456
1457tANI_S8 csrGetInfraSessionId( tpAniSirGlobal pMac )
1458{
1459 tANI_U8 i;
1460 tANI_S8 sessionid = -1;
1461
1462 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1463 {
1464 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateInfra( pMac, i ) )
1465 {
1466 sessionid = i;
1467 break;
1468 }
1469 }
1470
1471 return ( sessionid );
1472}
1473
1474tANI_U8 csrGetInfraOperationChannel( tpAniSirGlobal pMac, tANI_U8 sessionId)
1475{
1476 tANI_U8 channel;
1477
1478 if( CSR_IS_SESSION_VALID( pMac, sessionId ))
1479 {
1480 channel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
1481 }
1482 else
1483 {
1484 channel = 0;
1485 }
1486 return channel;
1487}
1488
Sushant Kaushik1d732562014-05-21 14:15:37 +05301489tANI_BOOLEAN csrIsSessionClientAndConnected(tpAniSirGlobal pMac, tANI_U8 sessionId)
1490{
1491 tCsrRoamSession *pSession = NULL;
1492 if ( CSR_IS_SESSION_VALID( pMac, sessionId) && csrIsConnStateInfra( pMac, sessionId))
1493 {
1494 pSession = CSR_GET_SESSION( pMac, sessionId);
Kaushik, Sushant79901762014-08-23 17:51:02 +05301495 if (NULL != pSession->pCurRoamProfile)
Sushant Kaushik1d732562014-05-21 14:15:37 +05301496 {
Kaushik, Sushant79901762014-08-23 17:51:02 +05301497 if ((pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE) ||
1498 (pSession->pCurRoamProfile->csrPersona == VOS_P2P_CLIENT_MODE))
1499 {
1500 return TRUE;
1501 }
Sushant Kaushik1d732562014-05-21 14:15:37 +05301502 }
1503 }
1504 return FALSE;
1505}
Jeff Johnson295189b2012-06-20 16:38:30 -07001506//This routine will return operating channel on FIRST BSS that is active/operating to be used for concurrency mode.
1507//If other BSS is not up or not connected it will return 0
1508
1509tANI_U8 csrGetConcurrentOperationChannel( tpAniSirGlobal pMac )
1510{
1511 tCsrRoamSession *pSession = NULL;
1512 tANI_U8 i = 0;
1513
1514 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1515 {
1516 if( CSR_IS_SESSION_VALID( pMac, i ) )
1517 {
1518 pSession = CSR_GET_SESSION( pMac, i );
1519
1520 if (NULL != pSession->pCurRoamProfile)
1521 {
1522 if (
1523 (((pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE) ||
1524 (pSession->pCurRoamProfile->csrPersona == VOS_P2P_CLIENT_MODE)) &&
1525 (pSession->connectState == eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED))
1526 ||
1527 (((pSession->pCurRoamProfile->csrPersona == VOS_P2P_GO_MODE) ||
1528 (pSession->pCurRoamProfile->csrPersona == VOS_STA_SAP_MODE)) &&
1529 (pSession->connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
1530 )
1531 return (pSession->connectedProfile.operationChannel);
1532 }
1533
1534 }
1535 }
1536 return 0;
1537}
1538
1539tANI_BOOLEAN csrIsAllSessionDisconnected( tpAniSirGlobal pMac )
1540{
1541 tANI_U32 i;
1542 tANI_BOOLEAN fRc = eANI_BOOLEAN_TRUE;
1543
1544 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1545 {
1546 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1547 {
1548 fRc = eANI_BOOLEAN_FALSE;
1549 break;
1550 }
1551 }
1552
1553 return ( fRc );
1554}
1555
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08001556tANI_BOOLEAN csrIsStaSessionConnected( tpAniSirGlobal pMac )
1557{
1558 tANI_U32 i;
1559 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1560 tCsrRoamSession *pSession = NULL;
1561 tANI_U32 countSta = 0;
1562
1563 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1564 {
1565 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1566 {
1567 pSession = CSR_GET_SESSION( pMac, i );
1568
1569 if (NULL != pSession->pCurRoamProfile)
1570 {
1571 if (pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE) {
1572 countSta++;
1573 }
1574 }
1575 }
1576 }
1577
1578 /* return TRUE if one of the following conditions is TRUE:
1579 * - more than one STA session connected
1580 */
1581 if ( countSta > 0) {
1582 fRc = eANI_BOOLEAN_TRUE;
1583 }
1584
1585 return( fRc );
1586}
1587
1588tANI_BOOLEAN csrIsP2pSessionConnected( tpAniSirGlobal pMac )
1589{
1590 tANI_U32 i;
1591 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1592 tCsrRoamSession *pSession = NULL;
1593 tANI_U32 countP2pCli = 0;
1594 tANI_U32 countP2pGo = 0;
Kalikinkar dhara96b4e7e2014-01-16 15:19:57 -08001595 tANI_U32 countSAP = 0;
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08001596
1597 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1598 {
1599 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1600 {
1601 pSession = CSR_GET_SESSION( pMac, i );
1602
1603 if (NULL != pSession->pCurRoamProfile)
1604 {
1605 if (pSession->pCurRoamProfile->csrPersona == VOS_P2P_CLIENT_MODE) {
1606 countP2pCli++;
1607 }
1608
1609 if (pSession->pCurRoamProfile->csrPersona == VOS_P2P_GO_MODE) {
1610 countP2pGo++;
1611 }
Kalikinkar dhara96b4e7e2014-01-16 15:19:57 -08001612
1613 if (pSession->pCurRoamProfile->csrPersona == VOS_STA_SAP_MODE) {
1614 countSAP++;
1615 }
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08001616 }
1617 }
1618 }
1619
1620 /* return TRUE if one of the following conditions is TRUE:
1621 * - at least one P2P CLI session is connected
1622 * - at least one P2P GO session is connected
1623 */
Kalikinkar dhara96b4e7e2014-01-16 15:19:57 -08001624 if ( (countP2pCli > 0) || (countP2pGo > 0 ) || (countSAP > 0 ) ) {
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08001625 fRc = eANI_BOOLEAN_TRUE;
1626 }
1627
1628 return( fRc );
1629}
1630
Madan Mohan Koyyalamudid3d22592012-09-24 14:01:29 -07001631tANI_BOOLEAN csrIsAnySessionConnected( tpAniSirGlobal pMac )
1632{
1633 tANI_U32 i, count;
1634 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1635
1636 count = 0;
1637 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1638 {
1639 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1640 {
1641 count++;
1642 }
1643 }
1644
1645 if (count > 0)
1646 {
1647 fRc = eANI_BOOLEAN_TRUE;
1648 }
1649 return( fRc );
1650}
Jeff Johnson295189b2012-06-20 16:38:30 -07001651
1652tANI_BOOLEAN csrIsInfraConnected( tpAniSirGlobal pMac )
1653{
1654 tANI_U32 i;
1655 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1656
1657 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1658 {
1659 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedInfra( pMac, i ) )
1660 {
1661 fRc = eANI_BOOLEAN_TRUE;
1662 break;
1663 }
1664 }
1665
1666 return ( fRc );
1667}
1668
1669tANI_BOOLEAN csrIsConcurrentInfraConnected( tpAniSirGlobal pMac )
1670{
1671 tANI_U32 i, noOfConnectedInfra = 0;
1672
1673 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1674
1675 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1676 {
1677 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedInfra( pMac, i ) )
1678 {
1679 ++noOfConnectedInfra;
1680 }
1681 }
1682
1683 // More than one Infra Sta Connected
1684 if(noOfConnectedInfra > 1)
1685 {
1686 fRc = eANI_BOOLEAN_TRUE;
1687 }
1688
1689 return ( fRc );
1690}
1691
1692tANI_BOOLEAN csrIsIBSSStarted( tpAniSirGlobal pMac )
1693{
1694 tANI_U32 i;
1695 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1696
1697 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1698 {
1699 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateIbss( pMac, i ) )
1700 {
1701 fRc = eANI_BOOLEAN_TRUE;
1702 break;
1703 }
1704 }
1705
1706 return ( fRc );
1707}
1708
1709
1710tANI_BOOLEAN csrIsBTAMPStarted( tpAniSirGlobal pMac )
1711{
1712 tANI_U32 i;
1713 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1714
1715 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1716 {
1717 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedWds( pMac, i ) )
1718 {
1719 fRc = eANI_BOOLEAN_TRUE;
1720 break;
1721 }
1722 }
1723
1724 return ( fRc );
1725}
1726
Jeff Johnsone7245742012-09-05 17:12:55 -07001727tANI_BOOLEAN csrIsConcurrentSessionRunning( tpAniSirGlobal pMac )
1728{
1729 tANI_U32 sessionId, noOfCocurrentSession = 0;
1730 eCsrConnectState connectState;
1731
1732 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1733
1734 for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
1735 {
1736 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
1737 {
1738 connectState = pMac->roam.roamSession[sessionId].connectState;
1739 if( (eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == connectState) ||
1740 (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == connectState) ||
1741 (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED == connectState) )
1742 {
1743 ++noOfCocurrentSession;
1744 }
1745 }
1746 }
1747
1748 // More than one session is Up and Running
1749 if(noOfCocurrentSession > 1)
1750 {
1751 fRc = eANI_BOOLEAN_TRUE;
1752 }
1753
1754 return ( fRc );
1755}
1756
Jeff Johnsone7245742012-09-05 17:12:55 -07001757tANI_BOOLEAN csrIsInfraApStarted( tpAniSirGlobal pMac )
1758{
1759 tANI_U32 sessionId;
1760 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1761
1762 for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
1763 {
1764 if( CSR_IS_SESSION_VALID( pMac, sessionId ) && (csrIsConnStateConnectedInfraAp(pMac, sessionId)) )
1765 {
1766 fRc = eANI_BOOLEAN_TRUE;
1767 break;
1768 }
1769 }
1770
1771 return ( fRc );
1772
1773}
Jeff Johnsone7245742012-09-05 17:12:55 -07001774
Jeff Johnson295189b2012-06-20 16:38:30 -07001775tANI_BOOLEAN csrIsBTAMP( tpAniSirGlobal pMac, tANI_U32 sessionId )
1776{
1777 return ( csrIsConnStateConnectedWds( pMac, sessionId ) );
1778}
1779
1780
1781tANI_BOOLEAN csrIsConnStateDisconnected(tpAniSirGlobal pMac, tANI_U32 sessionId)
1782{
1783 return (eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED == pMac->roam.roamSession[sessionId].connectState);
1784}
1785
Jeff Johnsone7245742012-09-05 17:12:55 -07001786tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId,
1787 tSirBssDescription *pBssDesc)
Jeff Johnson295189b2012-06-20 16:38:30 -07001788{
1789 tCsrRoamSession *pSession = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001790 eAniBoolean status = eANI_BOOLEAN_FALSE;
1791
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 //Check for MCC support
1793 if (!pMac->roam.configParam.fenableMCCMode)
1794 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001795 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 }
1797
Jeff Johnsone7245742012-09-05 17:12:55 -07001798 //Validate BeaconInterval
1799 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
1800 {
1801 pSession = CSR_GET_SESSION( pMac, sessionId );
1802 if (NULL != pSession->pCurRoamProfile)
1803 {
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07001804 if (csrIsconcurrentsessionValid (pMac, sessionId,
1805 pSession->pCurRoamProfile->csrPersona)
Jeff Johnsone7245742012-09-05 17:12:55 -07001806 == eHAL_STATUS_SUCCESS )
1807 {
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07001808 if (csrValidateMCCBeaconInterval( pMac, pBssDesc->channelId,
1809 &pBssDesc->beaconInterval, sessionId,
1810 pSession->pCurRoamProfile->csrPersona)
Jeff Johnsone7245742012-09-05 17:12:55 -07001811 != eHAL_STATUS_SUCCESS)
1812 {
1813 status = eANI_BOOLEAN_FALSE;
1814 }
1815 else
1816 {
1817 status = eANI_BOOLEAN_TRUE;
1818 }
1819 }
1820 else
1821 {
1822 status = eANI_BOOLEAN_FALSE;
1823 }
1824 }
1825 }
1826 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07001827}
1828
1829static tSirMacCapabilityInfo csrGetBssCapabilities( tSirBssDescription *pSirBssDesc )
1830{
1831 tSirMacCapabilityInfo dot11Caps;
1832
1833 //tSirMacCapabilityInfo is 16-bit
1834 pal_get_U16( (tANI_U8 *)&pSirBssDesc->capabilityInfo, (tANI_U16 *)&dot11Caps );
1835
1836 return( dot11Caps );
1837}
1838
1839tANI_BOOLEAN csrIsInfraBssDesc( tSirBssDescription *pSirBssDesc )
1840{
1841 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1842
1843 return( (tANI_BOOLEAN)dot11Caps.ess );
1844}
1845
1846
1847tANI_BOOLEAN csrIsIbssBssDesc( tSirBssDescription *pSirBssDesc )
1848{
1849 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1850
1851 return( (tANI_BOOLEAN)dot11Caps.ibss );
1852}
1853
1854tANI_BOOLEAN csrIsQoSBssDesc( tSirBssDescription *pSirBssDesc )
1855{
1856 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1857
1858 return( (tANI_BOOLEAN)dot11Caps.qos );
1859}
1860
1861tANI_BOOLEAN csrIsPrivacy( tSirBssDescription *pSirBssDesc )
1862{
1863 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1864
1865 return( (tANI_BOOLEAN)dot11Caps.privacy );
1866}
1867
1868
1869tANI_BOOLEAN csrIs11dSupported(tpAniSirGlobal pMac)
1870{
1871 return(pMac->roam.configParam.Is11dSupportEnabled);
1872}
1873
1874
1875tANI_BOOLEAN csrIs11hSupported(tpAniSirGlobal pMac)
1876{
1877 return(pMac->roam.configParam.Is11hSupportEnabled);
1878}
1879
1880
1881tANI_BOOLEAN csrIs11eSupported(tpAniSirGlobal pMac)
1882{
1883 return(pMac->roam.configParam.Is11eSupportEnabled);
1884}
1885
1886tANI_BOOLEAN csrIsMCCSupported ( tpAniSirGlobal pMac )
1887{
1888 return(pMac->roam.configParam.fenableMCCMode);
1889
1890}
1891
1892tANI_BOOLEAN csrIsWmmSupported(tpAniSirGlobal pMac)
1893{
1894 if(eCsrRoamWmmNoQos == pMac->roam.configParam.WMMSupportMode)
1895 {
1896 return eANI_BOOLEAN_FALSE;
1897 }
1898 else
1899 {
1900 return eANI_BOOLEAN_TRUE;
1901 }
1902}
1903
1904
1905
1906
1907//pIes is the IEs for pSirBssDesc2
1908tANI_BOOLEAN csrIsSsidEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1,
1909 tSirBssDescription *pSirBssDesc2, tDot11fBeaconIEs *pIes2 )
1910{
1911 tANI_BOOLEAN fEqual = FALSE;
1912 tSirMacSSid Ssid1, Ssid2;
1913 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1914 tDot11fBeaconIEs *pIes1 = NULL;
1915 tDot11fBeaconIEs *pIesLocal = pIes2;
1916
1917 do {
1918 if( ( NULL == pSirBssDesc1 ) || ( NULL == pSirBssDesc2 ) ) break;
1919 if( !pIesLocal && !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc2, &pIesLocal)) )
1920 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001921 smsLog(pMac, LOGE, FL(" fail to parse IEs"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001922 break;
1923 }
1924 if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc1, &pIes1)))
1925 {
1926 break;
1927 }
1928 if( ( !pIes1->SSID.present ) || ( !pIesLocal->SSID.present ) ) break;
1929 if ( pIes1->SSID.num_ssid != pIesLocal->SSID.num_ssid ) break;
Kiet Lam64c1b492013-07-12 13:56:44 +05301930 vos_mem_copy(Ssid1.ssId, pIes1->SSID.ssid, pIes1->SSID.num_ssid);
1931 vos_mem_copy(Ssid2.ssId, pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001932
Kiet Lam64c1b492013-07-12 13:56:44 +05301933 fEqual = vos_mem_compare(Ssid1.ssId, Ssid2.ssId, pIesLocal->SSID.num_ssid);
Jeff Johnson295189b2012-06-20 16:38:30 -07001934
1935 } while( 0 );
1936 if(pIes1)
1937 {
Kiet Lam64c1b492013-07-12 13:56:44 +05301938 vos_mem_free(pIes1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 }
1940 if( pIesLocal && !pIes2 )
1941 {
Kiet Lam64c1b492013-07-12 13:56:44 +05301942 vos_mem_free(pIesLocal);
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 }
1944
1945 return( fEqual );
1946}
1947
1948tANI_BOOLEAN csrIsAniWmeSupported(tDot11fIEAirgo *pIeAirgo)
1949{
1950 tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
1951
1952 if(pIeAirgo && pIeAirgo->present && pIeAirgo->PropCapability.present)
1953 {
1954 fRet = (tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability ));
1955 }
1956
1957 return fRet;
1958}
1959
1960
1961
1962
1963//pIes can be passed in as NULL if the caller doesn't have one prepared
1964tANI_BOOLEAN csrIsBssDescriptionWme( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes )
1965{
1966 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1967 // Assume that WME is found...
1968 tANI_BOOLEAN fWme = TRUE;
1969 tDot11fBeaconIEs *pIesTemp = pIes;
1970
1971 do
1972 {
1973 if(pIesTemp == NULL)
1974 {
1975 if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp)) )
1976 {
1977 fWme = FALSE;
1978 break;
1979 }
1980 }
1981 // if the AirgoProprietary indicator is found, then WME is supported...
1982 if ( csrIsAniWmeSupported(&pIesTemp->Airgo) ) break;
1983 // if the Wme Info IE is found, then WME is supported...
1984 if ( CSR_IS_QOS_BSS(pIesTemp) ) break;
1985 // if none of these are found, then WME is NOT supported...
1986 fWme = FALSE;
1987 } while( 0 );
1988 if( !csrIsWmmSupported( pMac ) && fWme)
1989 {
1990 if( !pIesTemp->HTCaps.present )
1991 {
1992 fWme = FALSE;
1993 }
1994 }
1995 if( ( pIes == NULL ) && ( NULL != pIesTemp ) )
1996 {
1997 //we allocate memory here so free it before returning
Kiet Lam64c1b492013-07-12 13:56:44 +05301998 vos_mem_free(pIesTemp);
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 }
2000
2001 return( fWme );
2002}
2003
2004tANI_BOOLEAN csrIsHcfEnabled( tDot11fIEAirgo *pIeAirgo )
2005{
2006 tANI_BOOLEAN fHcfSupported = FALSE;
2007
2008 fHcfSupported = ((tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability )) ||
2009 (pIeAirgo->present && pIeAirgo->HCF.present && pIeAirgo->HCF.enabled));
2010
2011 return( fHcfSupported );
2012}
2013
2014
2015eCsrMediaAccessType csrGetQoSFromBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc,
2016 tDot11fBeaconIEs *pIes )
2017{
2018 eCsrMediaAccessType qosType = eCSR_MEDIUM_ACCESS_DCF;
2019
Jeff Johnson295189b2012-06-20 16:38:30 -07002020 VOS_ASSERT( pIes != NULL );
Jeff Johnson295189b2012-06-20 16:38:30 -07002021
2022 do
2023 {
2024 // if we find WMM in the Bss Description, then we let this
2025 // override and use WMM.
2026 if ( csrIsBssDescriptionWme( hHal, pSirBssDesc, pIes ) )
2027 {
2028 qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP;
2029 }
2030 else
2031 {
2032 // if the QoS bit is on, then the AP is advertising 11E QoS...
2033 if ( csrIsQoSBssDesc( pSirBssDesc ) )
2034 {
2035 // which could be HCF or eDCF.
2036 if ( csrIsHcfEnabled( &pIes->Airgo ) )
2037 {
2038 qosType = eCSR_MEDIUM_ACCESS_11e_HCF;
2039 }
2040 else
2041 {
2042 qosType = eCSR_MEDIUM_ACCESS_11e_eDCF;
2043 }
2044 }
2045 else
2046 {
2047 qosType = eCSR_MEDIUM_ACCESS_DCF;
2048 }
2049 // scale back based on the types turned on for the adapter...
2050 if ( eCSR_MEDIUM_ACCESS_11e_eDCF == qosType && !csrIs11eSupported( hHal ) )
2051 {
2052 qosType = eCSR_MEDIUM_ACCESS_DCF;
2053 }
2054 }
2055
2056 } while(0);
2057
2058 return( qosType );
2059}
2060
2061
2062
2063
2064//Caller allocates memory for pIEStruct
2065eHalStatus csrParseBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIEStruct)
2066{
2067 eHalStatus status = eHAL_STATUS_FAILURE;
2068 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Abhishek Singhbad2b322016-10-21 11:22:33 +05302069 int ieLen = (int)GET_IE_LEN_IN_BSS(pBssDesc->length);
Jeff Johnson295189b2012-06-20 16:38:30 -07002070
2071 if(ieLen > 0 && pIEStruct)
2072 {
2073 if(!DOT11F_FAILED(dot11fUnpackBeaconIEs( pMac, (tANI_U8 *)pBssDesc->ieFields, ieLen, pIEStruct )))
2074 {
2075 status = eHAL_STATUS_SUCCESS;
2076 }
2077 }
2078
2079 return (status);
2080}
2081
2082
2083//This function will allocate memory for the parsed IEs to the caller. Caller must free the memory
2084//after it is done with the data only if this function succeeds
2085eHalStatus csrGetParsedBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs **ppIEStruct)
2086{
2087 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2088 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2089
2090 if(pBssDesc && ppIEStruct)
2091 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302092 *ppIEStruct = vos_mem_malloc(sizeof(tDot11fBeaconIEs));
2093 if ( (*ppIEStruct) != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302095 vos_mem_set((void *)*ppIEStruct, sizeof(tDot11fBeaconIEs), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 status = csrParseBssDescriptionIEs(hHal, pBssDesc, *ppIEStruct);
2097 if(!HAL_STATUS_SUCCESS(status))
2098 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302099 vos_mem_free(*ppIEStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 *ppIEStruct = NULL;
2101 }
2102 }
2103 else
2104 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002105 smsLog( pMac, LOGE, FL(" failed to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 VOS_ASSERT( 0 );
Kiet Lam64c1b492013-07-12 13:56:44 +05302107 return eHAL_STATUS_FAILURE;
2108 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 }
2110
2111 return (status);
2112}
2113
Siddharth Bhal64246172015-02-27 01:04:37 +05302114eHalStatus csrProcessGetFrameLogCommand( tpAniSirGlobal pMac,
2115 tSmeCmd *pCommand )
2116{
2117 tAniGetFrameLogReq *pMsg;
2118 tANI_U16 msgLen;
2119 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002120
Siddharth Bhal64246172015-02-27 01:04:37 +05302121 msgLen = sizeof(tAniGetFrameLogReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002122
Siddharth Bhal64246172015-02-27 01:04:37 +05302123 if ( NULL == pCommand )
2124 {
2125 smsLog( pMac, LOGE, FL("cannot process. cmd is null") );
2126 return eHAL_STATUS_FAILURE;
2127 }
2128
2129 pMsg = vos_mem_malloc(msgLen);
2130 if ( NULL == pMsg )
2131 {
2132 smsLog( pMac, LOGE, FL("fail to allocate memory") );
2133 return eHAL_STATUS_FAILURE;
2134 }
2135
2136 pMsg->msgType= pal_cpu_to_be16((tANI_U16)WDA_GET_FRAME_LOG_REQ);
2137 pMsg->msgLen= pal_cpu_to_be16(msgLen);
2138
Siddharth Bhal64246172015-02-27 01:04:37 +05302139 pMsg->getFrameLogCmdFlag = pCommand->u.getFramelogCmd.getFrameLogCmdFlag;
2140
2141 status = palSendMBMessage(pMac->hHdd, pMsg);
2142
2143 return( status );
2144}
Jeff Johnson295189b2012-06-20 16:38:30 -07002145
2146tANI_BOOLEAN csrIsNULLSSID( tANI_U8 *pBssSsid, tANI_U8 len )
2147{
2148 tANI_BOOLEAN fNullSsid = FALSE;
2149
2150 tANI_U32 SsidLength;
2151 tANI_U8 *pSsidStr;
2152
2153 do
2154 {
2155 if ( 0 == len )
2156 {
2157 fNullSsid = TRUE;
2158 break;
2159 }
2160
2161 //Consider 0 or space for hidden SSID
2162 if ( 0 == pBssSsid[0] )
2163 {
2164 fNullSsid = TRUE;
2165 break;
2166 }
2167
2168 SsidLength = len;
2169 pSsidStr = pBssSsid;
2170
2171 while ( SsidLength )
2172 {
2173 if( *pSsidStr )
2174 break;
2175
2176 pSsidStr++;
2177 SsidLength--;
2178 }
2179
2180 if( 0 == SsidLength )
2181 {
2182 fNullSsid = TRUE;
2183 break;
2184 }
2185 }
2186 while( 0 );
2187
2188 return fNullSsid;
2189}
2190
2191
2192tANI_U32 csrGetFragThresh( tHalHandle hHal )
2193{
2194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2195
2196 return pMac->roam.configParam.FragmentationThreshold;
2197}
2198
2199tANI_U32 csrGetRTSThresh( tHalHandle hHal )
2200{
2201 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2202
2203 return pMac->roam.configParam.RTSThreshold;
2204}
2205
2206eCsrPhyMode csrTranslateToPhyModeFromBssDesc( tSirBssDescription *pSirBssDesc )
2207{
2208 eCsrPhyMode phyMode;
2209
2210 switch ( pSirBssDesc->nwType )
2211 {
2212 case eSIR_11A_NW_TYPE:
2213 phyMode = eCSR_DOT11_MODE_11a;
2214 break;
2215
2216 case eSIR_11B_NW_TYPE:
2217 phyMode = eCSR_DOT11_MODE_11b;
2218 break;
2219
2220 case eSIR_11G_NW_TYPE:
2221 phyMode = eCSR_DOT11_MODE_11g;
2222 break;
2223
2224 case eSIR_11N_NW_TYPE:
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 phyMode = eCSR_DOT11_MODE_11n;
2226 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002227#ifdef WLAN_FEATURE_11AC
2228 case eSIR_11AC_NW_TYPE:
2229 default:
2230 phyMode = eCSR_DOT11_MODE_11ac;
2231#else
2232 default:
2233 phyMode = eCSR_DOT11_MODE_11n;
2234#endif
2235 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002237 return( phyMode );
2238}
2239
2240
2241tANI_U32 csrTranslateToWNICfgDot11Mode(tpAniSirGlobal pMac, eCsrCfgDot11Mode csrDot11Mode)
2242{
2243 tANI_U32 ret;
2244
2245 switch(csrDot11Mode)
2246 {
2247 case eCSR_CFG_DOT11_MODE_AUTO:
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002248 smsLog(pMac, LOGW, FL(" Warning: sees eCSR_CFG_DOT11_MODE_AUTO "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 //We cannot decide until now.
2250 if(pMac->roam.configParam.ProprietaryRatesEnabled)
2251 {
2252 ret = WNI_CFG_DOT11_MODE_TAURUS;
2253 }
2254 else
2255 {
Mukul Sharma45063942015-04-01 20:07:59 +05302256#ifdef WLAN_FEATURE_11AC
2257 if ( IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC) &&
2258 IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
2259 ret = WNI_CFG_DOT11_MODE_11AC;
2260 else
2261 ret = WNI_CFG_DOT11_MODE_11N;
2262#else
2263 ret = WNI_CFG_DOT11_MODE_11N;
2264#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 }
2266 break;
2267 case eCSR_CFG_DOT11_MODE_TAURUS:
2268 ret = WNI_CFG_DOT11_MODE_TAURUS;
2269 break;
2270 case eCSR_CFG_DOT11_MODE_11A:
2271 ret = WNI_CFG_DOT11_MODE_11A;
2272 break;
2273 case eCSR_CFG_DOT11_MODE_11B:
2274 ret = WNI_CFG_DOT11_MODE_11B;
2275 break;
2276 case eCSR_CFG_DOT11_MODE_11G:
2277 ret = WNI_CFG_DOT11_MODE_11G;
2278 break;
2279 case eCSR_CFG_DOT11_MODE_11N:
2280 ret = WNI_CFG_DOT11_MODE_11N;
2281 break;
2282 case eCSR_CFG_DOT11_MODE_POLARIS:
2283 ret = WNI_CFG_DOT11_MODE_POLARIS;
2284 break;
2285 case eCSR_CFG_DOT11_MODE_TITAN:
2286 ret = WNI_CFG_DOT11_MODE_TITAN;
2287 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002288 case eCSR_CFG_DOT11_MODE_11G_ONLY:
Mukul Sharma45063942015-04-01 20:07:59 +05302289 ret = WNI_CFG_DOT11_MODE_11G_ONLY;
2290 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 case eCSR_CFG_DOT11_MODE_11N_ONLY:
Mukul Sharma45063942015-04-01 20:07:59 +05302292 ret = WNI_CFG_DOT11_MODE_11N_ONLY;
2293 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002294
2295#ifdef WLAN_FEATURE_11AC
Mukul Sharma45063942015-04-01 20:07:59 +05302296 case eCSR_CFG_DOT11_MODE_11AC_ONLY:
2297 if ( IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC) &&
2298 IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
2299 ret = WNI_CFG_DOT11_MODE_11AC_ONLY;
2300 else
2301 ret = WNI_CFG_DOT11_MODE_11N;
Jeff Johnsone7245742012-09-05 17:12:55 -07002302 break;
Mukul Sharma45063942015-04-01 20:07:59 +05302303 case eCSR_CFG_DOT11_MODE_11AC:
2304 if ( IS_FEATURE_SUPPORTED_BY_DRIVER(DOT11AC) &&
2305 IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
2306 ret = WNI_CFG_DOT11_MODE_11AC;
2307 else
2308 ret = WNI_CFG_DOT11_MODE_11N;
2309 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002310#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002311 default:
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002312 smsLog(pMac, LOGW, FL("doesn't expect %d as csrDo11Mode"), csrDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 if(eCSR_BAND_24 == pMac->roam.configParam.eBand)
2314 {
2315 ret = WNI_CFG_DOT11_MODE_11G;
2316 }
2317 else
2318 {
2319 ret = WNI_CFG_DOT11_MODE_11A;
2320 }
2321 break;
2322 }
2323
2324 return (ret);
2325}
2326
2327
2328//This function should only return the super set of supported modes. 11n implies 11b/g/a/n.
2329eHalStatus csrGetPhyModeFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBSSDescription,
2330 eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes)
2331{
2332 eHalStatus status = eHAL_STATUS_SUCCESS;
2333 eCsrPhyMode phyMode = csrTranslateToPhyModeFromBssDesc(pBSSDescription);
2334
2335 if( pIes )
2336 {
2337 if(pIes->Airgo.present)
2338 {
2339 if(pIes->Airgo.PropCapability.present)
2340 {
2341 if( PROP_CAPABILITY_GET( TAURUS, pIes->Airgo.PropCapability.capability ))
2342 {
2343 phyMode = eCSR_DOT11_MODE_TAURUS;
2344 }
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302345 }
2346 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 if(pIes->HTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode))
2348 {
2349 phyMode = eCSR_DOT11_MODE_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07002350#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05302351 if (IS_BSS_VHT_CAPABLE(pIes->VHTCaps))
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302352 {
2353 phyMode = eCSR_DOT11_MODE_11ac;
2354 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002355#endif
Krishna Kumaar Natarajan025a8602015-08-04 16:31:36 +05302356 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002357 *pPhyMode = phyMode;
2358 }
2359
2360 return (status);
2361
2362}
2363
2364
2365//This function returns the correct eCSR_CFG_DOT11_MODE is the two phyModes matches
2366//bssPhyMode is the mode derived from the BSS description
2367//f5GhzBand is derived from the channel id of BSS description
2368tANI_BOOLEAN csrGetPhyModeInUse( eCsrPhyMode phyModeIn, eCsrPhyMode bssPhyMode, tANI_BOOLEAN f5GhzBand,
2369 eCsrCfgDot11Mode *pCfgDot11ModeToUse )
2370{
2371 tANI_BOOLEAN fMatch = FALSE;
2372 eCsrCfgDot11Mode cfgDot11Mode;
2373
2374 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; // to suppress compiler warning
2375
2376 switch( phyModeIn )
2377 {
2378 case eCSR_DOT11_MODE_abg: //11a or 11b or 11g
2379 if( f5GhzBand )
2380 {
2381 fMatch = TRUE;
2382 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2383 }
2384 else if( eCSR_DOT11_MODE_11b == bssPhyMode )
2385 {
2386 fMatch = TRUE;
2387 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2388 }
2389 else
2390 {
2391 fMatch = TRUE;
2392 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2393 }
2394 break;
2395
2396 case eCSR_DOT11_MODE_11a: //11a
2397 if( f5GhzBand )
2398 {
2399 fMatch = TRUE;
2400 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2401 }
2402 break;
2403
2404 case eCSR_DOT11_MODE_11a_ONLY: //11a
2405 if( eCSR_DOT11_MODE_11a == bssPhyMode )
2406 {
2407 fMatch = TRUE;
2408 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2409 }
2410 break;
2411
2412 case eCSR_DOT11_MODE_11g:
2413 if(!f5GhzBand)
2414 {
2415 if( eCSR_DOT11_MODE_11b == bssPhyMode )
2416 {
2417 fMatch = TRUE;
2418 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2419 }
2420 else
2421 {
2422 fMatch = TRUE;
2423 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2424 }
2425 }
2426 break;
2427
2428 case eCSR_DOT11_MODE_11g_ONLY:
2429 if( eCSR_DOT11_MODE_11g == bssPhyMode )
2430 {
2431 fMatch = TRUE;
2432 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2433 }
2434 break;
2435
2436 case eCSR_DOT11_MODE_11b:
2437 if( !f5GhzBand )
2438 {
2439 fMatch = TRUE;
2440 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2441 }
2442 break;
2443
2444 case eCSR_DOT11_MODE_11b_ONLY:
2445 if( eCSR_DOT11_MODE_11b == bssPhyMode )
2446 {
2447 fMatch = TRUE;
2448 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2449 }
2450 break;
2451
2452 case eCSR_DOT11_MODE_11n:
2453 fMatch = TRUE;
2454 switch(bssPhyMode)
2455 {
2456 case eCSR_DOT11_MODE_11g:
2457 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2458 break;
2459 case eCSR_DOT11_MODE_11b:
2460 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2461 break;
2462 case eCSR_DOT11_MODE_11a:
2463 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2464 break;
2465 case eCSR_DOT11_MODE_11n:
Jeff Johnsone7245742012-09-05 17:12:55 -07002466#ifdef WLAN_FEATURE_11AC
2467 case eCSR_DOT11_MODE_11ac:
2468#endif
2469 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
2470 break;
2471
Jeff Johnson295189b2012-06-20 16:38:30 -07002472 case eCSR_DOT11_MODE_TAURUS:
2473 default:
Jeff Johnsone7245742012-09-05 17:12:55 -07002474#ifdef WLAN_FEATURE_11AC
2475 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2476#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
Jeff Johnsone7245742012-09-05 17:12:55 -07002478#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 break;
2480 }
2481 break;
2482
2483 case eCSR_DOT11_MODE_11n_ONLY:
2484 if((eCSR_DOT11_MODE_11n == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode))
2485 {
2486 fMatch = TRUE;
2487 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
Jeff Johnsone7245742012-09-05 17:12:55 -07002488
2489 }
2490
2491 break;
2492#ifdef WLAN_FEATURE_11AC
2493 case eCSR_DOT11_MODE_11ac:
2494 fMatch = TRUE;
2495 switch(bssPhyMode)
2496 {
2497 case eCSR_DOT11_MODE_11g:
2498 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2499 break;
2500 case eCSR_DOT11_MODE_11b:
2501 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2502 break;
2503 case eCSR_DOT11_MODE_11a:
2504 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2505 break;
2506 case eCSR_DOT11_MODE_11n:
2507 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
2508 break;
2509 case eCSR_DOT11_MODE_11ac:
2510 case eCSR_DOT11_MODE_TAURUS:
2511 default:
2512 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2513 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 }
2515 break;
2516
Jeff Johnsone7245742012-09-05 17:12:55 -07002517 case eCSR_DOT11_MODE_11ac_ONLY:
2518 if((eCSR_DOT11_MODE_11ac == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode))
2519 {
2520 fMatch = TRUE;
2521 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2522 }
2523 break;
2524#endif
2525
Jeff Johnson295189b2012-06-20 16:38:30 -07002526 case eCSR_DOT11_MODE_TAURUS:
2527 default:
2528 fMatch = TRUE;
2529 switch(bssPhyMode)
2530 {
2531 case eCSR_DOT11_MODE_11g:
2532 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2533 break;
2534 case eCSR_DOT11_MODE_11b:
2535 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2536 break;
2537 case eCSR_DOT11_MODE_11a:
2538 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2539 break;
2540 case eCSR_DOT11_MODE_11n:
2541 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
2542 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002543#ifdef WLAN_FEATURE_11AC
2544 case eCSR_DOT11_MODE_11ac:
2545 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2546 break;
2547#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 case eCSR_DOT11_MODE_TAURUS:
2549 default:
2550 cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
2551 break;
2552 }
2553 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 }
2555
2556 if ( fMatch && pCfgDot11ModeToUse )
2557 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002558#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudief5dd972012-10-11 15:06:09 -07002559 if(cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC && (!IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)))
Jeff Johnsone7245742012-09-05 17:12:55 -07002560 {
2561 *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
2562 }
2563 else
2564#endif
2565 {
2566 *pCfgDot11ModeToUse = cfgDot11Mode;
2567 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 return( fMatch );
2570}
2571
2572
2573//This function decides whether the one of the bit of phyMode is matching the mode in the BSS and allowed by the user
2574//setting, pMac->roam.configParam.uCfgDot11Mode. It returns the mode that fits the criteria.
2575tANI_BOOLEAN csrIsPhyModeMatch( tpAniSirGlobal pMac, tANI_U32 phyMode,
2576 tSirBssDescription *pSirBssDesc, tCsrRoamProfile *pProfile,
2577 eCsrCfgDot11Mode *pReturnCfgDot11Mode,
2578 tDot11fBeaconIEs *pIes)
2579{
2580 tANI_BOOLEAN fMatch = FALSE;
2581 eCsrPhyMode phyModeInBssDesc, phyMode2;
2582 eCsrCfgDot11Mode cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_TAURUS;
2583 tANI_U32 bitMask, loopCount;
2584
2585 if(HAL_STATUS_SUCCESS(csrGetPhyModeFromBss(pMac, pSirBssDesc, &phyModeInBssDesc, pIes )))
2586 {
2587 //In case some change change eCSR_DOT11_MODE_TAURUS to non-0
2588 if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode))
2589 {
2590 //Taurus means anything
2591 if ( eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode )
2592 {
2593 phyMode = eCSR_DOT11_MODE_abg;
2594 }
2595 else if(eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode)
2596 {
2597 if(pMac->roam.configParam.ProprietaryRatesEnabled)
2598 {
2599 phyMode = eCSR_DOT11_MODE_TAURUS;
2600 }
2601 else
2602 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002603
2604#ifdef WLAN_FEATURE_11AC
2605 phyMode = eCSR_DOT11_MODE_11ac;
2606#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 phyMode = eCSR_DOT11_MODE_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07002608#endif
2609
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 }
2611 }
2612 else
2613 {
2614 //user's pick
2615 phyMode = pMac->roam.configParam.phyMode;
2616 }
2617 }
2618 if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode) )
2619 {
2620 if(0 != phyMode)
2621 {
2622 if(eCSR_DOT11_MODE_AUTO & phyMode)
2623 {
2624 phyMode2 = eCSR_DOT11_MODE_AUTO & phyMode;
2625 }
2626 else
2627 {
2628 phyMode2 = eCSR_DOT11_MODE_TAURUS & phyMode;
2629 }
2630 }
2631 else
2632 {
2633 phyMode2 = phyMode;
2634 }
2635 fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId),
2636 &cfgDot11ModeToUse );
2637 }
2638 else
2639 {
2640 bitMask = 1;
2641 loopCount = 0;
2642 while(loopCount < eCSR_NUM_PHY_MODE)
2643 {
2644 if(0 != ( phyMode2 = (phyMode & (bitMask << loopCount++)) ))
2645 {
2646 fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId),
2647 &cfgDot11ModeToUse );
2648 if(fMatch) break;
2649 }
2650 }
2651 }
2652 if ( fMatch && pReturnCfgDot11Mode )
2653 {
2654 if( pProfile )
2655 {
2656 /* IEEE 11n spec (8.4.3): HT STA shall eliminate TKIP as a
2657 * choice for the pairwise cipher suite if CCMP is advertised
2658 * by the AP or if the AP included an HT capabilities element
2659 * in its Beacons and Probe Response.
2660 */
2661 if( (!CSR_IS_11n_ALLOWED( pProfile->negotiatedUCEncryptionType )) &&
2662 ((eCSR_CFG_DOT11_MODE_11N == cfgDot11ModeToUse) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07002663#ifdef WLAN_FEATURE_11AC
2664 (eCSR_CFG_DOT11_MODE_11AC == cfgDot11ModeToUse) ||
2665#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002666 (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11ModeToUse)) )
2667 {
2668 //We cannot do 11n here
2669 if( !CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId) )
2670 {
2671 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
2672 }
2673 else
2674 {
2675 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
2676 }
2677 }
2678 }
2679 *pReturnCfgDot11Mode = cfgDot11ModeToUse;
2680 }
2681 }
2682
2683 return( fMatch );
2684}
2685
2686
2687eCsrCfgDot11Mode csrFindBestPhyMode( tpAniSirGlobal pMac, tANI_U32 phyMode )
2688{
2689 eCsrCfgDot11Mode cfgDot11ModeToUse;
2690 eCsrBand eBand = pMac->roam.configParam.eBand;
2691
Jeff Johnsone7245742012-09-05 17:12:55 -07002692
Madan Mohan Koyyalamudi0dae8812013-07-15 19:22:49 +05302693 if ((0 == phyMode) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07002694#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudi0dae8812013-07-15 19:22:49 +05302695 (eCSR_DOT11_MODE_11ac & phyMode) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07002696#endif
Madan Mohan Koyyalamudi0dae8812013-07-15 19:22:49 +05302697 (eCSR_DOT11_MODE_AUTO & phyMode))
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 {
Madan Mohan Koyyalamudi0dae8812013-07-15 19:22:49 +05302699#ifdef WLAN_FEATURE_11AC
2700 if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
2701 {
2702 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
2703 }
2704 else
2705#endif
2706 {
2707 /* Default to 11N mode if user has configured 11ac mode
2708 * and FW doesn't supports 11ac mode .
2709 */
2710 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
2711 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 }
2713 else
2714 {
2715 if( ( eCSR_DOT11_MODE_11n | eCSR_DOT11_MODE_11n_ONLY ) & phyMode )
2716 {
2717 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
2718 }
2719 else if ( eCSR_DOT11_MODE_abg & phyMode )
2720 {
2721 if( eCSR_BAND_24 != eBand )
2722 {
2723 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
2724 }
2725 else
2726 {
2727 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
2728 }
2729 }
2730 else if( ( eCSR_DOT11_MODE_11a | eCSR_DOT11_MODE_11a_ONLY ) & phyMode )
2731 {
2732 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
2733 }
2734 else if( ( eCSR_DOT11_MODE_11g | eCSR_DOT11_MODE_11g_ONLY ) & phyMode )
2735 {
2736 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
2737 }
2738 else
2739 {
2740 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11B;
2741 }
2742 }
2743
2744 return ( cfgDot11ModeToUse );
2745}
2746
2747
2748
2749
2750tANI_U32 csrGet11hPowerConstraint( tHalHandle hHal, tDot11fIEPowerConstraints *pPowerConstraint )
2751{
2752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2753 tANI_U32 localPowerConstraint = 0;
2754
2755 // check if .11h support is enabled, if not, the power constraint is 0.
2756 if(pMac->roam.configParam.Is11hSupportEnabled && pPowerConstraint->present)
2757 {
2758 localPowerConstraint = pPowerConstraint->localPowerConstraints;
2759 }
2760
2761 return( localPowerConstraint );
2762}
2763
2764
2765tANI_BOOLEAN csrIsProfileWpa( tCsrRoamProfile *pProfile )
2766{
2767 tANI_BOOLEAN fWpaProfile = FALSE;
2768
2769 switch ( pProfile->negotiatedAuthType )
2770 {
2771 case eCSR_AUTH_TYPE_WPA:
2772 case eCSR_AUTH_TYPE_WPA_PSK:
2773 case eCSR_AUTH_TYPE_WPA_NONE:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002774#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 case eCSR_AUTH_TYPE_CCKM_WPA:
2776#endif
2777 fWpaProfile = TRUE;
2778 break;
2779
2780 default:
2781 fWpaProfile = FALSE;
2782 break;
2783 }
2784
2785 if ( fWpaProfile )
2786 {
2787 switch ( pProfile->negotiatedUCEncryptionType )
2788 {
2789 case eCSR_ENCRYPT_TYPE_WEP40:
2790 case eCSR_ENCRYPT_TYPE_WEP104:
2791 case eCSR_ENCRYPT_TYPE_TKIP:
2792 case eCSR_ENCRYPT_TYPE_AES:
2793 fWpaProfile = TRUE;
2794 break;
2795
2796 default:
2797 fWpaProfile = FALSE;
2798 break;
2799 }
2800 }
2801 return( fWpaProfile );
2802}
2803
2804tANI_BOOLEAN csrIsProfileRSN( tCsrRoamProfile *pProfile )
2805{
2806 tANI_BOOLEAN fRSNProfile = FALSE;
2807
2808 switch ( pProfile->negotiatedAuthType )
2809 {
2810 case eCSR_AUTH_TYPE_RSN:
2811 case eCSR_AUTH_TYPE_RSN_PSK:
2812#ifdef WLAN_FEATURE_VOWIFI_11R
2813 case eCSR_AUTH_TYPE_FT_RSN:
2814 case eCSR_AUTH_TYPE_FT_RSN_PSK:
2815#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002816#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 case eCSR_AUTH_TYPE_CCKM_RSN:
2818#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07002819#ifdef WLAN_FEATURE_11W
2820 case eCSR_AUTH_TYPE_RSN_PSK_SHA256:
Abhishek Singhae408032014-09-25 17:22:04 +05302821 case eCSR_AUTH_TYPE_RSN_8021X_SHA256:
Chet Lanctot186b5732013-03-18 10:26:30 -07002822#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 fRSNProfile = TRUE;
2824 break;
2825
2826 default:
2827 fRSNProfile = FALSE;
2828 break;
2829 }
2830
2831 if ( fRSNProfile )
2832 {
2833 switch ( pProfile->negotiatedUCEncryptionType )
2834 {
2835 // !!REVIEW - For WPA2, use of RSN IE mandates
2836 // use of AES as encryption. Here, we qualify
2837 // even if encryption type is WEP or TKIP
2838 case eCSR_ENCRYPT_TYPE_WEP40:
2839 case eCSR_ENCRYPT_TYPE_WEP104:
2840 case eCSR_ENCRYPT_TYPE_TKIP:
2841 case eCSR_ENCRYPT_TYPE_AES:
2842 fRSNProfile = TRUE;
2843 break;
2844
2845 default:
2846 fRSNProfile = FALSE;
2847 break;
2848 }
2849 }
2850 return( fRSNProfile );
2851}
2852
Jeff Johnsone7245742012-09-05 17:12:55 -07002853eHalStatus
2854csrIsconcurrentsessionValid(tpAniSirGlobal pMac,tANI_U32 cursessionId,
2855 tVOS_CON_MODE currBssPersona)
2856{
2857 tANI_U32 sessionId = 0;
2858
2859 for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
2860 {
2861 if (cursessionId != sessionId )
2862 {
2863 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
2864 {
2865 continue;
2866 }
2867
2868 switch (currBssPersona)
2869 {
2870 case VOS_STA_MODE:
Jeff Johnsone7245742012-09-05 17:12:55 -07002871 {
Agarwal Ashish4cfa1e52014-05-09 20:25:11 +05302872 smsLog(pMac, LOG4, FL(" Second session for persona %d"), currBssPersona);
Agarwal Ashishe16e1212014-05-15 14:51:36 +05302873 return eHAL_STATUS_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002874 }
2875 break;
2876
2877 case VOS_STA_SAP_MODE:
Gopichand Nakkala53fefcd2013-02-28 12:35:20 +05302878 if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2879 == VOS_STA_SAP_MODE)&&
Ravi Joshia96ceb42013-05-20 18:52:39 -07002880 (pMac->roam.roamSession[sessionId].connectState
2881 != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
Jeff Johnsone7245742012-09-05 17:12:55 -07002882 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002883 smsLog(pMac, LOGE, FL(" ****SoftAP mode already exists ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002884 return eHAL_STATUS_FAILURE;
2885 }
Ravi Joshia96ceb42013-05-20 18:52:39 -07002886 else if( (pMac->roam.roamSession[sessionId].bssParams.bssPersona
2887 == VOS_P2P_GO_MODE &&
2888 pMac->roam.roamSession[sessionId].connectState
2889 != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED) ||
2890 (pMac->roam.roamSession[sessionId].bssParams.bssPersona
2891 == VOS_IBSS_MODE &&
2892 pMac->roam.roamSession[sessionId].connectState
2893 != eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED))
Jeff Johnsone7245742012-09-05 17:12:55 -07002894 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002895 smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002896 return eHAL_STATUS_FAILURE;
2897 }
2898 break;
2899
2900 case VOS_P2P_CLIENT_MODE:
2901 if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07002902 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
Jeff Johnsone7245742012-09-05 17:12:55 -07002903 == VOS_P2P_CLIENT_MODE)) //check for P2P client mode
2904 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002905 smsLog(pMac, LOGE, FL(" ****CLIENT mode already exists ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002906 return eHAL_STATUS_FAILURE;
2907 }
2908 break;
2909
2910 case VOS_P2P_GO_MODE:
Gopichand Nakkala53fefcd2013-02-28 12:35:20 +05302911 if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2912 == VOS_P2P_GO_MODE) &&
Ravi Joshia96ceb42013-05-20 18:52:39 -07002913 (pMac->roam.roamSession[sessionId].connectState
2914 != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
Jeff Johnsone7245742012-09-05 17:12:55 -07002915 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002916 smsLog(pMac, LOGE, FL(" ****P2P GO mode already exists ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002917 return eHAL_STATUS_FAILURE;
2918 }
Ravi Joshia96ceb42013-05-20 18:52:39 -07002919 else if( (pMac->roam.roamSession[sessionId].bssParams.bssPersona
2920 == VOS_STA_SAP_MODE &&
2921 pMac->roam.roamSession[sessionId].connectState
2922 != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED) ||
2923 (pMac->roam.roamSession[sessionId].bssParams.bssPersona
2924 == VOS_IBSS_MODE &&
2925 pMac->roam.roamSession[sessionId].connectState
2926 != eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED) )
Jeff Johnsone7245742012-09-05 17:12:55 -07002927 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002928 smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002929 return eHAL_STATUS_FAILURE;
2930 }
2931 break;
Ravi Joshia96ceb42013-05-20 18:52:39 -07002932 case VOS_IBSS_MODE:
2933 if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2934 == VOS_IBSS_MODE) &&
2935 (pMac->roam.roamSession[sessionId].connectState
2936 != eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED))
2937 {
2938 smsLog(pMac, LOGE, FL(" ****IBSS mode already exists ****"));
2939 return eHAL_STATUS_FAILURE;
2940 }
2941 else if( (pMac->roam.roamSession[sessionId].bssParams.bssPersona
2942 == VOS_P2P_GO_MODE ||
2943 pMac->roam.roamSession[sessionId].bssParams.bssPersona
2944 == VOS_STA_SAP_MODE) &&
2945 pMac->roam.roamSession[sessionId].connectState
2946 != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED)
2947 {
2948 smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****"));
2949 return eHAL_STATUS_FAILURE;
2950 }
2951 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002952 default :
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002953 smsLog(pMac, LOGE, FL("***Persona not handled = %d*****"),currBssPersona);
Jeff Johnsone7245742012-09-05 17:12:55 -07002954 break;
2955 }
2956 }
2957 }
2958 return eHAL_STATUS_SUCCESS;
2959
2960}
2961
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002962eHalStatus csrUpdateMCCp2pBeaconInterval(tpAniSirGlobal pMac)
Jeff Johnsone7245742012-09-05 17:12:55 -07002963{
2964 tANI_U32 sessionId = 0;
2965
2966 //If MCC is not supported just break and return SUCCESS
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002967 if ( !pMac->roam.configParam.fenableMCCMode){
2968 return eHAL_STATUS_FAILURE;
2969 }
2970
2971 for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
2972 {
2973 /* If GO in MCC support different beacon interval,
2974 * change the BI of the P2P-GO */
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07002975 if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
2976 == VOS_P2P_GO_MODE)
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002977 {
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07002978 /* Handle different BI scneario based on the configuration set.
2979 * If Config is set to 0x02 then Disconnect all the P2P clients
2980 * associated. If config is set to 0x04 then update the BI
2981 * without disconnecting all the clients
2982 */
2983 if ((pMac->roam.configParam.fAllowMCCGODiffBI == 0x04) &&
2984 (pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval))
2985 {
2986 return csrSendChngMCCBeaconInterval( pMac, sessionId);
2987 }
2988 //If the configuration of fAllowMCCGODiffBI is set to other than 0x04
2989 else if ( pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval)
2990 {
2991 return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS, eCSR_ROAM_RESULT_NONE);
2992 }
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002993 }
2994 }
2995 return eHAL_STATUS_FAILURE;
2996}
2997
2998tANI_U16 csrCalculateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U16 sta_bi, tANI_U16 go_gbi)
2999{
3000 tANI_U8 num_beacons = 0;
3001 tANI_U8 is_multiple = 0;
3002 tANI_U16 go_cbi = 0;
3003 tANI_U16 go_fbi = 0;
3004 tANI_U16 sta_cbi = 0;
3005
3006 //If GO's given beacon Interval is less than 100
3007 if(go_gbi < 100)
3008 go_cbi = 100;
3009 //if GO's given beacon Interval is greater than or equal to 100
3010 else
3011 go_cbi = 100 + (go_gbi % 100);
3012
AnjaneeDevi Kapparapu4b043912014-02-18 13:22:35 +05303013 if ( sta_bi == 0 )
3014 {
3015 /* There is possibility to receive zero as value.
3016 Which will cause divide by zero. Hence initialise with 100
3017 */
3018 sta_bi = 100;
3019 smsLog(pMac, LOGW,
3020 FL("sta_bi 2nd parameter is zero, initialise to %d"), sta_bi);
3021 }
3022
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003023 // check, if either one is multiple of another
3024 if (sta_bi > go_cbi)
3025 {
3026 is_multiple = !(sta_bi % go_cbi);
3027 }
3028 else
3029 {
3030 is_multiple = !(go_cbi % sta_bi);
3031 }
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08003032 // if it is multiple, then accept GO's beacon interval range [100,199] as it is
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003033 if (is_multiple)
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003034 {
3035 return go_cbi;
3036 }
3037 //else , if it is not multiple, then then check for number of beacons to be
3038 //inserted based on sta BI
3039 num_beacons = sta_bi / 100;
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003040 if (num_beacons)
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003041 {
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08003042 // GO's final beacon interval will be aligned to sta beacon interval, but
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003043 //in the range of [100, 199].
3044 sta_cbi = sta_bi / num_beacons;
3045 go_fbi = sta_cbi;
3046 }
3047 else
3048 {
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08003049 // if STA beacon interval is less than 100, use GO's change bacon interval
3050 //instead of updating to STA's beacon interval.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003051 go_fbi = go_cbi;
3052 }
3053 return go_fbi;
3054}
3055
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003056eHalStatus csrValidateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId,
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003057 tANI_U16 *beaconInterval, tANI_U32 cursessionId,
3058 tVOS_CON_MODE currBssPersona)
3059{
3060 tANI_U32 sessionId = 0;
3061 tANI_U16 new_beaconInterval = 0;
3062
3063 //If MCC is not supported just break
3064 if (!pMac->roam.configParam.fenableMCCMode){
Jeff Johnsone7245742012-09-05 17:12:55 -07003065 return eHAL_STATUS_FAILURE;
3066 }
3067
3068 for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
3069 {
3070 if (cursessionId != sessionId )
3071 {
3072 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
3073 {
3074 continue;
3075 }
3076
3077 switch (currBssPersona)
3078 {
3079 case VOS_STA_MODE:
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003080 if (pMac->roam.roamSession[sessionId].pCurRoamProfile &&
3081 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
Jeff Johnsone7245742012-09-05 17:12:55 -07003082 == VOS_P2P_CLIENT_MODE)) //check for P2P client mode
3083 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003084 smsLog(pMac, LOG1, FL(" Beacon Interval Validation not required for STA/CLIENT"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003085 }
3086 //IF SAP has started and STA wants to connect on different channel MCC should
3087 //MCC should not be enabled so making it false to enforce on same channel
3088 else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
3089 == VOS_STA_SAP_MODE)
3090 {
3091 if (pMac->roam.roamSession[sessionId].bssParams.operationChn
3092 != channelId )
3093 {
Agarwal Ashish4cfa1e52014-05-09 20:25:11 +05303094 smsLog(pMac, LOGE, FL("*** MCC with SAP+STA sessions ****"));
3095 return eHAL_STATUS_SUCCESS;
Jeff Johnsone7245742012-09-05 17:12:55 -07003096 }
3097 }
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003098 else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
Jeff Johnsone7245742012-09-05 17:12:55 -07003099 == VOS_P2P_GO_MODE) //Check for P2P go scenario
3100 {
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003101 /* if GO in MCC support different beacon interval,
3102 * change the BI of the P2P-GO */
3103 if ((pMac->roam.roamSession[sessionId].bssParams.operationChn
Jeff Johnsone7245742012-09-05 17:12:55 -07003104 != channelId ) &&
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003105 (pMac->roam.roamSession[sessionId].bssParams.beaconInterval
Jeff Johnsone7245742012-09-05 17:12:55 -07003106 != *beaconInterval))
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003107 {
3108 /* if GO in MCC support different beacon interval, return success */
3109 if ( pMac->roam.configParam.fAllowMCCGODiffBI == 0x01)
3110 {
3111 return eHAL_STATUS_SUCCESS;
3112 }
3113 // Send only Broadcast disassoc and update beaconInterval
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003114 //If configuration is set to 0x04 then dont
3115 // disconnect all the station
3116 else if ((pMac->roam.configParam.fAllowMCCGODiffBI == 0x02) ||
3117 (pMac->roam.configParam.fAllowMCCGODiffBI == 0x04))
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003118 {
3119 //Check to pass the right beacon Interval
3120 new_beaconInterval = csrCalculateMCCBeaconInterval(pMac, *beaconInterval,
3121 pMac->roam.roamSession[sessionId].bssParams.beaconInterval);
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003122 smsLog(pMac, LOG1, FL(" Peer AP BI : %d, new Beacon Interval: %d"),*beaconInterval,new_beaconInterval );
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003123 //Update the becon Interval
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003124 if (new_beaconInterval != pMac->roam.roamSession[sessionId].bssParams.beaconInterval)
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003125 {
3126 //Update the beaconInterval now
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003127 smsLog(pMac, LOGE, FL(" Beacon Interval got changed config used: %d\n"),
3128 pMac->roam.configParam.fAllowMCCGODiffBI);
3129
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003130 pMac->roam.roamSession[sessionId].bssParams.beaconInterval = new_beaconInterval;
3131 pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_TRUE;
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003132 return csrUpdateMCCp2pBeaconInterval(pMac);
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003133 }
3134 return eHAL_STATUS_SUCCESS;
3135 }
3136 //Disconnect the P2P session
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003137 else if (pMac->roam.configParam.fAllowMCCGODiffBI == 0x03)
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003138 {
3139 pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE;
3140 return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_SEND_P2P_STOP_BSS, eCSR_ROAM_RESULT_NONE);
3141 }
3142 else
3143 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003144 smsLog(pMac, LOGE, FL("BeaconInterval is different cannot connect to preferred AP..."));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003145 return eHAL_STATUS_FAILURE;
3146 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003147 }
3148 }
3149 break;
3150
3151 case VOS_P2P_CLIENT_MODE:
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003152 if (pMac->roam.roamSession[sessionId].pCurRoamProfile &&
3153 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
Jeff Johnsone7245742012-09-05 17:12:55 -07003154 == VOS_STA_MODE)) //check for P2P client mode
3155 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003156 smsLog(pMac, LOG1, FL(" Ignore Beacon Interval Validation..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003157 }
3158 //IF SAP has started and STA wants to connect on different channel MCC should
3159 //MCC should not be enabled so making it false to enforce on same channel
3160 else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
3161 == VOS_STA_SAP_MODE)
3162 {
3163 if (pMac->roam.roamSession[sessionId].bssParams.operationChn
3164 != channelId )
3165 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003166 smsLog(pMac, LOGE, FL("***MCC is not enabled for SAP + CLIENT****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003167 return eHAL_STATUS_FAILURE;
3168 }
3169 }
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003170 else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
Jeff Johnsone7245742012-09-05 17:12:55 -07003171 == VOS_P2P_GO_MODE) //Check for P2P go scenario
3172 {
3173 if ((pMac->roam.roamSession[sessionId].bssParams.operationChn
3174 != channelId ) &&
3175 (pMac->roam.roamSession[sessionId].bssParams.beaconInterval
3176 != *beaconInterval))
3177 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003178 smsLog(pMac, LOGE, FL("BeaconInterval is different cannot connect to P2P_GO network ..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003179 return eHAL_STATUS_FAILURE;
3180 }
3181 }
3182 break;
3183
3184 case VOS_P2P_GO_MODE :
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003185 {
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003186 if (pMac->roam.roamSession[sessionId].pCurRoamProfile &&
3187 ((pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003188 == VOS_P2P_CLIENT_MODE) ||
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003189 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
Jeff Johnsone7245742012-09-05 17:12:55 -07003190 == VOS_STA_MODE))) //check for P2P_client scenario
3191 {
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003192 if ((pMac->roam.roamSession[sessionId].connectedProfile.operationChannel
Jeff Johnsone7245742012-09-05 17:12:55 -07003193 == 0 )&&
3194 (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval
3195 == 0))
3196 {
3197 continue;
3198 }
3199
AnjaneeDevi Kapparapu4b043912014-02-18 13:22:35 +05303200 //Assert if connected profile beacon internal is ZERO
3201 if(!pMac->roam.roamSession[sessionId].\
3202 connectedProfile.beaconInterval)
3203 {
3204 smsLog( pMac, LOGE, FL(" Connected profile "
3205 "beacon interval is zero") );
3206 }
3207
Jeff Johnsone7245742012-09-05 17:12:55 -07003208
3209 if (csrIsConnStateConnectedInfra(pMac, sessionId) &&
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003210 (pMac->roam.roamSession[sessionId].connectedProfile.operationChannel
Jeff Johnsone7245742012-09-05 17:12:55 -07003211 != channelId ) &&
Sudhir Sattayappa Kohallid9a4df62013-04-04 14:47:54 -07003212 (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval
Jeff Johnsone7245742012-09-05 17:12:55 -07003213 != *beaconInterval))
3214 {
3215 /*
3216 * Updated beaconInterval should be used only when we are starting a new BSS
3217 * not incase of client or STA case
3218 */
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003219 //Calculate beacon Interval for P2P-GO incase of MCC
3220 new_beaconInterval = csrCalculateMCCBeaconInterval(pMac,
Chet Lanctot4c986162013-05-08 13:59:56 -07003221 pMac->roam.roamSession[sessionId].bssParams.beaconInterval,
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003222 *beaconInterval );
3223 if(*beaconInterval != new_beaconInterval)
3224 *beaconInterval = new_beaconInterval;
Jeff Johnsone7245742012-09-05 17:12:55 -07003225 return eHAL_STATUS_SUCCESS;
3226 }
3227 }
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003228 }
3229 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07003230
3231 default :
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05303232 smsLog(pMac, LOGE, FL(" Persona not supported : %d"),currBssPersona);
Jeff Johnsone7245742012-09-05 17:12:55 -07003233 return eHAL_STATUS_FAILURE;
3234 }
3235 }
3236 }
3237
3238 return eHAL_STATUS_SUCCESS;
3239}
Jeff Johnson295189b2012-06-20 16:38:30 -07003240
3241#ifdef WLAN_FEATURE_VOWIFI_11R
3242/* Function to return TRUE if the authtype is 11r */
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003243tANI_BOOLEAN csrIsAuthType11r( eCsrAuthType AuthType, tANI_U8 mdiePresent)
Jeff Johnson295189b2012-06-20 16:38:30 -07003244{
3245 switch ( AuthType )
3246 {
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003247 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
3248 if(mdiePresent)
3249 return TRUE;
3250 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003251 case eCSR_AUTH_TYPE_FT_RSN_PSK:
3252 case eCSR_AUTH_TYPE_FT_RSN:
3253 return TRUE;
3254 break;
3255 default:
3256 break;
3257 }
3258 return FALSE;
3259}
3260
3261/* Function to return TRUE if the profile is 11r */
3262tANI_BOOLEAN csrIsProfile11r( tCsrRoamProfile *pProfile )
3263{
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003264 return csrIsAuthType11r( pProfile->negotiatedAuthType, pProfile->MDID.mdiePresent );
Jeff Johnson295189b2012-06-20 16:38:30 -07003265}
3266
3267#endif
3268
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003269#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07003270
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003271/* Function to return TRUE if the authtype is ESE */
3272tANI_BOOLEAN csrIsAuthTypeESE( eCsrAuthType AuthType )
Jeff Johnson295189b2012-06-20 16:38:30 -07003273{
3274 switch ( AuthType )
3275 {
3276 case eCSR_AUTH_TYPE_CCKM_WPA:
3277 case eCSR_AUTH_TYPE_CCKM_RSN:
3278 return TRUE;
3279 break;
3280 default:
3281 break;
3282 }
3283 return FALSE;
3284}
3285
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003286/* Function to return TRUE if the profile is ESE */
3287tANI_BOOLEAN csrIsProfileESE( tCsrRoamProfile *pProfile )
Jeff Johnson295189b2012-06-20 16:38:30 -07003288{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003289 return (csrIsAuthTypeESE( pProfile->negotiatedAuthType ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003290}
3291
3292#endif
3293
3294#ifdef FEATURE_WLAN_WAPI
3295tANI_BOOLEAN csrIsProfileWapi( tCsrRoamProfile *pProfile )
3296{
3297 tANI_BOOLEAN fWapiProfile = FALSE;
3298
3299 switch ( pProfile->negotiatedAuthType )
3300 {
3301 case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE:
3302 case eCSR_AUTH_TYPE_WAPI_WAI_PSK:
3303 fWapiProfile = TRUE;
3304 break;
3305
3306 default:
3307 fWapiProfile = FALSE;
3308 break;
3309 }
3310
3311 if ( fWapiProfile )
3312 {
3313 switch ( pProfile->negotiatedUCEncryptionType )
3314 {
3315 case eCSR_ENCRYPT_TYPE_WPI:
3316 fWapiProfile = TRUE;
3317 break;
3318
3319 default:
3320 fWapiProfile = FALSE;
3321 break;
3322 }
3323 }
3324 return( fWapiProfile );
3325}
3326
3327static tANI_BOOLEAN csrIsWapiOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 )
3328{
Kiet Lam64c1b492013-07-12 13:56:44 +05303329 return (vos_mem_compare(Oui1, Oui2, CSR_WAPI_OUI_SIZE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003330}
3331
3332static tANI_BOOLEAN csrIsWapiOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE],
3333 tANI_U8 cAllCyphers,
3334 tANI_U8 Cypher[],
3335 tANI_U8 Oui[] )
3336{
3337 tANI_BOOLEAN fYes = FALSE;
3338 tANI_U8 idx;
3339
3340 for ( idx = 0; idx < cAllCyphers; idx++ )
3341 {
3342 if ( csrIsWapiOuiEqual( pMac, AllCyphers[ idx ], Cypher ) )
3343 {
3344 fYes = TRUE;
3345 break;
3346 }
3347 }
3348
3349 if ( fYes && Oui )
3350 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303351 vos_mem_copy(Oui, AllCyphers[ idx ], CSR_WAPI_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003352 }
3353
3354 return( fYes );
3355}
3356#endif /* FEATURE_WLAN_WAPI */
3357
3358static tANI_BOOLEAN csrIsWpaOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 )
3359{
Kiet Lam64c1b492013-07-12 13:56:44 +05303360 return(vos_mem_compare(Oui1, Oui2, CSR_WPA_OUI_SIZE));
Jeff Johnson295189b2012-06-20 16:38:30 -07003361}
3362
3363static tANI_BOOLEAN csrIsOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3364 tANI_U8 cAllCyphers,
3365 tANI_U8 Cypher[],
3366 tANI_U8 Oui[] )
3367{
3368 tANI_BOOLEAN fYes = FALSE;
3369 tANI_U8 idx;
3370
3371 for ( idx = 0; idx < cAllCyphers; idx++ )
3372 {
3373 if ( csrIsWpaOuiEqual( pMac, AllCyphers[ idx ], Cypher ) )
3374 {
3375 fYes = TRUE;
3376 break;
3377 }
3378 }
3379
3380 if ( fYes && Oui )
3381 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303382 vos_mem_copy(Oui, AllCyphers[ idx ], CSR_WPA_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003383 }
3384
3385 return( fYes );
3386}
3387
3388static tANI_BOOLEAN csrMatchRSNOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3389 tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
3390 tANI_U8 Oui[] )
3391{
3392 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui[ouiIndex], Oui ) );
3393
3394}
3395
3396#ifdef FEATURE_WLAN_WAPI
3397static tANI_BOOLEAN csrMatchWapiOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE],
3398 tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
3399 tANI_U8 Oui[] )
3400{
Kaushik, Sushantfe230152014-04-08 14:37:47 +05303401 if (ouiIndex < CSR_WAPI_OUI_ROW_SIZE)// since csrWapiOui row size is 3 .
3402 return( csrIsWapiOuiMatch( pMac, AllCyphers, cAllCyphers,
3403 csrWapiOui[ouiIndex], Oui ) );
3404 else
3405 return FALSE ;
Jeff Johnson295189b2012-06-20 16:38:30 -07003406
3407}
3408#endif /* FEATURE_WLAN_WAPI */
3409
3410static tANI_BOOLEAN csrMatchWPAOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3411 tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
3412 tANI_U8 Oui[] )
3413{
3414 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui[ouiIndex], Oui ) );
3415
3416}
3417
3418#if 0
3419static tANI_BOOLEAN csrIsRSNUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3420 tANI_U8 cAllCyphers,
3421 tANI_U8 Oui[] )
3422{
3423 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui00, Oui ) );
3424}
3425
3426static tANI_BOOLEAN csrIsRSNMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3427 tANI_U8 cAllCyphers,
3428 tANI_U8 Oui[] )
3429{
3430 tANI_BOOLEAN fYes = FALSE;
3431
3432 // Check Wep 104 first, if fails, then check Wep40.
3433 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui05, Oui );
3434
3435 if ( !fYes )
3436 {
3437 // if not Wep-104, check Wep-40
3438 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui01, Oui );
3439 }
3440
3441 return( fYes );
3442}
3443
3444
3445static tANI_BOOLEAN csrIsRSNUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3446 tANI_U8 cAllCyphers,
3447 tANI_U8 Oui[] )
3448{
3449 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) );
3450}
3451
3452
3453static tANI_BOOLEAN csrIsRSNMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3454 tANI_U8 cAllCyphers,
3455 tANI_U8 Oui[] )
3456{
3457 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) );
3458}
3459
3460static tANI_BOOLEAN csrIsRSNUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3461 tANI_U8 cAllCyphers,
3462 tANI_U8 Oui[] )
3463{
3464 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) );
3465}
3466
3467static tANI_BOOLEAN csrIsRSNMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3468 tANI_U8 cAllCyphers,
3469 tANI_U8 Oui[] )
3470{
3471 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) );
3472}
3473#endif
3474#ifdef FEATURE_WLAN_WAPI
3475static tANI_BOOLEAN csrIsAuthWapiCert( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE],
3476 tANI_U8 cAllSuites,
3477 tANI_U8 Oui[] )
3478{
3479 return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[1], Oui ) );
3480}
3481static tANI_BOOLEAN csrIsAuthWapiPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE],
3482 tANI_U8 cAllSuites,
3483 tANI_U8 Oui[] )
3484{
3485 return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[2], Oui ) );
3486}
3487#endif /* FEATURE_WLAN_WAPI */
3488
3489#ifdef WLAN_FEATURE_VOWIFI_11R
3490
3491/*
3492 * Function for 11R FT Authentication. We match the FT Authentication Cipher suite
3493 * here. This matches for FT Auth with the 802.1X exchange.
3494 *
3495 */
3496static tANI_BOOLEAN csrIsFTAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3497 tANI_U8 cAllSuites,
3498 tANI_U8 Oui[] )
3499{
3500 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[03], Oui ) );
3501}
3502
3503/*
3504 * Function for 11R FT Authentication. We match the FT Authentication Cipher suite
3505 * here. This matches for FT Auth with the PSK.
3506 *
3507 */
3508static tANI_BOOLEAN csrIsFTAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3509 tANI_U8 cAllSuites,
3510 tANI_U8 Oui[] )
3511{
3512 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[04], Oui ) );
3513}
3514
3515#endif
3516
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003517#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07003518
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003519/*
3520 * Function for ESE CCKM AKM Authentication. We match the CCKM AKM Authentication Key Management suite
Jeff Johnson295189b2012-06-20 16:38:30 -07003521 * here. This matches for CCKM AKM Auth with the 802.1X exchange.
3522 *
3523 */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003524static tANI_BOOLEAN csrIsEseCckmAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
Jeff Johnson295189b2012-06-20 16:38:30 -07003525 tANI_U8 cAllSuites,
3526 tANI_U8 Oui[] )
3527{
3528 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ) );
3529}
3530
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003531static tANI_BOOLEAN csrIsEseCckmAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 tANI_U8 cAllSuites,
3533 tANI_U8 Oui[] )
3534{
3535 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[06], Oui ) );
3536}
3537
3538#endif
3539
3540static tANI_BOOLEAN csrIsAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3541 tANI_U8 cAllSuites,
3542 tANI_U8 Oui[] )
3543{
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[01], Oui ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003545}
3546static tANI_BOOLEAN csrIsAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3547 tANI_U8 cAllSuites,
3548 tANI_U8 Oui[] )
3549{
Jeff Johnson295189b2012-06-20 16:38:30 -07003550 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[02], Oui ) );
Jeff Johnson295189b2012-06-20 16:38:30 -07003551}
3552
Chet Lanctot186b5732013-03-18 10:26:30 -07003553#ifdef WLAN_FEATURE_11W
3554static tANI_BOOLEAN csrIsAuthRSNPskSha256( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3555 tANI_U8 cAllSuites,
3556 tANI_U8 Oui[] )
3557{
Chet Lanctot4c986162013-05-08 13:59:56 -07003558 return csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[07], Oui );
Chet Lanctot186b5732013-03-18 10:26:30 -07003559}
Abhishek Singhae408032014-09-25 17:22:04 +05303560static tANI_BOOLEAN csrIsAuthRSN8021xSha256(tpAniSirGlobal pMac,
3561 tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3562 tANI_U8 cAllSuites,
3563 tANI_U8 Oui[] )
3564{
3565 return csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[8], Oui );
3566}
Chet Lanctot186b5732013-03-18 10:26:30 -07003567#endif
3568
Jeff Johnson295189b2012-06-20 16:38:30 -07003569static tANI_BOOLEAN csrIsAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
3570 tANI_U8 cAllSuites,
3571 tANI_U8 Oui[] )
3572{
3573 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[01], Oui ) );
3574}
3575
3576#ifdef NOT_CURRENTLY_USED
3577static tANI_BOOLEAN csrIsAuth802_1x( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
3578 tANI_U8 cAllSuites,
3579 tANI_U8 Oui[] )
3580{
3581 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[00], Oui ) );
3582}
3583#endif // NOT_CURRENTLY_USED
3584
3585static tANI_BOOLEAN csrIsAuthWpaPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
3586 tANI_U8 cAllSuites,
3587 tANI_U8 Oui[] )
3588{
3589 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[02], Oui ) );
3590}
3591#if 0
3592static tANI_BOOLEAN csrIsUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3593 tANI_U8 cAllCyphers,
3594 tANI_U8 Oui[] )
3595{
3596 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui00, Oui ) );
3597}
3598
3599static tANI_BOOLEAN csrIsUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3600 tANI_U8 cAllCyphers,
3601 tANI_U8 Oui[] )
3602{
3603 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) );
3604}
3605
3606static tANI_BOOLEAN csrIsUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3607 tANI_U8 cAllCyphers,
3608 tANI_U8 Oui[] )
3609{
3610 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) );
3611}
3612
3613
3614static tANI_BOOLEAN csrIsMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3615 tANI_U8 cAllCyphers,
3616 tANI_U8 Oui[] )
3617{
3618 tANI_BOOLEAN fYes = FALSE;
3619
3620 // Check Wep 104 first, if fails, then check Wep40.
3621 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui05, Oui );
3622
3623 if ( !fYes )
3624 {
3625 // if not Wep-104, check Wep-40
3626 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui01, Oui );
3627 }
3628
3629 return( fYes );
3630}
3631
3632
3633static tANI_BOOLEAN csrIsMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3634 tANI_U8 cAllCyphers,
3635 tANI_U8 Oui[] )
3636{
3637 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) );
3638}
3639
3640
3641static tANI_BOOLEAN csrIsMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3642 tANI_U8 cAllCyphers,
3643 tANI_U8 Oui[] )
3644{
3645 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) );
3646}
3647
3648#endif
3649
3650tANI_U8 csrGetOUIIndexFromCipher( eCsrEncryptionType enType )
3651{
3652 tANI_U8 OUIIndex;
3653
3654 switch ( enType )
3655 {
3656 case eCSR_ENCRYPT_TYPE_WEP40:
3657 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
3658 OUIIndex = CSR_OUI_WEP40_OR_1X_INDEX;
3659 break;
3660 case eCSR_ENCRYPT_TYPE_WEP104:
3661 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
3662 OUIIndex = CSR_OUI_WEP104_INDEX;
3663 break;
3664 case eCSR_ENCRYPT_TYPE_TKIP:
3665 OUIIndex = CSR_OUI_TKIP_OR_PSK_INDEX;
3666 break;
3667 case eCSR_ENCRYPT_TYPE_AES:
3668 OUIIndex = CSR_OUI_AES_INDEX;
3669 break;
3670 case eCSR_ENCRYPT_TYPE_NONE:
3671 OUIIndex = CSR_OUI_USE_GROUP_CIPHER_INDEX;
3672 break;
3673#ifdef FEATURE_WLAN_WAPI
3674 case eCSR_ENCRYPT_TYPE_WPI:
3675 OUIIndex = CSR_OUI_WAPI_WAI_CERT_OR_SMS4_INDEX;
3676 break;
3677#endif /* FEATURE_WLAN_WAPI */
3678 default: //HOWTO handle this?
3679 OUIIndex = CSR_OUI_RESERVED_INDEX;
3680 break;
3681 }//switch
3682
3683 return OUIIndex;
3684}
3685
3686tANI_BOOLEAN csrGetRSNInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
3687 tDot11fIERSN *pRSNIe,
3688 tANI_U8 *UnicastCypher,
3689 tANI_U8 *MulticastCypher,
3690 tANI_U8 *AuthSuite,
3691 tCsrRSNCapabilities *Capabilities,
3692 eCsrAuthType *pNegotiatedAuthtype,
3693 eCsrEncryptionType *pNegotiatedMCCipher )
3694{
3695 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3696 tANI_BOOLEAN fAcceptableCyphers = FALSE;
3697 tANI_U8 cUnicastCyphers = 0;
3698 tANI_U8 cMulticastCyphers = 0;
3699 tANI_U8 cAuthSuites = 0, i;
3700 tANI_U8 Unicast[ CSR_RSN_OUI_SIZE ];
3701 tANI_U8 Multicast[ CSR_RSN_OUI_SIZE ];
3702 tANI_U8 AuthSuites[ CSR_RSN_MAX_AUTH_SUITES ][ CSR_RSN_OUI_SIZE ];
3703 tANI_U8 Authentication[ CSR_RSN_OUI_SIZE ];
3704 tANI_U8 MulticastCyphers[ CSR_RSN_MAX_MULTICAST_CYPHERS ][ CSR_RSN_OUI_SIZE ];
3705 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
3706
3707 do{
3708 if ( pRSNIe->present )
3709 {
3710 cMulticastCyphers++;
Kiet Lam64c1b492013-07-12 13:56:44 +05303711 vos_mem_copy(MulticastCyphers, pRSNIe->gp_cipher_suite, CSR_RSN_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003712 cUnicastCyphers = (tANI_U8)(pRSNIe->pwise_cipher_suite_count);
Pragaspathi Thilagarajd1b02df2018-06-26 17:08:05 +05303713 cAuthSuites = (tANI_U8)(pRSNIe->akm_suite_cnt);
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 for(i = 0; i < cAuthSuites && i < CSR_RSN_MAX_AUTH_SUITES; i++)
3715 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303716 vos_mem_copy((void *)&AuthSuites[i],
Pragaspathi Thilagarajd1b02df2018-06-26 17:08:05 +05303717 (void *)&pRSNIe->akm_suite[i],
Kiet Lam64c1b492013-07-12 13:56:44 +05303718 CSR_RSN_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 }
3720
3721 //Check - Is requested Unicast Cipher supported by the BSS.
3722 fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, pRSNIe->pwise_cipher_suites, cUnicastCyphers,
3723 csrGetOUIIndexFromCipher( enType ), Unicast );
3724
3725 if( !fAcceptableCyphers ) break;
3726
3727
3728 //Unicast is supported. Pick the first matching Group cipher, if any.
3729 for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
3730 {
3731 fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, MulticastCyphers, cMulticastCyphers,
3732 csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast );
3733 if(fAcceptableCyphers)
3734 {
3735 break;
3736 }
3737 }
3738 if( !fAcceptableCyphers ) break;
3739
3740 if( pNegotiatedMCCipher )
3741 *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
3742
3743 /* Initializing with FALSE as it has TRUE value already */
3744 fAcceptableCyphers = FALSE;
3745 for (i = 0 ; i < pAuthType->numEntries; i++)
3746 {
3747 //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
3748 #ifdef WLAN_FEATURE_VOWIFI_11R
3749 /* Changed the AKM suites according to order of preference */
3750 if ( csrIsFTAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
3751 {
3752 if (eCSR_AUTH_TYPE_FT_RSN == pAuthType->authType[i])
3753 negAuthType = eCSR_AUTH_TYPE_FT_RSN;
3754 }
3755 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsFTAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
3756 {
3757 if (eCSR_AUTH_TYPE_FT_RSN_PSK == pAuthType->authType[i])
3758 negAuthType = eCSR_AUTH_TYPE_FT_RSN_PSK;
3759 }
3760#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003761#ifdef FEATURE_WLAN_ESE
3762 /* ESE only supports 802.1X. No PSK. */
3763 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsEseCckmAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003764 {
3765 if (eCSR_AUTH_TYPE_CCKM_RSN == pAuthType->authType[i])
3766 negAuthType = eCSR_AUTH_TYPE_CCKM_RSN;
3767 }
3768#endif
3769 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
3770 {
3771 if (eCSR_AUTH_TYPE_RSN == pAuthType->authType[i])
3772 negAuthType = eCSR_AUTH_TYPE_RSN;
3773 }
3774 if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
3775 {
3776 if (eCSR_AUTH_TYPE_RSN_PSK == pAuthType->authType[i])
3777 negAuthType = eCSR_AUTH_TYPE_RSN_PSK;
3778 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003779#ifdef WLAN_FEATURE_11W
3780 if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSNPskSha256( pMac, AuthSuites, cAuthSuites, Authentication ) )
3781 {
3782 if (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == pAuthType->authType[i])
3783 negAuthType = eCSR_AUTH_TYPE_RSN_PSK_SHA256;
3784 }
Abhishek Singhae408032014-09-25 17:22:04 +05303785 if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) &&
3786 csrIsAuthRSN8021xSha256(pMac, AuthSuites,
3787 cAuthSuites, Authentication)) {
3788 if (eCSR_AUTH_TYPE_RSN_8021X_SHA256 ==
3789 pAuthType->authType[i])
3790 negAuthType = eCSR_AUTH_TYPE_RSN_8021X_SHA256;
3791 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003792#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003793
3794 // The 1st auth type in the APs RSN IE, to match stations connecting
3795 // profiles auth type will cause us to exit this loop
3796 // This is added as some APs advertise multiple akms in the RSN IE.
3797 if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType)
3798 {
3799 fAcceptableCyphers = TRUE;
3800 break;
3801 }
3802 } // for
3803 }
3804
3805 }while (0);
3806
3807 if ( fAcceptableCyphers )
3808 {
3809 if ( MulticastCypher )
3810 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303811 vos_mem_copy(MulticastCypher, Multicast, CSR_RSN_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003812 }
3813
3814 if ( UnicastCypher )
3815 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303816 vos_mem_copy(UnicastCypher, Unicast, CSR_RSN_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003817 }
3818
3819 if ( AuthSuite )
3820 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303821 vos_mem_copy(AuthSuite, Authentication, CSR_RSN_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003822 }
3823
3824 if ( pNegotiatedAuthtype )
3825 {
3826 *pNegotiatedAuthtype = negAuthType;
3827 }
3828 if ( Capabilities )
3829 {
Venkata Prathyusha Kuntupalliea7098e2013-01-31 16:08:13 -08003830 Capabilities->PreAuthSupported = (pRSNIe->RSN_Cap[0] >> 0) & 0x1 ; // Bit 0 PreAuthentication
3831 Capabilities->NoPairwise = (pRSNIe->RSN_Cap[0] >> 1) & 0x1 ; // Bit 1 No Pairwise
3832 Capabilities->PTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 2) & 0x3 ; // Bit 2, 3 PTKSA Replay Counter
Chet Lanctot186b5732013-03-18 10:26:30 -07003833 Capabilities->GTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 4) & 0x3 ; // Bit 4, 5 GTKSA Replay Counter
Abhishek Singhf53e89d2015-06-18 12:30:00 +05303834#ifdef WLAN_FEATURE_11W
Chet Lanctot186b5732013-03-18 10:26:30 -07003835 Capabilities->MFPRequired = (pRSNIe->RSN_Cap[0] >> 6) & 0x1 ; // Bit 6 MFPR
3836 Capabilities->MFPCapable = (pRSNIe->RSN_Cap[0] >> 7) & 0x1 ; // Bit 7 MFPC
Abhishek Singhf53e89d2015-06-18 12:30:00 +05303837#else
3838 Capabilities->MFPRequired = 0 ; // Bit 6 MFPR
3839 Capabilities->MFPCapable = 0 ; // Bit 7 MFPC
3840#endif
3841
Chet Lanctot186b5732013-03-18 10:26:30 -07003842 Capabilities->Reserved = pRSNIe->RSN_Cap[1] & 0xff ; // remaining reserved
Jeff Johnson295189b2012-06-20 16:38:30 -07003843 }
3844 }
3845 return( fAcceptableCyphers );
3846}
3847
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05303848#ifdef WLAN_FEATURE_11W
3849/* ---------------------------------------------------------------------------
3850 \fn csrIsPMFCapabilitiesInRSNMatch
Jeff Johnson295189b2012-06-20 16:38:30 -07003851
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05303852 \brief this function is to match our current capabilities with the AP
3853 to which we are expecting make the connection.
3854
3855 \param hHal - HAL Pointer
3856 pFilterMFPEnabled - given by supplicant to us to specify what kind
3857 of connection supplicant is expecting to make
3858 if it is enabled then make PMF connection.
3859 if it is disabled then make normal connection.
3860 pFilterMFPRequired - given by supplicant based on our configuration
3861 if it is 1 then we will require mandatory
3862 PMF connection and if it is 0 then we PMF
3863 connection is optional.
3864 pFilterMFPCapable - given by supplicant based on our configuration
3865 if it 1 then we are PMF capable and if it 0
3866 then we are not PMF capable.
3867 pRSNIe - RSNIe from Beacon/probe response of
3868 neighbor AP against which we will compare
3869 our capabilities.
3870
3871 \return tANI_BOOLEAN - if our PMF capabilities matches with AP then we
3872 will return true to indicate that we are good
3873 to make connection with it. Else we will return
3874 false.
3875 -------------------------------------------------------------------------------*/
3876static tANI_BOOLEAN
3877csrIsPMFCapabilitiesInRSNMatch( tHalHandle hHal,
3878 tANI_BOOLEAN *pFilterMFPEnabled,
3879 tANI_U8 *pFilterMFPRequired,
3880 tANI_U8 *pFilterMFPCapable,
3881 tDot11fIERSN *pRSNIe)
3882{
3883 tANI_U8 apProfileMFPCapable = 0;
3884 tANI_U8 apProfileMFPRequired = 0;
3885 if (pRSNIe && pFilterMFPEnabled && pFilterMFPCapable && pFilterMFPRequired)
3886 {
3887 /* Extracting MFPCapable bit from RSN Ie */
3888 apProfileMFPCapable = (pRSNIe->RSN_Cap[0] >> 7) & 0x1;
3889 apProfileMFPRequired = (pRSNIe->RSN_Cap[0] >> 6) & 0x1;
3890 if (*pFilterMFPEnabled && *pFilterMFPCapable && *pFilterMFPRequired
3891 && (apProfileMFPCapable == 0))
3892 {
3893 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3894 "AP is not capable to make PMF connection");
3895 return VOS_FALSE;
3896 }
3897 else if (*pFilterMFPEnabled && *pFilterMFPCapable &&
3898 !(*pFilterMFPRequired) && (apProfileMFPCapable == 0))
3899 {
3900 /*
3901 * This is tricky, because supplicant asked us to make mandatory
3902 * PMF connection eventhough PMF connection is optional here.
3903 * so if AP is not capable of PMF then drop it. Don't try to
3904 * connect with it.
3905 */
3906 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3907 "we need PMF connection & AP isn't capable to make PMF connection");
3908 return VOS_FALSE;
3909 }
3910 else if (!(*pFilterMFPCapable) &&
3911 apProfileMFPCapable && apProfileMFPRequired)
3912 {
3913 /*
3914 * In this case, AP with whom we trying to connect requires
3915 * mandatory PMF connections and we are not capable so this AP
3916 * is not good choice to connect
3917 */
3918 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3919 "AP needs PMF connection and we are not capable of pmf connection");
3920 return VOS_FALSE;
3921 }
3922 else if (!(*pFilterMFPEnabled) && *pFilterMFPCapable &&
3923 (apProfileMFPCapable == 1))
3924 {
3925 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3926 "we don't need PMF connection eventhough both parties are capable");
3927 return VOS_FALSE;
3928 }
3929 }
3930 return VOS_TRUE;
3931}
3932#endif
3933
3934tANI_BOOLEAN csrIsRSNMatch( tHalHandle hHal, tCsrAuthList *pAuthType,
3935 eCsrEncryptionType enType,
3936 tCsrEncryptionList *pEnMcType,
3937 tANI_BOOLEAN *pMFPEnabled, tANI_U8 *pMFPRequired,
3938 tANI_U8 *pMFPCapable,
3939 tDot11fBeaconIEs *pIes,
3940 eCsrAuthType *pNegotiatedAuthType,
3941 eCsrEncryptionType *pNegotiatedMCCipher )
Jeff Johnson295189b2012-06-20 16:38:30 -07003942{
3943 tANI_BOOLEAN fRSNMatch = FALSE;
3944
3945 // See if the cyphers in the Bss description match with the settings in the profile.
3946 fRSNMatch = csrGetRSNInformation( hHal, pAuthType, enType, pEnMcType, &pIes->RSN, NULL, NULL, NULL, NULL,
3947 pNegotiatedAuthType, pNegotiatedMCCipher );
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05303948#ifdef WLAN_FEATURE_11W
3949 /* If all the filter matches then finally checks for PMF capabilities */
3950 if (fRSNMatch)
3951 {
3952 fRSNMatch = csrIsPMFCapabilitiesInRSNMatch( hHal, pMFPEnabled,
3953 pMFPRequired, pMFPCapable,
3954 &pIes->RSN);
3955 }
3956#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003957
3958 return( fRSNMatch );
3959}
3960
3961
3962tANI_BOOLEAN csrLookupPMKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pPMKId )
3963{
3964 tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE;
3965 tANI_U32 Index;
3966 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3967
Jeff Johnson32d95a32012-09-10 13:15:23 -07003968 if(!pSession)
3969 {
3970 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
3971 return FALSE;
3972 }
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003973 /* to force the AP initiate fresh 802.1x authentication after re-association should not
3974 * fill the PMKID from cache this is needed
3975 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3976
3977 if(pSession->fIgnorePMKIDCache)
3978 {
3979 pSession->fIgnorePMKIDCache = FALSE;
3980 return fRC;
3981 }
3982
Jeff Johnson295189b2012-06-20 16:38:30 -07003983 do
3984 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303985 for( Index=0; Index < CSR_MAX_PMKID_ALLOWED; Index++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 {
Kiet Lam64c1b492013-07-12 13:56:44 +05303987 if( vos_mem_compare(pBSSId, pSession->PmkidCacheInfo[Index].BSSID, sizeof(tCsrBssid)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07003988 {
3989 // match found
3990 fMatchFound = TRUE;
3991 break;
3992 }
3993 }
3994
3995 if( !fMatchFound ) break;
3996
Kiet Lam64c1b492013-07-12 13:56:44 +05303997 vos_mem_copy(pPMKId, pSession->PmkidCacheInfo[Index].PMKID, CSR_RSN_PMKID_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003998
3999 fRC = TRUE;
4000 }
4001 while( 0 );
Sushant Kaushik0b343422015-05-25 17:15:55 +05304002 smsLog(pMac, LOG1, "csrLookupPMKID called return match = %d pMac->roam.NumPmkidCache = %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004003 fRC, pSession->NumPmkidCache);
4004
4005 return fRC;
4006}
4007
4008
4009tANI_U8 csrConstructRSNIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
4010 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe )
4011{
4012 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4013 tANI_BOOLEAN fRSNMatch;
4014 tANI_U8 cbRSNIe = 0;
4015 tANI_U8 UnicastCypher[ CSR_RSN_OUI_SIZE ];
4016 tANI_U8 MulticastCypher[ CSR_RSN_OUI_SIZE ];
4017 tANI_U8 AuthSuite[ CSR_RSN_OUI_SIZE ];
4018 tCsrRSNAuthIe *pAuthSuite;
4019 tCsrRSNCapabilities RSNCapabilities;
4020 tCsrRSNPMKIe *pPMK;
4021 tANI_U8 PMKId[CSR_RSN_PMKID_SIZE];
Pragaspathi Thilagaraj830d7cc2018-06-19 01:18:53 +05304022 uint32_t ret;
Chet Lanctotedf3dbe2013-05-15 13:21:28 -07004023#ifdef WLAN_FEATURE_11W
4024 tANI_U8 *pGroupMgmtCipherSuite;
4025#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 tDot11fBeaconIEs *pIesLocal = pIes;
Sachin Ahuja4f06a792014-12-04 18:14:32 +05304027 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
Abhinav Kumar12560c32018-08-27 18:14:00 +05304028 tDot11fIERSN rsn_ie = {0};
Jeff Johnson295189b2012-06-20 16:38:30 -07004029
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07004030 smsLog(pMac, LOGW, "%s called...", __func__);
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004031
Jeff Johnson295189b2012-06-20 16:38:30 -07004032 do
4033 {
4034 if ( !csrIsProfileRSN( pProfile ) ) break;
4035
4036 if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
4037 {
4038 break;
4039 }
4040
Pragaspathi Thilagaraj830d7cc2018-06-19 01:18:53 +05304041 /* Use intersection of the RSN cap sent by user space and
4042 * the AP, so that only common capability are enabled.
4043 */
4044 if (pProfile->pRSNReqIE && pProfile->nRSNReqIELength) {
4045 ret = dot11fUnpackIeRSN(pMac, pProfile->pRSNReqIE + 2,
4046 pProfile->nRSNReqIELength -2, &rsn_ie);
4047 if (DOT11F_SUCCEEDED(ret)) {
4048 pIesLocal->RSN.RSN_Cap[0] = pIesLocal->RSN.RSN_Cap[0] &
4049 rsn_ie.RSN_Cap[0];
4050 pIesLocal->RSN.RSN_Cap[1] = pIesLocal->RSN.RSN_Cap[1] &
4051 rsn_ie.RSN_Cap[1];
4052 }
4053 }
4054
4055 /* See if the cyphers in the Bss description match with the settings in the profile */
Jeff Johnson295189b2012-06-20 16:38:30 -07004056 fRSNMatch = csrGetRSNInformation( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType,
4057 &pProfile->mcEncryptionType, &pIesLocal->RSN,
Sachin Ahuja4f06a792014-12-04 18:14:32 +05304058 UnicastCypher, MulticastCypher, AuthSuite, &RSNCapabilities, &negAuthType, NULL );
Jeff Johnson295189b2012-06-20 16:38:30 -07004059 if ( !fRSNMatch ) break;
4060
4061 pRSNIe->IeHeader.ElementID = SIR_MAC_RSN_EID;
4062
4063 pRSNIe->Version = CSR_RSN_VERSION_SUPPORTED;
4064
Kiet Lam64c1b492013-07-12 13:56:44 +05304065 vos_mem_copy(pRSNIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004066
4067 pRSNIe->cUnicastCyphers = 1;
4068
Kiet Lam64c1b492013-07-12 13:56:44 +05304069 vos_mem_copy(&pRSNIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004070
4071 pAuthSuite = (tCsrRSNAuthIe *)( &pRSNIe->UnicastOui[ pRSNIe->cUnicastCyphers ] );
4072
4073 pAuthSuite->cAuthenticationSuites = 1;
Kiet Lam64c1b492013-07-12 13:56:44 +05304074 vos_mem_copy(&pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004075
Pragaspathi Thilagaraj830d7cc2018-06-19 01:18:53 +05304076 /* PreAuthSupported is an AP only capability */
Jeff Johnson295189b2012-06-20 16:38:30 -07004077 RSNCapabilities.PreAuthSupported = 0;
Pragaspathi Thilagaraj830d7cc2018-06-19 01:18:53 +05304078
4079 /* Use the Management Frame Protection values given by the supplicant,
4080 * if AP and STA both are MFP capable.
4081 */
Chet Lanctot186b5732013-03-18 10:26:30 -07004082#ifdef WLAN_FEATURE_11W
4083 RSNCapabilities.MFPRequired = pProfile->MFPRequired;
4084 RSNCapabilities.MFPCapable = pProfile->MFPCapable;
4085#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004086 *(tANI_U16 *)( &pAuthSuite->AuthOui[ 1 ] ) = *((tANI_U16 *)(&RSNCapabilities));
4087
4088 pPMK = (tCsrRSNPMKIe *)( ((tANI_U8 *)(&pAuthSuite->AuthOui[ 1 ])) + sizeof(tANI_U16) );
4089
Sachin Ahuja4f06a792014-12-04 18:14:32 +05304090 if (
4091#ifdef FEATURE_WLAN_ESE
4092 (eCSR_AUTH_TYPE_CCKM_RSN != negAuthType) &&
4093#endif
4094 csrLookupPMKID( pMac, sessionId, pSirBssDesc->bssId, &(PMKId[0]) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004095 {
4096 pPMK->cPMKIDs = 1;
4097
Kiet Lam64c1b492013-07-12 13:56:44 +05304098 vos_mem_copy(pPMK->PMKIDList[0].PMKID, PMKId, CSR_RSN_PMKID_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004099 }
4100 else
4101 {
4102 pPMK->cPMKIDs = 0;
4103 }
4104
Chet Lanctotedf3dbe2013-05-15 13:21:28 -07004105#ifdef WLAN_FEATURE_11W
4106 if ( pProfile->MFPEnabled )
4107 {
4108 pGroupMgmtCipherSuite = (tANI_U8 *) pPMK + sizeof ( tANI_U16 ) +
4109 ( pPMK->cPMKIDs * CSR_RSN_PMKID_SIZE );
Kiet Lam64c1b492013-07-12 13:56:44 +05304110 vos_mem_copy(pGroupMgmtCipherSuite, csrRSNOui[07], CSR_WPA_OUI_SIZE);
Chet Lanctotedf3dbe2013-05-15 13:21:28 -07004111 }
4112#endif
4113
Jeff Johnson295189b2012-06-20 16:38:30 -07004114 // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length
4115 // Add in the size of the Auth suite (count plus a single OUI)
4116 // Add in the RSN caps field.
4117 // Add PMKID count and PMKID (if any)
Chet Lanctotedf3dbe2013-05-15 13:21:28 -07004118 // Add group management cipher suite
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 pRSNIe->IeHeader.Length = (tANI_U8) (sizeof( *pRSNIe ) - sizeof ( pRSNIe->IeHeader ) +
4120 sizeof( *pAuthSuite ) +
4121 sizeof( tCsrRSNCapabilities ));
4122 if(pPMK->cPMKIDs)
4123 {
4124 pRSNIe->IeHeader.Length += (tANI_U8)(sizeof( tANI_U16 ) +
4125 (pPMK->cPMKIDs * CSR_RSN_PMKID_SIZE));
4126 }
Chet Lanctotedf3dbe2013-05-15 13:21:28 -07004127#ifdef WLAN_FEATURE_11W
4128 if ( pProfile->MFPEnabled )
4129 {
4130 if ( 0 == pPMK->cPMKIDs )
4131 pRSNIe->IeHeader.Length += sizeof( tANI_U16 );
4132 pRSNIe->IeHeader.Length += CSR_WPA_OUI_SIZE;
4133 }
4134#endif
4135
Jeff Johnson295189b2012-06-20 16:38:30 -07004136 // return the size of the IE header (total) constructed...
4137 cbRSNIe = pRSNIe->IeHeader.Length + sizeof( pRSNIe->IeHeader );
4138
4139 } while( 0 );
4140
4141 if( !pIes && pIesLocal )
4142 {
4143 //locally allocated
Kiet Lam64c1b492013-07-12 13:56:44 +05304144 vos_mem_free(pIesLocal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004145 }
4146
4147 return( cbRSNIe );
4148}
4149
4150
4151#ifdef FEATURE_WLAN_WAPI
4152tANI_BOOLEAN csrGetWapiInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
4153 tDot11fIEWAPI *pWapiIe,
4154 tANI_U8 *UnicastCypher,
4155 tANI_U8 *MulticastCypher,
4156 tANI_U8 *AuthSuite,
4157 eCsrAuthType *pNegotiatedAuthtype,
4158 eCsrEncryptionType *pNegotiatedMCCipher )
4159{
4160 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4161 tANI_BOOLEAN fAcceptableCyphers = FALSE;
4162 tANI_U8 cUnicastCyphers = 0;
4163 tANI_U8 cMulticastCyphers = 0;
4164 tANI_U8 cAuthSuites = 0, i;
4165 tANI_U8 Unicast[ CSR_WAPI_OUI_SIZE ];
4166 tANI_U8 Multicast[ CSR_WAPI_OUI_SIZE ];
4167 tANI_U8 AuthSuites[ CSR_WAPI_MAX_AUTH_SUITES ][ CSR_WAPI_OUI_SIZE ];
4168 tANI_U8 Authentication[ CSR_WAPI_OUI_SIZE ];
4169 tANI_U8 MulticastCyphers[ CSR_WAPI_MAX_MULTICAST_CYPHERS ][ CSR_WAPI_OUI_SIZE ];
4170 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
4171
4172 do{
4173 if ( pWapiIe->present )
4174 {
4175 cMulticastCyphers++;
Kiet Lam64c1b492013-07-12 13:56:44 +05304176 vos_mem_copy(MulticastCyphers, pWapiIe->multicast_cipher_suite,
4177 CSR_WAPI_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004178 cUnicastCyphers = (tANI_U8)(pWapiIe->unicast_cipher_suite_count);
4179 cAuthSuites = (tANI_U8)(pWapiIe->akm_suite_count);
4180 for(i = 0; i < cAuthSuites && i < CSR_WAPI_MAX_AUTH_SUITES; i++)
4181 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304182 vos_mem_copy((void *)&AuthSuites[i], (void *)&pWapiIe->akm_suites[i],
4183 CSR_WAPI_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 }
4185
4186 //Check - Is requested Unicast Cipher supported by the BSS.
4187 fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, pWapiIe->unicast_cipher_suites, cUnicastCyphers,
4188 csrGetOUIIndexFromCipher( enType ), Unicast );
4189
4190 if( !fAcceptableCyphers ) break;
4191
4192
4193 //Unicast is supported. Pick the first matching Group cipher, if any.
4194 for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
4195 {
4196 fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, MulticastCyphers, cMulticastCyphers,
4197 csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast );
4198 if(fAcceptableCyphers)
4199 {
4200 break;
4201 }
4202 }
4203 if( !fAcceptableCyphers ) break;
4204
4205 if( pNegotiatedMCCipher )
4206 *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
4207
4208 //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
4209 if ( csrIsAuthWapiCert( pMac, AuthSuites, cAuthSuites, Authentication ) )
4210 {
4211 negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
4212 }
4213 else if ( csrIsAuthWapiPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
4214 {
4215 negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_PSK;
4216 }
4217 else
4218 {
4219 fAcceptableCyphers = FALSE;
4220 negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
4221 }
4222 if( ( 0 == pAuthType->numEntries ) || ( FALSE == fAcceptableCyphers ) )
4223 {
4224 //Caller doesn't care about auth type, or BSS doesn't match
4225 break;
4226 }
4227 fAcceptableCyphers = FALSE;
4228 for( i = 0 ; i < pAuthType->numEntries; i++ )
4229 {
4230 if( pAuthType->authType[i] == negAuthType )
4231 {
4232 fAcceptableCyphers = TRUE;
4233 break;
4234 }
4235 }
4236 }
4237 }while (0);
4238
4239 if ( fAcceptableCyphers )
4240 {
4241 if ( MulticastCypher )
4242 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304243 vos_mem_copy(MulticastCypher, Multicast, CSR_WAPI_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004244 }
4245
4246 if ( UnicastCypher )
4247 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304248 vos_mem_copy(UnicastCypher, Unicast, CSR_WAPI_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004249 }
4250
4251 if ( AuthSuite )
4252 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304253 vos_mem_copy(AuthSuite, Authentication, CSR_WAPI_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 }
4255
4256 if ( pNegotiatedAuthtype )
4257 {
4258 *pNegotiatedAuthtype = negAuthType;
4259 }
4260 }
4261 return( fAcceptableCyphers );
4262}
4263
4264tANI_BOOLEAN csrIsWapiMatch( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType,
4265 tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCCipher )
4266{
4267 tANI_BOOLEAN fWapiMatch = FALSE;
4268
4269 // See if the cyphers in the Bss description match with the settings in the profile.
4270 fWapiMatch = csrGetWapiInformation( hHal, pAuthType, enType, pEnMcType, &pIes->WAPI, NULL, NULL, NULL,
4271 pNegotiatedAuthType, pNegotiatedMCCipher );
4272
4273 return( fWapiMatch );
4274}
4275
4276tANI_BOOLEAN csrLookupBKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pBKId )
4277{
4278 tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE;
4279 tANI_U32 Index;
4280 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
4281
Jeff Johnson32d95a32012-09-10 13:15:23 -07004282 if(!pSession)
4283 {
4284 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
4285 return FALSE;
4286 }
4287
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 do
4289 {
4290 for( Index=0; Index < pSession->NumBkidCache; Index++ )
4291 {
Arif Hussaina7c8e412013-11-20 11:06:42 -08004292 smsLog(pMac, LOGW, "match BKID "MAC_ADDRESS_STR" to ",
4293 MAC_ADDR_ARRAY(pBSSId));
Kiet Lam64c1b492013-07-12 13:56:44 +05304294 if (vos_mem_compare(pBSSId, pSession->BkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004295 {
4296 // match found
4297 fMatchFound = TRUE;
4298 break;
4299 }
4300 }
4301
4302 if( !fMatchFound ) break;
4303
Kiet Lam64c1b492013-07-12 13:56:44 +05304304 vos_mem_copy(pBKId, pSession->BkidCacheInfo[Index].BKID, CSR_WAPI_BKID_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004305
4306 fRC = TRUE;
4307 }
4308 while( 0 );
4309 smsLog(pMac, LOGW, "csrLookupBKID called return match = %d pMac->roam.NumBkidCache = %d", fRC, pSession->NumBkidCache);
4310
4311 return fRC;
4312}
4313
4314tANI_U8 csrConstructWapiIe( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
4315 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe )
4316{
4317 tANI_BOOLEAN fWapiMatch = FALSE;
4318 tANI_U8 cbWapiIe = 0;
4319 tANI_U8 UnicastCypher[ CSR_WAPI_OUI_SIZE ];
4320 tANI_U8 MulticastCypher[ CSR_WAPI_OUI_SIZE ];
4321 tANI_U8 AuthSuite[ CSR_WAPI_OUI_SIZE ];
4322 tANI_U8 BKId[CSR_WAPI_BKID_SIZE];
4323 tANI_U8 *pWapi = NULL;
4324 tANI_BOOLEAN fBKIDFound = FALSE;
4325 tDot11fBeaconIEs *pIesLocal = pIes;
4326
4327 do
4328 {
4329 if ( !csrIsProfileWapi( pProfile ) ) break;
4330
4331 if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
4332 {
4333 break;
4334 }
4335
4336 // See if the cyphers in the Bss description match with the settings in the profile.
4337 fWapiMatch = csrGetWapiInformation( pMac, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType,
4338 &pProfile->mcEncryptionType, &pIesLocal->WAPI,
4339 UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL );
4340 if ( !fWapiMatch ) break;
4341
Kiet Lam64c1b492013-07-12 13:56:44 +05304342 vos_mem_set(pWapiIe, sizeof(tCsrWapiIe), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07004343
4344 pWapiIe->IeHeader.ElementID = DOT11F_EID_WAPI;
4345
4346 pWapiIe->Version = CSR_WAPI_VERSION_SUPPORTED;
4347
4348 pWapiIe->cAuthenticationSuites = 1;
Kiet Lam64c1b492013-07-12 13:56:44 +05304349 vos_mem_copy(&pWapiIe->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004350
4351 pWapi = (tANI_U8 *) (&pWapiIe->AuthOui[ 1 ]);
4352
4353 *pWapi = (tANI_U16)1; //cUnicastCyphers
4354 pWapi+=2;
Kiet Lam64c1b492013-07-12 13:56:44 +05304355 vos_mem_copy(pWapi, UnicastCypher, sizeof( UnicastCypher ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004356 pWapi += sizeof( UnicastCypher );
4357
Kiet Lam64c1b492013-07-12 13:56:44 +05304358 vos_mem_copy(pWapi, MulticastCypher, sizeof( MulticastCypher ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004359 pWapi += sizeof( MulticastCypher );
4360
4361
4362 // WAPI capabilities follows the Auth Suite (two octects)
4363 // we shouldn't EVER be sending out "pre-auth supported". It is an AP only capability
4364 // & since we already did a memset pWapiIe to 0, skip these fields
4365 pWapi +=2;
4366
4367 fBKIDFound = csrLookupBKID( pMac, sessionId, pSirBssDesc->bssId, &(BKId[0]) );
4368
4369
4370 if( fBKIDFound )
4371 {
4372 /* Do we need to change the endianness here */
4373 *pWapi = (tANI_U16)1; //cBKIDs
4374 pWapi+=2;
Kiet Lam64c1b492013-07-12 13:56:44 +05304375 vos_mem_copy(pWapi, BKId, CSR_WAPI_BKID_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 }
4377 else
4378 {
4379 *pWapi = 0;
4380 pWapi+=1;
4381 *pWapi = 0;
4382 pWapi+=1;
4383 }
4384
4385 // Add in the IE fields except the IE header
4386 // Add BKID count and BKID (if any)
4387 pWapiIe->IeHeader.Length = (tANI_U8) (sizeof( *pWapiIe ) - sizeof ( pWapiIe->IeHeader ));
4388
4389 /*2 bytes for BKID Count field*/
4390 pWapiIe->IeHeader.Length += sizeof( tANI_U16 );
4391
4392 if(fBKIDFound)
4393 {
4394 pWapiIe->IeHeader.Length += CSR_WAPI_BKID_SIZE;
4395 }
4396 // return the size of the IE header (total) constructed...
4397 cbWapiIe = pWapiIe->IeHeader.Length + sizeof( pWapiIe->IeHeader );
4398
4399 } while( 0 );
4400
4401 if( !pIes && pIesLocal )
4402 {
4403 //locally allocated
Kiet Lam64c1b492013-07-12 13:56:44 +05304404 vos_mem_free(pIesLocal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004405 }
4406
4407 return( cbWapiIe );
4408}
4409#endif /* FEATURE_WLAN_WAPI */
4410
4411tANI_BOOLEAN csrGetWpaCyphers( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
4412 tDot11fIEWPA *pWpaIe,
4413 tANI_U8 *UnicastCypher,
4414 tANI_U8 *MulticastCypher,
4415 tANI_U8 *AuthSuite,
4416 eCsrAuthType *pNegotiatedAuthtype,
4417 eCsrEncryptionType *pNegotiatedMCCipher )
4418{
4419 tANI_BOOLEAN fAcceptableCyphers = FALSE;
4420 tANI_U8 cUnicastCyphers = 0;
4421 tANI_U8 cMulticastCyphers = 0;
4422 tANI_U8 cAuthSuites = 0;
4423 tANI_U8 Unicast[ CSR_WPA_OUI_SIZE ];
4424 tANI_U8 Multicast[ CSR_WPA_OUI_SIZE ];
4425 tANI_U8 Authentication[ CSR_WPA_OUI_SIZE ];
4426 tANI_U8 MulticastCyphers[ 1 ][ CSR_WPA_OUI_SIZE ];
4427 tANI_U8 i;
4428 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
4429
4430 do
4431 {
4432 if ( pWpaIe->present )
4433 {
4434 cMulticastCyphers = 1;
Kiet Lam64c1b492013-07-12 13:56:44 +05304435 vos_mem_copy(MulticastCyphers, pWpaIe->multicast_cipher, CSR_WPA_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004436 cUnicastCyphers = (tANI_U8)(pWpaIe->unicast_cipher_count);
4437 cAuthSuites = (tANI_U8)(pWpaIe->auth_suite_count);
4438
4439 //Check - Is requested Unicast Cipher supported by the BSS.
4440 fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, pWpaIe->unicast_ciphers, cUnicastCyphers,
4441 csrGetOUIIndexFromCipher( enType ), Unicast );
4442
4443 if( !fAcceptableCyphers ) break;
4444
4445
4446 //Unicast is supported. Pick the first matching Group cipher, if any.
4447 for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
4448 {
4449 fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, MulticastCyphers, cMulticastCyphers,
4450 csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i]), Multicast );
4451 if(fAcceptableCyphers)
4452 {
4453 break;
4454 }
4455 }
4456 if( !fAcceptableCyphers ) break;
4457
4458 if( pNegotiatedMCCipher )
4459 *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
4460
4461 /* Initializing with FALSE as it has TRUE value already */
4462 fAcceptableCyphers = FALSE;
4463 for (i = 0 ; i < pAuthType->numEntries; i++)
4464 {
4465 //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
4466 if ( csrIsAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
4467 {
4468 if (eCSR_AUTH_TYPE_WPA == pAuthType->authType[i])
4469 negAuthType = eCSR_AUTH_TYPE_WPA;
4470 }
4471 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthWpaPsk( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
4472 {
4473 if (eCSR_AUTH_TYPE_WPA_PSK == pAuthType->authType[i])
4474 negAuthType = eCSR_AUTH_TYPE_WPA_PSK;
4475 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004476#ifdef FEATURE_WLAN_ESE
4477 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsEseCckmAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 {
4479 if (eCSR_AUTH_TYPE_CCKM_WPA == pAuthType->authType[i])
4480 negAuthType = eCSR_AUTH_TYPE_CCKM_WPA;
4481 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004482#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07004483
4484 // The 1st auth type in the APs WPA IE, to match stations connecting
4485 // profiles auth type will cause us to exit this loop
4486 // This is added as some APs advertise multiple akms in the WPA IE.
4487 if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType)
4488 {
4489 fAcceptableCyphers = TRUE;
4490 break;
4491 }
4492 } // for
4493 }
4494 }while(0);
4495
4496 if ( fAcceptableCyphers )
4497 {
4498 if ( MulticastCypher )
4499 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304500 vos_mem_copy((tANI_U8 **)MulticastCypher, Multicast, CSR_WPA_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004501 }
4502
4503 if ( UnicastCypher )
4504 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304505 vos_mem_copy((tANI_U8 **)UnicastCypher, Unicast, CSR_WPA_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 }
4507
4508 if ( AuthSuite )
4509 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304510 vos_mem_copy((tANI_U8 **)AuthSuite, Authentication, CSR_WPA_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07004511 }
4512
4513 if( pNegotiatedAuthtype )
4514 {
4515 *pNegotiatedAuthtype = negAuthType;
4516 }
4517 }
4518
4519 return( fAcceptableCyphers );
4520}
4521
4522
4523
4524tANI_BOOLEAN csrIsWpaEncryptionMatch( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType,
4525 tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthtype, eCsrEncryptionType *pNegotiatedMCCipher )
4526{
4527 tANI_BOOLEAN fWpaMatch = eANI_BOOLEAN_FALSE;
4528
4529 // See if the cyphers in the Bss description match with the settings in the profile.
4530 fWpaMatch = csrGetWpaCyphers( pMac, pAuthType, enType, pEnMcType, &pIes->WPA, NULL, NULL, NULL, pNegotiatedAuthtype, pNegotiatedMCCipher );
4531
4532 return( fWpaMatch );
4533}
4534
4535
4536tANI_U8 csrConstructWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc,
4537 tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe )
4538{
4539 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4540 tANI_BOOLEAN fWpaMatch;
4541 tANI_U8 cbWpaIe = 0;
4542 tANI_U8 UnicastCypher[ CSR_WPA_OUI_SIZE ];
4543 tANI_U8 MulticastCypher[ CSR_WPA_OUI_SIZE ];
4544 tANI_U8 AuthSuite[ CSR_WPA_OUI_SIZE ];
4545 tCsrWpaAuthIe *pAuthSuite;
4546 tDot11fBeaconIEs *pIesLocal = pIes;
4547
4548 do
4549 {
4550 if ( !csrIsProfileWpa( pProfile ) ) break;
4551
4552 if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
4553 {
4554 break;
4555 }
4556 // See if the cyphers in the Bss description match with the settings in the profile.
4557 fWpaMatch = csrGetWpaCyphers( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, &pProfile->mcEncryptionType,
4558 &pIesLocal->WPA, UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL );
4559 if ( !fWpaMatch ) break;
4560
4561 pWpaIe->IeHeader.ElementID = SIR_MAC_WPA_EID;
4562
Kiet Lam64c1b492013-07-12 13:56:44 +05304563 vos_mem_copy(pWpaIe->Oui, csrWpaOui[01], sizeof( pWpaIe->Oui ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004564
4565 pWpaIe->Version = CSR_WPA_VERSION_SUPPORTED;
4566
Kiet Lam64c1b492013-07-12 13:56:44 +05304567 vos_mem_copy(pWpaIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004568
4569 pWpaIe->cUnicastCyphers = 1;
4570
Kiet Lam64c1b492013-07-12 13:56:44 +05304571 vos_mem_copy(&pWpaIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004572
4573 pAuthSuite = (tCsrWpaAuthIe *)( &pWpaIe->UnicastOui[ pWpaIe->cUnicastCyphers ] );
4574
4575 pAuthSuite->cAuthenticationSuites = 1;
Kiet Lam64c1b492013-07-12 13:56:44 +05304576 vos_mem_copy(&pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004577
4578 // The WPA capabilities follows the Auth Suite (two octects)--
4579 // this field is optional, and we always "send" zero, so just
4580 // remove it. This is consistent with our assumptions in the
4581 // frames compiler; c.f. bug 15234:
4582 // http://gold.woodsidenet.com/bugzilla/show_bug.cgi?id=15234
4583
4584 // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length
4585 // Add in the size of the Auth suite (count plus a single OUI)
4586 pWpaIe->IeHeader.Length = sizeof( *pWpaIe ) - sizeof ( pWpaIe->IeHeader ) +
4587 sizeof( *pAuthSuite );
4588
4589 // return the size of the IE header (total) constructed...
4590 cbWpaIe = pWpaIe->IeHeader.Length + sizeof( pWpaIe->IeHeader );
4591
4592 } while( 0 );
4593
4594 if( !pIes && pIesLocal )
4595 {
4596 //locally allocated
Kiet Lam64c1b492013-07-12 13:56:44 +05304597 vos_mem_free(pIesLocal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004598 }
4599
4600 return( cbWpaIe );
4601}
4602
4603
4604tANI_BOOLEAN csrGetWpaRsnIe( tHalHandle hHal, tANI_U8 *pIes, tANI_U32 len,
4605 tANI_U8 *pWpaIe, tANI_U8 *pcbWpaIe, tANI_U8 *pRSNIe, tANI_U8 *pcbRSNIe)
4606{
Jeff Johnson295189b2012-06-20 16:38:30 -07004607 tDot11IEHeader *pIEHeader;
4608 tSirMacPropIE *pSirMacPropIE;
4609 tANI_U32 cbParsed;
4610 tANI_U32 cbIE;
4611 int cExpectedIEs = 0;
4612 int cFoundIEs = 0;
4613 int cbPropIETotal;
4614
4615 pIEHeader = (tDot11IEHeader *)pIes;
4616 if(pWpaIe) cExpectedIEs++;
4617 if(pRSNIe) cExpectedIEs++;
4618
4619 // bss description length includes all fields other than the length itself
4620 cbParsed = 0;
4621
4622 // Loop as long as there is data left in the IE of the Bss Description
4623 // and the number of Expected IEs is NOT found yet.
4624 while( ( (cbParsed + sizeof( *pIEHeader )) <= len ) && ( cFoundIEs < cExpectedIEs ) )
4625 {
4626 cbIE = sizeof( *pIEHeader ) + pIEHeader->Length;
4627
4628 if ( ( cbIE + cbParsed ) > len ) break;
4629
4630 if ( ( pIEHeader->Length >= gCsrIELengthTable[ pIEHeader->ElementID ].min ) &&
4631 ( pIEHeader->Length <= gCsrIELengthTable[ pIEHeader->ElementID ].max ) )
4632 {
4633 switch( pIEHeader->ElementID )
4634 {
4635 // Parse the 221 (0xdd) Proprietary IEs here...
4636 // Note that the 221 IE is overloaded, containing the WPA IE, WMM/WME IE, and the
4637 // Airgo proprietary IE information.
4638 case SIR_MAC_WPA_EID:
4639 {
4640 tANI_U32 aniOUI;
4641 tANI_U8 *pOui = (tANI_U8 *)&aniOUI;
4642
4643 pOui++;
4644 aniOUI = ANI_OUI;
4645 aniOUI = i_ntohl( aniOUI );
4646
4647 pSirMacPropIE = ( tSirMacPropIE *)pIEHeader;
4648 cbPropIETotal = pSirMacPropIE->length;
4649
4650 // Validate the ANI OUI is in the OUI field in the proprietary IE...
4651 if ( ( pSirMacPropIE->length >= WNI_CFG_MANUFACTURER_OUI_LEN ) &&
4652 pOui[ 0 ] == pSirMacPropIE->oui[ 0 ] &&
4653 pOui[ 1 ] == pSirMacPropIE->oui[ 1 ] &&
4654 pOui[ 2 ] == pSirMacPropIE->oui[ 2 ] )
4655 {
4656 }
4657 else
4658 {
4659 tCsrWpaIe *pIe = ( tCsrWpaIe * )pIEHeader;
4660
4661 if(!pWpaIe || !pcbWpaIe) break;
4662 // Check if this is a valid WPA IE. Then check that the
4663 // WPA OUI is in place and the version is one that we support.
4664 if ( ( pIe->IeHeader.Length >= SIR_MAC_WPA_IE_MIN_LENGTH ) &&
Kiet Lam64c1b492013-07-12 13:56:44 +05304665 ( vos_mem_compare( pIe->Oui, (void *)csrWpaOui[1],
4666 sizeof( pIe->Oui ) ) ) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07004667 ( pIe->Version <= CSR_WPA_VERSION_SUPPORTED ) )
4668 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304669 vos_mem_copy(pWpaIe, pIe,
4670 pIe->IeHeader.Length + sizeof( pIe->IeHeader ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004671 *pcbWpaIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader );
4672 cFoundIEs++;
4673
4674 break;
4675 }
4676 }
4677
4678 break;
4679 }
4680
4681 case SIR_MAC_RSN_EID:
4682 {
4683 tCsrRSNIe *pIe;
4684
4685 if(!pcbRSNIe || !pRSNIe) break;
4686 pIe = (tCsrRSNIe *)pIEHeader;
4687
4688 // Check the length of the RSN Ie to assure it is valid. Then check that the
4689 // version is one that we support.
4690
4691 if ( pIe->IeHeader.Length < SIR_MAC_RSN_IE_MIN_LENGTH ) break;
4692 if ( pIe->Version > CSR_RSN_VERSION_SUPPORTED ) break;
4693
4694 cFoundIEs++;
4695
4696 // if there is enough room in the WpaIE passed in, then copy the Wpa IE into
4697 // the buffer passed in.
4698 if ( *pcbRSNIe < pIe->IeHeader.Length + sizeof( pIe->IeHeader ) ) break;
Kiet Lam64c1b492013-07-12 13:56:44 +05304699 vos_mem_copy(pRSNIe, pIe,
4700 pIe->IeHeader.Length + sizeof( pIe->IeHeader ));
Jeff Johnson295189b2012-06-20 16:38:30 -07004701 *pcbRSNIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader );
4702
4703 break;
4704 }
4705
4706 // Add support for other IE here...
4707 default:
4708 break;
4709 }
4710 }
4711
4712 cbParsed += cbIE;
4713
4714 pIEHeader = (tDot11IEHeader *)( ((tANI_U8 *)pIEHeader) + cbIE );
4715
4716 }
4717
4718 // return a BOOL that tells if all of the IEs asked for were found...
4719 return( cFoundIEs == cExpectedIEs );
4720}
4721
4722
4723//If a WPAIE exists in the profile, just use it. Or else construct one from the BSS
4724//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
4725tANI_U8 csrRetrieveWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc,
4726 tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe )
4727{
4728 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4729 tANI_U8 cbWpaIe = 0;
4730
4731 do
4732 {
4733 if ( !csrIsProfileWpa( pProfile ) ) break;
4734 if(pProfile->nWPAReqIELength && pProfile->pWPAReqIE)
4735 {
4736 if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nWPAReqIELength)
4737 {
4738 cbWpaIe = (tANI_U8)pProfile->nWPAReqIELength;
Kiet Lam64c1b492013-07-12 13:56:44 +05304739 vos_mem_copy(pWpaIe, pProfile->pWPAReqIE, cbWpaIe);
Jeff Johnson295189b2012-06-20 16:38:30 -07004740 }
4741 else
4742 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004743 smsLog(pMac, LOGW, " csrRetrieveWpaIe detect invalid WPA IE length (%d) ", pProfile->nWPAReqIELength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004744 }
4745 }
4746 else
4747 {
4748 cbWpaIe = csrConstructWpaIe(pMac, pProfile, pSirBssDesc, pIes, pWpaIe);
4749 }
4750 }while(0);
4751
4752 return (cbWpaIe);
4753}
4754
4755
4756//If a RSNIE exists in the profile, just use it. Or else construct one from the BSS
4757//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
4758tANI_U8 csrRetrieveRsnIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
4759 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRsnIe )
4760{
4761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4762 tANI_U8 cbRsnIe = 0;
4763
4764 do
4765 {
4766 if ( !csrIsProfileRSN( pProfile ) ) break;
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004767#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304768 if (csrRoamIsFastRoamEnabled(pMac, sessionId))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004769 {
4770 // If "Legacy Fast Roaming" is enabled ALWAYS rebuild the RSN IE from
4771 // scratch. So it contains the current PMK-IDs
4772 cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe);
4773 }
4774 else
4775#endif
Pragaspathi Thilagaraj03e2ab12018-06-22 12:19:48 +05304776 if(pProfile->force_rsne_override &&
4777 pProfile->nRSNReqIELength && pProfile->pRSNReqIE)
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 {
Pragaspathi Thilagaraj03e2ab12018-06-22 12:19:48 +05304779 smsLog(pMac, LOGW, "force_rsne_override, copy RSN IE provided by user");
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004780 // If you have one started away, re-use it.
Jeff Johnson295189b2012-06-20 16:38:30 -07004781 if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nRSNReqIELength)
4782 {
4783 cbRsnIe = (tANI_U8)pProfile->nRSNReqIELength;
Kiet Lam64c1b492013-07-12 13:56:44 +05304784 vos_mem_copy(pRsnIe, pProfile->pRSNReqIE, cbRsnIe);
Jeff Johnson295189b2012-06-20 16:38:30 -07004785 }
4786 else
4787 {
Pragaspathi Thilagaraj03e2ab12018-06-22 12:19:48 +05304788 smsLog(pMac, LOGW, "csrRetrieveRsnIe detect invalid RSN IE length (%d)",
4789 pProfile->nRSNReqIELength);
4790 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004791 }
4792 }
4793 else
4794 {
4795 cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe);
4796 }
4797 }while(0);
4798
4799 return (cbRsnIe);
4800}
4801
4802
4803#ifdef FEATURE_WLAN_WAPI
4804//If a WAPI IE exists in the profile, just use it. Or else construct one from the BSS
4805//Caller allocated memory for pWapiIe and guarrantee it can contain a max length WAPI IE
4806tANI_U8 csrRetrieveWapiIe( tHalHandle hHal, tANI_U32 sessionId,
4807 tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc,
4808 tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe )
4809{
4810 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4811 tANI_U8 cbWapiIe = 0;
4812
4813 do
4814 {
4815 if ( !csrIsProfileWapi( pProfile ) ) break;
4816 if(pProfile->nWAPIReqIELength && pProfile->pWAPIReqIE)
4817 {
4818 if(DOT11F_IE_WAPI_MAX_LEN >= pProfile->nWAPIReqIELength)
4819 {
4820 cbWapiIe = (tANI_U8)pProfile->nWAPIReqIELength;
Kiet Lam64c1b492013-07-12 13:56:44 +05304821 vos_mem_copy(pWapiIe, pProfile->pWAPIReqIE, cbWapiIe);
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 }
4823 else
4824 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004825 smsLog(pMac, LOGW, " csrRetrieveWapiIe detect invalid WAPI IE length (%d) ", pProfile->nWAPIReqIELength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004826 }
4827 }
4828 else
4829 {
4830 cbWapiIe = csrConstructWapiIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pWapiIe);
4831 }
4832 }while(0);
4833
4834 return (cbWapiIe);
4835}
4836#endif /* FEATURE_WLAN_WAPI */
4837
4838tANI_BOOLEAN csrSearchChannelListForTxPower(tHalHandle hHal, tSirBssDescription *pBssDescription, tCsrChannelSet *returnChannelGroup)
4839{
4840 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4841 tListElem *pEntry;
4842 tANI_U16 i;
4843 tANI_U16 startingChannel;
4844 tANI_BOOLEAN found = FALSE;
4845 tCsrChannelSet *pChannelGroup;
4846
4847 pEntry = csrLLPeekHead( &pMac->roam.channelList5G, LL_ACCESS_LOCK );
4848
4849 while ( pEntry )
4850 {
4851 pChannelGroup = GET_BASE_ADDR( pEntry, tCsrChannelSet, channelListLink );
4852 startingChannel = pChannelGroup->firstChannel;
4853 for ( i = 0; i < pChannelGroup->numChannels; i++ )
4854 {
4855 if ( startingChannel + i * pChannelGroup->interChannelOffset == pBssDescription->channelId )
4856 {
4857 found = TRUE;
4858 break;
4859 }
4860 }
4861
4862 if ( found )
4863 {
Kiet Lam64c1b492013-07-12 13:56:44 +05304864 vos_mem_copy(returnChannelGroup, pChannelGroup, sizeof(tCsrChannelSet));
Jeff Johnson295189b2012-06-20 16:38:30 -07004865 break;
4866 }
4867 else
4868 {
4869 pEntry = csrLLNext( &pMac->roam.channelList5G, pEntry, LL_ACCESS_LOCK );
4870 }
4871 }
4872
4873 return( found );
4874}
4875
4876tANI_BOOLEAN csrRatesIsDot11Rate11bSupportedRate( tANI_U8 dot11Rate )
4877{
4878 tANI_BOOLEAN fSupported = FALSE;
4879 tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) );
4880
4881 switch ( nonBasicRate )
4882 {
4883 case eCsrSuppRate_1Mbps:
4884 case eCsrSuppRate_2Mbps:
4885 case eCsrSuppRate_5_5Mbps:
4886 case eCsrSuppRate_11Mbps:
4887 fSupported = TRUE;
4888 break;
4889
4890 default:
4891 break;
4892 }
4893
4894 return( fSupported );
4895}
4896
4897tANI_BOOLEAN csrRatesIsDot11Rate11aSupportedRate( tANI_U8 dot11Rate )
4898{
4899 tANI_BOOLEAN fSupported = FALSE;
4900 tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) );
4901
4902 switch ( nonBasicRate )
4903 {
4904 case eCsrSuppRate_6Mbps:
4905 case eCsrSuppRate_9Mbps:
4906 case eCsrSuppRate_12Mbps:
4907 case eCsrSuppRate_18Mbps:
4908 case eCsrSuppRate_24Mbps:
4909 case eCsrSuppRate_36Mbps:
4910 case eCsrSuppRate_48Mbps:
4911 case eCsrSuppRate_54Mbps:
4912 fSupported = TRUE;
4913 break;
4914
4915 default:
4916 break;
4917 }
4918
4919 return( fSupported );
4920}
4921
4922
4923
4924tAniEdType csrTranslateEncryptTypeToEdType( eCsrEncryptionType EncryptType )
4925{
4926 tAniEdType edType;
4927
4928 switch ( EncryptType )
4929 {
4930 default:
4931 case eCSR_ENCRYPT_TYPE_NONE:
4932 edType = eSIR_ED_NONE;
4933 break;
4934
4935 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
4936 case eCSR_ENCRYPT_TYPE_WEP40:
4937 edType = eSIR_ED_WEP40;
4938 break;
4939
4940 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
4941 case eCSR_ENCRYPT_TYPE_WEP104:
4942 edType = eSIR_ED_WEP104;
4943 break;
4944
4945 case eCSR_ENCRYPT_TYPE_TKIP:
4946 edType = eSIR_ED_TKIP;
4947 break;
4948
4949 case eCSR_ENCRYPT_TYPE_AES:
4950 edType = eSIR_ED_CCMP;
4951 break;
4952#ifdef FEATURE_WLAN_WAPI
4953 case eCSR_ENCRYPT_TYPE_WPI:
4954 edType = eSIR_ED_WPI;
Gopichand Nakkala39d9d7a2013-05-19 19:07:35 +05304955 break ;
Jeff Johnson295189b2012-06-20 16:38:30 -07004956#endif
4957#ifdef WLAN_FEATURE_11W
4958 //11w BIP
4959 case eCSR_ENCRYPT_TYPE_AES_CMAC:
4960 edType = eSIR_ED_AES_128_CMAC;
4961 break;
4962#endif
4963 }
4964
4965 return( edType );
4966}
4967
4968
4969//pIes can be NULL
4970tANI_BOOLEAN csrValidateWep( tpAniSirGlobal pMac, eCsrEncryptionType ucEncryptionType,
4971 tCsrAuthList *pAuthList, tCsrEncryptionList *pMCEncryptionList,
4972 eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCEncryption,
4973 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes )
4974{
4975 tANI_U32 idx;
4976 tANI_BOOLEAN fMatch = FALSE;
4977 eCsrAuthType negotiatedAuth = eCSR_AUTH_TYPE_OPEN_SYSTEM;
4978 eCsrEncryptionType negotiatedMCCipher = eCSR_ENCRYPT_TYPE_UNKNOWN;
4979
4980 //This function just checks whether HDD is giving correct values for Multicast cipher and Auth.
4981
4982 do
4983 {
4984 //If privacy bit is not set, consider no match
4985 if ( !csrIsPrivacy( pSirBssDesc ) ) break;
4986
4987 for( idx = 0; idx < pMCEncryptionList->numEntries; idx++ )
4988 {
4989 switch( pMCEncryptionList->encryptionType[idx] )
4990 {
4991 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
4992 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
4993 case eCSR_ENCRYPT_TYPE_WEP40:
4994 case eCSR_ENCRYPT_TYPE_WEP104:
4995 /* Multicast list may contain WEP40/WEP104. Check whether it matches UC.
4996 */
4997 if( ucEncryptionType == pMCEncryptionList->encryptionType[idx] )
4998 {
4999 fMatch = TRUE;
5000 negotiatedMCCipher = pMCEncryptionList->encryptionType[idx];
5001 }
5002 break;
5003 default:
5004 fMatch = FALSE;
5005 break;
5006 }
5007 if(fMatch) break;
5008 }
5009
5010 if(!fMatch) break;
5011
5012 for( idx = 0; idx < pAuthList->numEntries; idx++ )
5013 {
5014 switch( pAuthList->authType[idx] )
5015 {
5016 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
5017 case eCSR_AUTH_TYPE_SHARED_KEY:
5018 case eCSR_AUTH_TYPE_AUTOSWITCH:
5019 fMatch = TRUE;
5020 negotiatedAuth = pAuthList->authType[idx];
5021 break;
5022 default:
5023 fMatch = FALSE;
5024 }
5025 if (fMatch) break;
5026 }
5027
5028 if(!fMatch) break;
5029 //In case of WPA / WPA2, check whether it supports WEP as well
5030 if(pIes)
5031 {
5032 //Prepare the encryption type for WPA/WPA2 functions
5033 if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == ucEncryptionType )
5034 {
5035 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
5036 }
5037 else if( eCSR_ENCRYPT_TYPE_WEP104 == ucEncryptionType )
5038 {
5039 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
5040 }
5041 //else we can use the encryption type directly
Kiet Lam64c1b492013-07-12 13:56:44 +05305042 if ( pIes->WPA.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07005043 {
Kiet Lam64c1b492013-07-12 13:56:44 +05305044 fMatch = vos_mem_compare(pIes->WPA.multicast_cipher,
5045 csrWpaOui[csrGetOUIIndexFromCipher( ucEncryptionType )],
5046 CSR_WPA_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07005047 if( fMatch ) break;
5048 }
Kiet Lam64c1b492013-07-12 13:56:44 +05305049 if ( pIes->RSN.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07005050 {
Kiet Lam64c1b492013-07-12 13:56:44 +05305051 fMatch = vos_mem_compare(pIes->RSN.gp_cipher_suite,
5052 csrRSNOui[csrGetOUIIndexFromCipher( ucEncryptionType )],
5053 CSR_RSN_OUI_SIZE);
Jeff Johnson295189b2012-06-20 16:38:30 -07005054 }
5055 }
5056
5057 }while(0);
5058
5059 if( fMatch )
5060 {
5061 if( pNegotiatedAuthType )
5062 *pNegotiatedAuthType = negotiatedAuth;
5063
5064 if( pNegotiatedMCEncryption )
5065 *pNegotiatedMCEncryption = negotiatedMCCipher;
5066 }
5067
5068
5069 return fMatch;
5070}
5071
5072
5073//pIes shall contain IEs from pSirBssDesc. It shall be returned from function csrGetParsedBssDescriptionIEs
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05305074tANI_BOOLEAN csrIsSecurityMatch( tHalHandle hHal, tCsrAuthList *authType,
5075 tCsrEncryptionList *pUCEncryptionType,
5076 tCsrEncryptionList *pMCEncryptionType,
5077 tANI_BOOLEAN *pMFPEnabled,
5078 tANI_U8 *pMFPRequired, tANI_U8 *pMFPCapable,
5079 tSirBssDescription *pSirBssDesc,
5080 tDot11fBeaconIEs *pIes,
5081 eCsrAuthType *negotiatedAuthtype,
5082 eCsrEncryptionType *negotiatedUCCipher,
5083 eCsrEncryptionType *negotiatedMCCipher )
Jeff Johnson295189b2012-06-20 16:38:30 -07005084{
5085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5086 tANI_BOOLEAN fMatch = FALSE;
5087 tANI_U8 i,idx;
5088 eCsrEncryptionType mcCipher = eCSR_ENCRYPT_TYPE_UNKNOWN, ucCipher = eCSR_ENCRYPT_TYPE_UNKNOWN;
5089 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
5090
5091 for( i = 0 ; ((i < pUCEncryptionType->numEntries) && (!fMatch)) ; i++ )
5092 {
5093 ucCipher = pUCEncryptionType->encryptionType[i];
5094 // If the Bss description shows the Privacy bit is on, then we must have some sort of encryption configured
5095 // for the profile to work. Don't attempt to join networks with Privacy bit set when profiles say NONE for
5096 // encryption type.
5097 switch ( ucCipher )
5098 {
5099 case eCSR_ENCRYPT_TYPE_NONE:
5100 {
5101 // for NO encryption, if the Bss description has the Privacy bit turned on, then encryption is
5102 // required so we have to reject this Bss.
5103 if ( csrIsPrivacy( pSirBssDesc ) )
5104 {
5105 fMatch = FALSE;
5106 }
5107 else
5108 {
5109 fMatch = TRUE;
5110 }
5111
5112 if ( fMatch )
5113 {
5114 fMatch = FALSE;
5115 //Check Multicast cipher requested and Auth type requested.
5116 for( idx = 0 ; idx < pMCEncryptionType->numEntries ; idx++ )
5117 {
5118 if( eCSR_ENCRYPT_TYPE_NONE == pMCEncryptionType->encryptionType[idx] )
5119 {
5120 fMatch = TRUE; //Multicast can only be none.
5121 mcCipher = pMCEncryptionType->encryptionType[idx];
5122 break;
5123 }
5124 }
5125 if (!fMatch) break;
5126
5127 fMatch = FALSE;
5128 //Check Auth list. It should contain AuthOpen.
5129 for( idx = 0 ; idx < authType->numEntries ; idx++ )
5130 {
5131 if( eCSR_AUTH_TYPE_OPEN_SYSTEM == authType->authType[idx] )
5132 {
5133 fMatch = TRUE;
5134 negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
5135 break;
5136 }
5137 }
5138 if (!fMatch) break;
5139
5140 }
5141 break;
5142 }
5143
5144 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
5145 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
5146 // !! might want to check for WEP keys set in the Profile.... ?
5147 // !! don't need to have the privacy bit in the Bss description. Many AP policies make legacy
5148 // encryption 'optional' so we don't know if we can associate or not. The AP will reject if
5149 // encryption is not allowed without the Privacy bit turned on.
5150 fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes);
5151
5152 break;
5153
5154 // these are all of the WPA encryption types...
5155 case eCSR_ENCRYPT_TYPE_WEP40:
5156 case eCSR_ENCRYPT_TYPE_WEP104:
5157 fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes);
5158 break;
5159
5160 case eCSR_ENCRYPT_TYPE_TKIP:
5161 case eCSR_ENCRYPT_TYPE_AES:
5162 {
5163 if(pIes)
5164 {
5165 // First check if there is a RSN match
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05305166 fMatch = csrIsRSNMatch( pMac, authType, ucCipher,
5167 pMCEncryptionType, pMFPEnabled,
5168 pMFPRequired, pMFPCapable,
5169 pIes, &negAuthType, &mcCipher );
Jeff Johnson295189b2012-06-20 16:38:30 -07005170 if( !fMatch )
5171 {
5172 // If not RSN, then check if there is a WPA match
5173 fMatch = csrIsWpaEncryptionMatch( pMac, authType, ucCipher, pMCEncryptionType, pIes,
5174 &negAuthType, &mcCipher );
5175 }
5176 }
5177 else
5178 {
5179 fMatch = FALSE;
5180 }
5181 break;
5182 }
5183#ifdef FEATURE_WLAN_WAPI
5184 case eCSR_ENCRYPT_TYPE_WPI://WAPI
5185 {
5186 if(pIes)
5187 {
5188 fMatch = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
5189 }
5190 else
5191 {
5192 fMatch = FALSE;
5193 }
5194 break;
5195 }
5196#endif /* FEATURE_WLAN_WAPI */
5197 case eCSR_ENCRYPT_TYPE_ANY:
5198 default:
5199 {
5200 tANI_BOOLEAN fMatchAny = eANI_BOOLEAN_FALSE;
5201
5202 fMatch = eANI_BOOLEAN_TRUE;
5203 //It is allowed to match anything. Try the more secured ones first.
5204 if(pIes)
5205 {
5206 //Check AES first
5207 ucCipher = eCSR_ENCRYPT_TYPE_AES;
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05305208 fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher,
5209 pMCEncryptionType, pMFPEnabled,
5210 pMFPRequired, pMFPCapable, pIes,
5211 &negAuthType, &mcCipher );
Jeff Johnson295189b2012-06-20 16:38:30 -07005212 if(!fMatchAny)
5213 {
5214 //Check TKIP
5215 ucCipher = eCSR_ENCRYPT_TYPE_TKIP;
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05305216 fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher,
5217 pMCEncryptionType,
5218 pMFPEnabled, pMFPRequired,
5219 pMFPCapable, pIes,
5220 &negAuthType, &mcCipher );
Jeff Johnson295189b2012-06-20 16:38:30 -07005221 }
5222#ifdef FEATURE_WLAN_WAPI
5223 if(!fMatchAny)
5224 {
5225 //Check WAPI
5226 ucCipher = eCSR_ENCRYPT_TYPE_WPI;
5227 fMatchAny = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
5228 }
5229#endif /* FEATURE_WLAN_WAPI */
5230 }
5231 if(!fMatchAny)
5232 {
5233 ucCipher = eCSR_ENCRYPT_TYPE_WEP104;
5234 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
5235 {
5236 ucCipher = eCSR_ENCRYPT_TYPE_WEP40;
5237 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
5238 {
5239 ucCipher = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
5240 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
5241 {
5242 ucCipher = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
5243 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
5244 {
5245 //It must be open and no encryption
5246 if ( csrIsPrivacy( pSirBssDesc ) )
5247 {
5248 //This is not right
5249 fMatch = eANI_BOOLEAN_FALSE;
5250 }
5251 else
5252 {
5253 negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
5254 mcCipher = eCSR_ENCRYPT_TYPE_NONE;
5255 ucCipher = eCSR_ENCRYPT_TYPE_NONE;
5256 }
5257 }
5258 }
5259 }
5260 }
5261 }
5262 break;
5263 }
5264 }
5265
5266 }
5267
5268 if( fMatch )
5269 {
5270 if( negotiatedUCCipher )
5271 *negotiatedUCCipher = ucCipher;
5272
5273 if( negotiatedMCCipher )
5274 *negotiatedMCCipher = mcCipher;
5275
5276 if( negotiatedAuthtype )
5277 *negotiatedAuthtype = negAuthType;
5278 }
5279
5280 return( fMatch );
5281}
5282
5283
5284tANI_BOOLEAN csrIsSsidMatch( tpAniSirGlobal pMac, tANI_U8 *ssid1, tANI_U8 ssid1Len, tANI_U8 *bssSsid,
5285 tANI_U8 bssSsidLen, tANI_BOOLEAN fSsidRequired )
5286{
5287 tANI_BOOLEAN fMatch = FALSE;
5288
5289 do {
Padma, Santhosh Kumara43e06c2015-05-21 14:58:13 +05305290 // Check for the specification of the Broadcast SSID at the beginning
5291 // of the list. If specified, then all SSIDs are matches
5292 // (broadcast SSID means accept all SSIDs).
5293 if ( ssid1Len == 0 )
5294 {
5295 fMatch = TRUE;
5296 break;
5297 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005298
5299 // There are a few special cases. If the Bss description has a Broadcast SSID,
5300 // then our Profile must have a single SSID without Wildcards so we can program
5301 // the SSID.
5302 // SSID could be suppressed in beacons. In that case SSID IE has valid length
5303 // but the SSID value is all NULL characters. That condition is trated same
5304 // as NULL SSID
5305 if ( csrIsNULLSSID( bssSsid, bssSsidLen ) )
5306 {
5307 if ( eANI_BOOLEAN_FALSE == fSsidRequired )
5308 {
5309 fMatch = TRUE;
5310 }
5311 break;
5312 }
5313
Jeff Johnson295189b2012-06-20 16:38:30 -07005314 if(ssid1Len != bssSsidLen) break;
Kiet Lam64c1b492013-07-12 13:56:44 +05305315 if (vos_mem_compare(bssSsid, ssid1, bssSsidLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005316 {
5317 fMatch = TRUE;
5318 break;
5319 }
5320
5321 } while( 0 );
5322
5323 return( fMatch );
5324}
5325
5326
5327//Null ssid means match
5328tANI_BOOLEAN csrIsSsidInList( tHalHandle hHal, tSirMacSSid *pSsid, tCsrSSIDs *pSsidList )
5329{
Jeff Johnson295189b2012-06-20 16:38:30 -07005330 tANI_BOOLEAN fMatch = FALSE;
5331 tANI_U32 i;
5332
5333 if ( pSsidList && pSsid )
5334 {
5335 for(i = 0; i < pSsidList->numOfSSIDs; i++)
5336 {
5337 if(csrIsNULLSSID(pSsidList->SSIDList[i].SSID.ssId, pSsidList->SSIDList[i].SSID.length) ||
Kiet Lam64c1b492013-07-12 13:56:44 +05305338 ((pSsidList->SSIDList[i].SSID.length == pSsid->length) &&
5339 vos_mem_compare(pSsid->ssId, pSsidList->SSIDList[i].SSID.ssId, pSsid->length)))
Jeff Johnson295189b2012-06-20 16:38:30 -07005340 {
5341 fMatch = TRUE;
5342 break;
5343 }
5344 }
5345 }
5346
5347 return (fMatch);
5348}
5349
5350//like to use sirCompareMacAddr
5351tANI_BOOLEAN csrIsMacAddressZero( tpAniSirGlobal pMac, tCsrBssid *pMacAddr )
5352{
5353 tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0, 0, 0, 0, 0, 0};
5354
Kiet Lam64c1b492013-07-12 13:56:44 +05305355 return (vos_mem_compare(bssid, pMacAddr, WNI_CFG_BSSID_LEN));
Jeff Johnson295189b2012-06-20 16:38:30 -07005356}
5357
5358//like to use sirCompareMacAddr
5359tANI_BOOLEAN csrIsMacAddressBroadcast( tpAniSirGlobal pMac, tCsrBssid *pMacAddr )
5360{
5361 tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
5362
Kiet Lam64c1b492013-07-12 13:56:44 +05305363 return(vos_mem_compare(bssid, pMacAddr, WNI_CFG_BSSID_LEN));
Jeff Johnson295189b2012-06-20 16:38:30 -07005364}
5365
5366
5367//like to use sirCompareMacAddr
5368tANI_BOOLEAN csrIsMacAddressEqual( tpAniSirGlobal pMac, tCsrBssid *pMacAddr1, tCsrBssid *pMacAddr2 )
5369{
Kiet Lam64c1b492013-07-12 13:56:44 +05305370 return(vos_mem_compare(pMacAddr1, pMacAddr2, sizeof(tCsrBssid)));
Jeff Johnson295189b2012-06-20 16:38:30 -07005371}
5372
5373
5374tANI_BOOLEAN csrIsBssidMatch( tHalHandle hHal, tCsrBssid *pProfBssid, tCsrBssid *BssBssid )
5375{
5376 tANI_BOOLEAN fMatch = FALSE;
5377 tCsrBssid ProfileBssid;
5378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5379
5380 // for efficiency of the MAC_ADDRESS functions, move the
5381 // Bssid's into MAC_ADDRESS structs.
Kiet Lam64c1b492013-07-12 13:56:44 +05305382 vos_mem_copy(&ProfileBssid, pProfBssid, sizeof(tCsrBssid));
Jeff Johnson295189b2012-06-20 16:38:30 -07005383
5384 do {
5385
5386 // Give the profile the benefit of the doubt... accept either all 0 or
5387 // the real broadcast Bssid (all 0xff) as broadcast Bssids (meaning to
5388 // match any Bssids).
5389 if ( csrIsMacAddressZero( pMac, &ProfileBssid ) ||
5390 csrIsMacAddressBroadcast( pMac, &ProfileBssid ) )
5391 {
5392 fMatch = TRUE;
5393 break;
5394 }
5395
5396 if ( csrIsMacAddressEqual( pMac, BssBssid, &ProfileBssid ) )
5397 {
5398 fMatch = TRUE;
5399 break;
5400 }
5401
5402 } while( 0 );
5403
5404 return( fMatch );
5405}
5406
5407
5408tANI_BOOLEAN csrIsBSSTypeMatch(eCsrRoamBssType bssType1, eCsrRoamBssType bssType2)
5409{
5410 if((eCSR_BSS_TYPE_ANY != bssType1 && eCSR_BSS_TYPE_ANY != bssType2) && (bssType1 != bssType2))
5411 return eANI_BOOLEAN_FALSE;
5412 else
5413 return eANI_BOOLEAN_TRUE;
5414}
5415
5416
5417tANI_BOOLEAN csrIsBssTypeIBSS(eCsrRoamBssType bssType)
5418{
5419 return((tANI_BOOLEAN)(eCSR_BSS_TYPE_START_IBSS == bssType || eCSR_BSS_TYPE_IBSS == bssType));
5420}
5421
5422tANI_BOOLEAN csrIsBssTypeWDS(eCsrRoamBssType bssType)
5423{
5424 return((tANI_BOOLEAN)(eCSR_BSS_TYPE_WDS_STA == bssType || eCSR_BSS_TYPE_WDS_AP == bssType));
5425}
5426
5427tANI_BOOLEAN csrIsBSSTypeCapsMatch( eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc )
5428{
5429 tANI_BOOLEAN fMatch = TRUE;
5430
5431 do
5432 {
5433 switch( bssType )
5434 {
5435 case eCSR_BSS_TYPE_ANY:
5436 break;
5437
5438 case eCSR_BSS_TYPE_INFRASTRUCTURE:
5439 case eCSR_BSS_TYPE_WDS_STA:
5440 if( !csrIsInfraBssDesc( pSirBssDesc ) )
5441 fMatch = FALSE;
5442
5443 break;
5444
5445 case eCSR_BSS_TYPE_IBSS:
5446 case eCSR_BSS_TYPE_START_IBSS:
5447 if( !csrIsIbssBssDesc( pSirBssDesc ) )
5448 fMatch = FALSE;
5449
5450 break;
5451
5452 case eCSR_BSS_TYPE_WDS_AP: //For WDS AP, no need to match anything
5453 default:
5454 fMatch = FALSE;
5455 break;
5456 }
5457 }
5458 while( 0 );
5459
5460
5461 return( fMatch );
5462}
5463
5464static tANI_BOOLEAN csrIsCapabilitiesMatch( tpAniSirGlobal pMac, eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc )
5465{
5466 return( csrIsBSSTypeCapsMatch( bssType, pSirBssDesc ) );
5467}
5468
5469
5470
5471static tANI_BOOLEAN csrIsSpecificChannelMatch( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, tANI_U8 Channel )
5472{
5473 tANI_BOOLEAN fMatch = TRUE;
5474
5475 do
5476 {
5477 // if the channel is ANY, then always match...
5478 if ( eCSR_OPERATING_CHANNEL_ANY == Channel ) break;
5479 if ( Channel == pSirBssDesc->channelId ) break;
5480
5481 // didn't match anything.. so return NO match
5482 fMatch = FALSE;
5483
5484 } while( 0 );
5485
5486 return( fMatch );
5487}
5488
5489
5490tANI_BOOLEAN csrIsChannelBandMatch( tpAniSirGlobal pMac, tANI_U8 channelId, tSirBssDescription *pSirBssDesc )
5491{
5492 tANI_BOOLEAN fMatch = TRUE;
5493
5494 do
5495 {
5496 // if the profile says Any channel AND the global settings says ANY channel, then we
5497 // always match...
5498 if ( eCSR_OPERATING_CHANNEL_ANY == channelId ) break;
5499
5500 if ( eCSR_OPERATING_CHANNEL_ANY != channelId )
5501 {
5502 fMatch = csrIsSpecificChannelMatch( pMac, pSirBssDesc, channelId );
5503 }
5504
5505 } while( 0 );
5506
5507 return( fMatch );
5508}
5509
5510
5511/**
5512 * \brief Enquire as to whether a given rate is supported by the
5513 * adapter as currently configured
5514 *
5515 *
5516 * \param nRate A rate in units of 500kbps
5517 *
5518 * \return TRUE if the adapter is currently capable of supporting this
5519 * rate, FALSE else
5520 *
5521 *
5522 * The rate encoding is just as in 802.11 Information Elements, except
5523 * that the high bit is \em not interpreted as indicating a Basic Rate,
5524 * and proprietary rates are allowed, too.
5525 *
5526 * Note that if the adapter's dot11Mode is g, we don't restrict the
5527 * rates. According to hwReadEepromParameters, this will happen when:
5528 *
5529 * ... the card is configured for ALL bands through the property
5530 * page. If this occurs, and the card is not an ABG card ,then this
5531 * code is setting the dot11Mode to assume the mode that the
5532 * hardware can support. For example, if the card is an 11BG card
5533 * and we are configured to support ALL bands, then we change the
5534 * dot11Mode to 11g because ALL in this case is only what the
5535 * hardware can support.
5536 *
5537 *
5538 */
5539
5540static tANI_BOOLEAN csrIsAggregateRateSupported( tpAniSirGlobal pMac, tANI_U16 rate )
5541{
5542 tANI_BOOLEAN fSupported = eANI_BOOLEAN_FALSE;
5543 tANI_U16 idx, newRate;
5544
5545 //In case basic rate flag is set
5546 newRate = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
5547 if ( eCSR_CFG_DOT11_MODE_11A == pMac->roam.configParam.uCfgDot11Mode )
5548 {
5549 switch ( newRate )
5550 {
5551 case eCsrSuppRate_6Mbps:
5552 case eCsrSuppRate_9Mbps:
5553 case eCsrSuppRate_12Mbps:
5554 case eCsrSuppRate_18Mbps:
5555 case eCsrSuppRate_24Mbps:
5556 case eCsrSuppRate_36Mbps:
5557 case eCsrSuppRate_48Mbps:
5558 case eCsrSuppRate_54Mbps:
5559 fSupported = TRUE;
5560 break;
5561 default:
5562 fSupported = FALSE;
5563 break;
5564 }
5565
5566 }
5567 else if( eCSR_CFG_DOT11_MODE_11B == pMac->roam.configParam.uCfgDot11Mode )
5568 {
5569 switch ( newRate )
5570 {
5571 case eCsrSuppRate_1Mbps:
5572 case eCsrSuppRate_2Mbps:
5573 case eCsrSuppRate_5_5Mbps:
5574 case eCsrSuppRate_11Mbps:
5575 fSupported = TRUE;
5576 break;
5577 default:
5578 fSupported = FALSE;
5579 break;
5580 }
5581 }
5582 else if ( !pMac->roam.configParam.ProprietaryRatesEnabled )
5583 {
5584
5585 switch ( newRate )
5586 {
5587 case eCsrSuppRate_1Mbps:
5588 case eCsrSuppRate_2Mbps:
5589 case eCsrSuppRate_5_5Mbps:
5590 case eCsrSuppRate_6Mbps:
5591 case eCsrSuppRate_9Mbps:
5592 case eCsrSuppRate_11Mbps:
5593 case eCsrSuppRate_12Mbps:
5594 case eCsrSuppRate_18Mbps:
5595 case eCsrSuppRate_24Mbps:
5596 case eCsrSuppRate_36Mbps:
5597 case eCsrSuppRate_48Mbps:
5598 case eCsrSuppRate_54Mbps:
5599 fSupported = TRUE;
5600 break;
5601 default:
5602 fSupported = FALSE;
5603 break;
5604 }
5605
5606 }
5607 else {
5608
5609 if ( eCsrSuppRate_1Mbps == newRate ||
5610 eCsrSuppRate_2Mbps == newRate ||
5611 eCsrSuppRate_5_5Mbps == newRate ||
5612 eCsrSuppRate_11Mbps == newRate )
5613 {
5614 fSupported = TRUE;
5615 }
5616 else {
5617 idx = 0x1;
5618
5619 switch ( newRate )
5620 {
5621 case eCsrSuppRate_6Mbps:
5622 fSupported = gPhyRatesSuppt[0][idx];
5623 break;
5624 case eCsrSuppRate_9Mbps:
5625 fSupported = gPhyRatesSuppt[1][idx];
5626 break;
5627 case eCsrSuppRate_12Mbps:
5628 fSupported = gPhyRatesSuppt[2][idx];
5629 break;
5630 case eCsrSuppRate_18Mbps:
5631 fSupported = gPhyRatesSuppt[3][idx];
5632 break;
5633 case eCsrSuppRate_20Mbps:
5634 fSupported = gPhyRatesSuppt[4][idx];
5635 break;
5636 case eCsrSuppRate_24Mbps:
5637 fSupported = gPhyRatesSuppt[5][idx];
5638 break;
5639 case eCsrSuppRate_36Mbps:
5640 fSupported = gPhyRatesSuppt[6][idx];
5641 break;
5642 case eCsrSuppRate_40Mbps:
5643 fSupported = gPhyRatesSuppt[7][idx];
5644 break;
5645 case eCsrSuppRate_42Mbps:
5646 fSupported = gPhyRatesSuppt[8][idx];
5647 break;
5648 case eCsrSuppRate_48Mbps:
5649 fSupported = gPhyRatesSuppt[9][idx];
5650 break;
5651 case eCsrSuppRate_54Mbps:
5652 fSupported = gPhyRatesSuppt[10][idx];
5653 break;
5654 case eCsrSuppRate_72Mbps:
5655 fSupported = gPhyRatesSuppt[11][idx];
5656 break;
5657 case eCsrSuppRate_80Mbps:
5658 fSupported = gPhyRatesSuppt[12][idx];
5659 break;
5660 case eCsrSuppRate_84Mbps:
5661 fSupported = gPhyRatesSuppt[13][idx];
5662 break;
5663 case eCsrSuppRate_96Mbps:
5664 fSupported = gPhyRatesSuppt[14][idx];
5665 break;
5666 case eCsrSuppRate_108Mbps:
5667 fSupported = gPhyRatesSuppt[15][idx];
5668 break;
5669 case eCsrSuppRate_120Mbps:
5670 fSupported = gPhyRatesSuppt[16][idx];
5671 break;
5672 case eCsrSuppRate_126Mbps:
5673 fSupported = gPhyRatesSuppt[17][idx];
5674 break;
5675 case eCsrSuppRate_144Mbps:
5676 fSupported = gPhyRatesSuppt[18][idx];
5677 break;
5678 case eCsrSuppRate_160Mbps:
5679 fSupported = gPhyRatesSuppt[19][idx];
5680 break;
5681 case eCsrSuppRate_168Mbps:
5682 fSupported = gPhyRatesSuppt[20][idx];
5683 break;
5684 case eCsrSuppRate_192Mbps:
5685 fSupported = gPhyRatesSuppt[21][idx];
5686 break;
5687 case eCsrSuppRate_216Mbps:
5688 fSupported = gPhyRatesSuppt[22][idx];
5689 break;
5690 case eCsrSuppRate_240Mbps:
5691 fSupported = gPhyRatesSuppt[23][idx];
5692 break;
5693 default:
5694 fSupported = FALSE;
5695 break;
5696 }
5697 }
5698 }
5699
5700 return fSupported;
5701}
5702
5703
5704
5705static tANI_BOOLEAN csrIsRateSetMatch( tpAniSirGlobal pMac,
5706 tDot11fIESuppRates *pBssSuppRates,
5707 tDot11fIEExtSuppRates *pBssExtSuppRates )
5708{
5709 tANI_BOOLEAN fMatch = TRUE;
5710 tANI_U32 i;
5711
5712
5713 // Validate that all of the Basic rates advertised in the Bss description are supported.
5714 if ( pBssSuppRates )
5715 {
5716 for( i = 0; i < pBssSuppRates->num_rates; i++ )
5717 {
5718 if ( CSR_IS_BASIC_RATE( pBssSuppRates->rates[ i ] ) )
5719 {
5720 if ( !csrIsAggregateRateSupported( pMac, pBssSuppRates->rates[ i ] ) )
5721 {
5722 fMatch = FALSE;
5723 break;
5724 }
5725 }
5726 }
5727 }
5728
5729 if ( fMatch && pBssExtSuppRates )
5730 {
5731 for( i = 0; i < pBssExtSuppRates->num_rates; i++ )
5732 {
5733 if ( CSR_IS_BASIC_RATE( pBssExtSuppRates->rates[ i ] ) )
5734 {
5735 if ( !csrIsAggregateRateSupported( pMac, pBssExtSuppRates->rates[ i ] ) )
5736 {
5737 fMatch = FALSE;
5738 break;
5739 }
5740 }
5741 }
5742 }
5743
5744 return( fMatch );
5745
5746}
5747
Pragaspathi Thilagaraje548fab2018-06-22 11:55:55 +05305748/**
5749 * csr_match_security() - wrapper to check if the security is matching
5750 * @mac_ctx: mac context
5751 * @filter: scan filter
5752 * @bss_desc: BSS Descriptor
5753 * @ies_ptr: Pointer to the IE fields
5754 * @neg_auth_type: Negotiated Auth type with the AP
5755 * @neg_uc_cipher: Negotiated unicast cipher suite
5756 * @neg_mc_cipher: Negotiated multicast cipher
5757 *
5758 * Return: true if matched else false.
5759 */
5760#ifdef WLAN_FEATURE_11W
5761static inline bool csr_match_security(tpAniSirGlobal pMac,
5762 tCsrScanResultFilter *filter, tSirBssDescription *bss_desc,
5763 tDot11fBeaconIEs *ies_ptr, eCsrAuthType *neg_auth,
5764 eCsrEncryptionType *neg_uc,
5765 eCsrEncryptionType *neg_mc)
5766{
5767
5768 if (!filter)
5769 return false;
5770
5771 if (filter->bWPSAssociation || filter->bOSENAssociation)
5772 return true;
5773
5774 if (filter->ignore_pmf_cap)
5775 return csrIsSecurityMatch(pMac, &filter->authType,
5776 &filter->EncryptionType,
5777 &filter->mcEncryptionType,
5778 NULL, NULL, NULL,
5779 bss_desc, ies_ptr, neg_auth,
5780 neg_uc, neg_mc);
5781 else
5782 return csrIsSecurityMatch(pMac, &filter->authType,
5783 &filter->EncryptionType,
5784 &filter->mcEncryptionType,
5785 &filter->MFPEnabled,
5786 &filter->MFPRequired,
5787 &filter->MFPCapable,
5788 bss_desc, ies_ptr, neg_auth,
5789 neg_uc, neg_mc);
5790
5791}
5792#else
5793static inline bool csr_match_security(tpAniSirGlobal mac_ctx,
5794 tCsrScanResultFilter *filter, tSirBssDescription *bss_desc,
5795 tDot11fBeaconIEs *ies_ptr, eCsrAuthType *neg_auth,
5796 eCsrEncryptionType *neg_uc,
5797 eCsrEncryptionType *neg_mc)
5798
5799{
5800 if (!filter)
5801 return false;
5802
5803 if (filter->bWPSAssociation || filter->bOSENAssociation)
5804 return true;
5805
5806 return csrIsSecurityMatch(mac_ctx, &filter->authType,
5807 &filter->EncryptionType,
5808 &filter->mcEncryptionType,
5809 NULL, NULL, NULL,
5810 bss_desc, ies_ptr, neg_auth,
5811 neg_uc, neg_mc);
5812}
5813#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005814
5815//ppIes can be NULL. If caller want to get the *ppIes allocated by this function, pass in *ppIes = NULL
5816tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrScanResultFilter *pFilter,
5817 eCsrAuthType *pNegAuth, eCsrEncryptionType *pNegUc, eCsrEncryptionType *pNegMc,
5818 tDot11fBeaconIEs **ppIes)
5819{
5820 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5821 tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck;
5822 tANI_U32 i;
5823 tDot11fBeaconIEs *pIes = NULL;
5824 tANI_U8 *pb;
5825
5826 do {
5827 if( ( NULL == ppIes ) || ( *ppIes ) == NULL )
5828 {
5829 //If no IEs passed in, get our own.
5830 if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes)))
5831 {
5832 break;
5833 }
5834 }
5835 else
5836 {
5837 //Save the one pass in for local use
5838 pIes = *ppIes;
5839 }
5840
5841 //Check if caller wants P2P
5842 fCheck = (!pFilter->p2pResult || pIes->P2PBeaconProbeRes.present);
5843 if(!fCheck) break;
5844
5845 if(pIes->SSID.present)
5846 {
5847 for(i = 0; i < pFilter->SSIDs.numOfSSIDs; i++)
5848 {
5849 fCheck = csrIsSsidMatch( pMac, pFilter->SSIDs.SSIDList[i].SSID.ssId, pFilter->SSIDs.SSIDList[i].SSID.length,
5850 pIes->SSID.ssid,
5851 pIes->SSID.num_ssid, eANI_BOOLEAN_TRUE );
5852 if ( fCheck ) break;
5853 }
5854 if(!fCheck) break;
5855 }
5856 fCheck = eANI_BOOLEAN_TRUE;
5857 for(i = 0; i < pFilter->BSSIDs.numOfBSSIDs; i++)
5858 {
5859 fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i], (tCsrBssid *)pBssDesc->bssId );
5860 if ( fCheck ) break;
5861
5862 if (pFilter->p2pResult && pIes->P2PBeaconProbeRes.present)
5863 {
5864 fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i],
5865 (tCsrBssid *)pIes->P2PBeaconProbeRes.P2PDeviceInfo.P2PDeviceAddress );
5866
5867 if ( fCheck ) break;
5868 }
5869 }
5870 if(!fCheck) break;
5871
5872 fCheck = eANI_BOOLEAN_TRUE;
5873 for(i = 0; i < pFilter->ChannelInfo.numOfChannels; i++)
5874 {
5875 fCheck = csrIsChannelBandMatch( pMac, pFilter->ChannelInfo.ChannelList[i], pBssDesc );
5876 if ( fCheck ) break;
5877 }
5878 if(!fCheck)
5879 break;
5880#if defined WLAN_FEATURE_VOWIFI
5881 /* If this is for measurement filtering */
5882 if( pFilter->fMeasurement )
5883 {
5884 fRC = eANI_BOOLEAN_TRUE;
5885 break;
5886 }
5887#endif
5888 if ( !csrIsPhyModeMatch( pMac, pFilter->phyMode, pBssDesc, NULL, NULL, pIes ) ) break;
Pragaspathi Thilagaraje548fab2018-06-22 11:55:55 +05305889 if ( !csr_match_security(pMac, pFilter, pBssDesc, pIes, pNegAuth, pNegUc, pNegMc)) break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005890 if ( !csrIsCapabilitiesMatch( pMac, pFilter->BSSType, pBssDesc ) ) break;
5891 if ( !csrIsRateSetMatch( pMac, &pIes->SuppRates, &pIes->ExtSuppRates ) ) break;
5892 //Tush-QoS: validate first if asked for APSD or WMM association
5893 if ( (eCsrRoamWmmQbssOnly == pMac->roam.configParam.WMMSupportMode) &&
5894 !CSR_IS_QOS_BSS(pIes) )
5895 break;
5896 //Check country. check even when pb is NULL because we may want to make sure
5897 //AP has a country code in it if fEnforceCountryCodeMatch is set.
5898 pb = ( pFilter->countryCode[0] ) ? ( pFilter->countryCode) : NULL;
5899
5900 fCheck = csrMatchCountryCode( pMac, pb, pIes );
5901 if(!fCheck)
5902 break;
5903
5904#ifdef WLAN_FEATURE_VOWIFI_11R
Hema Aparna Medicharlaf9dec8d2015-04-29 12:37:06 +05305905 if (pFilter->MDID.mdiePresent && csrRoamIs11rAssoc(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07005906 {
5907 if (pBssDesc->mdiePresent)
5908 {
5909 if (pFilter->MDID.mobilityDomain != (pBssDesc->mdie[1] << 8 | pBssDesc->mdie[0]))
5910 break;
5911 }
5912 else
5913 break;
5914 }
5915#endif
5916 fRC = eANI_BOOLEAN_TRUE;
5917
5918 } while( 0 );
5919 if( ppIes )
5920 {
5921 *ppIes = pIes;
5922 }
5923 else if( pIes )
5924 {
Kiet Lam64c1b492013-07-12 13:56:44 +05305925 vos_mem_free(pIes);
Jeff Johnson295189b2012-06-20 16:38:30 -07005926 }
5927
5928 return( fRC );
5929}
5930
5931tANI_BOOLEAN csrMatchConnectedBSSSecurity( tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile,
5932 tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
5933{
5934 tCsrEncryptionList ucEncryptionList, mcEncryptionList;
5935 tCsrAuthList authList;
5936
5937 ucEncryptionList.numEntries = 1;
5938 ucEncryptionList.encryptionType[0] = pProfile->EncryptionType;
5939
5940 mcEncryptionList.numEntries = 1;
5941 mcEncryptionList.encryptionType[0] = pProfile->mcEncryptionType;
5942
5943 authList.numEntries = 1;
5944 authList.authType[0] = pProfile->AuthType;
5945
Abhishek Singh3b56d3a2014-06-25 12:37:39 +05305946 return( csrIsSecurityMatch( pMac, &authList, &ucEncryptionList,
5947 &mcEncryptionList, NULL, NULL, NULL,
5948 pBssDesc, pIes, NULL, NULL, NULL ));
Jeff Johnson295189b2012-06-20 16:38:30 -07005949
5950}
5951
5952
5953tANI_BOOLEAN csrMatchBSSToConnectProfile( tHalHandle hHal, tCsrRoamConnectedProfile *pProfile,
5954 tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes )
5955{
5956 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5957 tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck;
5958 tDot11fBeaconIEs *pIesLocal = pIes;
5959
5960 do {
5961 if( !pIes )
5962 {
5963 if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal)))
5964 {
5965 break;
5966 }
5967 }
5968 fCheck = eANI_BOOLEAN_TRUE;
5969 if(pIesLocal->SSID.present)
5970 {
5971 tANI_BOOLEAN fCheckSsid = eANI_BOOLEAN_FALSE;
5972 if(pProfile->SSID.length)
5973 {
5974 fCheckSsid = eANI_BOOLEAN_TRUE;
5975 }
5976 fCheck = csrIsSsidMatch( pMac, pProfile->SSID.ssId, pProfile->SSID.length,
5977 pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid, fCheckSsid );
5978 if(!fCheck) break;
5979 }
5980 if ( !csrMatchConnectedBSSSecurity( pMac, pProfile, pBssDesc, pIesLocal) ) break;
5981 if ( !csrIsCapabilitiesMatch( pMac, pProfile->BSSType, pBssDesc ) ) break;
5982 if ( !csrIsRateSetMatch( pMac, &pIesLocal->SuppRates, &pIesLocal->ExtSuppRates ) ) break;
5983 fCheck = csrIsChannelBandMatch( pMac, pProfile->operationChannel, pBssDesc );
5984 if(!fCheck)
5985 break;
5986
5987 fRC = eANI_BOOLEAN_TRUE;
5988
5989 } while( 0 );
5990
5991 if( !pIes && pIesLocal )
5992 {
5993 //locally allocated
Kiet Lam64c1b492013-07-12 13:56:44 +05305994 vos_mem_free(pIesLocal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005995 }
5996
5997 return( fRC );
5998}
5999
6000
6001
Masti, Narayanraddi3f5affe2015-01-08 12:10:08 +05306002void csrAddRateBitmap(tANI_U8 rate, tANI_U16 *pRateBitmap)
6003{
6004 tANI_U16 rateBitmap;
6005 tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK );
6006 rateBitmap = *pRateBitmap;
6007 switch(n)
6008 {
6009 case SIR_MAC_RATE_1:
6010 rateBitmap |= SIR_MAC_RATE_1_BITMAP;
6011 break;
6012 case SIR_MAC_RATE_2:
6013 rateBitmap |= SIR_MAC_RATE_2_BITMAP;
6014 break;
6015 case SIR_MAC_RATE_5_5:
6016 rateBitmap |= SIR_MAC_RATE_5_5_BITMAP;
6017 break;
6018 case SIR_MAC_RATE_11:
6019 rateBitmap |= SIR_MAC_RATE_11_BITMAP;
6020 break;
6021 case SIR_MAC_RATE_6:
6022 rateBitmap |= SIR_MAC_RATE_6_BITMAP;
6023 break;
6024 case SIR_MAC_RATE_9:
6025 rateBitmap |= SIR_MAC_RATE_9_BITMAP;
6026 break;
6027 case SIR_MAC_RATE_12:
6028 rateBitmap |= SIR_MAC_RATE_12_BITMAP;
6029 break;
6030 case SIR_MAC_RATE_18:
6031 rateBitmap |= SIR_MAC_RATE_18_BITMAP;
6032 break;
6033 case SIR_MAC_RATE_24:
6034 rateBitmap |= SIR_MAC_RATE_24_BITMAP;
6035 break;
6036 case SIR_MAC_RATE_36:
6037 rateBitmap |= SIR_MAC_RATE_36_BITMAP;
6038 break;
6039 case SIR_MAC_RATE_48:
6040 rateBitmap |= SIR_MAC_RATE_48_BITMAP;
6041 break;
6042 case SIR_MAC_RATE_54:
6043 rateBitmap |= SIR_MAC_RATE_54_BITMAP;
6044 break;
6045 }
6046 *pRateBitmap = rateBitmap;
6047}
6048
6049
6050
6051tANI_BOOLEAN csrIsRateAlreadyPresent(tANI_U8 rate, tANI_U16 rateBitmap)
6052{
6053 tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK );
6054
6055 switch(n)
6056 {
6057 case SIR_MAC_RATE_1:
6058 rateBitmap &= SIR_MAC_RATE_1_BITMAP;
6059 break;
6060 case SIR_MAC_RATE_2:
6061 rateBitmap &= SIR_MAC_RATE_2_BITMAP;
6062 break;
6063 case SIR_MAC_RATE_5_5:
6064 rateBitmap &= SIR_MAC_RATE_5_5_BITMAP;
6065 break;
6066 case SIR_MAC_RATE_11:
6067 rateBitmap &= SIR_MAC_RATE_11_BITMAP;
6068 break;
6069 case SIR_MAC_RATE_6:
6070 rateBitmap &= SIR_MAC_RATE_6_BITMAP;
6071 break;
6072 case SIR_MAC_RATE_9:
6073 rateBitmap &= SIR_MAC_RATE_9_BITMAP;
6074 break;
6075 case SIR_MAC_RATE_12:
6076 rateBitmap &= SIR_MAC_RATE_12_BITMAP;
6077 break;
6078 case SIR_MAC_RATE_18:
6079 rateBitmap &= SIR_MAC_RATE_18_BITMAP;
6080 break;
6081 case SIR_MAC_RATE_24:
6082 rateBitmap &= SIR_MAC_RATE_24_BITMAP;
6083 break;
6084 case SIR_MAC_RATE_36:
6085 rateBitmap &= SIR_MAC_RATE_36_BITMAP;
6086 break;
6087 case SIR_MAC_RATE_48:
6088 rateBitmap &= SIR_MAC_RATE_48_BITMAP;
6089 break;
6090 case SIR_MAC_RATE_54:
6091 rateBitmap &= SIR_MAC_RATE_54_BITMAP;
6092 break;
6093 }
6094 return !!rateBitmap;
6095}
6096
6097
6098
Jeff Johnson295189b2012-06-20 16:38:30 -07006099tANI_BOOLEAN csrRatesIsDot11RateSupported( tHalHandle hHal, tANI_U8 rate )
6100{
6101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6102 tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK );
6103
6104 return csrIsAggregateRateSupported( pMac, n );
6105}
6106
6107
6108tANI_U16 csrRatesMacPropToDot11( tANI_U16 Rate )
6109{
6110 tANI_U16 ConvertedRate = Rate;
6111
6112 switch( Rate )
6113 {
6114 case SIR_MAC_RATE_1:
6115 ConvertedRate = 2;
6116 break;
6117 case SIR_MAC_RATE_2:
6118 ConvertedRate = 4;
6119 break;
6120 case SIR_MAC_RATE_5_5:
6121 ConvertedRate = 11;
6122 break;
6123 case SIR_MAC_RATE_11:
6124 ConvertedRate = 22;
6125 break;
6126
6127 case SIR_MAC_RATE_6:
6128 ConvertedRate = 12;
6129 break;
6130 case SIR_MAC_RATE_9:
6131 ConvertedRate = 18;
6132 break;
6133 case SIR_MAC_RATE_12:
6134 ConvertedRate = 24;
6135 break;
6136 case SIR_MAC_RATE_18:
6137 ConvertedRate = 36;
6138 break;
6139 case SIR_MAC_RATE_24:
6140 ConvertedRate = 48;
6141 break;
6142 case SIR_MAC_RATE_36:
6143 ConvertedRate = 72;
6144 break;
6145 case SIR_MAC_RATE_42:
6146 ConvertedRate = 84;
6147 break;
6148 case SIR_MAC_RATE_48:
6149 ConvertedRate = 96;
6150 break;
6151 case SIR_MAC_RATE_54:
6152 ConvertedRate = 108;
6153 break;
6154
6155 case SIR_MAC_RATE_72:
6156 ConvertedRate = 144;
6157 break;
6158 case SIR_MAC_RATE_84:
6159 ConvertedRate = 168;
6160 break;
6161 case SIR_MAC_RATE_96:
6162 ConvertedRate = 192;
6163 break;
6164 case SIR_MAC_RATE_108:
6165 ConvertedRate = 216;
6166 break;
6167 case SIR_MAC_RATE_126:
6168 ConvertedRate = 252;
6169 break;
6170 case SIR_MAC_RATE_144:
6171 ConvertedRate = 288;
6172 break;
6173 case SIR_MAC_RATE_168:
6174 ConvertedRate = 336;
6175 break;
6176 case SIR_MAC_RATE_192:
6177 ConvertedRate = 384;
6178 break;
6179 case SIR_MAC_RATE_216:
6180 ConvertedRate = 432;
6181 break;
6182 case SIR_MAC_RATE_240:
6183 ConvertedRate = 480;
6184 break;
6185
6186 case 0xff:
6187 ConvertedRate = 0;
6188 break;
6189 }
6190
6191 return ConvertedRate;
6192}
6193
6194
6195tANI_U16 csrRatesFindBestRate( tSirMacRateSet *pSuppRates, tSirMacRateSet *pExtRates, tSirMacPropRateSet *pPropRates )
6196{
6197 tANI_U8 i;
6198 tANI_U16 nBest;
6199
6200 nBest = pSuppRates->rate[ 0 ] & ( ~CSR_DOT11_BASIC_RATE_MASK );
6201
6202 if(pSuppRates->numRates > SIR_MAC_RATESET_EID_MAX)
6203 {
6204 pSuppRates->numRates = SIR_MAC_RATESET_EID_MAX;
6205 }
6206
6207 for ( i = 1U; i < pSuppRates->numRates; ++i )
6208 {
6209 nBest = (tANI_U16)CSR_MAX( nBest, pSuppRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) );
6210 }
6211
6212 if ( NULL != pExtRates )
6213 {
6214 for ( i = 0U; i < pExtRates->numRates; ++i )
6215 {
6216 nBest = (tANI_U16)CSR_MAX( nBest, pExtRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) );
6217 }
6218 }
6219
6220 if ( NULL != pPropRates )
6221 {
6222 for ( i = 0U; i < pPropRates->numPropRates; ++i )
6223 {
6224 nBest = (tANI_U16)CSR_MAX( nBest, csrRatesMacPropToDot11( pPropRates->propRate[ i ] ) );
6225 }
6226 }
6227
6228 return nBest;
6229}
6230
6231
6232void csrReleaseProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile)
6233{
6234 if(pProfile)
6235 {
6236 if(pProfile->BSSIDs.bssid)
6237 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306238 vos_mem_free(pProfile->BSSIDs.bssid);
Jeff Johnson295189b2012-06-20 16:38:30 -07006239 pProfile->BSSIDs.bssid = NULL;
6240 }
6241 if(pProfile->SSIDs.SSIDList)
6242 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306243 vos_mem_free(pProfile->SSIDs.SSIDList);
Jeff Johnson295189b2012-06-20 16:38:30 -07006244 pProfile->SSIDs.SSIDList = NULL;
6245 }
6246 if(pProfile->pWPAReqIE)
6247 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306248 vos_mem_free(pProfile->pWPAReqIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006249 pProfile->pWPAReqIE = NULL;
6250 }
6251 if(pProfile->pRSNReqIE)
6252 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306253 vos_mem_free(pProfile->pRSNReqIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006254 pProfile->pRSNReqIE = NULL;
6255 }
6256#ifdef FEATURE_WLAN_WAPI
6257 if(pProfile->pWAPIReqIE)
6258 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306259 vos_mem_free(pProfile->pWAPIReqIE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006260 pProfile->pWAPIReqIE = NULL;
6261 }
6262#endif /* FEATURE_WLAN_WAPI */
6263
Agarwal Ashish4f616132013-12-30 23:32:50 +05306264 if (pProfile->nAddIEScanLength)
Jeff Johnson295189b2012-06-20 16:38:30 -07006265 {
Ganesh Kondabattini7500fb32015-04-10 14:50:32 +05306266 memset(pProfile->addIEScan, 0 , SIR_MAC_MAX_ADD_IE_LENGTH+2);
Agarwal Ashish4f616132013-12-30 23:32:50 +05306267 pProfile->nAddIEScanLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006268 }
6269
6270 if(pProfile->pAddIEAssoc)
6271 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306272 vos_mem_free(pProfile->pAddIEAssoc);
Jeff Johnson295189b2012-06-20 16:38:30 -07006273 pProfile->pAddIEAssoc = NULL;
6274 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006275 if(pProfile->ChannelInfo.ChannelList)
6276 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306277 vos_mem_free(pProfile->ChannelInfo.ChannelList);
Jeff Johnson295189b2012-06-20 16:38:30 -07006278 pProfile->ChannelInfo.ChannelList = NULL;
6279 }
Kiet Lam64c1b492013-07-12 13:56:44 +05306280 vos_mem_set(pProfile, sizeof(tCsrRoamProfile), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006281 }
6282}
6283
6284void csrFreeScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
6285{
6286 if(pScanFilter->BSSIDs.bssid)
6287 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306288 vos_mem_free(pScanFilter->BSSIDs.bssid);
Jeff Johnson295189b2012-06-20 16:38:30 -07006289 pScanFilter->BSSIDs.bssid = NULL;
6290 }
6291 if(pScanFilter->ChannelInfo.ChannelList)
6292 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306293 vos_mem_free(pScanFilter->ChannelInfo.ChannelList);
Jeff Johnson295189b2012-06-20 16:38:30 -07006294 pScanFilter->ChannelInfo.ChannelList = NULL;
6295 }
6296 if(pScanFilter->SSIDs.SSIDList)
6297 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306298 vos_mem_free(pScanFilter->SSIDs.SSIDList);
Jeff Johnson295189b2012-06-20 16:38:30 -07006299 pScanFilter->SSIDs.SSIDList = NULL;
6300 }
6301}
6302
6303
6304void csrFreeRoamProfile(tpAniSirGlobal pMac, tANI_U32 sessionId)
6305{
6306 tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId];
6307
6308 if(pSession->pCurRoamProfile)
6309 {
6310 csrReleaseProfile(pMac, pSession->pCurRoamProfile);
Kiet Lam64c1b492013-07-12 13:56:44 +05306311 vos_mem_free(pSession->pCurRoamProfile);
Jeff Johnson295189b2012-06-20 16:38:30 -07006312 pSession->pCurRoamProfile = NULL;
6313 }
6314}
6315
6316
6317void csrFreeConnectBssDesc(tpAniSirGlobal pMac, tANI_U32 sessionId)
6318{
6319 tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId];
6320
6321 if(pSession->pConnectBssDesc)
6322 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306323 vos_mem_free(pSession->pConnectBssDesc);
Jeff Johnson295189b2012-06-20 16:38:30 -07006324 pSession->pConnectBssDesc = NULL;
6325 }
6326}
6327
6328
6329
6330tSirResultCodes csrGetDisassocRspStatusCode( tSirSmeDisassocRsp *pSmeDisassocRsp )
6331{
6332 tANI_U8 *pBuffer = (tANI_U8 *)pSmeDisassocRsp;
6333 tANI_U32 ret;
6334
6335 pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tSirMacAddr));
6336 //tSirResultCodes is an enum, assuming is 32bit
6337 //If we cannot make this assumption, use copymemory
6338 pal_get_U32( pBuffer, &ret );
6339
6340 return( ( tSirResultCodes )ret );
6341}
6342
6343
6344tSirResultCodes csrGetDeAuthRspStatusCode( tSirSmeDeauthRsp *pSmeRsp )
6345{
6346 tANI_U8 *pBuffer = (tANI_U8 *)pSmeRsp;
6347 tANI_U32 ret;
6348
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08006349 pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tANI_U8) + sizeof(tANI_U16));
Jeff Johnson295189b2012-06-20 16:38:30 -07006350 //tSirResultCodes is an enum, assuming is 32bit
6351 //If we cannot make this assumption, use copymemory
6352 pal_get_U32( pBuffer, &ret );
6353
6354 return( ( tSirResultCodes )ret );
6355}
6356
6357#if 0
6358tSirScanType csrGetScanType(tANI_U8 chnId, eRegDomainId domainId, tANI_U8 *countryCode)
6359{
6360 tSirScanType scanType = eSIR_PASSIVE_SCAN;
6361 tANI_U8 cc = 0;
6362
6363 while (cc++ < gCsrDomainChnInfo[domainId].numChannels)
6364 {
6365 if(chnId == gCsrDomainChnInfo[domainId].chnInfo[cc].chnId)
6366 {
6367 scanType = gCsrDomainChnInfo[domainId].chnInfo[cc].scanType;
6368 break;
6369 }
6370 }
6371
6372 return (scanType);
6373}
6374#endif
6375
6376tSirScanType csrGetScanType(tpAniSirGlobal pMac, tANI_U8 chnId)
6377{
6378 tSirScanType scanType = eSIR_PASSIVE_SCAN;
6379 eNVChannelEnabledType channelEnabledType;
6380
6381 channelEnabledType = vos_nv_getChannelEnabledState(chnId);
6382 if( NV_CHANNEL_ENABLE == channelEnabledType)
6383 {
6384 scanType = eSIR_ACTIVE_SCAN;
6385 }
6386 return (scanType);
6387}
6388
6389
6390tANI_U8 csrToUpper( tANI_U8 ch )
6391{
6392 tANI_U8 chOut;
6393
6394 if ( ch >= 'a' && ch <= 'z' )
6395 {
6396 chOut = ch - 'a' + 'A';
6397 }
6398 else
6399 {
6400 chOut = ch;
6401 }
6402 return( chOut );
6403}
6404
6405
6406tSirBssType csrTranslateBsstypeToMacType(eCsrRoamBssType csrtype)
6407{
6408 tSirBssType ret;
6409
6410 switch(csrtype)
6411 {
6412 case eCSR_BSS_TYPE_INFRASTRUCTURE:
6413 ret = eSIR_INFRASTRUCTURE_MODE;
6414 break;
6415 case eCSR_BSS_TYPE_IBSS:
6416 case eCSR_BSS_TYPE_START_IBSS:
6417 ret = eSIR_IBSS_MODE;
6418 break;
6419 case eCSR_BSS_TYPE_WDS_AP:
6420 ret = eSIR_BTAMP_AP_MODE;
6421 break;
6422 case eCSR_BSS_TYPE_WDS_STA:
6423 ret = eSIR_BTAMP_STA_MODE;
6424 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07006425 case eCSR_BSS_TYPE_INFRA_AP:
6426 ret = eSIR_INFRA_AP_MODE;
6427 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07006428 case eCSR_BSS_TYPE_ANY:
6429 default:
6430 ret = eSIR_AUTO_MODE;
6431 break;
6432 }
6433
6434 return (ret);
6435}
6436
6437
6438//This function use the parameters to decide the CFG value.
6439//CSR never sets WNI_CFG_DOT11_MODE_ALL to the CFG
6440//So PE should not see WNI_CFG_DOT11_MODE_ALL when it gets the CFG value
Jeff Johnson295189b2012-06-20 16:38:30 -07006441eCsrCfgDot11Mode csrGetCfgDot11ModeFromCsrPhyMode(tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tANI_BOOLEAN fProprietary)
Jeff Johnson295189b2012-06-20 16:38:30 -07006442{
6443 tANI_U32 cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG;
6444
6445 switch(phyMode)
6446 {
6447 case eCSR_DOT11_MODE_11a:
6448 case eCSR_DOT11_MODE_11a_ONLY:
6449 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
6450 break;
6451 case eCSR_DOT11_MODE_11b:
6452 case eCSR_DOT11_MODE_11b_ONLY:
6453 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
6454 break;
6455 case eCSR_DOT11_MODE_11g:
6456 case eCSR_DOT11_MODE_11g_ONLY:
Jeff Johnson295189b2012-06-20 16:38:30 -07006457 if(pProfile && (CSR_IS_INFRA_AP(pProfile)) && (phyMode == eCSR_DOT11_MODE_11g_ONLY))
6458 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G_ONLY;
6459 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006460 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
6461 break;
6462 case eCSR_DOT11_MODE_11n:
6463 if(fProprietary)
6464 {
6465 cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
6466 }
6467 else
6468 {
6469 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
6470 }
6471 break;
6472 case eCSR_DOT11_MODE_11n_ONLY:
Jeff Johnson295189b2012-06-20 16:38:30 -07006473 if(pProfile && CSR_IS_INFRA_AP(pProfile))
6474 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N_ONLY;
6475 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006476 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
6477 break;
6478 case eCSR_DOT11_MODE_TAURUS:
6479 cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
6480 break;
6481 case eCSR_DOT11_MODE_abg:
6482 cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG;
6483 break;
6484 case eCSR_DOT11_MODE_AUTO:
6485 cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO;
6486 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07006487
6488#ifdef WLAN_FEATURE_11AC
6489 case eCSR_DOT11_MODE_11ac:
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07006490 if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
6491 {
6492 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
6493 }
6494 else
6495 {
Ravi Joshia96ceb42013-05-20 18:52:39 -07006496 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07006497 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006498 break;
6499 case eCSR_DOT11_MODE_11ac_ONLY:
Ravi Joshia96ceb42013-05-20 18:52:39 -07006500 if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
6501 {
6502 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY;
6503 }
6504 else
6505 {
6506 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
6507 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006508 break;
6509#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006510 default:
6511 //No need to assign anything here
6512 break;
6513 }
6514
6515 return (cfgDot11Mode);
6516}
6517
6518
6519eHalStatus csrSetRegulatoryDomain(tpAniSirGlobal pMac, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
6520{
6521 eHalStatus status = eHAL_STATUS_SUCCESS;
6522 tANI_BOOLEAN fRestart;
6523
6524 if(pMac->scan.domainIdCurrent == domainId)
6525 {
6526 //no change
6527 fRestart = eANI_BOOLEAN_FALSE;
6528 }
6529 else if( !pMac->roam.configParam.fEnforceDefaultDomain )
6530 {
6531 pMac->scan.domainIdCurrent = domainId;
6532 fRestart = eANI_BOOLEAN_TRUE;
6533 }
6534 else
6535 {
6536 //We cannot change the domain
6537 status = eHAL_STATUS_CSR_WRONG_STATE;
6538 fRestart = eANI_BOOLEAN_FALSE;
6539 }
6540 if(pfRestartNeeded)
6541 {
6542 *pfRestartNeeded = fRestart;
6543 }
6544
6545 return (status);
6546}
6547
6548
6549v_REGDOMAIN_t csrGetCurrentRegulatoryDomain(tpAniSirGlobal pMac)
6550{
6551 return (pMac->scan.domainIdCurrent);
6552}
6553
Jeff Johnson295189b2012-06-20 16:38:30 -07006554
Kiet Lam6c583332013-10-14 05:37:09 +05306555eHalStatus csrGetRegulatoryDomainForCountry
6556(
6557tpAniSirGlobal pMac,
6558tANI_U8 *pCountry,
6559v_REGDOMAIN_t *pDomainId,
6560v_CountryInfoSource_t source
6561)
Jeff Johnson295189b2012-06-20 16:38:30 -07006562{
6563 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6564 VOS_STATUS vosStatus;
6565 v_COUNTRYCODE_t countryCode;
6566 v_REGDOMAIN_t domainId;
6567
6568 if(pCountry)
6569 {
6570 countryCode[0] = pCountry[0];
6571 countryCode[1] = pCountry[1];
Kiet Lam6c583332013-10-14 05:37:09 +05306572 vosStatus = vos_nv_getRegDomainFromCountryCode(&domainId,
6573 countryCode,
6574 source);
6575
Jeff Johnson295189b2012-06-20 16:38:30 -07006576 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
6577 {
6578 if( pDomainId )
6579 {
6580 *pDomainId = domainId;
6581 }
6582 status = eHAL_STATUS_SUCCESS;
6583 }
6584 else
6585 {
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05306586 smsLog(pMac, LOGW, FL(" Couldn't find domain for country code %c%c"), pCountry[0], pCountry[1]);
Jeff Johnson295189b2012-06-20 16:38:30 -07006587 status = eHAL_STATUS_INVALID_PARAMETER;
6588 }
6589 }
6590
6591 return (status);
6592}
6593
6594//To check whether a country code matches the one in the IE
6595//Only check the first two characters, ignoring in/outdoor
6596//pCountry -- caller allocated buffer contain the country code that is checking against
6597//the one in pIes. It can be NULL.
6598//caller must provide pIes, it cannot be NULL
6599//This function always return TRUE if 11d support is not turned on.
6600tANI_BOOLEAN csrMatchCountryCode( tpAniSirGlobal pMac, tANI_U8 *pCountry, tDot11fBeaconIEs *pIes )
6601{
6602 tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
Jeff Johnson43971f52012-07-17 12:26:56 -07006603 v_REGDOMAIN_t domainId = REGDOMAIN_COUNT; //This is init to invalid value
Jeff Johnson295189b2012-06-20 16:38:30 -07006604 eHalStatus status;
6605
6606 do
6607 {
6608 if( !csrIs11dSupported( pMac) )
6609 {
6610 break;
6611 }
6612 if( !pIes )
6613 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08006614 smsLog(pMac, LOGE, FL(" No IEs"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006615 break;
6616 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006617 if( pMac->roam.configParam.fEnforceDefaultDomain ||
6618 pMac->roam.configParam.fEnforceCountryCodeMatch )
Jeff Johnson295189b2012-06-20 16:38:30 -07006619 {
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006620 //Make sure this country is recognizable
6621 if( pIes->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07006622 {
Kiet Lam6c583332013-10-14 05:37:09 +05306623 status = csrGetRegulatoryDomainForCountry(pMac,
6624 pIes->Country.country,
6625 &domainId, COUNTRY_QUERY);
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006626 if( !HAL_STATUS_SUCCESS( status ) )
6627 {
Kiet Lam6c583332013-10-14 05:37:09 +05306628 status = csrGetRegulatoryDomainForCountry(pMac,
6629 pMac->scan.countryCode11d,
6630 (v_REGDOMAIN_t *) &domainId,
6631 COUNTRY_QUERY);
Gowri Deepthiff9adf92012-12-13 15:09:56 -08006632 if( !HAL_STATUS_SUCCESS( status ) )
6633 {
6634 fRet = eANI_BOOLEAN_FALSE;
6635 break;
6636 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006637 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006638 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006639 //check whether it is needed to enforce to the default regulatory domain first
6640 if( pMac->roam.configParam.fEnforceDefaultDomain )
Jeff Johnson295189b2012-06-20 16:38:30 -07006641 {
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006642 if( domainId != pMac->scan.domainIdCurrent )
6643 {
6644 fRet = eANI_BOOLEAN_FALSE;
6645 break;
6646 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006647 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006648 if( pMac->roam.configParam.fEnforceCountryCodeMatch )
6649 {
Jeff Johnson43971f52012-07-17 12:26:56 -07006650 if( domainId >= REGDOMAIN_COUNT )
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006651 {
6652 fRet = eANI_BOOLEAN_FALSE;
6653 break;
6654 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006655 }
6656 }
6657 if( pCountry )
6658 {
6659 tANI_U32 i;
6660
6661 if( !pIes->Country.present )
6662 {
6663 fRet = eANI_BOOLEAN_FALSE;
6664 break;
6665 }
6666 // Convert the CountryCode characters to upper
6667 for ( i = 0; i < WNI_CFG_COUNTRY_CODE_LEN - 1; i++ )
6668 {
6669 pCountry[i] = csrToUpper( pCountry[i] );
6670 }
Kiet Lam64c1b492013-07-12 13:56:44 +05306671 if (!vos_mem_compare(pIes->Country.country, pCountry,
6672 WNI_CFG_COUNTRY_CODE_LEN - 1))
Jeff Johnson295189b2012-06-20 16:38:30 -07006673 {
6674 fRet = eANI_BOOLEAN_FALSE;
6675 break;
6676 }
6677 }
6678 } while(0);
6679
6680 return (fRet);
6681}
6682
6683#if 0
6684eHalStatus csrSetCountryDomainMapping(tpAniSirGlobal pMac, tCsrCountryDomainMapping *pCountryDomainMapping)
6685{
6686 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6687 tANI_U32 i, j;
6688 tANI_BOOLEAN fDomainChanged = eANI_BOOLEAN_FALSE;
6689 tANI_U8 countryCode[WNI_CFG_COUNTRY_CODE_LEN];
6690
6691 i = WNI_CFG_COUNTRY_CODE_LEN;
6692 //Get the currently used country code
6693 status = ccmCfgGetStr(pMac, WNI_CFG_COUNTRY_CODE, countryCode, &i);
6694 if(HAL_STATUS_SUCCESS(status))
6695 {
6696 if(pCountryDomainMapping && pCountryDomainMapping->numEntry)
6697 {
6698 for(i = 0; i < pCountryDomainMapping->numEntry; i++)
6699 {
6700 for(j = 0; j < eCSR_NUM_COUNTRY_INDEX; j++)
6701 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306702 if (vos_mem_compare(gCsrCountryInfo[j].countryCode,
6703 pCountryDomainMapping->pCountryInfo[i].countryCode,
6704 2))
Jeff Johnson295189b2012-06-20 16:38:30 -07006705 {
6706 if(gCsrCountryInfo[j].domainId != pCountryDomainMapping->pCountryInfo[i].domainId)
6707 {
6708 gCsrCountryInfo[j].domainId = pCountryDomainMapping->pCountryInfo[i].domainId;
6709 //Check whether it matches the currently used country code
6710 //If matching, need to update base on the new domain setting.
Kiet Lam64c1b492013-07-12 13:56:44 +05306711 if (vos_mem_compare(countryCode,
6712 pCountryDomainMapping->pCountryInfo[i].countryCode,
6713 2))
Jeff Johnson295189b2012-06-20 16:38:30 -07006714 {
6715 fDomainChanged = eANI_BOOLEAN_TRUE;
6716 }
6717 }
6718 break;
6719 }
6720 }
6721 }
6722 status = eHAL_STATUS_SUCCESS;
6723 if(fDomainChanged)
6724 {
6725 tCsrChannel *pChannelList;
6726
6727 if(pMac->scan.f11dInfoApplied)
6728 {
6729 //11d info already applied. Let's reapply with the new domain setting
6730 if(pMac->scan.channels11d.numChannels)
6731 {
6732 pChannelList = &pMac->scan.channels11d;
6733 }
6734 else
6735 {
6736 pChannelList = &pMac->scan.base20MHzChannels;
6737 }
6738 }
6739 else
6740 {
6741 //no 11d so we use the base channelist from EEPROM
6742 pChannelList = &pMac->scan.base20MHzChannels;
6743 }
6744 //set the new domain's scan requirement to CFG
6745 csrSetCfgScanControlList(pMac, countryCode, pChannelList);
6746 }
6747 }
6748 }
6749
6750 return (status);
6751}
6752
6753eHalStatus csrSetDomainScanSetting(tpAniSirGlobal pMac, tCsrDomainFreqInfo *pDomainFreqInfo)
6754{
6755 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6756 tANI_U32 i, j;
6757 tANI_U16 freq;
6758
6759 if(pDomainFreqInfo && pDomainFreqInfo->numEntry && (pDomainFreqInfo->domainId < NUM_REG_DOMAINS))
6760 {
6761 tCsrDomainChnInfo *pDomainChnInfo = &gCsrDomainChnInfo[pDomainFreqInfo->domainId];
6762
6763 for(j = 0; j < pDomainChnInfo->numChannels; j++)
6764 {
6765 if(HAL_STATUS_SUCCESS(halPhyChIdToFreqConversion(pDomainChnInfo->chnInfo[j].chnId, &freq)))
6766 {
6767 for(i = 0; i < pDomainFreqInfo->numEntry; i++)
6768 {
6769 if((pDomainFreqInfo->pCsrScanFreqInfo[i].nStartFreq <= freq) &&
6770 (freq <= pDomainFreqInfo->pCsrScanFreqInfo[i].nEndFreq))
6771 {
6772 pDomainChnInfo->chnInfo[j].scanType = pDomainFreqInfo->pCsrScanFreqInfo[i].scanType;
6773 break;
6774 }
6775 }
6776 }
6777 else
6778 {
6779 smsLog(pMac, LOGW, " Failed to get frequency of channel %d", pDomainChnInfo->chnInfo[j].chnId);
6780 }
6781 }
6782 status = eHAL_STATUS_SUCCESS;
6783 }
6784
6785 return (status);
6786}
6787#endif
6788
6789eHalStatus csrGetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
6790 tCsrRoamModifyProfileFields *pModifyProfileFields)
6791{
6792
6793 if(!pModifyProfileFields)
6794 {
6795 return eHAL_STATUS_FAILURE;
6796 }
6797
Kiet Lam64c1b492013-07-12 13:56:44 +05306798 vos_mem_copy(pModifyProfileFields,
6799 &pMac->roam.roamSession[sessionId].connectedProfile.modifyProfileFields,
6800 sizeof(tCsrRoamModifyProfileFields));
Jeff Johnson295189b2012-06-20 16:38:30 -07006801
6802 return eHAL_STATUS_SUCCESS;
6803}
6804
6805eHalStatus csrSetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
6806 tCsrRoamModifyProfileFields *pModifyProfileFields)
6807{
6808 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
6809
Kiet Lam64c1b492013-07-12 13:56:44 +05306810 vos_mem_copy(&pSession->connectedProfile.modifyProfileFields,
6811 pModifyProfileFields,
6812 sizeof(tCsrRoamModifyProfileFields));
Jeff Johnson295189b2012-06-20 16:38:30 -07006813
6814 return eHAL_STATUS_SUCCESS;
6815}
6816
6817
6818#if 0
6819/* ---------------------------------------------------------------------------
6820 \fn csrGetSupportedCountryCode
6821 \brief this function is to get a list of the country code current being supported
6822 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
6823 this has the country code list. 3 bytes for each country code. This may be NULL if
6824 caller wants to know the needed bytes.
6825 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
6826 this contains the length of the data in pBuf
6827 \return eHalStatus
6828 -------------------------------------------------------------------------------*/
6829eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen)
6830{
6831 tANI_U32 numOfCountry = sizeof( gCsrCountryInfo ) / sizeof( gCsrCountryInfo[0] );
6832 tANI_U32 numBytes = 0;
6833 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6834
6835 if( pbLen )
6836 {
6837 numBytes = *pbLen;
6838 //Consider it ok, at least we can return the number of bytes needed;
6839 *pbLen = numOfCountry * WNI_CFG_COUNTRY_CODE_LEN;
6840 status = eHAL_STATUS_SUCCESS;
6841 if( pBuf && ( numBytes >= *pbLen ) )
6842 {
6843 //The ugly part starts.
6844 //We may need to alter the data structure and find a way to make this faster.
6845 tANI_U32 i;
6846
Kiet Lam64c1b492013-07-12 13:56:44 +05306847 for ( i = 0; i < numOfCountry; i++ )
Jeff Johnson295189b2012-06-20 16:38:30 -07006848 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306849 vos_mem_copy(pBuf + ( i * WNI_CFG_COUNTRY_CODE_LEN ),
6850 gCsrCountryInfo[i].countryCode,
6851 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006852 }
6853 }
6854 }
6855
6856 return ( status );
6857}
6858#endif
6859
6860/* ---------------------------------------------------------------------------
6861 \fn csrGetSupportedCountryCode
6862 \brief this function is to get a list of the country code current being supported
6863 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
6864 this has the country code list. 3 bytes for each country code. This may be NULL if
6865 caller wants to know the needed bytes.
6866 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
6867 this contains the length of the data in pBuf
6868 \return eHalStatus
6869 -------------------------------------------------------------------------------*/
6870eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen)
6871{
6872 eHalStatus status = eHAL_STATUS_SUCCESS;
6873 VOS_STATUS vosStatus;
6874 v_SIZE_t size = (v_SIZE_t)*pbLen;
6875
6876 vosStatus = vos_nv_getSupportedCountryCode( pBuf, &size, 1 );
6877 //eiter way, return the value back
6878 *pbLen = (tANI_U32)size;
6879
6880 //If pBuf is NULL, caller just want to get the size, consider it success
6881 if(pBuf)
6882 {
6883 if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
6884 {
6885 tANI_U32 i, n = *pbLen / 3;
6886
6887 for( i = 0; i < n; i++ )
6888 {
6889 pBuf[i*3 + 2] = ' ';
6890 }
6891 }
6892 else
6893 {
6894 status = eHAL_STATUS_FAILURE;
6895 }
6896 }
6897
6898 return (status);
6899}
6900
6901
6902
6903//Upper layer to get the list of the base channels to scan for passively 11d info from csr
6904eHalStatus csrScanGetBaseChannels( tpAniSirGlobal pMac, tCsrChannelInfo * pChannelInfo )
6905{
6906 eHalStatus status = eHAL_STATUS_FAILURE;
6907
6908 do
6909 {
6910
6911 if(!pMac->scan.baseChannels.numChannels || !pChannelInfo)
6912 {
6913 break;
6914 }
Kiet Lam64c1b492013-07-12 13:56:44 +05306915 pChannelInfo->ChannelList = vos_mem_malloc(pMac->scan.baseChannels.numChannels);
6916 if ( NULL == pChannelInfo->ChannelList )
Jeff Johnson295189b2012-06-20 16:38:30 -07006917 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08006918 smsLog( pMac, LOGE, FL("csrScanGetBaseChannels: fail to allocate memory") );
Kiet Lam64c1b492013-07-12 13:56:44 +05306919 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006920 }
Kiet Lam64c1b492013-07-12 13:56:44 +05306921 vos_mem_copy(pChannelInfo->ChannelList,
6922 pMac->scan.baseChannels.channelList,
6923 pMac->scan.baseChannels.numChannels);
Jeff Johnson295189b2012-06-20 16:38:30 -07006924 pChannelInfo->numOfChannels = pMac->scan.baseChannels.numChannels;
6925
6926 }while(0);
6927
6928 return ( status );
6929}
6930
6931
6932tANI_BOOLEAN csrIsSetKeyAllowed(tpAniSirGlobal pMac, tANI_U32 sessionId)
6933{
6934 tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006935 tCsrRoamSession *pSession;
6936
6937 pSession =CSR_GET_SESSION(pMac, sessionId);
6938
6939 /*This condition is not working for infra state. When infra is in not-connected state
6940 * the pSession->pCurRoamProfile is NULL. And this function returns TRUE, that is incorrect.
6941 * Since SAP requires to set key without any BSS started, it needs this condition to be met.
6942 * In other words, this function is useless.
6943 * The current work-around is to process setcontext_rsp and removekey_rsp no matter what the
6944 * state is.
6945 */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08006946 smsLog( pMac, LOG2, FL(" is not what it intends to. Must be revisit or removed") );
Jeff Johnson295189b2012-06-20 16:38:30 -07006947 if( (NULL == pSession) ||
6948 ( csrIsConnStateDisconnected( pMac, sessionId ) &&
6949 (pSession->pCurRoamProfile != NULL) &&
6950 (!(CSR_IS_INFRA_AP(pSession->pCurRoamProfile))) )
6951 )
6952 {
6953 fRet = eANI_BOOLEAN_FALSE;
6954 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006955
6956 return ( fRet );
6957}
6958
6959//no need to acquire lock for this basic function
6960tANI_U16 sme_ChnToFreq(tANI_U8 chanNum)
6961{
6962 int i;
6963
6964 for (i = 0; i < NUM_RF_CHANNELS; i++)
6965 {
6966 if (rfChannels[i].channelNum == chanNum)
6967 {
6968 return rfChannels[i].targetFreq;
6969 }
6970 }
6971
6972 return (0);
6973}
6974
6975/* Disconnect all active sessions by sending disassoc. This is mainly used to disconnect the remaining session when we
6976 * transition from concurrent sessions to a single session. The use case is Infra STA and wifi direct multiple sessions are up and
6977 * P2P session is removed. The Infra STA session remains and should resume BMPS if BMPS is enabled by default. However, there
6978 * are some issues seen with BMPS resume during this transition and this is a workaround which will allow the Infra STA session to
6979 * disconnect and auto connect back and enter BMPS this giving the same effect as resuming BMPS
6980 */
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006981
6982//Remove this code once SLM_Sessionization is supported
6983//BMPS_WORKAROUND_NOT_NEEDED
Jeff Johnson295189b2012-06-20 16:38:30 -07006984void csrDisconnectAllActiveSessions(tpAniSirGlobal pMac)
6985{
6986 tANI_U8 i;
6987
6988 /* Disconnect all the active sessions */
6989 for (i=0; i<CSR_ROAM_SESSION_MAX; i++)
6990 {
6991 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
6992 {
6993 csrRoamDisconnectInternal(pMac, i, eCSR_DISCONNECT_REASON_UNSPECIFIED);
6994 }
6995 }
6996}
Mohit Khanna349bc392012-09-11 17:24:52 -07006997
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07006998#ifdef FEATURE_WLAN_LFR
6999tANI_BOOLEAN csrIsChannelPresentInList(
7000 tANI_U8 *pChannelList,
7001 int numChannels,
7002 tANI_U8 channel
7003 )
7004{
7005 int i = 0;
7006
7007 // Check for NULL pointer
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08007008 if (!pChannelList || (numChannels == 0))
7009 {
7010 return FALSE;
7011 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07007012
7013 // Look for the channel in the list
7014 for (i = 0; i < numChannels; i++)
7015 {
7016 if (pChannelList[i] == channel)
7017 return TRUE;
7018 }
7019
7020 return FALSE;
7021}
7022
7023VOS_STATUS csrAddToChannelListFront(
7024 tANI_U8 *pChannelList,
7025 int numChannels,
7026 tANI_U8 channel
7027 )
7028{
7029 int i = 0;
7030
7031 // Check for NULL pointer
7032 if (!pChannelList) return eHAL_STATUS_E_NULL_VALUE;
7033
7034 // Make room for the addition. (Start moving from the back.)
7035 for (i = numChannels; i > 0; i--)
7036 {
7037 pChannelList[i] = pChannelList[i-1];
7038 }
7039
7040 // Now add the NEW channel...at the front
7041 pChannelList[0] = channel;
7042
7043 return eHAL_STATUS_SUCCESS;
7044}
7045#endif
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05307046const char * sme_requestTypetoString(const v_U8_t requestType)
7047{
7048 switch (requestType)
7049 {
7050 CASE_RETURN_STRING( eCSR_SCAN_REQUEST_11D_SCAN );
7051 CASE_RETURN_STRING( eCSR_SCAN_REQUEST_FULL_SCAN );
7052 CASE_RETURN_STRING( eCSR_SCAN_IDLE_MODE_SCAN );
7053 CASE_RETURN_STRING( eCSR_SCAN_HO_BG_SCAN );
7054 CASE_RETURN_STRING( eCSR_SCAN_HO_PROBE_SCAN );
7055 CASE_RETURN_STRING( eCSR_SCAN_HO_NT_BG_SCAN );
7056 CASE_RETURN_STRING( eCSR_SCAN_P2P_DISCOVERY );
7057 CASE_RETURN_STRING( eCSR_SCAN_SOFTAP_CHANNEL_RANGE );
7058 CASE_RETURN_STRING( eCSR_SCAN_P2P_FIND_PEER );
7059 default:
7060 return "Unknown Scan Request Type";
7061 }
7062}