blob: 25bff95a7b1e85a5885a2173ab705844c2834a74 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/** ------------------------------------------------------------------------- *
42 ------------------------------------------------------------------------- *
43
44
45 \file csrUtil.c
46
47 Implementation supporting routines for CSR.
48
49
50 Copyright (C) 2006 Airgo Networks, Incorporated
51 ========================================================================== */
52
Jeff Johnson295189b2012-06-20 16:38:30 -070053
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include "aniGlobal.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070055
56#include "palApi.h"
57#include "csrSupport.h"
58#include "csrInsideApi.h"
59#include "smsDebug.h"
60#include "smeQosInternal.h"
Jeff Johnsone7245742012-09-05 17:12:55 -070061#include "wlan_qct_wda.h"
62
Jeff Johnson295189b2012-06-20 16:38:30 -070063#ifdef FEATURE_WLAN_CCX
64#include "vos_utils.h"
65#include "csrCcx.h"
66#endif /* FEATURE_WLAN_CCX */
67
68tANI_U8 csrWpaOui[][ CSR_WPA_OUI_SIZE ] = {
69 { 0x00, 0x50, 0xf2, 0x00 },
70 { 0x00, 0x50, 0xf2, 0x01 },
71 { 0x00, 0x50, 0xf2, 0x02 },
72 { 0x00, 0x50, 0xf2, 0x03 },
73 { 0x00, 0x50, 0xf2, 0x04 },
74 { 0x00, 0x50, 0xf2, 0x05 },
75#ifdef FEATURE_WLAN_CCX
76 { 0x00, 0x40, 0x96, 0x00 }, // CCKM
77#endif /* FEATURE_WLAN_CCX */
78};
79
80tANI_U8 csrRSNOui[][ CSR_RSN_OUI_SIZE ] = {
81 { 0x00, 0x0F, 0xAC, 0x00 }, // group cipher
82 { 0x00, 0x0F, 0xAC, 0x01 }, // WEP-40 or RSN
83 { 0x00, 0x0F, 0xAC, 0x02 }, // TKIP or RSN-PSK
84 { 0x00, 0x0F, 0xAC, 0x03 }, // Reserved
85 { 0x00, 0x0F, 0xAC, 0x04 }, // AES-CCMP
86 { 0x00, 0x0F, 0xAC, 0x05 }, // WEP-104
87#ifdef WLAN_FEATURE_11W
88 { 0x00, 0x0F, 0xAC, 0x06 }, // BIP(encryption type) or (RSN-PSK-SHA256(authentication type)
89#endif
90#ifdef FEATURE_WLAN_CCX
91 { 0x00, 0x40, 0x96, 0x00 } // CCKM
92#endif /* FEATURE_WLAN_CCX */
93
94};
95
96#ifdef FEATURE_WLAN_WAPI
97tANI_U8 csrWapiOui[][ CSR_WAPI_OUI_SIZE ] = {
98 { 0x00, 0x14, 0x72, 0x00 }, // Reserved
99 { 0x00, 0x14, 0x72, 0x01 }, // WAI certificate or SMS4
100 { 0x00, 0x14, 0x72, 0x02 } // WAI PSK
101};
102#endif /* FEATURE_WLAN_WAPI */
103tANI_U8 csrWmeInfoOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
104tANI_U8 csrWmeParmOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 };
105
106static tCsrIELenInfo gCsrIELengthTable[] = {
107/* 000 */ { SIR_MAC_SSID_EID_MIN, SIR_MAC_SSID_EID_MAX },
108/* 001 */ { SIR_MAC_RATESET_EID_MIN, SIR_MAC_RATESET_EID_MAX },
109/* 002 */ { SIR_MAC_FH_PARAM_SET_EID_MIN, SIR_MAC_FH_PARAM_SET_EID_MAX },
110/* 003 */ { SIR_MAC_DS_PARAM_SET_EID_MIN, SIR_MAC_DS_PARAM_SET_EID_MAX },
111/* 004 */ { SIR_MAC_CF_PARAM_SET_EID_MIN, SIR_MAC_CF_PARAM_SET_EID_MAX },
112/* 005 */ { SIR_MAC_TIM_EID_MIN, SIR_MAC_TIM_EID_MAX },
113/* 006 */ { SIR_MAC_IBSS_PARAM_SET_EID_MIN, SIR_MAC_IBSS_PARAM_SET_EID_MAX },
114/* 007 */ { SIR_MAC_COUNTRY_EID_MIN, SIR_MAC_COUNTRY_EID_MAX },
115/* 008 */ { SIR_MAC_FH_PARAMS_EID_MIN, SIR_MAC_FH_PARAMS_EID_MAX },
116/* 009 */ { SIR_MAC_FH_PATTERN_EID_MIN, SIR_MAC_FH_PATTERN_EID_MAX },
117/* 010 */ { SIR_MAC_REQUEST_EID_MIN, SIR_MAC_REQUEST_EID_MAX },
118/* 011 */ { SIR_MAC_QBSS_LOAD_EID_MIN, SIR_MAC_QBSS_LOAD_EID_MAX },
119/* 012 */ { SIR_MAC_EDCA_PARAM_SET_EID_MIN, SIR_MAC_EDCA_PARAM_SET_EID_MAX },
120/* 013 */ { SIR_MAC_TSPEC_EID_MIN, SIR_MAC_TSPEC_EID_MAX },
121/* 014 */ { SIR_MAC_TCLAS_EID_MIN, SIR_MAC_TCLAS_EID_MAX },
122/* 015 */ { SIR_MAC_QOS_SCHEDULE_EID_MIN, SIR_MAC_QOS_SCHEDULE_EID_MAX },
123/* 016 */ { SIR_MAC_CHALLENGE_TEXT_EID_MIN, SIR_MAC_CHALLENGE_TEXT_EID_MAX },
124/* 017 */ { 0, 255 },
125/* 018 */ { 0, 255 },
126/* 019 */ { 0, 255 },
127/* 020 */ { 0, 255 },
128/* 021 */ { 0, 255 },
129/* 022 */ { 0, 255 },
130/* 023 */ { 0, 255 },
131/* 024 */ { 0, 255 },
132/* 025 */ { 0, 255 },
133/* 026 */ { 0, 255 },
134/* 027 */ { 0, 255 },
135/* 028 */ { 0, 255 },
136/* 029 */ { 0, 255 },
137/* 030 */ { 0, 255 },
138/* 031 */ { 0, 255 },
139/* 032 */ { SIR_MAC_PWR_CONSTRAINT_EID_MIN, SIR_MAC_PWR_CONSTRAINT_EID_MAX },
140/* 033 */ { SIR_MAC_PWR_CAPABILITY_EID_MIN, SIR_MAC_PWR_CAPABILITY_EID_MAX },
141/* 034 */ { SIR_MAC_TPC_REQ_EID_MIN, SIR_MAC_TPC_REQ_EID_MAX },
142/* 035 */ { SIR_MAC_TPC_RPT_EID_MIN, SIR_MAC_TPC_RPT_EID_MAX },
143/* 036 */ { SIR_MAC_SPRTD_CHNLS_EID_MIN, SIR_MAC_SPRTD_CHNLS_EID_MAX },
144/* 037 */ { SIR_MAC_CHNL_SWITCH_ANN_EID_MIN, SIR_MAC_CHNL_SWITCH_ANN_EID_MAX },
145/* 038 */ { SIR_MAC_MEAS_REQ_EID_MIN, SIR_MAC_MEAS_REQ_EID_MAX },
146/* 039 */ { SIR_MAC_MEAS_RPT_EID_MIN, SIR_MAC_MEAS_RPT_EID_MAX },
147/* 040 */ { SIR_MAC_QUIET_EID_MIN, SIR_MAC_QUIET_EID_MAX },
148/* 041 */ { SIR_MAC_IBSS_DFS_EID_MIN, SIR_MAC_IBSS_DFS_EID_MAX },
149/* 042 */ { SIR_MAC_ERP_INFO_EID_MIN, SIR_MAC_ERP_INFO_EID_MAX },
150/* 043 */ { SIR_MAC_TS_DELAY_EID_MIN, SIR_MAC_TS_DELAY_EID_MAX },
151/* 044 */ { SIR_MAC_TCLAS_PROC_EID_MIN, SIR_MAC_TCLAS_PROC_EID_MAX },
152/* 045 */ { SIR_MAC_QOS_ACTION_EID_MIN, SIR_MAC_QOS_ACTION_EID_MAX },
153/* 046 */ { SIR_MAC_QOS_CAPABILITY_EID_MIN, SIR_MAC_QOS_CAPABILITY_EID_MAX },
154/* 047 */ { 0, 255 },
155/* 048 */ { SIR_MAC_RSN_EID_MIN, SIR_MAC_RSN_EID_MAX },
156/* 049 */ { 0, 255 },
157/* 050 */ { SIR_MAC_EXTENDED_RATE_EID_MIN, SIR_MAC_EXTENDED_RATE_EID_MAX },
158/* 051 */ { 0, 255 },
159/* 052 */ { 0, 255 },
160/* 053 */ { 0, 255 },
161/* 054 */ { 0, 255 },
162/* 055 */ { 0, 255 },
163/* 056 */ { 0, 255 },
164/* 057 */ { 0, 255 },
165/* 058 */ { 0, 255 },
166/* 059 */ { 0, 255 },
167/* 060 */ { 0, 255 },
168/* 061 */ { 0, 255 },
169/* 062 */ { 0, 255 },
170/* 063 */ { 0, 255 },
171/* 064 */ { 0, 255 },
172/* 065 */ { 0, 255 },
173/* 066 */ { 0, 255 },
174/* 067 */ { 0, 255 },
175#ifdef FEATURE_WLAN_WAPI
176/* 068 */ { DOT11F_EID_WAPI, DOT11F_IE_WAPI_MAX_LEN },
177#else
178/* 068 */ { 0, 255 },
179#endif /* FEATURE_WLAN_WAPI */
180/* 069 */ { 0, 255 },
181/* 070 */ { 0, 255 },
182/* 071 */ { 0, 255 },
183/* 072 */ { 0, 255 },
184/* 073 */ { 0, 255 },
185/* 074 */ { 0, 255 },
186/* 075 */ { 0, 255 },
187/* 076 */ { 0, 255 },
188/* 077 */ { 0, 255 },
189/* 078 */ { 0, 255 },
190/* 079 */ { 0, 255 },
191/* 080 */ { 0, 255 },
192/* 081 */ { 0, 255 },
193/* 082 */ { 0, 255 },
194/* 083 */ { 0, 255 },
195/* 084 */ { 0, 255 },
196/* 085 */ { 0, 255 },
197/* 086 */ { 0, 255 },
198/* 087 */ { 0, 255 },
199/* 088 */ { 0, 255 },
200/* 089 */ { 0, 255 },
201/* 090 */ { 0, 255 },
202/* 091 */ { 0, 255 },
203/* 092 */ { 0, 255 },
204/* 093 */ { 0, 255 },
205/* 094 */ { 0, 255 },
206/* 095 */ { 0, 255 },
207/* 096 */ { 0, 255 },
208/* 097 */ { 0, 255 },
209/* 098 */ { 0, 255 },
210/* 099 */ { 0, 255 },
211/* 100 */ { 0, 255 },
212/* 101 */ { 0, 255 },
213/* 102 */ { 0, 255 },
214/* 103 */ { 0, 255 },
215/* 104 */ { 0, 255 },
216/* 105 */ { 0, 255 },
217/* 106 */ { 0, 255 },
218/* 107 */ { 0, 255 },
219/* 108 */ { 0, 255 },
220/* 109 */ { 0, 255 },
221/* 110 */ { 0, 255 },
222/* 111 */ { 0, 255 },
223/* 112 */ { 0, 255 },
224/* 113 */ { 0, 255 },
225/* 114 */ { 0, 255 },
226/* 115 */ { 0, 255 },
227/* 116 */ { 0, 255 },
228/* 117 */ { 0, 255 },
229/* 118 */ { 0, 255 },
230/* 119 */ { 0, 255 },
231/* 120 */ { 0, 255 },
232/* 121 */ { 0, 255 },
233/* 122 */ { 0, 255 },
234/* 123 */ { 0, 255 },
235/* 124 */ { 0, 255 },
236/* 125 */ { 0, 255 },
237/* 126 */ { 0, 255 },
238/* 127 */ { 0, 255 },
239/* 128 */ { 0, 255 },
240/* 129 */ { 0, 255 },
241/* 130 */ { 0, 255 },
242/* 131 */ { 0, 255 },
243/* 132 */ { 0, 255 },
244/* 133 */ { 0, 255 },
245/* 134 */ { 0, 255 },
246/* 135 */ { 0, 255 },
247/* 136 */ { 0, 255 },
248/* 137 */ { 0, 255 },
249/* 138 */ { 0, 255 },
250/* 139 */ { 0, 255 },
251/* 140 */ { 0, 255 },
252/* 141 */ { 0, 255 },
253/* 142 */ { 0, 255 },
254/* 143 */ { 0, 255 },
255/* 144 */ { 0, 255 },
256/* 145 */ { 0, 255 },
257/* 146 */ { 0, 255 },
258/* 147 */ { 0, 255 },
259/* 148 */ { 0, 255 },
260/* 149 */ { 0, 255 },
261/* 150 */ { 0, 255 },
262/* 151 */ { 0, 255 },
263/* 152 */ { 0, 255 },
264/* 153 */ { 0, 255 },
265/* 154 */ { 0, 255 },
266/* 155 */ { 0, 255 },
267/* 156 */ { 0, 255 },
268/* 157 */ { 0, 255 },
269/* 158 */ { 0, 255 },
270/* 159 */ { 0, 255 },
271/* 160 */ { 0, 255 },
272/* 161 */ { 0, 255 },
273/* 162 */ { 0, 255 },
274/* 163 */ { 0, 255 },
275/* 164 */ { 0, 255 },
276/* 165 */ { 0, 255 },
277/* 166 */ { 0, 255 },
278/* 167 */ { 0, 255 },
279/* 168 */ { 0, 255 },
280/* 169 */ { 0, 255 },
281/* 170 */ { 0, 255 },
282/* 171 */ { 0, 255 },
283/* 172 */ { 0, 255 },
284/* 173 */ { 0, 255 },
285/* 174 */ { 0, 255 },
286/* 175 */ { 0, 255 },
287/* 176 */ { 0, 255 },
288/* 177 */ { 0, 255 },
289/* 178 */ { 0, 255 },
290/* 179 */ { 0, 255 },
291/* 180 */ { 0, 255 },
292/* 181 */ { 0, 255 },
293/* 182 */ { 0, 255 },
294/* 183 */ { 0, 255 },
295/* 184 */ { 0, 255 },
296/* 185 */ { 0, 255 },
297/* 186 */ { 0, 255 },
298/* 187 */ { 0, 255 },
299/* 188 */ { 0, 255 },
300/* 189 */ { 0, 255 },
301/* 190 */ { 0, 255 },
302/* 191 */ { 0, 255 },
303/* 192 */ { 0, 255 },
304/* 193 */ { 0, 255 },
305/* 194 */ { 0, 255 },
306/* 195 */ { 0, 255 },
307/* 196 */ { 0, 255 },
308/* 197 */ { 0, 255 },
309/* 198 */ { 0, 255 },
310/* 199 */ { 0, 255 },
311/* 200 */ { 0, 255 },
312/* 201 */ { 0, 255 },
313/* 202 */ { 0, 255 },
314/* 203 */ { 0, 255 },
315/* 204 */ { 0, 255 },
316/* 205 */ { 0, 255 },
317/* 206 */ { 0, 255 },
318/* 207 */ { 0, 255 },
319/* 208 */ { 0, 255 },
320/* 209 */ { 0, 255 },
321/* 210 */ { 0, 255 },
322/* 211 */ { 0, 255 },
323/* 212 */ { 0, 255 },
324/* 213 */ { 0, 255 },
325/* 214 */ { 0, 255 },
326/* 215 */ { 0, 255 },
327/* 216 */ { 0, 255 },
328/* 217 */ { 0, 255 },
329/* 218 */ { 0, 255 },
330/* 219 */ { 0, 255 },
331/* 220 */ { 0, 255 },
332/* 221 */ { SIR_MAC_WPA_EID_MIN, SIR_MAC_WPA_EID_MAX },
333/* 222 */ { 0, 255 },
334/* 223 */ { 0, 255 },
335/* 224 */ { 0, 255 },
336/* 225 */ { 0, 255 },
337/* 226 */ { 0, 255 },
338/* 227 */ { 0, 255 },
339/* 228 */ { 0, 255 },
340/* 229 */ { 0, 255 },
341/* 230 */ { 0, 255 },
342/* 231 */ { 0, 255 },
343/* 232 */ { 0, 255 },
344/* 233 */ { 0, 255 },
345/* 234 */ { 0, 255 },
346/* 235 */ { 0, 255 },
347/* 236 */ { 0, 255 },
348/* 237 */ { 0, 255 },
349/* 238 */ { 0, 255 },
350/* 239 */ { 0, 255 },
351/* 240 */ { 0, 255 },
352/* 241 */ { 0, 255 },
353/* 242 */ { 0, 255 },
354/* 243 */ { 0, 255 },
355/* 244 */ { 0, 255 },
356/* 245 */ { 0, 255 },
357/* 246 */ { 0, 255 },
358/* 247 */ { 0, 255 },
359/* 248 */ { 0, 255 },
360/* 249 */ { 0, 255 },
361/* 250 */ { 0, 255 },
362/* 251 */ { 0, 255 },
363/* 252 */ { 0, 255 },
364/* 253 */ { 0, 255 },
365/* 254 */ { 0, 255 },
366/* 255 */ { SIR_MAC_ANI_WORKAROUND_EID_MIN, SIR_MAC_ANI_WORKAROUND_EID_MAX }
367};
368
369#if 0
370//Don't not insert entry into the table, put it to the end. If you have to insert, make sure it is also
371//reflected in eCsrCountryIndex
372static tCsrCountryInfo gCsrCountryInfo[eCSR_NUM_COUNTRY_INDEX] =
373{
374 {REG_DOMAIN_FCC, {'U', 'S', ' '}}, //USA/******The "US" MUST be at index 0*******/
375 {REG_DOMAIN_WORLD, {'A', 'D', ' '}}, //ANDORRA
376 {REG_DOMAIN_WORLD, {'A', 'E', ' '}}, //UAE
377 {REG_DOMAIN_WORLD, {'A', 'F', ' '}}, //AFGHANISTAN
378 {REG_DOMAIN_WORLD, {'A', 'G', ' '}}, //ANTIGUA AND BARBUDA
379 {REG_DOMAIN_WORLD, {'A', 'I', ' '}}, //ANGUILLA
380 {REG_DOMAIN_HI_5GHZ, {'A', 'L', ' '}}, //ALBANIA
381 {REG_DOMAIN_WORLD, {'A', 'M', ' '}}, //ARMENIA
382 {REG_DOMAIN_WORLD, {'A', 'N', ' '}}, //NETHERLANDS ANTILLES
383 {REG_DOMAIN_WORLD, {'A', 'O', ' '}}, //ANGOLA
384 {REG_DOMAIN_WORLD, {'A', 'Q', ' '}}, //ANTARCTICA
385 {REG_DOMAIN_HI_5GHZ, {'A', 'R', ' '}}, //ARGENTINA
386 {REG_DOMAIN_FCC, {'A', 'S', ' '}}, //AMERICAN SOMOA
387 {REG_DOMAIN_ETSI, {'A', 'T', ' '}}, //AUSTRIA
388 {REG_DOMAIN_ETSI, {'A', 'U', ' '}}, //AUSTRALIA
389 {REG_DOMAIN_WORLD, {'A', 'W', ' '}}, //ARUBA
390 {REG_DOMAIN_WORLD, {'A', 'X', ' '}}, //ALAND ISLANDS
391 {REG_DOMAIN_WORLD, {'A', 'Z', ' '}}, //AZERBAIJAN
392 {REG_DOMAIN_WORLD, {'B', 'A', ' '}}, //BOSNIA AND HERZEGOVINA
393 {REG_DOMAIN_WORLD, {'B', 'B', ' '}}, //BARBADOS
394 {REG_DOMAIN_WORLD, {'B', 'D', ' '}}, //BANGLADESH
395 {REG_DOMAIN_ETSI, {'B', 'E', ' '}}, //BELGIUM
396 {REG_DOMAIN_WORLD, {'B', 'F', ' '}}, //BURKINA FASO
397 {REG_DOMAIN_HI_5GHZ, {'B', 'G', ' '}}, //BULGARIA
398 {REG_DOMAIN_WORLD, {'B', 'H', ' '}}, //BAHRAIN
399 {REG_DOMAIN_WORLD, {'B', 'I', ' '}}, //BURUNDI
400 {REG_DOMAIN_WORLD, {'B', 'J', ' '}}, //BENIN
401 {REG_DOMAIN_WORLD, {'B', 'L', ' '}}, //SAINT BARTHELEMY
402 {REG_DOMAIN_ETSI, {'B', 'M', ' '}}, //BERMUDA
403 {REG_DOMAIN_WORLD, {'B', 'N', ' '}}, //BRUNEI DARUSSALAM
404 {REG_DOMAIN_WORLD, {'B', 'O', ' '}}, //BOLIVIA
405 {REG_DOMAIN_WORLD, {'B', 'R', ' '}}, //BRAZIL
406 {REG_DOMAIN_WORLD, {'B', 'S', ' '}}, //BAHAMAS
407 {REG_DOMAIN_WORLD, {'B', 'T', ' '}}, //BHUTAN
408 {REG_DOMAIN_WORLD, {'B', 'V', ' '}}, //BOUVET ISLAND
409 {REG_DOMAIN_WORLD, {'B', 'W', ' '}}, //BOTSWANA
410 {REG_DOMAIN_WORLD, {'B', 'Y', ' '}}, //BELARUS
411 {REG_DOMAIN_WORLD, {'B', 'Z', ' '}}, //BELIZE
412 {REG_DOMAIN_FCC, {'C', 'A', ' '}}, //CANADA
413 {REG_DOMAIN_WORLD, {'C', 'C', ' '}}, //COCOS (KEELING) ISLANDS
414 {REG_DOMAIN_WORLD, {'C', 'D', ' '}}, //CONGO, THE DEMOCRATIC REPUBLIC OF THE
415 {REG_DOMAIN_WORLD, {'C', 'F', ' '}}, //CENTRAL AFRICAN REPUBLIC
416 {REG_DOMAIN_WORLD, {'C', 'G', ' '}}, //CONGO
417 {REG_DOMAIN_ETSI, {'C', 'H', ' '}}, //SWITZERLAND
418 {REG_DOMAIN_WORLD, {'C', 'I', ' '}}, //COTE D'IVOIRE
419 {REG_DOMAIN_WORLD, {'C', 'K', ' '}}, //COOK ISLANDS
420 {REG_DOMAIN_WORLD, {'C', 'L', ' '}}, //CHILE
421 {REG_DOMAIN_WORLD, {'C', 'M', ' '}}, //CAMEROON
422 {REG_DOMAIN_HI_5GHZ, {'C', 'N', ' '}}, //CHINA
423 {REG_DOMAIN_WORLD, {'C', 'O', ' '}}, //COLOMBIA
424 {REG_DOMAIN_WORLD, {'C', 'R', ' '}}, //COSTA RICA
425 {REG_DOMAIN_WORLD, {'C', 'U', ' '}}, //CUBA
426 {REG_DOMAIN_WORLD, {'C', 'V', ' '}}, //CAPE VERDE
427 {REG_DOMAIN_WORLD, {'C', 'X', ' '}}, //CHRISTMAS ISLAND
428 {REG_DOMAIN_WORLD, {'C', 'Y', ' '}}, //CYPRUS
429 {REG_DOMAIN_HI_5GHZ, {'C', 'Z', ' '}}, //CZECH REPUBLIC
430 {REG_DOMAIN_ETSI, {'D', 'E', ' '}}, //GERMANY
431 {REG_DOMAIN_WORLD, {'D', 'J', ' '}}, //DJIBOUTI
432 {REG_DOMAIN_ETSI, {'D', 'K', ' '}}, //DENMARK
433 {REG_DOMAIN_WORLD, {'D', 'M', ' '}}, //DOMINICA
434 {REG_DOMAIN_WORLD, {'D', 'O', ' '}}, //DOMINICAN REPUBLIC
435 {REG_DOMAIN_WORLD, {'D', 'Z', ' '}}, //ALGERIA
436 {REG_DOMAIN_WORLD, {'E', 'C', ' '}}, //ECUADOR
437 {REG_DOMAIN_HI_5GHZ, {'E', 'E', ' '}}, //ESTONIA
438 {REG_DOMAIN_WORLD, {'E', 'G', ' '}}, //EGYPT
439 {REG_DOMAIN_WORLD, {'E', 'H', ' '}}, //WESTERN SAHARA
440 {REG_DOMAIN_WORLD, {'E', 'R', ' '}}, //ERITREA
441 {REG_DOMAIN_ETSI, {'E', 'S', ' '}}, //SPAIN
442 {REG_DOMAIN_WORLD, {'E', 'T', ' '}}, //ETHIOPIA
443 {REG_DOMAIN_WORLD, {'F', 'I', ' '}}, //FINLAND
444 {REG_DOMAIN_WORLD, {'F', 'J', ' '}}, //FIJI
445 {REG_DOMAIN_WORLD, {'F', 'K', ' '}}, //FALKLAND ISLANDS (MALVINAS)
446 {REG_DOMAIN_WORLD, {'F', 'M', ' '}}, //MICRONESIA, FEDERATED STATES OF
447 {REG_DOMAIN_WORLD, {'F', 'O', ' '}}, //FAROE ISLANDS
448 {REG_DOMAIN_ETSI, {'F', 'R', ' '}}, //FRANCE
449 {REG_DOMAIN_WORLD, {'G', 'A', ' '}}, //GABON
450 {REG_DOMAIN_ETSI, {'G', 'B', ' '}}, //UNITED KINGDOM
451 {REG_DOMAIN_WORLD, {'G', 'D', ' '}}, //GRENADA
452 {REG_DOMAIN_HI_5GHZ, {'G', 'E', ' '}}, //GEORGIA
453 {REG_DOMAIN_WORLD, {'G', 'F', ' '}}, //FRENCH GUIANA
454 {REG_DOMAIN_ETSI, {'G', 'G', ' '}}, //GUERNSEY
455 {REG_DOMAIN_WORLD, {'G', 'H', ' '}}, //GHANA
456 {REG_DOMAIN_WORLD, {'G', 'I', ' '}}, //GIBRALTAR
457 {REG_DOMAIN_WORLD, {'G', 'L', ' '}}, //GREENLAND
458 {REG_DOMAIN_WORLD, {'G', 'M', ' '}}, //GAMBIA
459 {REG_DOMAIN_WORLD, {'G', 'N', ' '}}, //GUINEA
460 {REG_DOMAIN_WORLD, {'G', 'P', ' '}}, //GUADELOUPE
461 {REG_DOMAIN_WORLD, {'G', 'Q', ' '}}, //EQUATORIAL GUINEA
462 {REG_DOMAIN_ETSI, {'G', 'R', ' '}}, //GREECE
463 {REG_DOMAIN_WORLD, {'G', 'S', ' '}}, //SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS
464 {REG_DOMAIN_WORLD, {'G', 'T', ' '}}, //GUATEMALA
465 {REG_DOMAIN_WORLD, {'G', 'U', ' '}}, //GUAM
466 {REG_DOMAIN_WORLD, {'G', 'W', ' '}}, //GUINEA-BISSAU
467 {REG_DOMAIN_WORLD, {'G', 'Y', ' '}}, //GUYANA
468 {REG_DOMAIN_WORLD, {'H', 'K', ' '}}, //HONGKONG
469 {REG_DOMAIN_WORLD, {'H', 'M', ' '}}, //HEARD ISLAND AND MCDONALD ISLANDS
470 {REG_DOMAIN_WORLD, {'H', 'N', ' '}}, //HONDURAS
471 {REG_DOMAIN_HI_5GHZ, {'H', 'R', ' '}}, //CROATIA
472 {REG_DOMAIN_WORLD, {'H', 'T', ' '}}, //HAITI
473 {REG_DOMAIN_HI_5GHZ, {'H', 'U', ' '}}, //HUNGARY
474 {REG_DOMAIN_APAC, {'I', 'D', ' '}}, //INDONESIA
475 {REG_DOMAIN_ETSI, {'I', 'E', ' '}}, //IRELAND
476 {REG_DOMAIN_WORLD, {'I', 'L', ' '}}, //ISREAL
477 {REG_DOMAIN_ETSI, {'I', 'M', ' '}}, //ISLE OF MAN
478 {REG_DOMAIN_WORLD, {'I', 'N', ' '}}, //INDIA
479 {REG_DOMAIN_ETSI, {'I', 'O', ' '}}, //BRITISH INDIAN OCEAN TERRITORY
480 {REG_DOMAIN_WORLD, {'I', 'Q', ' '}}, //IRAQ
481 {REG_DOMAIN_WORLD, {'I', 'R', ' '}}, //IRAN, ISLAMIC REPUBLIC OF
482 {REG_DOMAIN_WORLD, {'I', 'S', ' '}}, //ICELAND
483 {REG_DOMAIN_ETSI, {'I', 'T', ' '}}, //ITALY
484 {REG_DOMAIN_ETSI, {'J', 'E', ' '}}, //JERSEY
485 {REG_DOMAIN_WORLD, {'J', 'M', ' '}}, //JAMAICA
486 {REG_DOMAIN_WORLD, {'J', 'O', ' '}}, //JORDAN
487 {REG_DOMAIN_JAPAN, {'J', 'P', ' '}}, //JAPAN
488 {REG_DOMAIN_WORLD, {'K', 'E', ' '}}, //KENYA
489 {REG_DOMAIN_WORLD, {'K', 'G', ' '}}, //KYRGYZSTAN
490 {REG_DOMAIN_WORLD, {'K', 'H', ' '}}, //CAMBODIA
491 {REG_DOMAIN_WORLD, {'K', 'I', ' '}}, //KIRIBATI
492 {REG_DOMAIN_WORLD, {'K', 'M', ' '}}, //COMOROS
493 {REG_DOMAIN_WORLD, {'K', 'N', ' '}}, //SAINT KITTS AND NEVIS
494 {REG_DOMAIN_KOREA, {'K', 'P', ' '}}, //KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF
495 {REG_DOMAIN_KOREA, {'K', 'R', ' '}}, //KOREA, REPUBLIC OF
496 {REG_DOMAIN_WORLD, {'K', 'W', ' '}}, //KUWAIT
497 {REG_DOMAIN_WORLD, {'K', 'Y', ' '}}, //CAYMAN ISLANDS
498 {REG_DOMAIN_WORLD, {'K', 'Z', ' '}}, //KAZAKHSTAN
499 {REG_DOMAIN_WORLD, {'L', 'A', ' '}}, //LAO PEOPLE'S DEMOCRATIC REPUBLIC
500 {REG_DOMAIN_WORLD, {'L', 'B', ' '}}, //LEBANON
501 {REG_DOMAIN_WORLD, {'L', 'C', ' '}}, //SAINT LUCIA
502 {REG_DOMAIN_ETSI, {'L', 'I', ' '}}, //LIECHTENSTEIN
503 {REG_DOMAIN_WORLD, {'L', 'K', ' '}}, //SRI LANKA
504 {REG_DOMAIN_WORLD, {'L', 'R', ' '}}, //LIBERIA
505 {REG_DOMAIN_WORLD, {'L', 'S', ' '}}, //LESOTHO
506 {REG_DOMAIN_HI_5GHZ, {'L', 'T', ' '}}, //LITHUANIA
507 {REG_DOMAIN_ETSI, {'L', 'U', ' '}}, //LUXEMBOURG
508 {REG_DOMAIN_HI_5GHZ, {'L', 'V', ' '}}, //LATVIA
509 {REG_DOMAIN_WORLD, {'L', 'Y', ' '}}, //LIBYAN ARAB JAMAHIRIYA
510 {REG_DOMAIN_WORLD, {'M', 'A', ' '}}, //MOROCCO
511 {REG_DOMAIN_ETSI, {'M', 'C', ' '}}, //MONACO
512 {REG_DOMAIN_WORLD, {'M', 'D', ' '}}, //MOLDOVA, REPUBLIC OF
513 {REG_DOMAIN_WORLD, {'M', 'E', ' '}}, //MONTENEGRO
514 {REG_DOMAIN_WORLD, {'M', 'G', ' '}}, //MADAGASCAR
515 {REG_DOMAIN_WORLD, {'M', 'H', ' '}}, //MARSHALL ISLANDS
516 {REG_DOMAIN_WORLD, {'M', 'K', ' '}}, //MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF
517 {REG_DOMAIN_WORLD, {'M', 'L', ' '}}, //MALI
518 {REG_DOMAIN_WORLD, {'M', 'M', ' '}}, //MYANMAR
519 {REG_DOMAIN_HI_5GHZ, {'M', 'N', ' '}}, //MONGOLIA
520 {REG_DOMAIN_WORLD, {'M', 'O', ' '}}, //MACAO
521 {REG_DOMAIN_WORLD, {'M', 'P', ' '}}, //NORTHERN MARIANA ISLANDS
522 {REG_DOMAIN_WORLD, {'M', 'Q', ' '}}, //MARTINIQUE
523 {REG_DOMAIN_WORLD, {'M', 'R', ' '}}, //MAURITANIA
524 {REG_DOMAIN_WORLD, {'M', 'S', ' '}}, //MONTSERRAT
525 {REG_DOMAIN_WORLD, {'M', 'T', ' '}}, //MALTA
526 {REG_DOMAIN_WORLD, {'M', 'U', ' '}}, //MAURITIUS
527 {REG_DOMAIN_WORLD, {'M', 'V', ' '}}, //MALDIVES
528 {REG_DOMAIN_WORLD, {'M', 'W', ' '}}, //MALAWI
529 {REG_DOMAIN_WORLD, {'M', 'X', ' '}}, //MEXICO
530 {REG_DOMAIN_HI_5GHZ, {'M', 'Y', ' '}}, //MALAYSIA
531 {REG_DOMAIN_WORLD, {'M', 'Z', ' '}}, //MOZAMBIQUE
532 {REG_DOMAIN_WORLD, {'N', 'A', ' '}}, //NAMIBIA
533 {REG_DOMAIN_WORLD, {'N', 'C', ' '}}, //NEW CALEDONIA
534 {REG_DOMAIN_WORLD, {'N', 'E', ' '}}, //NIGER
535 {REG_DOMAIN_WORLD, {'N', 'F', ' '}}, //NORFOLD ISLAND
536 {REG_DOMAIN_WORLD, {'N', 'G', ' '}}, //NIGERIA
537 {REG_DOMAIN_WORLD, {'N', 'I', ' '}}, //NICARAGUA
538 {REG_DOMAIN_ETSI, {'N', 'L', ' '}}, //NETHERLANDS
539 {REG_DOMAIN_WORLD, {'N', 'O', ' '}}, //NORWAY
540 {REG_DOMAIN_WORLD, {'N', 'P', ' '}}, //NEPAL
541 {REG_DOMAIN_WORLD, {'N', 'R', ' '}}, //NAURU
542 {REG_DOMAIN_WORLD, {'N', 'U', ' '}}, //NIUE
543 {REG_DOMAIN_ETSI, {'N', 'Z', ' '}}, //NEW ZEALAND
544 {REG_DOMAIN_WORLD, {'O', 'M', ' '}}, //OMAN
545 {REG_DOMAIN_WORLD, {'P', 'A', ' '}}, //PANAMA
546 {REG_DOMAIN_WORLD, {'P', 'E', ' '}}, //PERU
547 {REG_DOMAIN_WORLD, {'P', 'F', ' '}}, //FRENCH POLYNESIA
548 {REG_DOMAIN_WORLD, {'P', 'G', ' '}}, //PAPUA NEW GUINEA
549 {REG_DOMAIN_WORLD, {'P', 'H', ' '}}, //PHILIPPINES
550 {REG_DOMAIN_WORLD, {'P', 'K', ' '}}, //PAKISTAN
551 {REG_DOMAIN_WORLD, {'P', 'L', ' '}}, //POLAND
552 {REG_DOMAIN_WORLD, {'P', 'M', ' '}}, //SAINT PIERRE AND MIQUELON
553 {REG_DOMAIN_WORLD, {'P', 'N', ' '}}, //PITCAIRN
554 {REG_DOMAIN_FCC, {'P', 'R', ' '}}, //PUERTO RICO
555 {REG_DOMAIN_WORLD, {'P', 'S', ' '}}, //PALESTINIAN TERRITORY, OCCUPIED
556 {REG_DOMAIN_ETSI, {'P', 'T', ' '}}, //PORTUGAL
557 {REG_DOMAIN_WORLD, {'P', 'W', ' '}}, //PALAU
558 {REG_DOMAIN_WORLD, {'P', 'Y', ' '}}, //PARAGUAY
559 {REG_DOMAIN_WORLD, {'Q', 'A', ' '}}, //QATAR
560 {REG_DOMAIN_WORLD, {'R', 'E', ' '}}, //REUNION
561 {REG_DOMAIN_HI_5GHZ, {'R', 'O', ' '}}, //ROMANIA
562 {REG_DOMAIN_HI_5GHZ, {'R', 'S', ' '}}, //SERBIA
563 {REG_DOMAIN_WORLD, {'R', 'U', ' '}}, //RUSSIA
564 {REG_DOMAIN_WORLD, {'R', 'W', ' '}}, //RWANDA
565 {REG_DOMAIN_WORLD, {'S', 'A', ' '}}, //SAUDI ARABIA
566 {REG_DOMAIN_WORLD, {'S', 'B', ' '}}, //SOLOMON ISLANDS
567 {REG_DOMAIN_ETSI, {'S', 'C', ' '}}, //SEYCHELLES
568 {REG_DOMAIN_WORLD, {'S', 'D', ' '}}, //SUDAN
569 {REG_DOMAIN_ETSI, {'S', 'E', ' '}}, //SWEDEN
570 {REG_DOMAIN_APAC, {'S', 'G', ' '}}, //SINGAPORE
571 {REG_DOMAIN_WORLD, {'S', 'H', ' '}}, //SAINT HELENA
572 {REG_DOMAIN_HI_5GHZ, {'S', 'I', ' '}}, //SLOVENNIA
573 {REG_DOMAIN_WORLD, {'S', 'J', ' '}}, //SVALBARD AND JAN MAYEN
574 {REG_DOMAIN_HI_5GHZ, {'S', 'K', ' '}}, //SLOVAKIA
575 {REG_DOMAIN_WORLD, {'S', 'L', ' '}}, //SIERRA LEONE
576 {REG_DOMAIN_WORLD, {'S', 'M', ' '}}, //SAN MARINO
577 {REG_DOMAIN_WORLD, {'S', 'N', ' '}}, //SENEGAL
578 {REG_DOMAIN_WORLD, {'S', 'O', ' '}}, //SOMALIA
579 {REG_DOMAIN_WORLD, {'S', 'R', ' '}}, //SURINAME
580 {REG_DOMAIN_WORLD, {'S', 'T', ' '}}, //SAO TOME AND PRINCIPE
581 {REG_DOMAIN_WORLD, {'S', 'V', ' '}}, //EL SALVADOR
582 {REG_DOMAIN_WORLD, {'S', 'Y', ' '}}, //SYRIAN ARAB REPUBLIC
583 {REG_DOMAIN_WORLD, {'S', 'Z', ' '}}, //SWAZILAND
584 {REG_DOMAIN_WORLD, {'T', 'C', ' '}}, //TURKS AND CAICOS ISLANDS
585 {REG_DOMAIN_WORLD, {'T', 'D', ' '}}, //CHAD
586 {REG_DOMAIN_WORLD, {'T', 'F', ' '}}, //FRENCH SOUTHERN TERRITORIES
587 {REG_DOMAIN_WORLD, {'T', 'G', ' '}}, //TOGO
588 {REG_DOMAIN_WORLD, {'T', 'H', ' '}}, //THAILAND
589 {REG_DOMAIN_WORLD, {'T', 'J', ' '}}, //TAJIKISTAN
590 {REG_DOMAIN_WORLD, {'T', 'K', ' '}}, //TOKELAU
591 {REG_DOMAIN_WORLD, {'T', 'L', ' '}}, //TIMOR-LESTE
592 {REG_DOMAIN_WORLD, {'T', 'M', ' '}}, //TURKMENISTAN
593 {REG_DOMAIN_WORLD, {'T', 'N', ' '}}, //TUNISIA
594 {REG_DOMAIN_WORLD, {'T', 'O', ' '}}, //TONGA
595 {REG_DOMAIN_WORLD, {'T', 'R', ' '}}, //TURKEY
596 {REG_DOMAIN_WORLD, {'T', 'T', ' '}}, //TRINIDAD AND TOBAGO
597 {REG_DOMAIN_WORLD, {'T', 'V', ' '}}, //TUVALU
598 {REG_DOMAIN_HI_5GHZ, {'T', 'W', ' '}}, //TAIWAN, PROVINCE OF CHINA
599 {REG_DOMAIN_WORLD, {'T', 'Z', ' '}}, //TANZANIA, UNITED REPUBLIC OF
600 {REG_DOMAIN_HI_5GHZ, {'U', 'A', ' '}}, //UKRAINE
601 {REG_DOMAIN_WORLD, {'U', 'G', ' '}}, //UGANDA
602 {REG_DOMAIN_FCC, {'U', 'M', ' '}}, //UNITED STATES MINOR OUTLYING ISLANDS
603 {REG_DOMAIN_WORLD, {'U', 'Y', ' '}}, //URUGUAY
604 {REG_DOMAIN_HI_5GHZ, {'U', 'Z', ' '}}, //UZBEKISTAN
605 {REG_DOMAIN_ETSI, {'V', 'A', ' '}}, //HOLY SEE (VATICAN CITY STATE)
606 {REG_DOMAIN_WORLD, {'V', 'C', ' '}}, //SAINT VINCENT AND THE GRENADINES
607 {REG_DOMAIN_HI_5GHZ, {'V', 'E', ' '}}, //VENEZUELA
608 {REG_DOMAIN_ETSI, {'V', 'G', ' '}}, //VIRGIN ISLANDS, BRITISH
609 {REG_DOMAIN_FCC, {'V', 'I', ' '}}, //VIRGIN ISLANDS, US
610 {REG_DOMAIN_WORLD, {'V', 'N', ' '}}, //VIET NAM
611 {REG_DOMAIN_WORLD, {'V', 'U', ' '}}, //VANUATU
612 {REG_DOMAIN_WORLD, {'W', 'F', ' '}}, //WALLIS AND FUTUNA
613 {REG_DOMAIN_WORLD, {'W', 'S', ' '}}, //SOMOA
614 {REG_DOMAIN_WORLD, {'Y', 'E', ' '}}, //YEMEN
615 {REG_DOMAIN_WORLD, {'Y', 'T', ' '}}, //MAYOTTE
616 {REG_DOMAIN_WORLD, {'Z', 'A', ' '}}, //SOUTH AFRICA
617 {REG_DOMAIN_WORLD, {'Z', 'M', ' '}}, //ZAMBIA
618 {REG_DOMAIN_WORLD, {'Z', 'W', ' '}}, //ZIMBABWE
619
620 {REG_DOMAIN_KOREA, {'K', '1', ' '}}, //Korea alternate 1
621 {REG_DOMAIN_KOREA, {'K', '2', ' '}}, //Korea alternate 2
622 {REG_DOMAIN_KOREA, {'K', '3', ' '}}, //Korea alternate 3
623 {REG_DOMAIN_KOREA, {'K', '4', ' '}}, //Korea alternate 4
624};
625
626
627//The channels listed here doesn't mean they are valid channels for certain domain. They are here only to present
628//whether they should be passive scanned.
629tCsrDomainChnInfo gCsrDomainChnInfo[NUM_REG_DOMAINS] =
630{
631 //REG_DOMAIN_FCC
632 {
633 REG_DOMAIN_FCC,
634 45, //Num channels
635 //Channels
636 {
637 //5GHz
638 //5180 - 5240
639 {36, eSIR_ACTIVE_SCAN},
640 {40, eSIR_ACTIVE_SCAN},
641 {44, eSIR_ACTIVE_SCAN},
642 {48, eSIR_ACTIVE_SCAN},
643 //5250 to 5350
644 {52, eSIR_PASSIVE_SCAN},
645 {56, eSIR_PASSIVE_SCAN},
646 {60, eSIR_PASSIVE_SCAN},
647 {64, eSIR_PASSIVE_SCAN},
648 //5470 to 5725
649 {100, eSIR_PASSIVE_SCAN},
650 {104, eSIR_PASSIVE_SCAN},
651 {108, eSIR_PASSIVE_SCAN},
652 {112, eSIR_PASSIVE_SCAN},
653 {116, eSIR_PASSIVE_SCAN},
654 {120, eSIR_PASSIVE_SCAN},
655 {124, eSIR_PASSIVE_SCAN},
656 {128, eSIR_PASSIVE_SCAN},
657 {132, eSIR_PASSIVE_SCAN},
658 {136, eSIR_PASSIVE_SCAN},
659 {140, eSIR_PASSIVE_SCAN},
660 //5745 - 5825
661 {149, eSIR_ACTIVE_SCAN},
662 {153, eSIR_ACTIVE_SCAN},
663 {157, eSIR_ACTIVE_SCAN},
664 {161, eSIR_ACTIVE_SCAN},
665 {165, eSIR_ACTIVE_SCAN},
666 //4.9GHz
667 //4920 - 5080
668 {240, eSIR_ACTIVE_SCAN},
669 {244, eSIR_ACTIVE_SCAN},
670 {248, eSIR_ACTIVE_SCAN},
671 {252, eSIR_ACTIVE_SCAN},
672 {208, eSIR_ACTIVE_SCAN},
673 {212, eSIR_ACTIVE_SCAN},
674 {216, eSIR_ACTIVE_SCAN},
675 //2,4GHz
676 {1, eSIR_ACTIVE_SCAN},
677 {2, eSIR_ACTIVE_SCAN},
678 {3, eSIR_ACTIVE_SCAN},
679 {4, eSIR_ACTIVE_SCAN},
680 {5, eSIR_ACTIVE_SCAN},
681 {6, eSIR_ACTIVE_SCAN},
682 {7, eSIR_ACTIVE_SCAN},
683 {8, eSIR_ACTIVE_SCAN},
684 {9, eSIR_ACTIVE_SCAN},
685 {10, eSIR_ACTIVE_SCAN},
686 {11, eSIR_ACTIVE_SCAN},
687 {12, eSIR_ACTIVE_SCAN},
688 {13, eSIR_ACTIVE_SCAN},
689 {14, eSIR_ACTIVE_SCAN},
690 }
691 },
692 //REG_DOMAIN_ETSI
693 {
694 REG_DOMAIN_ETSI,
695 45, //Num channels
696 //Channels
697 {
698 //5GHz
699 //5180 - 5240
700 {36, eSIR_ACTIVE_SCAN},
701 {40, eSIR_ACTIVE_SCAN},
702 {44, eSIR_ACTIVE_SCAN},
703 {48, eSIR_ACTIVE_SCAN},
704 //5250 to 5350
705 {52, eSIR_PASSIVE_SCAN},
706 {56, eSIR_PASSIVE_SCAN},
707 {60, eSIR_PASSIVE_SCAN},
708 {64, eSIR_PASSIVE_SCAN},
709 //5470 to 5725
710 {100, eSIR_PASSIVE_SCAN},
711 {104, eSIR_PASSIVE_SCAN},
712 {108, eSIR_PASSIVE_SCAN},
713 {112, eSIR_PASSIVE_SCAN},
714 {116, eSIR_PASSIVE_SCAN},
715 {120, eSIR_PASSIVE_SCAN},
716 {124, eSIR_PASSIVE_SCAN},
717 {128, eSIR_PASSIVE_SCAN},
718 {132, eSIR_PASSIVE_SCAN},
719 {136, eSIR_PASSIVE_SCAN},
720 {140, eSIR_PASSIVE_SCAN},
721 //5745 - 5825
722 {149, eSIR_ACTIVE_SCAN},
723 {153, eSIR_ACTIVE_SCAN},
724 {157, eSIR_ACTIVE_SCAN},
725 {161, eSIR_ACTIVE_SCAN},
726 {165, eSIR_ACTIVE_SCAN},
727 //4.9GHz
728 //4920 - 5080
729 {240, eSIR_ACTIVE_SCAN},
730 {244, eSIR_ACTIVE_SCAN},
731 {248, eSIR_ACTIVE_SCAN},
732 {252, eSIR_ACTIVE_SCAN},
733 {208, eSIR_ACTIVE_SCAN},
734 {212, eSIR_ACTIVE_SCAN},
735 {216, eSIR_ACTIVE_SCAN},
736 //2,4GHz
737 {1, eSIR_ACTIVE_SCAN},
738 {2, eSIR_ACTIVE_SCAN},
739 {3, eSIR_ACTIVE_SCAN},
740 {4, eSIR_ACTIVE_SCAN},
741 {5, eSIR_ACTIVE_SCAN},
742 {6, eSIR_ACTIVE_SCAN},
743 {7, eSIR_ACTIVE_SCAN},
744 {8, eSIR_ACTIVE_SCAN},
745 {9, eSIR_ACTIVE_SCAN},
746 {10, eSIR_ACTIVE_SCAN},
747 {11, eSIR_ACTIVE_SCAN},
748 {12, eSIR_ACTIVE_SCAN},
749 {13, eSIR_ACTIVE_SCAN},
750 {14, eSIR_ACTIVE_SCAN},
751 }
752 },
753 //REG_DOMAIN_JAPAN
754 {
755 REG_DOMAIN_JAPAN,
756 45, //Num channels
757 //Channels
758 {
759 //5GHz
760 //5180 - 5240
761 {36, eSIR_ACTIVE_SCAN},
762 {40, eSIR_ACTIVE_SCAN},
763 {44, eSIR_ACTIVE_SCAN},
764 {48, eSIR_ACTIVE_SCAN},
765 //5250 to 5350
766 {52, eSIR_PASSIVE_SCAN},
767 {56, eSIR_PASSIVE_SCAN},
768 {60, eSIR_PASSIVE_SCAN},
769 {64, eSIR_PASSIVE_SCAN},
770 //5470 to 5725
771 {100, eSIR_PASSIVE_SCAN},
772 {104, eSIR_PASSIVE_SCAN},
773 {108, eSIR_PASSIVE_SCAN},
774 {112, eSIR_PASSIVE_SCAN},
775 {116, eSIR_PASSIVE_SCAN},
776 {120, eSIR_PASSIVE_SCAN},
777 {124, eSIR_PASSIVE_SCAN},
778 {128, eSIR_PASSIVE_SCAN},
779 {132, eSIR_PASSIVE_SCAN},
780 {136, eSIR_PASSIVE_SCAN},
781 {140, eSIR_PASSIVE_SCAN},
782 //5745 - 5825
783 {149, eSIR_ACTIVE_SCAN},
784 {153, eSIR_ACTIVE_SCAN},
785 {157, eSIR_ACTIVE_SCAN},
786 {161, eSIR_ACTIVE_SCAN},
787 {165, eSIR_ACTIVE_SCAN},
788 //4.9GHz
789 //4920 - 5080
790 {240, eSIR_ACTIVE_SCAN},
791 {244, eSIR_ACTIVE_SCAN},
792 {248, eSIR_ACTIVE_SCAN},
793 {252, eSIR_ACTIVE_SCAN},
794 {208, eSIR_ACTIVE_SCAN},
795 {212, eSIR_ACTIVE_SCAN},
796 {216, eSIR_ACTIVE_SCAN},
797 //2,4GHz
798 {1, eSIR_ACTIVE_SCAN},
799 {2, eSIR_ACTIVE_SCAN},
800 {3, eSIR_ACTIVE_SCAN},
801 {4, eSIR_ACTIVE_SCAN},
802 {5, eSIR_ACTIVE_SCAN},
803 {6, eSIR_ACTIVE_SCAN},
804 {7, eSIR_ACTIVE_SCAN},
805 {8, eSIR_ACTIVE_SCAN},
806 {9, eSIR_ACTIVE_SCAN},
807 {10, eSIR_ACTIVE_SCAN},
808 {11, eSIR_ACTIVE_SCAN},
809 {12, eSIR_ACTIVE_SCAN},
810 {13, eSIR_ACTIVE_SCAN},
811 {14, eSIR_ACTIVE_SCAN},
812 }
813 },
814 //REG_DOMAIN_WORLD
815 {
816 REG_DOMAIN_WORLD,
817 45, //Num channels
818 //Channels
819 {
820 //5GHz
821 //5180 - 5240
822 {36, eSIR_ACTIVE_SCAN},
823 {40, eSIR_ACTIVE_SCAN},
824 {44, eSIR_ACTIVE_SCAN},
825 {48, eSIR_ACTIVE_SCAN},
826 //5250 to 5350
827 {52, eSIR_ACTIVE_SCAN},
828 {56, eSIR_ACTIVE_SCAN},
829 {60, eSIR_ACTIVE_SCAN},
830 {64, eSIR_ACTIVE_SCAN},
831 //5470 to 5725
832 {100, eSIR_ACTIVE_SCAN},
833 {104, eSIR_ACTIVE_SCAN},
834 {108, eSIR_ACTIVE_SCAN},
835 {112, eSIR_ACTIVE_SCAN},
836 {116, eSIR_ACTIVE_SCAN},
837 {120, eSIR_ACTIVE_SCAN},
838 {124, eSIR_ACTIVE_SCAN},
839 {128, eSIR_ACTIVE_SCAN},
840 {132, eSIR_ACTIVE_SCAN},
841 {136, eSIR_ACTIVE_SCAN},
842 {140, eSIR_ACTIVE_SCAN},
843 //5745 - 5825
844 {149, eSIR_ACTIVE_SCAN},
845 {153, eSIR_ACTIVE_SCAN},
846 {157, eSIR_ACTIVE_SCAN},
847 {161, eSIR_ACTIVE_SCAN},
848 {165, eSIR_ACTIVE_SCAN},
849 //4.9GHz
850 //4920 - 5080
851 {240, eSIR_ACTIVE_SCAN},
852 {244, eSIR_ACTIVE_SCAN},
853 {248, eSIR_ACTIVE_SCAN},
854 {252, eSIR_ACTIVE_SCAN},
855 {208, eSIR_ACTIVE_SCAN},
856 {212, eSIR_ACTIVE_SCAN},
857 {216, eSIR_ACTIVE_SCAN},
858 //2,4GHz
859 {1, eSIR_ACTIVE_SCAN},
860 {2, eSIR_ACTIVE_SCAN},
861 {3, eSIR_ACTIVE_SCAN},
862 {4, eSIR_ACTIVE_SCAN},
863 {5, eSIR_ACTIVE_SCAN},
864 {6, eSIR_ACTIVE_SCAN},
865 {7, eSIR_ACTIVE_SCAN},
866 {8, eSIR_ACTIVE_SCAN},
867 {9, eSIR_ACTIVE_SCAN},
868 {10, eSIR_ACTIVE_SCAN},
869 {11, eSIR_ACTIVE_SCAN},
870 {12, eSIR_ACTIVE_SCAN},
871 {13, eSIR_ACTIVE_SCAN},
872 {14, eSIR_ACTIVE_SCAN},
873 }
874 },
875 //REG_DOMAIN_N_AMER_EXC_FCC
876 {
877 REG_DOMAIN_N_AMER_EXC_FCC,
878 45, //Num channels
879 //Channels
880 {
881 //5GHz
882 //5180 - 5240
883 {36, eSIR_ACTIVE_SCAN},
884 {40, eSIR_ACTIVE_SCAN},
885 {44, eSIR_ACTIVE_SCAN},
886 {48, eSIR_ACTIVE_SCAN},
887 //5250 to 5350
888 {52, eSIR_PASSIVE_SCAN},
889 {56, eSIR_PASSIVE_SCAN},
890 {60, eSIR_PASSIVE_SCAN},
891 {64, eSIR_PASSIVE_SCAN},
892 //5470 to 5725
893 {100, eSIR_ACTIVE_SCAN},
894 {104, eSIR_ACTIVE_SCAN},
895 {108, eSIR_ACTIVE_SCAN},
896 {112, eSIR_ACTIVE_SCAN},
897 {116, eSIR_ACTIVE_SCAN},
898 {120, eSIR_ACTIVE_SCAN},
899 {124, eSIR_ACTIVE_SCAN},
900 {128, eSIR_ACTIVE_SCAN},
901 {132, eSIR_ACTIVE_SCAN},
902 {136, eSIR_ACTIVE_SCAN},
903 {140, eSIR_ACTIVE_SCAN},
904 //5745 - 5825
905 {149, eSIR_ACTIVE_SCAN},
906 {153, eSIR_ACTIVE_SCAN},
907 {157, eSIR_ACTIVE_SCAN},
908 {161, eSIR_ACTIVE_SCAN},
909 {165, eSIR_ACTIVE_SCAN},
910 //4.9GHz
911 //4920 - 5080
912 {240, eSIR_ACTIVE_SCAN},
913 {244, eSIR_ACTIVE_SCAN},
914 {248, eSIR_ACTIVE_SCAN},
915 {252, eSIR_ACTIVE_SCAN},
916 {208, eSIR_ACTIVE_SCAN},
917 {212, eSIR_ACTIVE_SCAN},
918 {216, eSIR_ACTIVE_SCAN},
919 //2,4GHz
920 {1, eSIR_ACTIVE_SCAN},
921 {2, eSIR_ACTIVE_SCAN},
922 {3, eSIR_ACTIVE_SCAN},
923 {4, eSIR_ACTIVE_SCAN},
924 {5, eSIR_ACTIVE_SCAN},
925 {6, eSIR_ACTIVE_SCAN},
926 {7, eSIR_ACTIVE_SCAN},
927 {8, eSIR_ACTIVE_SCAN},
928 {9, eSIR_ACTIVE_SCAN},
929 {10, eSIR_ACTIVE_SCAN},
930 {11, eSIR_ACTIVE_SCAN},
931 {12, eSIR_ACTIVE_SCAN},
932 {13, eSIR_ACTIVE_SCAN},
933 {14, eSIR_ACTIVE_SCAN},
934 }
935 },
936 //REG_DOMAIN_APAC
937 {
938 REG_DOMAIN_APAC,
939 45, //Num channels
940 //Channels
941 {
942 //5GHz
943 //5180 - 5240
944 {36, eSIR_ACTIVE_SCAN},
945 {40, eSIR_ACTIVE_SCAN},
946 {44, eSIR_ACTIVE_SCAN},
947 {48, eSIR_ACTIVE_SCAN},
948 //5250 to 5350
949 {52, eSIR_PASSIVE_SCAN},
950 {56, eSIR_PASSIVE_SCAN},
951 {60, eSIR_PASSIVE_SCAN},
952 {64, eSIR_PASSIVE_SCAN},
953 //5470 to 5725
954 {100, eSIR_ACTIVE_SCAN},
955 {104, eSIR_ACTIVE_SCAN},
956 {108, eSIR_ACTIVE_SCAN},
957 {112, eSIR_ACTIVE_SCAN},
958 {116, eSIR_ACTIVE_SCAN},
959 {120, eSIR_ACTIVE_SCAN},
960 {124, eSIR_ACTIVE_SCAN},
961 {128, eSIR_ACTIVE_SCAN},
962 {132, eSIR_ACTIVE_SCAN},
963 {136, eSIR_ACTIVE_SCAN},
964 {140, eSIR_ACTIVE_SCAN},
965 //5745 - 5825
966 {149, eSIR_ACTIVE_SCAN},
967 {153, eSIR_ACTIVE_SCAN},
968 {157, eSIR_ACTIVE_SCAN},
969 {161, eSIR_ACTIVE_SCAN},
970 {165, eSIR_ACTIVE_SCAN},
971 //4.9GHz
972 //4920 - 5080
973 {240, eSIR_ACTIVE_SCAN},
974 {244, eSIR_ACTIVE_SCAN},
975 {248, eSIR_ACTIVE_SCAN},
976 {252, eSIR_ACTIVE_SCAN},
977 {208, eSIR_ACTIVE_SCAN},
978 {212, eSIR_ACTIVE_SCAN},
979 {216, eSIR_ACTIVE_SCAN},
980 //2,4GHz
981 {1, eSIR_ACTIVE_SCAN},
982 {2, eSIR_ACTIVE_SCAN},
983 {3, eSIR_ACTIVE_SCAN},
984 {4, eSIR_ACTIVE_SCAN},
985 {5, eSIR_ACTIVE_SCAN},
986 {6, eSIR_ACTIVE_SCAN},
987 {7, eSIR_ACTIVE_SCAN},
988 {8, eSIR_ACTIVE_SCAN},
989 {9, eSIR_ACTIVE_SCAN},
990 {10, eSIR_ACTIVE_SCAN},
991 {11, eSIR_ACTIVE_SCAN},
992 {12, eSIR_ACTIVE_SCAN},
993 {13, eSIR_ACTIVE_SCAN},
994 {14, eSIR_ACTIVE_SCAN},
995 }
996 },
997 //REG_DOMAIN_KOREA
998 {
999 REG_DOMAIN_KOREA,
1000 45, //Num channels
1001 //Channels
1002 {
1003 //5GHz
1004 //5180 - 5240
1005 {36, eSIR_ACTIVE_SCAN},
1006 {40, eSIR_ACTIVE_SCAN},
1007 {44, eSIR_ACTIVE_SCAN},
1008 {48, eSIR_ACTIVE_SCAN},
1009 //5250 to 5350
1010 {52, eSIR_PASSIVE_SCAN},
1011 {56, eSIR_PASSIVE_SCAN},
1012 {60, eSIR_PASSIVE_SCAN},
1013 {64, eSIR_PASSIVE_SCAN},
1014 //5470 to 5725
1015 {100, eSIR_PASSIVE_SCAN},
1016 {104, eSIR_PASSIVE_SCAN},
1017 {108, eSIR_PASSIVE_SCAN},
1018 {112, eSIR_PASSIVE_SCAN},
1019 {116, eSIR_PASSIVE_SCAN},
1020 {120, eSIR_PASSIVE_SCAN},
1021 {124, eSIR_PASSIVE_SCAN},
1022 {128, eSIR_PASSIVE_SCAN},
1023 {132, eSIR_PASSIVE_SCAN},
1024 {136, eSIR_PASSIVE_SCAN},
1025 {140, eSIR_PASSIVE_SCAN},
1026 //5745 - 5825
1027 {149, eSIR_ACTIVE_SCAN},
1028 {153, eSIR_ACTIVE_SCAN},
1029 {157, eSIR_ACTIVE_SCAN},
1030 {161, eSIR_ACTIVE_SCAN},
1031 {165, eSIR_ACTIVE_SCAN},
1032 //4.9GHz
1033 //4920 - 5080
1034 {240, eSIR_ACTIVE_SCAN},
1035 {244, eSIR_ACTIVE_SCAN},
1036 {248, eSIR_ACTIVE_SCAN},
1037 {252, eSIR_ACTIVE_SCAN},
1038 {208, eSIR_ACTIVE_SCAN},
1039 {212, eSIR_ACTIVE_SCAN},
1040 {216, eSIR_ACTIVE_SCAN},
1041 //2,4GHz
1042 {1, eSIR_ACTIVE_SCAN},
1043 {2, eSIR_ACTIVE_SCAN},
1044 {3, eSIR_ACTIVE_SCAN},
1045 {4, eSIR_ACTIVE_SCAN},
1046 {5, eSIR_ACTIVE_SCAN},
1047 {6, eSIR_ACTIVE_SCAN},
1048 {7, eSIR_ACTIVE_SCAN},
1049 {8, eSIR_ACTIVE_SCAN},
1050 {9, eSIR_ACTIVE_SCAN},
1051 {10, eSIR_ACTIVE_SCAN},
1052 {11, eSIR_ACTIVE_SCAN},
1053 {12, eSIR_ACTIVE_SCAN},
1054 {13, eSIR_ACTIVE_SCAN},
1055 {14, eSIR_ACTIVE_SCAN},
1056 }
1057 },
1058 //REG_DOMAIN_HI_5GHZ
1059 {
1060 REG_DOMAIN_HI_5GHZ,
1061 45, //Num channels
1062 //Channels
1063 {
1064 //5GHz
1065 //5180 - 5240
1066 {36, eSIR_ACTIVE_SCAN},
1067 {40, eSIR_ACTIVE_SCAN},
1068 {44, eSIR_ACTIVE_SCAN},
1069 {48, eSIR_ACTIVE_SCAN},
1070 //5250 to 5350
1071 {52, eSIR_ACTIVE_SCAN},
1072 {56, eSIR_ACTIVE_SCAN},
1073 {60, eSIR_ACTIVE_SCAN},
1074 {64, eSIR_ACTIVE_SCAN},
1075 //5470 to 5725
1076 {100, eSIR_ACTIVE_SCAN},
1077 {104, eSIR_ACTIVE_SCAN},
1078 {108, eSIR_ACTIVE_SCAN},
1079 {112, eSIR_ACTIVE_SCAN},
1080 {116, eSIR_ACTIVE_SCAN},
1081 {120, eSIR_ACTIVE_SCAN},
1082 {124, eSIR_ACTIVE_SCAN},
1083 {128, eSIR_ACTIVE_SCAN},
1084 {132, eSIR_ACTIVE_SCAN},
1085 {136, eSIR_ACTIVE_SCAN},
1086 {140, eSIR_ACTIVE_SCAN},
1087 //5745 - 5825
1088 {149, eSIR_ACTIVE_SCAN},
1089 {153, eSIR_ACTIVE_SCAN},
1090 {157, eSIR_ACTIVE_SCAN},
1091 {161, eSIR_ACTIVE_SCAN},
1092 {165, eSIR_ACTIVE_SCAN},
1093 //4.9GHz
1094 //4920 - 5080
1095 {240, eSIR_ACTIVE_SCAN},
1096 {244, eSIR_ACTIVE_SCAN},
1097 {248, eSIR_ACTIVE_SCAN},
1098 {252, eSIR_ACTIVE_SCAN},
1099 {208, eSIR_ACTIVE_SCAN},
1100 {212, eSIR_ACTIVE_SCAN},
1101 {216, eSIR_ACTIVE_SCAN},
1102 //2,4GHz
1103 {1, eSIR_ACTIVE_SCAN},
1104 {2, eSIR_ACTIVE_SCAN},
1105 {3, eSIR_ACTIVE_SCAN},
1106 {4, eSIR_ACTIVE_SCAN},
1107 {5, eSIR_ACTIVE_SCAN},
1108 {6, eSIR_ACTIVE_SCAN},
1109 {7, eSIR_ACTIVE_SCAN},
1110 {8, eSIR_ACTIVE_SCAN},
1111 {9, eSIR_ACTIVE_SCAN},
1112 {10, eSIR_ACTIVE_SCAN},
1113 {11, eSIR_ACTIVE_SCAN},
1114 {12, eSIR_ACTIVE_SCAN},
1115 {13, eSIR_ACTIVE_SCAN},
1116 {14, eSIR_ACTIVE_SCAN},
1117 }
1118 },
1119 //REG_DOMAIN_NO_5GHZ
1120 {
1121 REG_DOMAIN_NO_5GHZ,
1122 45, //Num channels
1123 //Channels
1124 {
1125 //5GHz
1126 //5180 - 5240
1127 {36, eSIR_ACTIVE_SCAN},
1128 {40, eSIR_ACTIVE_SCAN},
1129 {44, eSIR_ACTIVE_SCAN},
1130 {48, eSIR_ACTIVE_SCAN},
1131 //5250 to 5350
1132 {52, eSIR_ACTIVE_SCAN},
1133 {56, eSIR_ACTIVE_SCAN},
1134 {60, eSIR_ACTIVE_SCAN},
1135 {64, eSIR_ACTIVE_SCAN},
1136 //5470 to 5725
1137 {100, eSIR_ACTIVE_SCAN},
1138 {104, eSIR_ACTIVE_SCAN},
1139 {108, eSIR_ACTIVE_SCAN},
1140 {112, eSIR_ACTIVE_SCAN},
1141 {116, eSIR_ACTIVE_SCAN},
1142 {120, eSIR_ACTIVE_SCAN},
1143 {124, eSIR_ACTIVE_SCAN},
1144 {128, eSIR_ACTIVE_SCAN},
1145 {132, eSIR_ACTIVE_SCAN},
1146 {136, eSIR_ACTIVE_SCAN},
1147 {140, eSIR_ACTIVE_SCAN},
1148 //5745 - 5825
1149 {149, eSIR_ACTIVE_SCAN},
1150 {153, eSIR_ACTIVE_SCAN},
1151 {157, eSIR_ACTIVE_SCAN},
1152 {161, eSIR_ACTIVE_SCAN},
1153 {165, eSIR_ACTIVE_SCAN},
1154 //4.9GHz
1155 //4920 - 5080
1156 {240, eSIR_ACTIVE_SCAN},
1157 {244, eSIR_ACTIVE_SCAN},
1158 {248, eSIR_ACTIVE_SCAN},
1159 {252, eSIR_ACTIVE_SCAN},
1160 {208, eSIR_ACTIVE_SCAN},
1161 {212, eSIR_ACTIVE_SCAN},
1162 {216, eSIR_ACTIVE_SCAN},
1163 //2,4GHz
1164 {1, eSIR_ACTIVE_SCAN},
1165 {2, eSIR_ACTIVE_SCAN},
1166 {3, eSIR_ACTIVE_SCAN},
1167 {4, eSIR_ACTIVE_SCAN},
1168 {5, eSIR_ACTIVE_SCAN},
1169 {6, eSIR_ACTIVE_SCAN},
1170 {7, eSIR_ACTIVE_SCAN},
1171 {8, eSIR_ACTIVE_SCAN},
1172 {9, eSIR_ACTIVE_SCAN},
1173 {10, eSIR_ACTIVE_SCAN},
1174 {11, eSIR_ACTIVE_SCAN},
1175 {12, eSIR_ACTIVE_SCAN},
1176 {13, eSIR_ACTIVE_SCAN},
1177 {14, eSIR_ACTIVE_SCAN},
1178 }
1179 },
1180};
1181#endif
1182
1183extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS];
1184
Jeff Johnson295189b2012-06-20 16:38:30 -07001185////////////////////////////////////////////////////////////////////////
1186
1187/**
1188 * \var gPhyRatesSuppt
1189 *
1190 * \brief Rate support lookup table
1191 *
1192 *
1193 * This is a lookup table indexing rates & configuration parameters to
1194 * support. Given a rate (in unites of 0.5Mpbs) & three booleans (MIMO
1195 * Enabled, Channel Bonding Enabled, & Concatenation Enabled), one can
1196 * determine whether the given rate is supported by computing two
1197 * indices. The first maps the rate to table row as indicated below
1198 * (i.e. eHddSuppRate_6Mbps maps to row zero, eHddSuppRate_9Mbps to row
1199 * 1, and so on). Index two can be computed like so:
1200 *
1201 * \code
1202 idx2 = ( fEsf ? 0x4 : 0x0 ) |
1203 ( fCb ? 0x2 : 0x0 ) |
1204 ( fMimo ? 0x1 : 0x0 );
1205 * \endcode
1206 *
1207 *
1208 * Given that:
1209 *
1210 \code
1211 fSupported = gPhyRatesSuppt[idx1][idx2];
1212 \endcode
1213 *
1214 *
1215 * This table is based on the document "PHY Supported Rates.doc". This
1216 * table is permissive in that a rate is reflected as being supported
1217 * even when turning off an enabled feature would be required. For
1218 * instance, "PHY Supported Rates" lists 42Mpbs as unsupported when CB,
1219 * ESF, & MIMO are all on. However, if we turn off either of CB or
1220 * MIMO, it then becomes supported. Therefore, we mark it as supported
1221 * even in index 7 of this table.
1222 *
1223 *
1224 */
1225
1226static const tANI_BOOLEAN gPhyRatesSuppt[24][8] = {
1227
1228 // SSF SSF SSF SSF ESF ESF ESF ESF
1229 // SIMO MIMO SIMO MIMO SIMO MIMO SIMO MIMO
1230 // No CB No CB CB CB No CB No CB CB CB
1231 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 6Mbps
1232 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 9Mbps
1233 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 12Mbps
1234 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 18Mbps
1235 { FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE }, // 20Mbps
1236 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 24Mbps
1237 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 36Mbps
1238 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 40Mbps
1239 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 42Mbps
1240 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 48Mbps
1241 { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }, // 54Mbps
1242 { FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 72Mbps
1243 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 80Mbps
1244 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 84Mbps
1245 { FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 96Mbps
1246 { FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 108Mbps
1247 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 120Mbps
1248 { FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE }, // 126Mbps
1249 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 144Mbps
1250 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 160Mbps
1251 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 168Mbps
1252 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 192Mbps
1253 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 216Mbps
1254 { FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE }, // 240Mbps
1255
1256};
1257
1258#define CASE_RETURN_STR(n) case (n): return (#n)
1259
1260const char *
1261get_eRoamCmdStatus_str(eRoamCmdStatus val)
1262{
1263 switch (val)
1264 {
1265 CASE_RETURN_STR(eCSR_ROAM_CANCELLED);
1266 CASE_RETURN_STR(eCSR_ROAM_ROAMING_START);
1267 CASE_RETURN_STR(eCSR_ROAM_ROAMING_COMPLETION);
1268 CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_START);
1269 CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_COMPLETION);
1270 CASE_RETURN_STR(eCSR_ROAM_DISASSOCIATED);
1271 CASE_RETURN_STR(eCSR_ROAM_SHOULD_ROAM);
1272 CASE_RETURN_STR(eCSR_ROAM_SCAN_FOUND_NEW_BSS);
1273 CASE_RETURN_STR(eCSR_ROAM_LOSTLINK);
1274 default:
1275 return "unknown";
1276 }
1277}
1278
1279const char *
1280get_eCsrRoamResult_str(eCsrRoamResult val)
1281{
1282 switch (val)
1283 {
1284 CASE_RETURN_STR(eCSR_ROAM_RESULT_NONE);
1285 CASE_RETURN_STR(eCSR_ROAM_RESULT_FAILURE);
1286 CASE_RETURN_STR(eCSR_ROAM_RESULT_ASSOCIATED);
1287 CASE_RETURN_STR(eCSR_ROAM_RESULT_NOT_ASSOCIATED);
1288 CASE_RETURN_STR(eCSR_ROAM_RESULT_MIC_FAILURE);
1289 CASE_RETURN_STR(eCSR_ROAM_RESULT_FORCED);
1290 CASE_RETURN_STR(eCSR_ROAM_RESULT_DISASSOC_IND);
1291 CASE_RETURN_STR(eCSR_ROAM_RESULT_DEAUTH_IND);
1292 CASE_RETURN_STR(eCSR_ROAM_RESULT_CAP_CHANGED);
1293 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_CONNECT);
1294 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_INACTIVE);
1295 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_NEW_PEER);
1296 CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_COALESCED);
1297 default:
1298 return "unknown";
1299 }
1300}
1301
1302
1303
1304tANI_BOOLEAN csrGetBssIdBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tCsrBssid *pBssId )
1305{
1306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1307 palCopyMemory( pMac->hHdd, pBssId, &pSirBssDesc->bssId[ 0 ], sizeof(tCsrBssid) );
1308 return( TRUE );
1309}
1310
1311
1312tANI_BOOLEAN csrIsBssIdEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1, tSirBssDescription *pSirBssDesc2 )
1313{
1314 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1315 tANI_BOOLEAN fEqual = FALSE;
1316 tCsrBssid bssId1;
1317 tCsrBssid bssId2;
1318
1319 do {
1320 if ( !pSirBssDesc1 ) break;
1321 if ( !pSirBssDesc2 ) break;
1322
1323 if ( !csrGetBssIdBssDesc( pMac, pSirBssDesc1, &bssId1 ) ) break;
1324 if ( !csrGetBssIdBssDesc( pMac, pSirBssDesc2, &bssId2 ) ) break;
1325
1326 //sirCompareMacAddr
1327 fEqual = csrIsMacAddressEqual(pMac, &bssId1, &bssId2);
1328
1329 } while( 0 );
1330
1331 return( fEqual );
1332}
1333
1334tANI_BOOLEAN csrIsConnStateConnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
1335{
1336 return( eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED == pMac->roam.roamSession[sessionId].connectState );
1337}
1338
1339tANI_BOOLEAN csrIsConnStateDisconnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
1340{
1341 return( eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState );
1342}
1343
1344tANI_BOOLEAN csrIsConnStateConnectedInfra( tpAniSirGlobal pMac, tANI_U32 sessionId )
1345{
1346 return( eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == pMac->roam.roamSession[sessionId].connectState );
1347}
1348
1349tANI_BOOLEAN csrIsConnStateConnected( tpAniSirGlobal pMac, tANI_U32 sessionId )
1350{
1351 if( csrIsConnStateConnectedIbss( pMac, sessionId ) || csrIsConnStateConnectedInfra( pMac, sessionId ) || csrIsConnStateConnectedWds( pMac, sessionId) )
1352 return TRUE;
1353 else
1354 return FALSE;
1355}
1356
1357tANI_BOOLEAN csrIsConnStateInfra( tpAniSirGlobal pMac, tANI_U32 sessionId )
1358{
1359 return( csrIsConnStateConnectedInfra( pMac, sessionId ) );
1360}
1361
1362tANI_BOOLEAN csrIsConnStateIbss( tpAniSirGlobal pMac, tANI_U32 sessionId )
1363{
1364 return( csrIsConnStateConnectedIbss( pMac, sessionId ) || csrIsConnStateDisconnectedIbss( pMac, sessionId ) );
1365}
1366
1367
1368tANI_BOOLEAN csrIsConnStateConnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
1369{
1370 return( eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED == pMac->roam.roamSession[sessionId].connectState );
1371}
1372
Jeff Johnson295189b2012-06-20 16:38:30 -07001373tANI_BOOLEAN csrIsConnStateConnectedInfraAp( tpAniSirGlobal pMac, tANI_U32 sessionId )
1374{
1375 return( (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == pMac->roam.roamSession[sessionId].connectState) ||
1376 (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState ) );
1377}
Jeff Johnson295189b2012-06-20 16:38:30 -07001378
1379tANI_BOOLEAN csrIsConnStateDisconnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
1380{
1381 return( eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState );
1382}
1383
1384tANI_BOOLEAN csrIsConnStateWds( tpAniSirGlobal pMac, tANI_U32 sessionId )
1385{
1386 return( csrIsConnStateConnectedWds( pMac, sessionId ) ||
1387 csrIsConnStateDisconnectedWds( pMac, sessionId ) );
1388}
1389
Jeff Johnsone7245742012-09-05 17:12:55 -07001390tANI_BOOLEAN csrIsConnStateAp( tpAniSirGlobal pMac, tANI_U32 sessionId )
1391{
1392 tCsrRoamSession *pSession;
1393 pSession = CSR_GET_SESSION(pMac, sessionId);
1394 if (!pSession)
1395 return eANI_BOOLEAN_FALSE;
1396 if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) )
1397 {
1398 return eANI_BOOLEAN_TRUE;
1399 }
1400 return eANI_BOOLEAN_FALSE;
1401}
1402
Jeff Johnson295189b2012-06-20 16:38:30 -07001403tANI_BOOLEAN csrIsAnySessionInConnectState( tpAniSirGlobal pMac )
1404{
1405 tANI_U32 i;
1406 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1407
1408 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1409 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001410 if( CSR_IS_SESSION_VALID( pMac, i ) &&
1411 ( csrIsConnStateInfra( pMac, i )
1412 || csrIsConnStateIbss( pMac, i )
1413 || csrIsConnStateAp( pMac, i) ) )
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 {
1415 fRc = eANI_BOOLEAN_TRUE;
1416 break;
1417 }
1418 }
1419
1420 return ( fRc );
1421}
1422
1423tANI_S8 csrGetInfraSessionId( tpAniSirGlobal pMac )
1424{
1425 tANI_U8 i;
1426 tANI_S8 sessionid = -1;
1427
1428 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1429 {
1430 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateInfra( pMac, i ) )
1431 {
1432 sessionid = i;
1433 break;
1434 }
1435 }
1436
1437 return ( sessionid );
1438}
1439
1440tANI_U8 csrGetInfraOperationChannel( tpAniSirGlobal pMac, tANI_U8 sessionId)
1441{
1442 tANI_U8 channel;
1443
1444 if( CSR_IS_SESSION_VALID( pMac, sessionId ))
1445 {
1446 channel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
1447 }
1448 else
1449 {
1450 channel = 0;
1451 }
1452 return channel;
1453}
1454
1455//This routine will return operating channel on FIRST BSS that is active/operating to be used for concurrency mode.
1456//If other BSS is not up or not connected it will return 0
1457
1458tANI_U8 csrGetConcurrentOperationChannel( tpAniSirGlobal pMac )
1459{
1460 tCsrRoamSession *pSession = NULL;
1461 tANI_U8 i = 0;
1462
1463 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1464 {
1465 if( CSR_IS_SESSION_VALID( pMac, i ) )
1466 {
1467 pSession = CSR_GET_SESSION( pMac, i );
1468
1469 if (NULL != pSession->pCurRoamProfile)
1470 {
1471 if (
1472 (((pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE) ||
1473 (pSession->pCurRoamProfile->csrPersona == VOS_P2P_CLIENT_MODE)) &&
1474 (pSession->connectState == eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED))
1475 ||
1476 (((pSession->pCurRoamProfile->csrPersona == VOS_P2P_GO_MODE) ||
1477 (pSession->pCurRoamProfile->csrPersona == VOS_STA_SAP_MODE)) &&
1478 (pSession->connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
1479 )
1480 return (pSession->connectedProfile.operationChannel);
1481 }
1482
1483 }
1484 }
1485 return 0;
1486}
1487
1488tANI_BOOLEAN csrIsAllSessionDisconnected( tpAniSirGlobal pMac )
1489{
1490 tANI_U32 i;
1491 tANI_BOOLEAN fRc = eANI_BOOLEAN_TRUE;
1492
1493 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1494 {
1495 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1496 {
1497 fRc = eANI_BOOLEAN_FALSE;
1498 break;
1499 }
1500 }
1501
1502 return ( fRc );
1503}
1504
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08001505tANI_BOOLEAN csrIsStaSessionConnected( tpAniSirGlobal pMac )
1506{
1507 tANI_U32 i;
1508 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1509 tCsrRoamSession *pSession = NULL;
1510 tANI_U32 countSta = 0;
1511
1512 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1513 {
1514 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1515 {
1516 pSession = CSR_GET_SESSION( pMac, i );
1517
1518 if (NULL != pSession->pCurRoamProfile)
1519 {
1520 if (pSession->pCurRoamProfile->csrPersona == VOS_STA_MODE) {
1521 countSta++;
1522 }
1523 }
1524 }
1525 }
1526
1527 /* return TRUE if one of the following conditions is TRUE:
1528 * - more than one STA session connected
1529 */
1530 if ( countSta > 0) {
1531 fRc = eANI_BOOLEAN_TRUE;
1532 }
1533
1534 return( fRc );
1535}
1536
1537tANI_BOOLEAN csrIsP2pSessionConnected( tpAniSirGlobal pMac )
1538{
1539 tANI_U32 i;
1540 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1541 tCsrRoamSession *pSession = NULL;
1542 tANI_U32 countP2pCli = 0;
1543 tANI_U32 countP2pGo = 0;
1544
1545 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1546 {
1547 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1548 {
1549 pSession = CSR_GET_SESSION( pMac, i );
1550
1551 if (NULL != pSession->pCurRoamProfile)
1552 {
1553 if (pSession->pCurRoamProfile->csrPersona == VOS_P2P_CLIENT_MODE) {
1554 countP2pCli++;
1555 }
1556
1557 if (pSession->pCurRoamProfile->csrPersona == VOS_P2P_GO_MODE) {
1558 countP2pGo++;
1559 }
1560 }
1561 }
1562 }
1563
1564 /* return TRUE if one of the following conditions is TRUE:
1565 * - at least one P2P CLI session is connected
1566 * - at least one P2P GO session is connected
1567 */
1568 if ( (countP2pCli > 0) || (countP2pGo > 0 ) ) {
1569 fRc = eANI_BOOLEAN_TRUE;
1570 }
1571
1572 return( fRc );
1573}
1574
Madan Mohan Koyyalamudid3d22592012-09-24 14:01:29 -07001575tANI_BOOLEAN csrIsAnySessionConnected( tpAniSirGlobal pMac )
1576{
1577 tANI_U32 i, count;
1578 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1579
1580 count = 0;
1581 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1582 {
1583 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
1584 {
1585 count++;
1586 }
1587 }
1588
1589 if (count > 0)
1590 {
1591 fRc = eANI_BOOLEAN_TRUE;
1592 }
1593 return( fRc );
1594}
Jeff Johnson295189b2012-06-20 16:38:30 -07001595
1596tANI_BOOLEAN csrIsInfraConnected( tpAniSirGlobal pMac )
1597{
1598 tANI_U32 i;
1599 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1600
1601 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1602 {
1603 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedInfra( pMac, i ) )
1604 {
1605 fRc = eANI_BOOLEAN_TRUE;
1606 break;
1607 }
1608 }
1609
1610 return ( fRc );
1611}
1612
1613tANI_BOOLEAN csrIsConcurrentInfraConnected( tpAniSirGlobal pMac )
1614{
1615 tANI_U32 i, noOfConnectedInfra = 0;
1616
1617 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1618
1619 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1620 {
1621 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedInfra( pMac, i ) )
1622 {
1623 ++noOfConnectedInfra;
1624 }
1625 }
1626
1627 // More than one Infra Sta Connected
1628 if(noOfConnectedInfra > 1)
1629 {
1630 fRc = eANI_BOOLEAN_TRUE;
1631 }
1632
1633 return ( fRc );
1634}
1635
1636tANI_BOOLEAN csrIsIBSSStarted( tpAniSirGlobal pMac )
1637{
1638 tANI_U32 i;
1639 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1640
1641 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1642 {
1643 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateIbss( pMac, i ) )
1644 {
1645 fRc = eANI_BOOLEAN_TRUE;
1646 break;
1647 }
1648 }
1649
1650 return ( fRc );
1651}
1652
1653
1654tANI_BOOLEAN csrIsBTAMPStarted( tpAniSirGlobal pMac )
1655{
1656 tANI_U32 i;
1657 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1658
1659 for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
1660 {
1661 if( CSR_IS_SESSION_VALID( pMac, i ) && csrIsConnStateConnectedWds( pMac, i ) )
1662 {
1663 fRc = eANI_BOOLEAN_TRUE;
1664 break;
1665 }
1666 }
1667
1668 return ( fRc );
1669}
1670
Jeff Johnsone7245742012-09-05 17:12:55 -07001671tANI_BOOLEAN csrIsConcurrentSessionRunning( tpAniSirGlobal pMac )
1672{
1673 tANI_U32 sessionId, noOfCocurrentSession = 0;
1674 eCsrConnectState connectState;
1675
1676 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1677
1678 for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
1679 {
1680 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
1681 {
1682 connectState = pMac->roam.roamSession[sessionId].connectState;
1683 if( (eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == connectState) ||
1684 (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == connectState) ||
1685 (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED == connectState) )
1686 {
1687 ++noOfCocurrentSession;
1688 }
1689 }
1690 }
1691
1692 // More than one session is Up and Running
1693 if(noOfCocurrentSession > 1)
1694 {
1695 fRc = eANI_BOOLEAN_TRUE;
1696 }
1697
1698 return ( fRc );
1699}
1700
Jeff Johnsone7245742012-09-05 17:12:55 -07001701tANI_BOOLEAN csrIsInfraApStarted( tpAniSirGlobal pMac )
1702{
1703 tANI_U32 sessionId;
1704 tANI_BOOLEAN fRc = eANI_BOOLEAN_FALSE;
1705
1706 for( sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
1707 {
1708 if( CSR_IS_SESSION_VALID( pMac, sessionId ) && (csrIsConnStateConnectedInfraAp(pMac, sessionId)) )
1709 {
1710 fRc = eANI_BOOLEAN_TRUE;
1711 break;
1712 }
1713 }
1714
1715 return ( fRc );
1716
1717}
Jeff Johnsone7245742012-09-05 17:12:55 -07001718
Jeff Johnson295189b2012-06-20 16:38:30 -07001719tANI_BOOLEAN csrIsBTAMP( tpAniSirGlobal pMac, tANI_U32 sessionId )
1720{
1721 return ( csrIsConnStateConnectedWds( pMac, sessionId ) );
1722}
1723
1724
1725tANI_BOOLEAN csrIsConnStateDisconnected(tpAniSirGlobal pMac, tANI_U32 sessionId)
1726{
1727 return (eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED == pMac->roam.roamSession[sessionId].connectState);
1728}
1729
Jeff Johnsone7245742012-09-05 17:12:55 -07001730tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId,
1731 tSirBssDescription *pBssDesc)
Jeff Johnson295189b2012-06-20 16:38:30 -07001732{
1733 tCsrRoamSession *pSession = NULL;
1734 tANI_U8 Index = 0, ConnId = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07001735 eAniBoolean status = eANI_BOOLEAN_FALSE;
1736
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 tVOS_CON_MODE Mode[CSR_ROAM_SESSION_MAX];
1738
1739 //Check for MCC support
1740 if (!pMac->roam.configParam.fenableMCCMode)
1741 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001742 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07001743 }
1744
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 for( Index = 0; Index < CSR_ROAM_SESSION_MAX; Index++ )
1746 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001747 Mode[Index] = VOS_MAX_NO_OF_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 if( CSR_IS_SESSION_VALID( pMac, Index ) )
1749 {
1750 pSession = CSR_GET_SESSION( pMac, Index );
1751
1752 if (NULL != pSession->pCurRoamProfile)
1753 {
1754 Mode[ConnId] = pSession->pCurRoamProfile->csrPersona;
1755 ConnId++;
1756 }
1757 }
1758 }
1759
1760 Index = 0;
1761 if (Mode[Index] == VOS_STA_MODE && ConnId > Index)
1762 {
1763 switch (Mode[Index+1])
1764 {
1765 case VOS_P2P_CLIENT_MODE :
Jeff Johnsone7245742012-09-05 17:12:55 -07001766 status = eANI_BOOLEAN_TRUE;
1767 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001768 case VOS_MAX_NO_OF_MODE :
1769 default :
1770 break;
1771 }
1772 }
1773 else if (Mode[Index] == VOS_P2P_CLIENT_MODE && ConnId > Index)
1774 {
1775 switch (Mode[Index +1])
1776 {
1777 case VOS_STA_MODE :
Jeff Johnsone7245742012-09-05 17:12:55 -07001778 status = eANI_BOOLEAN_TRUE;
1779 break;
1780
Jeff Johnson295189b2012-06-20 16:38:30 -07001781 case VOS_MAX_NO_OF_MODE :
1782 default :
1783 break;
1784 }
1785 }
1786
Jeff Johnsone7245742012-09-05 17:12:55 -07001787 //Validate BeaconInterval
1788 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
1789 {
1790 pSession = CSR_GET_SESSION( pMac, sessionId );
1791 if (NULL != pSession->pCurRoamProfile)
1792 {
1793 if(csrIsconcurrentsessionValid (pMac, sessionId,
1794 pSession->pCurRoamProfile->csrPersona)
1795 == eHAL_STATUS_SUCCESS )
1796 {
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001797 if(csrValidateMCCBeaconInterval( pMac, pBssDesc->channelId,
Jeff Johnsone7245742012-09-05 17:12:55 -07001798 &pBssDesc->beaconInterval, sessionId,
1799 pSession->pCurRoamProfile->csrPersona)
1800 != eHAL_STATUS_SUCCESS)
1801 {
1802 status = eANI_BOOLEAN_FALSE;
1803 }
1804 else
1805 {
1806 status = eANI_BOOLEAN_TRUE;
1807 }
1808 }
1809 else
1810 {
1811 status = eANI_BOOLEAN_FALSE;
1812 }
1813 }
1814 }
1815 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07001816}
1817
1818static tSirMacCapabilityInfo csrGetBssCapabilities( tSirBssDescription *pSirBssDesc )
1819{
1820 tSirMacCapabilityInfo dot11Caps;
1821
1822 //tSirMacCapabilityInfo is 16-bit
1823 pal_get_U16( (tANI_U8 *)&pSirBssDesc->capabilityInfo, (tANI_U16 *)&dot11Caps );
1824
1825 return( dot11Caps );
1826}
1827
1828tANI_BOOLEAN csrIsInfraBssDesc( tSirBssDescription *pSirBssDesc )
1829{
1830 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1831
1832 return( (tANI_BOOLEAN)dot11Caps.ess );
1833}
1834
1835
1836tANI_BOOLEAN csrIsIbssBssDesc( tSirBssDescription *pSirBssDesc )
1837{
1838 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1839
1840 return( (tANI_BOOLEAN)dot11Caps.ibss );
1841}
1842
1843tANI_BOOLEAN csrIsQoSBssDesc( tSirBssDescription *pSirBssDesc )
1844{
1845 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1846
1847 return( (tANI_BOOLEAN)dot11Caps.qos );
1848}
1849
1850tANI_BOOLEAN csrIsPrivacy( tSirBssDescription *pSirBssDesc )
1851{
1852 tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc );
1853
1854 return( (tANI_BOOLEAN)dot11Caps.privacy );
1855}
1856
1857
1858tANI_BOOLEAN csrIs11dSupported(tpAniSirGlobal pMac)
1859{
1860 return(pMac->roam.configParam.Is11dSupportEnabled);
1861}
1862
1863
1864tANI_BOOLEAN csrIs11hSupported(tpAniSirGlobal pMac)
1865{
1866 return(pMac->roam.configParam.Is11hSupportEnabled);
1867}
1868
1869
1870tANI_BOOLEAN csrIs11eSupported(tpAniSirGlobal pMac)
1871{
1872 return(pMac->roam.configParam.Is11eSupportEnabled);
1873}
1874
1875tANI_BOOLEAN csrIsMCCSupported ( tpAniSirGlobal pMac )
1876{
1877 return(pMac->roam.configParam.fenableMCCMode);
1878
1879}
1880
1881tANI_BOOLEAN csrIsWmmSupported(tpAniSirGlobal pMac)
1882{
1883 if(eCsrRoamWmmNoQos == pMac->roam.configParam.WMMSupportMode)
1884 {
1885 return eANI_BOOLEAN_FALSE;
1886 }
1887 else
1888 {
1889 return eANI_BOOLEAN_TRUE;
1890 }
1891}
1892
1893
1894
1895
1896//pIes is the IEs for pSirBssDesc2
1897tANI_BOOLEAN csrIsSsidEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1,
1898 tSirBssDescription *pSirBssDesc2, tDot11fBeaconIEs *pIes2 )
1899{
1900 tANI_BOOLEAN fEqual = FALSE;
1901 tSirMacSSid Ssid1, Ssid2;
1902 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1903 tDot11fBeaconIEs *pIes1 = NULL;
1904 tDot11fBeaconIEs *pIesLocal = pIes2;
1905
1906 do {
1907 if( ( NULL == pSirBssDesc1 ) || ( NULL == pSirBssDesc2 ) ) break;
1908 if( !pIesLocal && !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc2, &pIesLocal)) )
1909 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001910 smsLog(pMac, LOGE, FL(" fail to parse IEs"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 break;
1912 }
1913 if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc1, &pIes1)))
1914 {
1915 break;
1916 }
1917 if( ( !pIes1->SSID.present ) || ( !pIesLocal->SSID.present ) ) break;
1918 if ( pIes1->SSID.num_ssid != pIesLocal->SSID.num_ssid ) break;
1919 palCopyMemory(pMac->hHdd, Ssid1.ssId, pIes1->SSID.ssid, pIes1->SSID.num_ssid);
1920 palCopyMemory(pMac->hHdd, Ssid2.ssId, pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid);
1921
1922 fEqual = palEqualMemory(pMac->hHdd, Ssid1.ssId, Ssid2.ssId, pIesLocal->SSID.num_ssid );
1923
1924 } while( 0 );
1925 if(pIes1)
1926 {
1927 palFreeMemory(pMac->hHdd, pIes1);
1928 }
1929 if( pIesLocal && !pIes2 )
1930 {
1931 palFreeMemory(pMac->hHdd, pIesLocal);
1932 }
1933
1934 return( fEqual );
1935}
1936
1937tANI_BOOLEAN csrIsAniWmeSupported(tDot11fIEAirgo *pIeAirgo)
1938{
1939 tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE;
1940
1941 if(pIeAirgo && pIeAirgo->present && pIeAirgo->PropCapability.present)
1942 {
1943 fRet = (tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability ));
1944 }
1945
1946 return fRet;
1947}
1948
1949
1950
1951
1952//pIes can be passed in as NULL if the caller doesn't have one prepared
1953tANI_BOOLEAN csrIsBssDescriptionWme( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes )
1954{
1955 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1956 // Assume that WME is found...
1957 tANI_BOOLEAN fWme = TRUE;
1958 tDot11fBeaconIEs *pIesTemp = pIes;
1959
1960 do
1961 {
1962 if(pIesTemp == NULL)
1963 {
1964 if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp)) )
1965 {
1966 fWme = FALSE;
1967 break;
1968 }
1969 }
1970 // if the AirgoProprietary indicator is found, then WME is supported...
1971 if ( csrIsAniWmeSupported(&pIesTemp->Airgo) ) break;
1972 // if the Wme Info IE is found, then WME is supported...
1973 if ( CSR_IS_QOS_BSS(pIesTemp) ) break;
1974 // if none of these are found, then WME is NOT supported...
1975 fWme = FALSE;
1976 } while( 0 );
1977 if( !csrIsWmmSupported( pMac ) && fWme)
1978 {
1979 if( !pIesTemp->HTCaps.present )
1980 {
1981 fWme = FALSE;
1982 }
1983 }
1984 if( ( pIes == NULL ) && ( NULL != pIesTemp ) )
1985 {
1986 //we allocate memory here so free it before returning
1987 palFreeMemory(pMac->hHdd, pIesTemp);
1988 }
1989
1990 return( fWme );
1991}
1992
1993tANI_BOOLEAN csrIsHcfEnabled( tDot11fIEAirgo *pIeAirgo )
1994{
1995 tANI_BOOLEAN fHcfSupported = FALSE;
1996
1997 fHcfSupported = ((tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability )) ||
1998 (pIeAirgo->present && pIeAirgo->HCF.present && pIeAirgo->HCF.enabled));
1999
2000 return( fHcfSupported );
2001}
2002
2003
2004eCsrMediaAccessType csrGetQoSFromBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc,
2005 tDot11fBeaconIEs *pIes )
2006{
2007 eCsrMediaAccessType qosType = eCSR_MEDIUM_ACCESS_DCF;
2008
Jeff Johnson295189b2012-06-20 16:38:30 -07002009 VOS_ASSERT( pIes != NULL );
Jeff Johnson295189b2012-06-20 16:38:30 -07002010
2011 do
2012 {
2013 // if we find WMM in the Bss Description, then we let this
2014 // override and use WMM.
2015 if ( csrIsBssDescriptionWme( hHal, pSirBssDesc, pIes ) )
2016 {
2017 qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP;
2018 }
2019 else
2020 {
2021 // if the QoS bit is on, then the AP is advertising 11E QoS...
2022 if ( csrIsQoSBssDesc( pSirBssDesc ) )
2023 {
2024 // which could be HCF or eDCF.
2025 if ( csrIsHcfEnabled( &pIes->Airgo ) )
2026 {
2027 qosType = eCSR_MEDIUM_ACCESS_11e_HCF;
2028 }
2029 else
2030 {
2031 qosType = eCSR_MEDIUM_ACCESS_11e_eDCF;
2032 }
2033 }
2034 else
2035 {
2036 qosType = eCSR_MEDIUM_ACCESS_DCF;
2037 }
2038 // scale back based on the types turned on for the adapter...
2039 if ( eCSR_MEDIUM_ACCESS_11e_eDCF == qosType && !csrIs11eSupported( hHal ) )
2040 {
2041 qosType = eCSR_MEDIUM_ACCESS_DCF;
2042 }
2043 }
2044
2045 } while(0);
2046
2047 return( qosType );
2048}
2049
2050
2051
2052
2053//Caller allocates memory for pIEStruct
2054eHalStatus csrParseBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIEStruct)
2055{
2056 eHalStatus status = eHAL_STATUS_FAILURE;
2057 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2058 int ieLen = (int)(pBssDesc->length + sizeof( pBssDesc->length ) - GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
2059
2060 if(ieLen > 0 && pIEStruct)
2061 {
2062 if(!DOT11F_FAILED(dot11fUnpackBeaconIEs( pMac, (tANI_U8 *)pBssDesc->ieFields, ieLen, pIEStruct )))
2063 {
2064 status = eHAL_STATUS_SUCCESS;
2065 }
2066 }
2067
2068 return (status);
2069}
2070
2071
2072//This function will allocate memory for the parsed IEs to the caller. Caller must free the memory
2073//after it is done with the data only if this function succeeds
2074eHalStatus csrGetParsedBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs **ppIEStruct)
2075{
2076 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
2077 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2078
2079 if(pBssDesc && ppIEStruct)
2080 {
2081 status = palAllocateMemory(pMac->hHdd, (void **)ppIEStruct, sizeof(tDot11fBeaconIEs));
2082 if(HAL_STATUS_SUCCESS(status))
2083 {
2084 palZeroMemory(pMac->hHdd, (void *)*ppIEStruct, sizeof(tDot11fBeaconIEs));
2085 status = csrParseBssDescriptionIEs(hHal, pBssDesc, *ppIEStruct);
2086 if(!HAL_STATUS_SUCCESS(status))
2087 {
2088 palFreeMemory(pMac->hHdd, *ppIEStruct);
2089 *ppIEStruct = NULL;
2090 }
2091 }
2092 else
2093 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002094 smsLog( pMac, LOGE, FL(" failed to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 VOS_ASSERT( 0 );
2096 }
2097 }
2098
2099 return (status);
2100}
2101
2102
2103
2104
2105tANI_BOOLEAN csrIsNULLSSID( tANI_U8 *pBssSsid, tANI_U8 len )
2106{
2107 tANI_BOOLEAN fNullSsid = FALSE;
2108
2109 tANI_U32 SsidLength;
2110 tANI_U8 *pSsidStr;
2111
2112 do
2113 {
2114 if ( 0 == len )
2115 {
2116 fNullSsid = TRUE;
2117 break;
2118 }
2119
2120 //Consider 0 or space for hidden SSID
2121 if ( 0 == pBssSsid[0] )
2122 {
2123 fNullSsid = TRUE;
2124 break;
2125 }
2126
2127 SsidLength = len;
2128 pSsidStr = pBssSsid;
2129
2130 while ( SsidLength )
2131 {
2132 if( *pSsidStr )
2133 break;
2134
2135 pSsidStr++;
2136 SsidLength--;
2137 }
2138
2139 if( 0 == SsidLength )
2140 {
2141 fNullSsid = TRUE;
2142 break;
2143 }
2144 }
2145 while( 0 );
2146
2147 return fNullSsid;
2148}
2149
2150
2151tANI_U32 csrGetFragThresh( tHalHandle hHal )
2152{
2153 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2154
2155 return pMac->roam.configParam.FragmentationThreshold;
2156}
2157
2158tANI_U32 csrGetRTSThresh( tHalHandle hHal )
2159{
2160 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2161
2162 return pMac->roam.configParam.RTSThreshold;
2163}
2164
2165eCsrPhyMode csrTranslateToPhyModeFromBssDesc( tSirBssDescription *pSirBssDesc )
2166{
2167 eCsrPhyMode phyMode;
2168
2169 switch ( pSirBssDesc->nwType )
2170 {
2171 case eSIR_11A_NW_TYPE:
2172 phyMode = eCSR_DOT11_MODE_11a;
2173 break;
2174
2175 case eSIR_11B_NW_TYPE:
2176 phyMode = eCSR_DOT11_MODE_11b;
2177 break;
2178
2179 case eSIR_11G_NW_TYPE:
2180 phyMode = eCSR_DOT11_MODE_11g;
2181 break;
2182
2183 case eSIR_11N_NW_TYPE:
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 phyMode = eCSR_DOT11_MODE_11n;
2185 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002186#ifdef WLAN_FEATURE_11AC
2187 case eSIR_11AC_NW_TYPE:
2188 default:
2189 phyMode = eCSR_DOT11_MODE_11ac;
2190#else
2191 default:
2192 phyMode = eCSR_DOT11_MODE_11n;
2193#endif
2194 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 return( phyMode );
2197}
2198
2199
2200tANI_U32 csrTranslateToWNICfgDot11Mode(tpAniSirGlobal pMac, eCsrCfgDot11Mode csrDot11Mode)
2201{
2202 tANI_U32 ret;
2203
2204 switch(csrDot11Mode)
2205 {
2206 case eCSR_CFG_DOT11_MODE_AUTO:
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002207 smsLog(pMac, LOGW, FL(" Warning: sees eCSR_CFG_DOT11_MODE_AUTO "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 //We cannot decide until now.
2209 if(pMac->roam.configParam.ProprietaryRatesEnabled)
2210 {
2211 ret = WNI_CFG_DOT11_MODE_TAURUS;
2212 }
2213 else
2214 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08002215 ret = WNI_CFG_DOT11_MODE_11AC;
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 }
2217 break;
2218 case eCSR_CFG_DOT11_MODE_TAURUS:
2219 ret = WNI_CFG_DOT11_MODE_TAURUS;
2220 break;
2221 case eCSR_CFG_DOT11_MODE_11A:
2222 ret = WNI_CFG_DOT11_MODE_11A;
2223 break;
2224 case eCSR_CFG_DOT11_MODE_11B:
2225 ret = WNI_CFG_DOT11_MODE_11B;
2226 break;
2227 case eCSR_CFG_DOT11_MODE_11G:
2228 ret = WNI_CFG_DOT11_MODE_11G;
2229 break;
2230 case eCSR_CFG_DOT11_MODE_11N:
2231 ret = WNI_CFG_DOT11_MODE_11N;
2232 break;
2233 case eCSR_CFG_DOT11_MODE_POLARIS:
2234 ret = WNI_CFG_DOT11_MODE_POLARIS;
2235 break;
2236 case eCSR_CFG_DOT11_MODE_TITAN:
2237 ret = WNI_CFG_DOT11_MODE_TITAN;
2238 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 case eCSR_CFG_DOT11_MODE_11G_ONLY:
2240 ret = WNI_CFG_DOT11_MODE_11G_ONLY;
2241 break;
2242 case eCSR_CFG_DOT11_MODE_11N_ONLY:
2243 ret = WNI_CFG_DOT11_MODE_11N_ONLY;
2244 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002245
2246#ifdef WLAN_FEATURE_11AC
2247 case eCSR_CFG_DOT11_MODE_11AC_ONLY:
2248 ret = WNI_CFG_DOT11_MODE_11AC_ONLY;
2249 break;
2250 case eCSR_CFG_DOT11_MODE_11AC:
2251 ret = WNI_CFG_DOT11_MODE_11AC;
2252 break;
2253#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 default:
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002255 smsLog(pMac, LOGW, FL("doesn't expect %d as csrDo11Mode"), csrDot11Mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 if(eCSR_BAND_24 == pMac->roam.configParam.eBand)
2257 {
2258 ret = WNI_CFG_DOT11_MODE_11G;
2259 }
2260 else
2261 {
2262 ret = WNI_CFG_DOT11_MODE_11A;
2263 }
2264 break;
2265 }
2266
2267 return (ret);
2268}
2269
2270
2271//This function should only return the super set of supported modes. 11n implies 11b/g/a/n.
2272eHalStatus csrGetPhyModeFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBSSDescription,
2273 eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes)
2274{
2275 eHalStatus status = eHAL_STATUS_SUCCESS;
2276 eCsrPhyMode phyMode = csrTranslateToPhyModeFromBssDesc(pBSSDescription);
2277
2278 if( pIes )
2279 {
2280 if(pIes->Airgo.present)
2281 {
2282 if(pIes->Airgo.PropCapability.present)
2283 {
2284 if( PROP_CAPABILITY_GET( TAURUS, pIes->Airgo.PropCapability.capability ))
2285 {
2286 phyMode = eCSR_DOT11_MODE_TAURUS;
2287 }
2288 }
2289 }
2290 if(pIes->HTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode))
2291 {
2292 phyMode = eCSR_DOT11_MODE_11n;
2293 }
Jeff Johnsone7245742012-09-05 17:12:55 -07002294
2295#ifdef WLAN_FEATURE_11AC
2296 if ( pIes->VHTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode))
2297 {
2298 phyMode = eCSR_DOT11_MODE_11ac;
2299 }
2300#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 *pPhyMode = phyMode;
2302 }
2303
2304 return (status);
2305
2306}
2307
2308
2309//This function returns the correct eCSR_CFG_DOT11_MODE is the two phyModes matches
2310//bssPhyMode is the mode derived from the BSS description
2311//f5GhzBand is derived from the channel id of BSS description
2312tANI_BOOLEAN csrGetPhyModeInUse( eCsrPhyMode phyModeIn, eCsrPhyMode bssPhyMode, tANI_BOOLEAN f5GhzBand,
2313 eCsrCfgDot11Mode *pCfgDot11ModeToUse )
2314{
2315 tANI_BOOLEAN fMatch = FALSE;
2316 eCsrCfgDot11Mode cfgDot11Mode;
2317
2318 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; // to suppress compiler warning
2319
2320 switch( phyModeIn )
2321 {
2322 case eCSR_DOT11_MODE_abg: //11a or 11b or 11g
2323 if( f5GhzBand )
2324 {
2325 fMatch = TRUE;
2326 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2327 }
2328 else if( eCSR_DOT11_MODE_11b == bssPhyMode )
2329 {
2330 fMatch = TRUE;
2331 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2332 }
2333 else
2334 {
2335 fMatch = TRUE;
2336 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2337 }
2338 break;
2339
2340 case eCSR_DOT11_MODE_11a: //11a
2341 if( f5GhzBand )
2342 {
2343 fMatch = TRUE;
2344 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2345 }
2346 break;
2347
2348 case eCSR_DOT11_MODE_11a_ONLY: //11a
2349 if( eCSR_DOT11_MODE_11a == bssPhyMode )
2350 {
2351 fMatch = TRUE;
2352 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2353 }
2354 break;
2355
2356 case eCSR_DOT11_MODE_11g:
2357 if(!f5GhzBand)
2358 {
2359 if( eCSR_DOT11_MODE_11b == bssPhyMode )
2360 {
2361 fMatch = TRUE;
2362 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2363 }
2364 else
2365 {
2366 fMatch = TRUE;
2367 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2368 }
2369 }
2370 break;
2371
2372 case eCSR_DOT11_MODE_11g_ONLY:
2373 if( eCSR_DOT11_MODE_11g == bssPhyMode )
2374 {
2375 fMatch = TRUE;
2376 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2377 }
2378 break;
2379
2380 case eCSR_DOT11_MODE_11b:
2381 if( !f5GhzBand )
2382 {
2383 fMatch = TRUE;
2384 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2385 }
2386 break;
2387
2388 case eCSR_DOT11_MODE_11b_ONLY:
2389 if( eCSR_DOT11_MODE_11b == bssPhyMode )
2390 {
2391 fMatch = TRUE;
2392 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2393 }
2394 break;
2395
2396 case eCSR_DOT11_MODE_11n:
2397 fMatch = TRUE;
2398 switch(bssPhyMode)
2399 {
2400 case eCSR_DOT11_MODE_11g:
2401 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2402 break;
2403 case eCSR_DOT11_MODE_11b:
2404 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2405 break;
2406 case eCSR_DOT11_MODE_11a:
2407 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2408 break;
2409 case eCSR_DOT11_MODE_11n:
Jeff Johnsone7245742012-09-05 17:12:55 -07002410#ifdef WLAN_FEATURE_11AC
2411 case eCSR_DOT11_MODE_11ac:
2412#endif
2413 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
2414 break;
2415
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 case eCSR_DOT11_MODE_TAURUS:
2417 default:
Jeff Johnsone7245742012-09-05 17:12:55 -07002418#ifdef WLAN_FEATURE_11AC
2419 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2420#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002421 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
Jeff Johnsone7245742012-09-05 17:12:55 -07002422#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002423 break;
2424 }
2425 break;
2426
2427 case eCSR_DOT11_MODE_11n_ONLY:
2428 if((eCSR_DOT11_MODE_11n == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode))
2429 {
2430 fMatch = TRUE;
2431 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
Jeff Johnsone7245742012-09-05 17:12:55 -07002432
2433 }
2434
2435 break;
2436#ifdef WLAN_FEATURE_11AC
2437 case eCSR_DOT11_MODE_11ac:
2438 fMatch = TRUE;
2439 switch(bssPhyMode)
2440 {
2441 case eCSR_DOT11_MODE_11g:
2442 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2443 break;
2444 case eCSR_DOT11_MODE_11b:
2445 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2446 break;
2447 case eCSR_DOT11_MODE_11a:
2448 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2449 break;
2450 case eCSR_DOT11_MODE_11n:
2451 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
2452 break;
2453 case eCSR_DOT11_MODE_11ac:
2454 case eCSR_DOT11_MODE_TAURUS:
2455 default:
2456 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2457 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 }
2459 break;
2460
Jeff Johnsone7245742012-09-05 17:12:55 -07002461 case eCSR_DOT11_MODE_11ac_ONLY:
2462 if((eCSR_DOT11_MODE_11ac == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode))
2463 {
2464 fMatch = TRUE;
2465 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2466 }
2467 break;
2468#endif
2469
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 case eCSR_DOT11_MODE_TAURUS:
2471 default:
2472 fMatch = TRUE;
2473 switch(bssPhyMode)
2474 {
2475 case eCSR_DOT11_MODE_11g:
2476 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
2477 break;
2478 case eCSR_DOT11_MODE_11b:
2479 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
2480 break;
2481 case eCSR_DOT11_MODE_11a:
2482 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
2483 break;
2484 case eCSR_DOT11_MODE_11n:
2485 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
2486 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07002487#ifdef WLAN_FEATURE_11AC
2488 case eCSR_DOT11_MODE_11ac:
2489 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
2490 break;
2491#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 case eCSR_DOT11_MODE_TAURUS:
2493 default:
2494 cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
2495 break;
2496 }
2497 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 }
2499
2500 if ( fMatch && pCfgDot11ModeToUse )
2501 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002502#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudief5dd972012-10-11 15:06:09 -07002503 if(cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC && (!IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)))
Jeff Johnsone7245742012-09-05 17:12:55 -07002504 {
2505 *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
2506 }
2507 else
2508#endif
2509 {
2510 *pCfgDot11ModeToUse = cfgDot11Mode;
2511 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002513 return( fMatch );
2514}
2515
2516
2517//This function decides whether the one of the bit of phyMode is matching the mode in the BSS and allowed by the user
2518//setting, pMac->roam.configParam.uCfgDot11Mode. It returns the mode that fits the criteria.
2519tANI_BOOLEAN csrIsPhyModeMatch( tpAniSirGlobal pMac, tANI_U32 phyMode,
2520 tSirBssDescription *pSirBssDesc, tCsrRoamProfile *pProfile,
2521 eCsrCfgDot11Mode *pReturnCfgDot11Mode,
2522 tDot11fBeaconIEs *pIes)
2523{
2524 tANI_BOOLEAN fMatch = FALSE;
2525 eCsrPhyMode phyModeInBssDesc, phyMode2;
2526 eCsrCfgDot11Mode cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_TAURUS;
2527 tANI_U32 bitMask, loopCount;
2528
2529 if(HAL_STATUS_SUCCESS(csrGetPhyModeFromBss(pMac, pSirBssDesc, &phyModeInBssDesc, pIes )))
2530 {
2531 //In case some change change eCSR_DOT11_MODE_TAURUS to non-0
2532 if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode))
2533 {
2534 //Taurus means anything
2535 if ( eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode )
2536 {
2537 phyMode = eCSR_DOT11_MODE_abg;
2538 }
2539 else if(eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode)
2540 {
2541 if(pMac->roam.configParam.ProprietaryRatesEnabled)
2542 {
2543 phyMode = eCSR_DOT11_MODE_TAURUS;
2544 }
2545 else
2546 {
Jeff Johnsone7245742012-09-05 17:12:55 -07002547
2548#ifdef WLAN_FEATURE_11AC
2549 phyMode = eCSR_DOT11_MODE_11ac;
2550#else
Jeff Johnson295189b2012-06-20 16:38:30 -07002551 phyMode = eCSR_DOT11_MODE_11n;
Jeff Johnsone7245742012-09-05 17:12:55 -07002552#endif
2553
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 }
2555 }
2556 else
2557 {
2558 //user's pick
2559 phyMode = pMac->roam.configParam.phyMode;
2560 }
2561 }
2562 if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode) )
2563 {
2564 if(0 != phyMode)
2565 {
2566 if(eCSR_DOT11_MODE_AUTO & phyMode)
2567 {
2568 phyMode2 = eCSR_DOT11_MODE_AUTO & phyMode;
2569 }
2570 else
2571 {
2572 phyMode2 = eCSR_DOT11_MODE_TAURUS & phyMode;
2573 }
2574 }
2575 else
2576 {
2577 phyMode2 = phyMode;
2578 }
2579 fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId),
2580 &cfgDot11ModeToUse );
2581 }
2582 else
2583 {
2584 bitMask = 1;
2585 loopCount = 0;
2586 while(loopCount < eCSR_NUM_PHY_MODE)
2587 {
2588 if(0 != ( phyMode2 = (phyMode & (bitMask << loopCount++)) ))
2589 {
2590 fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId),
2591 &cfgDot11ModeToUse );
2592 if(fMatch) break;
2593 }
2594 }
2595 }
2596 if ( fMatch && pReturnCfgDot11Mode )
2597 {
2598 if( pProfile )
2599 {
2600 /* IEEE 11n spec (8.4.3): HT STA shall eliminate TKIP as a
2601 * choice for the pairwise cipher suite if CCMP is advertised
2602 * by the AP or if the AP included an HT capabilities element
2603 * in its Beacons and Probe Response.
2604 */
2605 if( (!CSR_IS_11n_ALLOWED( pProfile->negotiatedUCEncryptionType )) &&
2606 ((eCSR_CFG_DOT11_MODE_11N == cfgDot11ModeToUse) ||
Jeff Johnsone7245742012-09-05 17:12:55 -07002607#ifdef WLAN_FEATURE_11AC
2608 (eCSR_CFG_DOT11_MODE_11AC == cfgDot11ModeToUse) ||
2609#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11ModeToUse)) )
2611 {
2612 //We cannot do 11n here
2613 if( !CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId) )
2614 {
2615 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
2616 }
2617 else
2618 {
2619 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
2620 }
2621 }
2622 }
2623 *pReturnCfgDot11Mode = cfgDot11ModeToUse;
2624 }
2625 }
2626
2627 return( fMatch );
2628}
2629
2630
2631eCsrCfgDot11Mode csrFindBestPhyMode( tpAniSirGlobal pMac, tANI_U32 phyMode )
2632{
2633 eCsrCfgDot11Mode cfgDot11ModeToUse;
2634 eCsrBand eBand = pMac->roam.configParam.eBand;
2635
Jeff Johnsone7245742012-09-05 17:12:55 -07002636
2637#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudief5dd972012-10-11 15:06:09 -07002638 if ((0 == phyMode) || ((eCSR_DOT11_MODE_AUTO & phyMode) && (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)))
2639 || ((eCSR_DOT11_MODE_11ac & phyMode) && (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))))
Jeff Johnsone7245742012-09-05 17:12:55 -07002640 {
2641 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC;
2642 }
2643 else
2644#endif
2645
Madan Mohan Koyyalamudief5dd972012-10-11 15:06:09 -07002646 if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode))
Jeff Johnson295189b2012-06-20 16:38:30 -07002647 {
2648 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
2649 }
2650 else
2651 {
2652 if( ( eCSR_DOT11_MODE_11n | eCSR_DOT11_MODE_11n_ONLY ) & phyMode )
2653 {
2654 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N;
2655 }
2656 else if ( eCSR_DOT11_MODE_abg & phyMode )
2657 {
2658 if( eCSR_BAND_24 != eBand )
2659 {
2660 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
2661 }
2662 else
2663 {
2664 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
2665 }
2666 }
2667 else if( ( eCSR_DOT11_MODE_11a | eCSR_DOT11_MODE_11a_ONLY ) & phyMode )
2668 {
2669 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A;
2670 }
2671 else if( ( eCSR_DOT11_MODE_11g | eCSR_DOT11_MODE_11g_ONLY ) & phyMode )
2672 {
2673 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G;
2674 }
2675 else
2676 {
2677 cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11B;
2678 }
2679 }
2680
2681 return ( cfgDot11ModeToUse );
2682}
2683
2684
2685
2686
2687tANI_U32 csrGet11hPowerConstraint( tHalHandle hHal, tDot11fIEPowerConstraints *pPowerConstraint )
2688{
2689 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2690 tANI_U32 localPowerConstraint = 0;
2691
2692 // check if .11h support is enabled, if not, the power constraint is 0.
2693 if(pMac->roam.configParam.Is11hSupportEnabled && pPowerConstraint->present)
2694 {
2695 localPowerConstraint = pPowerConstraint->localPowerConstraints;
2696 }
2697
2698 return( localPowerConstraint );
2699}
2700
2701
2702tANI_BOOLEAN csrIsProfileWpa( tCsrRoamProfile *pProfile )
2703{
2704 tANI_BOOLEAN fWpaProfile = FALSE;
2705
2706 switch ( pProfile->negotiatedAuthType )
2707 {
2708 case eCSR_AUTH_TYPE_WPA:
2709 case eCSR_AUTH_TYPE_WPA_PSK:
2710 case eCSR_AUTH_TYPE_WPA_NONE:
2711#ifdef FEATURE_WLAN_CCX
2712 case eCSR_AUTH_TYPE_CCKM_WPA:
2713#endif
2714 fWpaProfile = TRUE;
2715 break;
2716
2717 default:
2718 fWpaProfile = FALSE;
2719 break;
2720 }
2721
2722 if ( fWpaProfile )
2723 {
2724 switch ( pProfile->negotiatedUCEncryptionType )
2725 {
2726 case eCSR_ENCRYPT_TYPE_WEP40:
2727 case eCSR_ENCRYPT_TYPE_WEP104:
2728 case eCSR_ENCRYPT_TYPE_TKIP:
2729 case eCSR_ENCRYPT_TYPE_AES:
2730 fWpaProfile = TRUE;
2731 break;
2732
2733 default:
2734 fWpaProfile = FALSE;
2735 break;
2736 }
2737 }
2738 return( fWpaProfile );
2739}
2740
2741tANI_BOOLEAN csrIsProfileRSN( tCsrRoamProfile *pProfile )
2742{
2743 tANI_BOOLEAN fRSNProfile = FALSE;
2744
2745 switch ( pProfile->negotiatedAuthType )
2746 {
2747 case eCSR_AUTH_TYPE_RSN:
2748 case eCSR_AUTH_TYPE_RSN_PSK:
2749#ifdef WLAN_FEATURE_VOWIFI_11R
2750 case eCSR_AUTH_TYPE_FT_RSN:
2751 case eCSR_AUTH_TYPE_FT_RSN_PSK:
2752#endif
2753#ifdef FEATURE_WLAN_CCX
2754 case eCSR_AUTH_TYPE_CCKM_RSN:
2755#endif
Chet Lanctot186b5732013-03-18 10:26:30 -07002756#ifdef WLAN_FEATURE_11W
2757 case eCSR_AUTH_TYPE_RSN_PSK_SHA256:
2758#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002759 fRSNProfile = TRUE;
2760 break;
2761
2762 default:
2763 fRSNProfile = FALSE;
2764 break;
2765 }
2766
2767 if ( fRSNProfile )
2768 {
2769 switch ( pProfile->negotiatedUCEncryptionType )
2770 {
2771 // !!REVIEW - For WPA2, use of RSN IE mandates
2772 // use of AES as encryption. Here, we qualify
2773 // even if encryption type is WEP or TKIP
2774 case eCSR_ENCRYPT_TYPE_WEP40:
2775 case eCSR_ENCRYPT_TYPE_WEP104:
2776 case eCSR_ENCRYPT_TYPE_TKIP:
2777 case eCSR_ENCRYPT_TYPE_AES:
2778 fRSNProfile = TRUE;
2779 break;
2780
2781 default:
2782 fRSNProfile = FALSE;
2783 break;
2784 }
2785 }
2786 return( fRSNProfile );
2787}
2788
Jeff Johnsone7245742012-09-05 17:12:55 -07002789eHalStatus
2790csrIsconcurrentsessionValid(tpAniSirGlobal pMac,tANI_U32 cursessionId,
2791 tVOS_CON_MODE currBssPersona)
2792{
2793 tANI_U32 sessionId = 0;
2794
2795 for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
2796 {
2797 if (cursessionId != sessionId )
2798 {
2799 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
2800 {
2801 continue;
2802 }
2803
2804 switch (currBssPersona)
2805 {
2806 case VOS_STA_MODE:
2807 if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
2808 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
2809 == VOS_STA_MODE)) //check for P2P client mode
2810 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002811 smsLog(pMac, LOGE, FL(" ****STA mode already exists ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002812 return eHAL_STATUS_FAILURE;
2813 }
2814 break;
2815
2816 case VOS_STA_SAP_MODE:
Gopichand Nakkala53fefcd2013-02-28 12:35:20 +05302817 if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2818 == VOS_STA_SAP_MODE)&&
2819 (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
Jeff Johnsone7245742012-09-05 17:12:55 -07002820 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002821 smsLog(pMac, LOGE, FL(" ****SoftAP mode already exists ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002822 return eHAL_STATUS_FAILURE;
2823 }
2824
Gopichand Nakkala53fefcd2013-02-28 12:35:20 +05302825 else if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2826 == VOS_P2P_GO_MODE) &&
2827 (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
Jeff Johnsone7245742012-09-05 17:12:55 -07002828 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002829 smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002830 return eHAL_STATUS_FAILURE;
2831 }
2832 break;
2833
2834 case VOS_P2P_CLIENT_MODE:
2835 if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
2836 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
2837 == VOS_P2P_CLIENT_MODE)) //check for P2P client mode
2838 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002839 smsLog(pMac, LOGE, FL(" ****CLIENT mode already exists ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002840 return eHAL_STATUS_FAILURE;
2841 }
2842 break;
2843
2844 case VOS_P2P_GO_MODE:
Gopichand Nakkala53fefcd2013-02-28 12:35:20 +05302845 if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2846 == VOS_P2P_GO_MODE) &&
2847 (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
Jeff Johnsone7245742012-09-05 17:12:55 -07002848 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002849 smsLog(pMac, LOGE, FL(" ****P2P GO mode already exists ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002850 return eHAL_STATUS_FAILURE;
2851 }
Gopichand Nakkala53fefcd2013-02-28 12:35:20 +05302852 else if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2853 == VOS_STA_SAP_MODE) &&
2854 (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))
Jeff Johnsone7245742012-09-05 17:12:55 -07002855 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002856 smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002857 return eHAL_STATUS_FAILURE;
2858 }
2859 break;
2860
2861 default :
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002862 smsLog(pMac, LOGE, FL("***Persona not handled = %d*****"),currBssPersona);
Jeff Johnsone7245742012-09-05 17:12:55 -07002863 break;
2864 }
2865 }
2866 }
2867 return eHAL_STATUS_SUCCESS;
2868
2869}
2870
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002871eHalStatus csrUpdateMCCp2pBeaconInterval(tpAniSirGlobal pMac)
Jeff Johnsone7245742012-09-05 17:12:55 -07002872{
2873 tANI_U32 sessionId = 0;
2874
2875 //If MCC is not supported just break and return SUCCESS
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002876 if ( !pMac->roam.configParam.fenableMCCMode){
2877 return eHAL_STATUS_FAILURE;
2878 }
2879
2880 for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
2881 {
2882 /* If GO in MCC support different beacon interval,
2883 * change the BI of the P2P-GO */
2884 if((pMac->roam.roamSession[sessionId].bssParams.bssPersona
2885 == VOS_P2P_GO_MODE) &&
2886 (pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval ))
2887 {
2888 return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS, eCSR_ROAM_RESULT_NONE);
2889 }
2890 }
2891 return eHAL_STATUS_FAILURE;
2892}
2893
2894tANI_U16 csrCalculateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U16 sta_bi, tANI_U16 go_gbi)
2895{
2896 tANI_U8 num_beacons = 0;
2897 tANI_U8 is_multiple = 0;
2898 tANI_U16 go_cbi = 0;
2899 tANI_U16 go_fbi = 0;
2900 tANI_U16 sta_cbi = 0;
2901
2902 //If GO's given beacon Interval is less than 100
2903 if(go_gbi < 100)
2904 go_cbi = 100;
2905 //if GO's given beacon Interval is greater than or equal to 100
2906 else
2907 go_cbi = 100 + (go_gbi % 100);
2908
2909 // check, if either one is multiple of another
2910 if (sta_bi > go_cbi)
2911 {
2912 is_multiple = !(sta_bi % go_cbi);
2913 }
2914 else
2915 {
2916 is_multiple = !(go_cbi % sta_bi);
2917 }
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08002918 // if it is multiple, then accept GO's beacon interval range [100,199] as it is
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002919 if(is_multiple)
2920 {
2921 return go_cbi;
2922 }
2923 //else , if it is not multiple, then then check for number of beacons to be
2924 //inserted based on sta BI
2925 num_beacons = sta_bi / 100;
2926 if(num_beacons)
2927 {
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08002928 // GO's final beacon interval will be aligned to sta beacon interval, but
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002929 //in the range of [100, 199].
2930 sta_cbi = sta_bi / num_beacons;
2931 go_fbi = sta_cbi;
2932 }
2933 else
2934 {
Madan Mohan Koyyalamudi48081ef2012-12-04 16:49:55 -08002935 // if STA beacon interval is less than 100, use GO's change bacon interval
2936 //instead of updating to STA's beacon interval.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002937 go_fbi = go_cbi;
2938 }
2939 return go_fbi;
2940}
2941
2942eHalStatus csrValidateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId,
2943 tANI_U16 *beaconInterval, tANI_U32 cursessionId,
2944 tVOS_CON_MODE currBssPersona)
2945{
2946 tANI_U32 sessionId = 0;
2947 tANI_U16 new_beaconInterval = 0;
2948
2949 //If MCC is not supported just break
2950 if (!pMac->roam.configParam.fenableMCCMode){
Jeff Johnsone7245742012-09-05 17:12:55 -07002951 return eHAL_STATUS_FAILURE;
2952 }
2953
2954 for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ )
2955 {
2956 if (cursessionId != sessionId )
2957 {
2958 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
2959 {
2960 continue;
2961 }
2962
2963 switch (currBssPersona)
2964 {
2965 case VOS_STA_MODE:
2966 if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
2967 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
2968 == VOS_P2P_CLIENT_MODE)) //check for P2P client mode
2969 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002970 smsLog(pMac, LOG1, FL(" Beacon Interval Validation not required for STA/CLIENT"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002971 }
2972 //IF SAP has started and STA wants to connect on different channel MCC should
2973 //MCC should not be enabled so making it false to enforce on same channel
2974 else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
2975 == VOS_STA_SAP_MODE)
2976 {
2977 if (pMac->roam.roamSession[sessionId].bssParams.operationChn
2978 != channelId )
2979 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002980 smsLog(pMac, LOGE, FL("***MCC is not enabled for SAP +STA****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07002981 return eHAL_STATUS_FAILURE;
2982 }
2983 }
2984 else if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
2985 == VOS_P2P_GO_MODE) //Check for P2P go scenario
2986 {
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002987 /* if GO in MCC support different beacon interval,
2988 * change the BI of the P2P-GO */
2989 if ((pMac->roam.roamSession[sessionId].bssParams.operationChn
Jeff Johnsone7245742012-09-05 17:12:55 -07002990 != channelId ) &&
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002991 (pMac->roam.roamSession[sessionId].bssParams.beaconInterval
Jeff Johnsone7245742012-09-05 17:12:55 -07002992 != *beaconInterval))
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08002993 {
2994 /* if GO in MCC support different beacon interval, return success */
2995 if ( pMac->roam.configParam.fAllowMCCGODiffBI == 0x01)
2996 {
2997 return eHAL_STATUS_SUCCESS;
2998 }
2999 // Send only Broadcast disassoc and update beaconInterval
3000 else if(pMac->roam.configParam.fAllowMCCGODiffBI == 0x02)
3001 {
3002 //Check to pass the right beacon Interval
3003 new_beaconInterval = csrCalculateMCCBeaconInterval(pMac, *beaconInterval,
3004 pMac->roam.roamSession[sessionId].bssParams.beaconInterval);
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003005 smsLog(pMac, LOG1, FL(" Peer AP BI : %d, new Beacon Interval: %d"),*beaconInterval,new_beaconInterval );
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003006 //Update the becon Interval
Sudhir Sattayappa Kohalli32285c92013-03-05 19:31:56 -08003007 if( new_beaconInterval !=
3008 pMac->roam.roamSession[sessionId].bssParams.beaconInterval )
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003009 {
3010 //Update the beaconInterval now
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003011 smsLog(pMac, LOG1, FL(" Beacon Interval got changed"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003012 pMac->roam.roamSession[sessionId].bssParams.beaconInterval = new_beaconInterval;
3013 pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_TRUE;
3014 csrUpdateMCCp2pBeaconInterval(pMac);
3015 }
3016 return eHAL_STATUS_SUCCESS;
3017 }
3018 //Disconnect the P2P session
3019 else if(pMac->roam.configParam.fAllowMCCGODiffBI == 0x03)
3020 {
3021 pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE;
3022 return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_SEND_P2P_STOP_BSS, eCSR_ROAM_RESULT_NONE);
3023 }
3024 else
3025 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003026 smsLog(pMac, LOGE, FL("BeaconInterval is different cannot connect to preferred AP..."));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003027 return eHAL_STATUS_FAILURE;
3028 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003029 }
3030 }
3031 break;
3032
3033 case VOS_P2P_CLIENT_MODE:
3034 if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
3035 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
3036 == VOS_STA_MODE)) //check for P2P client mode
3037 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003038 smsLog(pMac, LOG1, FL(" Ignore Beacon Interval Validation..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003039 }
3040 //IF SAP has started and STA wants to connect on different channel MCC should
3041 //MCC should not be enabled so making it false to enforce on same channel
3042 else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona
3043 == VOS_STA_SAP_MODE)
3044 {
3045 if (pMac->roam.roamSession[sessionId].bssParams.operationChn
3046 != channelId )
3047 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003048 smsLog(pMac, LOGE, FL("***MCC is not enabled for SAP + CLIENT****"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003049 return eHAL_STATUS_FAILURE;
3050 }
3051 }
3052 else if(pMac->roam.roamSession[sessionId].bssParams.bssPersona
3053 == VOS_P2P_GO_MODE) //Check for P2P go scenario
3054 {
3055 if ((pMac->roam.roamSession[sessionId].bssParams.operationChn
3056 != channelId ) &&
3057 (pMac->roam.roamSession[sessionId].bssParams.beaconInterval
3058 != *beaconInterval))
3059 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003060 smsLog(pMac, LOGE, FL("BeaconInterval is different cannot connect to P2P_GO network ..."));
Jeff Johnsone7245742012-09-05 17:12:55 -07003061 return eHAL_STATUS_FAILURE;
3062 }
3063 }
3064 break;
3065
3066 case VOS_P2P_GO_MODE :
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003067 {
Jeff Johnsone7245742012-09-05 17:12:55 -07003068 if(pMac->roam.roamSession[sessionId].pCurRoamProfile &&
3069 ((pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003070 == VOS_P2P_CLIENT_MODE) ||
3071 (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona
Jeff Johnsone7245742012-09-05 17:12:55 -07003072 == VOS_STA_MODE))) //check for P2P_client scenario
3073 {
3074 if ((pMac->roam.roamSession[sessionId].connectedProfile.operationChannel
3075 == 0 )&&
3076 (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval
3077 == 0))
3078 {
3079 continue;
3080 }
3081
3082
3083 if (csrIsConnStateConnectedInfra(pMac, sessionId) &&
3084 (pMac->roam.roamSession[sessionId].connectedProfile.operationChannel
3085 != channelId ) &&
3086 (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval
3087 != *beaconInterval))
3088 {
3089 /*
3090 * Updated beaconInterval should be used only when we are starting a new BSS
3091 * not incase of client or STA case
3092 */
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003093 //Calculate beacon Interval for P2P-GO incase of MCC
3094 new_beaconInterval = csrCalculateMCCBeaconInterval(pMac,
3095 pMac->roam.roamSession[sessionId].bssParams.beaconInterval,
3096 *beaconInterval );
3097 if(*beaconInterval != new_beaconInterval)
3098 *beaconInterval = new_beaconInterval;
Jeff Johnsone7245742012-09-05 17:12:55 -07003099 return eHAL_STATUS_SUCCESS;
3100 }
3101 }
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08003102 }
3103 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07003104
3105 default :
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003106 smsLog(pMac, LOG1, FL(" Persona not supported : %d"),currBssPersona);
Jeff Johnsone7245742012-09-05 17:12:55 -07003107 return eHAL_STATUS_FAILURE;
3108 }
3109 }
3110 }
3111
3112 return eHAL_STATUS_SUCCESS;
3113}
Jeff Johnson295189b2012-06-20 16:38:30 -07003114
3115#ifdef WLAN_FEATURE_VOWIFI_11R
3116/* Function to return TRUE if the authtype is 11r */
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003117tANI_BOOLEAN csrIsAuthType11r( eCsrAuthType AuthType, tANI_U8 mdiePresent)
Jeff Johnson295189b2012-06-20 16:38:30 -07003118{
3119 switch ( AuthType )
3120 {
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003121 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
3122 if(mdiePresent)
3123 return TRUE;
3124 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 case eCSR_AUTH_TYPE_FT_RSN_PSK:
3126 case eCSR_AUTH_TYPE_FT_RSN:
3127 return TRUE;
3128 break;
3129 default:
3130 break;
3131 }
3132 return FALSE;
3133}
3134
3135/* Function to return TRUE if the profile is 11r */
3136tANI_BOOLEAN csrIsProfile11r( tCsrRoamProfile *pProfile )
3137{
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003138 return csrIsAuthType11r( pProfile->negotiatedAuthType, pProfile->MDID.mdiePresent );
Jeff Johnson295189b2012-06-20 16:38:30 -07003139}
3140
3141#endif
3142
3143#ifdef FEATURE_WLAN_CCX
3144
3145/* Function to return TRUE if the authtype is CCX */
3146tANI_BOOLEAN csrIsAuthTypeCCX( eCsrAuthType AuthType )
3147{
3148 switch ( AuthType )
3149 {
3150 case eCSR_AUTH_TYPE_CCKM_WPA:
3151 case eCSR_AUTH_TYPE_CCKM_RSN:
3152 return TRUE;
3153 break;
3154 default:
3155 break;
3156 }
3157 return FALSE;
3158}
3159
3160/* Function to return TRUE if the profile is CCX */
3161tANI_BOOLEAN csrIsProfileCCX( tCsrRoamProfile *pProfile )
3162{
3163 return (csrIsAuthTypeCCX( pProfile->negotiatedAuthType ));
3164}
3165
3166#endif
3167
3168#ifdef FEATURE_WLAN_WAPI
3169tANI_BOOLEAN csrIsProfileWapi( tCsrRoamProfile *pProfile )
3170{
3171 tANI_BOOLEAN fWapiProfile = FALSE;
3172
3173 switch ( pProfile->negotiatedAuthType )
3174 {
3175 case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE:
3176 case eCSR_AUTH_TYPE_WAPI_WAI_PSK:
3177 fWapiProfile = TRUE;
3178 break;
3179
3180 default:
3181 fWapiProfile = FALSE;
3182 break;
3183 }
3184
3185 if ( fWapiProfile )
3186 {
3187 switch ( pProfile->negotiatedUCEncryptionType )
3188 {
3189 case eCSR_ENCRYPT_TYPE_WPI:
3190 fWapiProfile = TRUE;
3191 break;
3192
3193 default:
3194 fWapiProfile = FALSE;
3195 break;
3196 }
3197 }
3198 return( fWapiProfile );
3199}
3200
3201static tANI_BOOLEAN csrIsWapiOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 )
3202{
3203 return( palEqualMemory(pMac->hHdd, Oui1, Oui2, CSR_WAPI_OUI_SIZE ) );
3204}
3205
3206static tANI_BOOLEAN csrIsWapiOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE],
3207 tANI_U8 cAllCyphers,
3208 tANI_U8 Cypher[],
3209 tANI_U8 Oui[] )
3210{
3211 tANI_BOOLEAN fYes = FALSE;
3212 tANI_U8 idx;
3213
3214 for ( idx = 0; idx < cAllCyphers; idx++ )
3215 {
3216 if ( csrIsWapiOuiEqual( pMac, AllCyphers[ idx ], Cypher ) )
3217 {
3218 fYes = TRUE;
3219 break;
3220 }
3221 }
3222
3223 if ( fYes && Oui )
3224 {
3225 palCopyMemory( pMac->hHdd, Oui, AllCyphers[ idx ], CSR_WAPI_OUI_SIZE );
3226 }
3227
3228 return( fYes );
3229}
3230#endif /* FEATURE_WLAN_WAPI */
3231
3232static tANI_BOOLEAN csrIsWpaOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 )
3233{
3234 return( palEqualMemory(pMac->hHdd, Oui1, Oui2, CSR_WPA_OUI_SIZE ) );
3235}
3236
3237static tANI_BOOLEAN csrIsOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3238 tANI_U8 cAllCyphers,
3239 tANI_U8 Cypher[],
3240 tANI_U8 Oui[] )
3241{
3242 tANI_BOOLEAN fYes = FALSE;
3243 tANI_U8 idx;
3244
3245 for ( idx = 0; idx < cAllCyphers; idx++ )
3246 {
3247 if ( csrIsWpaOuiEqual( pMac, AllCyphers[ idx ], Cypher ) )
3248 {
3249 fYes = TRUE;
3250 break;
3251 }
3252 }
3253
3254 if ( fYes && Oui )
3255 {
3256 palCopyMemory( pMac->hHdd, Oui, AllCyphers[ idx ], CSR_WPA_OUI_SIZE );
3257 }
3258
3259 return( fYes );
3260}
3261
3262static tANI_BOOLEAN csrMatchRSNOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3263 tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
3264 tANI_U8 Oui[] )
3265{
3266 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui[ouiIndex], Oui ) );
3267
3268}
3269
3270#ifdef FEATURE_WLAN_WAPI
3271static tANI_BOOLEAN csrMatchWapiOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE],
3272 tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
3273 tANI_U8 Oui[] )
3274{
3275 return( csrIsWapiOuiMatch( pMac, AllCyphers, cAllCyphers, csrWapiOui[ouiIndex], Oui ) );
3276
3277}
3278#endif /* FEATURE_WLAN_WAPI */
3279
3280static tANI_BOOLEAN csrMatchWPAOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3281 tANI_U8 cAllCyphers, tANI_U8 ouiIndex,
3282 tANI_U8 Oui[] )
3283{
3284 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui[ouiIndex], Oui ) );
3285
3286}
3287
3288#if 0
3289static tANI_BOOLEAN csrIsRSNUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3290 tANI_U8 cAllCyphers,
3291 tANI_U8 Oui[] )
3292{
3293 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui00, Oui ) );
3294}
3295
3296static tANI_BOOLEAN csrIsRSNMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3297 tANI_U8 cAllCyphers,
3298 tANI_U8 Oui[] )
3299{
3300 tANI_BOOLEAN fYes = FALSE;
3301
3302 // Check Wep 104 first, if fails, then check Wep40.
3303 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui05, Oui );
3304
3305 if ( !fYes )
3306 {
3307 // if not Wep-104, check Wep-40
3308 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui01, Oui );
3309 }
3310
3311 return( fYes );
3312}
3313
3314
3315static tANI_BOOLEAN csrIsRSNUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3316 tANI_U8 cAllCyphers,
3317 tANI_U8 Oui[] )
3318{
3319 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) );
3320}
3321
3322
3323static tANI_BOOLEAN csrIsRSNMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3324 tANI_U8 cAllCyphers,
3325 tANI_U8 Oui[] )
3326{
3327 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) );
3328}
3329
3330static tANI_BOOLEAN csrIsRSNUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3331 tANI_U8 cAllCyphers,
3332 tANI_U8 Oui[] )
3333{
3334 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) );
3335}
3336
3337static tANI_BOOLEAN csrIsRSNMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE],
3338 tANI_U8 cAllCyphers,
3339 tANI_U8 Oui[] )
3340{
3341 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) );
3342}
3343#endif
3344#ifdef FEATURE_WLAN_WAPI
3345static tANI_BOOLEAN csrIsAuthWapiCert( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE],
3346 tANI_U8 cAllSuites,
3347 tANI_U8 Oui[] )
3348{
3349 return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[1], Oui ) );
3350}
3351static tANI_BOOLEAN csrIsAuthWapiPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE],
3352 tANI_U8 cAllSuites,
3353 tANI_U8 Oui[] )
3354{
3355 return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[2], Oui ) );
3356}
3357#endif /* FEATURE_WLAN_WAPI */
3358
3359#ifdef WLAN_FEATURE_VOWIFI_11R
3360
3361/*
3362 * Function for 11R FT Authentication. We match the FT Authentication Cipher suite
3363 * here. This matches for FT Auth with the 802.1X exchange.
3364 *
3365 */
3366static tANI_BOOLEAN csrIsFTAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3367 tANI_U8 cAllSuites,
3368 tANI_U8 Oui[] )
3369{
3370 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[03], Oui ) );
3371}
3372
3373/*
3374 * Function for 11R FT Authentication. We match the FT Authentication Cipher suite
3375 * here. This matches for FT Auth with the PSK.
3376 *
3377 */
3378static tANI_BOOLEAN csrIsFTAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3379 tANI_U8 cAllSuites,
3380 tANI_U8 Oui[] )
3381{
3382 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[04], Oui ) );
3383}
3384
3385#endif
3386
3387#ifdef FEATURE_WLAN_CCX
3388
3389/*
3390 * Function for CCX CCKM AKM Authentication. We match the CCKM AKM Authentication Key Management suite
3391 * here. This matches for CCKM AKM Auth with the 802.1X exchange.
3392 *
3393 */
3394static tANI_BOOLEAN csrIsCcxCckmAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3395 tANI_U8 cAllSuites,
3396 tANI_U8 Oui[] )
3397{
3398 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ) );
3399}
3400
3401static tANI_BOOLEAN csrIsCcxCckmAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
3402 tANI_U8 cAllSuites,
3403 tANI_U8 Oui[] )
3404{
3405 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[06], Oui ) );
3406}
3407
3408#endif
3409
3410static tANI_BOOLEAN csrIsAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3411 tANI_U8 cAllSuites,
3412 tANI_U8 Oui[] )
3413{
3414#ifdef WLAN_FEATURE_11W
3415 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[01], Oui ) ||
Chet Lanctot186b5732013-03-18 10:26:30 -07003416 csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003417#else
3418 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[01], Oui ) );
3419#endif
3420}
3421static tANI_BOOLEAN csrIsAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3422 tANI_U8 cAllSuites,
3423 tANI_U8 Oui[] )
3424{
3425#ifdef WLAN_FEATURE_11W
3426 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[02], Oui ) ||
3427 csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ) );
3428#else
3429 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[02], Oui ) );
3430#endif
3431}
3432
Chet Lanctot186b5732013-03-18 10:26:30 -07003433#ifdef WLAN_FEATURE_11W
3434static tANI_BOOLEAN csrIsAuthRSNPskSha256( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE],
3435 tANI_U8 cAllSuites,
3436 tANI_U8 Oui[] )
3437{
3438 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ) );
3439}
3440#endif
3441
Jeff Johnson295189b2012-06-20 16:38:30 -07003442static tANI_BOOLEAN csrIsAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
3443 tANI_U8 cAllSuites,
3444 tANI_U8 Oui[] )
3445{
3446 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[01], Oui ) );
3447}
3448
3449#ifdef NOT_CURRENTLY_USED
3450static tANI_BOOLEAN csrIsAuth802_1x( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
3451 tANI_U8 cAllSuites,
3452 tANI_U8 Oui[] )
3453{
3454 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[00], Oui ) );
3455}
3456#endif // NOT_CURRENTLY_USED
3457
3458static tANI_BOOLEAN csrIsAuthWpaPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE],
3459 tANI_U8 cAllSuites,
3460 tANI_U8 Oui[] )
3461{
3462 return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[02], Oui ) );
3463}
3464#if 0
3465static tANI_BOOLEAN csrIsUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3466 tANI_U8 cAllCyphers,
3467 tANI_U8 Oui[] )
3468{
3469 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui00, Oui ) );
3470}
3471
3472static tANI_BOOLEAN csrIsUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3473 tANI_U8 cAllCyphers,
3474 tANI_U8 Oui[] )
3475{
3476 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) );
3477}
3478
3479static tANI_BOOLEAN csrIsUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3480 tANI_U8 cAllCyphers,
3481 tANI_U8 Oui[] )
3482{
3483 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) );
3484}
3485
3486
3487static tANI_BOOLEAN csrIsMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3488 tANI_U8 cAllCyphers,
3489 tANI_U8 Oui[] )
3490{
3491 tANI_BOOLEAN fYes = FALSE;
3492
3493 // Check Wep 104 first, if fails, then check Wep40.
3494 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui05, Oui );
3495
3496 if ( !fYes )
3497 {
3498 // if not Wep-104, check Wep-40
3499 fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui01, Oui );
3500 }
3501
3502 return( fYes );
3503}
3504
3505
3506static tANI_BOOLEAN csrIsMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3507 tANI_U8 cAllCyphers,
3508 tANI_U8 Oui[] )
3509{
3510 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) );
3511}
3512
3513
3514static tANI_BOOLEAN csrIsMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE],
3515 tANI_U8 cAllCyphers,
3516 tANI_U8 Oui[] )
3517{
3518 return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) );
3519}
3520
3521#endif
3522
3523tANI_U8 csrGetOUIIndexFromCipher( eCsrEncryptionType enType )
3524{
3525 tANI_U8 OUIIndex;
3526
3527 switch ( enType )
3528 {
3529 case eCSR_ENCRYPT_TYPE_WEP40:
3530 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
3531 OUIIndex = CSR_OUI_WEP40_OR_1X_INDEX;
3532 break;
3533 case eCSR_ENCRYPT_TYPE_WEP104:
3534 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
3535 OUIIndex = CSR_OUI_WEP104_INDEX;
3536 break;
3537 case eCSR_ENCRYPT_TYPE_TKIP:
3538 OUIIndex = CSR_OUI_TKIP_OR_PSK_INDEX;
3539 break;
3540 case eCSR_ENCRYPT_TYPE_AES:
3541 OUIIndex = CSR_OUI_AES_INDEX;
3542 break;
3543 case eCSR_ENCRYPT_TYPE_NONE:
3544 OUIIndex = CSR_OUI_USE_GROUP_CIPHER_INDEX;
3545 break;
3546#ifdef FEATURE_WLAN_WAPI
3547 case eCSR_ENCRYPT_TYPE_WPI:
3548 OUIIndex = CSR_OUI_WAPI_WAI_CERT_OR_SMS4_INDEX;
3549 break;
3550#endif /* FEATURE_WLAN_WAPI */
3551 default: //HOWTO handle this?
3552 OUIIndex = CSR_OUI_RESERVED_INDEX;
3553 break;
3554 }//switch
3555
3556 return OUIIndex;
3557}
3558
3559tANI_BOOLEAN csrGetRSNInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
3560 tDot11fIERSN *pRSNIe,
3561 tANI_U8 *UnicastCypher,
3562 tANI_U8 *MulticastCypher,
3563 tANI_U8 *AuthSuite,
3564 tCsrRSNCapabilities *Capabilities,
3565 eCsrAuthType *pNegotiatedAuthtype,
3566 eCsrEncryptionType *pNegotiatedMCCipher )
3567{
3568 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3569 tANI_BOOLEAN fAcceptableCyphers = FALSE;
3570 tANI_U8 cUnicastCyphers = 0;
3571 tANI_U8 cMulticastCyphers = 0;
3572 tANI_U8 cAuthSuites = 0, i;
3573 tANI_U8 Unicast[ CSR_RSN_OUI_SIZE ];
3574 tANI_U8 Multicast[ CSR_RSN_OUI_SIZE ];
3575 tANI_U8 AuthSuites[ CSR_RSN_MAX_AUTH_SUITES ][ CSR_RSN_OUI_SIZE ];
3576 tANI_U8 Authentication[ CSR_RSN_OUI_SIZE ];
3577 tANI_U8 MulticastCyphers[ CSR_RSN_MAX_MULTICAST_CYPHERS ][ CSR_RSN_OUI_SIZE ];
3578 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
3579
3580 do{
3581 if ( pRSNIe->present )
3582 {
3583 cMulticastCyphers++;
3584 palCopyMemory(pMac->hHdd, MulticastCyphers, pRSNIe->gp_cipher_suite, CSR_RSN_OUI_SIZE);
3585 cUnicastCyphers = (tANI_U8)(pRSNIe->pwise_cipher_suite_count);
3586 cAuthSuites = (tANI_U8)(pRSNIe->akm_suite_count);
3587 for(i = 0; i < cAuthSuites && i < CSR_RSN_MAX_AUTH_SUITES; i++)
3588 {
3589 palCopyMemory(pMac->hHdd, (void *)&AuthSuites[i],
3590 (void *)&pRSNIe->akm_suites[i], CSR_RSN_OUI_SIZE);
3591 }
3592
3593 //Check - Is requested Unicast Cipher supported by the BSS.
3594 fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, pRSNIe->pwise_cipher_suites, cUnicastCyphers,
3595 csrGetOUIIndexFromCipher( enType ), Unicast );
3596
3597 if( !fAcceptableCyphers ) break;
3598
3599
3600 //Unicast is supported. Pick the first matching Group cipher, if any.
3601 for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
3602 {
3603 fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, MulticastCyphers, cMulticastCyphers,
3604 csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast );
3605 if(fAcceptableCyphers)
3606 {
3607 break;
3608 }
3609 }
3610 if( !fAcceptableCyphers ) break;
3611
3612 if( pNegotiatedMCCipher )
3613 *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
3614
3615 /* Initializing with FALSE as it has TRUE value already */
3616 fAcceptableCyphers = FALSE;
3617 for (i = 0 ; i < pAuthType->numEntries; i++)
3618 {
3619 //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
3620 #ifdef WLAN_FEATURE_VOWIFI_11R
3621 /* Changed the AKM suites according to order of preference */
3622 if ( csrIsFTAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
3623 {
3624 if (eCSR_AUTH_TYPE_FT_RSN == pAuthType->authType[i])
3625 negAuthType = eCSR_AUTH_TYPE_FT_RSN;
3626 }
3627 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsFTAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
3628 {
3629 if (eCSR_AUTH_TYPE_FT_RSN_PSK == pAuthType->authType[i])
3630 negAuthType = eCSR_AUTH_TYPE_FT_RSN_PSK;
3631 }
3632#endif
3633#ifdef FEATURE_WLAN_CCX
3634 /* CCX only supports 802.1X. No PSK. */
3635 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsCcxCckmAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
3636 {
3637 if (eCSR_AUTH_TYPE_CCKM_RSN == pAuthType->authType[i])
3638 negAuthType = eCSR_AUTH_TYPE_CCKM_RSN;
3639 }
3640#endif
3641 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) )
3642 {
3643 if (eCSR_AUTH_TYPE_RSN == pAuthType->authType[i])
3644 negAuthType = eCSR_AUTH_TYPE_RSN;
3645 }
3646 if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
3647 {
3648 if (eCSR_AUTH_TYPE_RSN_PSK == pAuthType->authType[i])
3649 negAuthType = eCSR_AUTH_TYPE_RSN_PSK;
3650 }
Chet Lanctot186b5732013-03-18 10:26:30 -07003651#ifdef WLAN_FEATURE_11W
3652 if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSNPskSha256( pMac, AuthSuites, cAuthSuites, Authentication ) )
3653 {
3654 if (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == pAuthType->authType[i])
3655 negAuthType = eCSR_AUTH_TYPE_RSN_PSK_SHA256;
3656 }
3657#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003658
3659 // The 1st auth type in the APs RSN IE, to match stations connecting
3660 // profiles auth type will cause us to exit this loop
3661 // This is added as some APs advertise multiple akms in the RSN IE.
3662 if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType)
3663 {
3664 fAcceptableCyphers = TRUE;
3665 break;
3666 }
3667 } // for
3668 }
3669
3670 }while (0);
3671
3672 if ( fAcceptableCyphers )
3673 {
3674 if ( MulticastCypher )
3675 {
3676 palCopyMemory( pMac->hHdd, MulticastCypher, Multicast, CSR_RSN_OUI_SIZE );
3677 }
3678
3679 if ( UnicastCypher )
3680 {
3681 palCopyMemory( pMac->hHdd, UnicastCypher, Unicast, CSR_RSN_OUI_SIZE );
3682 }
3683
3684 if ( AuthSuite )
3685 {
3686 palCopyMemory( pMac->hHdd, AuthSuite, Authentication, CSR_RSN_OUI_SIZE );
3687 }
3688
3689 if ( pNegotiatedAuthtype )
3690 {
3691 *pNegotiatedAuthtype = negAuthType;
3692 }
3693 if ( Capabilities )
3694 {
Venkata Prathyusha Kuntupalliea7098e2013-01-31 16:08:13 -08003695 Capabilities->PreAuthSupported = (pRSNIe->RSN_Cap[0] >> 0) & 0x1 ; // Bit 0 PreAuthentication
3696 Capabilities->NoPairwise = (pRSNIe->RSN_Cap[0] >> 1) & 0x1 ; // Bit 1 No Pairwise
3697 Capabilities->PTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 2) & 0x3 ; // Bit 2, 3 PTKSA Replay Counter
Chet Lanctot186b5732013-03-18 10:26:30 -07003698 Capabilities->GTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 4) & 0x3 ; // Bit 4, 5 GTKSA Replay Counter
3699#ifdef WLAN_FEATURE_11W
3700 Capabilities->MFPRequired = (pRSNIe->RSN_Cap[0] >> 6) & 0x1 ; // Bit 6 MFPR
3701 Capabilities->MFPCapable = (pRSNIe->RSN_Cap[0] >> 7) & 0x1 ; // Bit 7 MFPC
3702#endif
3703 Capabilities->Reserved = pRSNIe->RSN_Cap[1] & 0xff ; // remaining reserved
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 }
3705 }
3706 return( fAcceptableCyphers );
3707}
3708
3709
3710tANI_BOOLEAN csrIsRSNMatch( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType,
3711 tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCCipher )
3712{
3713 tANI_BOOLEAN fRSNMatch = FALSE;
3714
3715 // See if the cyphers in the Bss description match with the settings in the profile.
3716 fRSNMatch = csrGetRSNInformation( hHal, pAuthType, enType, pEnMcType, &pIes->RSN, NULL, NULL, NULL, NULL,
3717 pNegotiatedAuthType, pNegotiatedMCCipher );
3718
3719 return( fRSNMatch );
3720}
3721
3722
3723tANI_BOOLEAN csrLookupPMKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pPMKId )
3724{
3725 tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE;
3726 tANI_U32 Index;
3727 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3728
Jeff Johnson32d95a32012-09-10 13:15:23 -07003729 if(!pSession)
3730 {
3731 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
3732 return FALSE;
3733 }
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003734 /* to force the AP initiate fresh 802.1x authentication after re-association should not
3735 * fill the PMKID from cache this is needed
3736 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3737
3738 if(pSession->fIgnorePMKIDCache)
3739 {
3740 pSession->fIgnorePMKIDCache = FALSE;
3741 return fRC;
3742 }
3743
Jeff Johnson295189b2012-06-20 16:38:30 -07003744 do
3745 {
3746 for( Index=0; Index < pSession->NumPmkidCache; Index++ )
3747 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003748 smsLog(pMac, LOGW, "match PMKID %02X-%02X-%02X-%02X-%02X-%02X to ",
Jeff Johnson295189b2012-06-20 16:38:30 -07003749 pBSSId[0], pBSSId[1], pBSSId[2], pBSSId[3], pBSSId[4], pBSSId[5]);
3750 if( palEqualMemory( pMac->hHdd, pBSSId, pSession->PmkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) )
3751 {
3752 // match found
3753 fMatchFound = TRUE;
3754 break;
3755 }
3756 }
3757
3758 if( !fMatchFound ) break;
3759
3760 palCopyMemory( pMac->hHdd, pPMKId, pSession->PmkidCacheInfo[Index].PMKID, CSR_RSN_PMKID_SIZE );
3761
3762 fRC = TRUE;
3763 }
3764 while( 0 );
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003765 smsLog(pMac, LOGW, "csrLookupPMKID called return match = %d pMac->roam.NumPmkidCache = %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07003766 fRC, pSession->NumPmkidCache);
3767
3768 return fRC;
3769}
3770
3771
3772tANI_U8 csrConstructRSNIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
3773 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe )
3774{
3775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3776 tANI_BOOLEAN fRSNMatch;
3777 tANI_U8 cbRSNIe = 0;
3778 tANI_U8 UnicastCypher[ CSR_RSN_OUI_SIZE ];
3779 tANI_U8 MulticastCypher[ CSR_RSN_OUI_SIZE ];
3780 tANI_U8 AuthSuite[ CSR_RSN_OUI_SIZE ];
3781 tCsrRSNAuthIe *pAuthSuite;
3782 tCsrRSNCapabilities RSNCapabilities;
3783 tCsrRSNPMKIe *pPMK;
3784 tANI_U8 PMKId[CSR_RSN_PMKID_SIZE];
3785 tDot11fBeaconIEs *pIesLocal = pIes;
3786
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07003787 smsLog(pMac, LOGW, "%s called...", __func__);
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003788
Jeff Johnson295189b2012-06-20 16:38:30 -07003789 do
3790 {
3791 if ( !csrIsProfileRSN( pProfile ) ) break;
3792
3793 if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
3794 {
3795 break;
3796 }
3797
3798 // See if the cyphers in the Bss description match with the settings in the profile.
3799 fRSNMatch = csrGetRSNInformation( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType,
3800 &pProfile->mcEncryptionType, &pIesLocal->RSN,
3801 UnicastCypher, MulticastCypher, AuthSuite, &RSNCapabilities, NULL, NULL );
3802 if ( !fRSNMatch ) break;
3803
3804 pRSNIe->IeHeader.ElementID = SIR_MAC_RSN_EID;
3805
3806 pRSNIe->Version = CSR_RSN_VERSION_SUPPORTED;
3807
3808 palCopyMemory( pMac->hHdd, pRSNIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ) );
3809
3810 pRSNIe->cUnicastCyphers = 1;
3811
3812 palCopyMemory( pMac->hHdd, &pRSNIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ) );
3813
3814 pAuthSuite = (tCsrRSNAuthIe *)( &pRSNIe->UnicastOui[ pRSNIe->cUnicastCyphers ] );
3815
3816 pAuthSuite->cAuthenticationSuites = 1;
3817 palCopyMemory( pMac->hHdd, &pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) );
3818
3819 // RSN capabilities follows the Auth Suite (two octects)
3820 // !!REVIEW - What should STA put in RSN capabilities, currently
3821 // just putting back APs capabilities
3822 // For one, we shouldn't EVER be sending out "pre-auth supported". It is an AP only capability
Chet Lanctot186b5732013-03-18 10:26:30 -07003823 // For another, we should use the Management Frame Protection values given by the supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07003824 RSNCapabilities.PreAuthSupported = 0;
Chet Lanctot186b5732013-03-18 10:26:30 -07003825#ifdef WLAN_FEATURE_11W
3826 RSNCapabilities.MFPRequired = pProfile->MFPRequired;
3827 RSNCapabilities.MFPCapable = pProfile->MFPCapable;
3828#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003829 *(tANI_U16 *)( &pAuthSuite->AuthOui[ 1 ] ) = *((tANI_U16 *)(&RSNCapabilities));
3830
3831 pPMK = (tCsrRSNPMKIe *)( ((tANI_U8 *)(&pAuthSuite->AuthOui[ 1 ])) + sizeof(tANI_U16) );
3832
3833 if( csrLookupPMKID( pMac, sessionId, pSirBssDesc->bssId, &(PMKId[0]) ) )
3834 {
3835 pPMK->cPMKIDs = 1;
3836
3837 palCopyMemory( pMac->hHdd, pPMK->PMKIDList[0].PMKID, PMKId, CSR_RSN_PMKID_SIZE );
3838 }
3839 else
3840 {
3841 pPMK->cPMKIDs = 0;
3842 }
3843
3844 // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length
3845 // Add in the size of the Auth suite (count plus a single OUI)
3846 // Add in the RSN caps field.
3847 // Add PMKID count and PMKID (if any)
3848 pRSNIe->IeHeader.Length = (tANI_U8) (sizeof( *pRSNIe ) - sizeof ( pRSNIe->IeHeader ) +
3849 sizeof( *pAuthSuite ) +
3850 sizeof( tCsrRSNCapabilities ));
3851 if(pPMK->cPMKIDs)
3852 {
3853 pRSNIe->IeHeader.Length += (tANI_U8)(sizeof( tANI_U16 ) +
3854 (pPMK->cPMKIDs * CSR_RSN_PMKID_SIZE));
3855 }
3856 // return the size of the IE header (total) constructed...
3857 cbRSNIe = pRSNIe->IeHeader.Length + sizeof( pRSNIe->IeHeader );
3858
3859 } while( 0 );
3860
3861 if( !pIes && pIesLocal )
3862 {
3863 //locally allocated
3864 palFreeMemory(pMac->hHdd, pIesLocal);
3865 }
3866
3867 return( cbRSNIe );
3868}
3869
3870
3871#ifdef FEATURE_WLAN_WAPI
3872tANI_BOOLEAN csrGetWapiInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
3873 tDot11fIEWAPI *pWapiIe,
3874 tANI_U8 *UnicastCypher,
3875 tANI_U8 *MulticastCypher,
3876 tANI_U8 *AuthSuite,
3877 eCsrAuthType *pNegotiatedAuthtype,
3878 eCsrEncryptionType *pNegotiatedMCCipher )
3879{
3880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3881 tANI_BOOLEAN fAcceptableCyphers = FALSE;
3882 tANI_U8 cUnicastCyphers = 0;
3883 tANI_U8 cMulticastCyphers = 0;
3884 tANI_U8 cAuthSuites = 0, i;
3885 tANI_U8 Unicast[ CSR_WAPI_OUI_SIZE ];
3886 tANI_U8 Multicast[ CSR_WAPI_OUI_SIZE ];
3887 tANI_U8 AuthSuites[ CSR_WAPI_MAX_AUTH_SUITES ][ CSR_WAPI_OUI_SIZE ];
3888 tANI_U8 Authentication[ CSR_WAPI_OUI_SIZE ];
3889 tANI_U8 MulticastCyphers[ CSR_WAPI_MAX_MULTICAST_CYPHERS ][ CSR_WAPI_OUI_SIZE ];
3890 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
3891
3892 do{
3893 if ( pWapiIe->present )
3894 {
3895 cMulticastCyphers++;
3896 palCopyMemory(pMac->hHdd, MulticastCyphers, pWapiIe->multicast_cipher_suite, CSR_WAPI_OUI_SIZE);
3897 cUnicastCyphers = (tANI_U8)(pWapiIe->unicast_cipher_suite_count);
3898 cAuthSuites = (tANI_U8)(pWapiIe->akm_suite_count);
3899 for(i = 0; i < cAuthSuites && i < CSR_WAPI_MAX_AUTH_SUITES; i++)
3900 {
3901 palCopyMemory(pMac->hHdd, (void *)&AuthSuites[i],
3902 (void *)&pWapiIe->akm_suites[i], CSR_WAPI_OUI_SIZE);
3903 }
3904
3905 //Check - Is requested Unicast Cipher supported by the BSS.
3906 fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, pWapiIe->unicast_cipher_suites, cUnicastCyphers,
3907 csrGetOUIIndexFromCipher( enType ), Unicast );
3908
3909 if( !fAcceptableCyphers ) break;
3910
3911
3912 //Unicast is supported. Pick the first matching Group cipher, if any.
3913 for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
3914 {
3915 fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, MulticastCyphers, cMulticastCyphers,
3916 csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast );
3917 if(fAcceptableCyphers)
3918 {
3919 break;
3920 }
3921 }
3922 if( !fAcceptableCyphers ) break;
3923
3924 if( pNegotiatedMCCipher )
3925 *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
3926
3927 //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
3928 if ( csrIsAuthWapiCert( pMac, AuthSuites, cAuthSuites, Authentication ) )
3929 {
3930 negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
3931 }
3932 else if ( csrIsAuthWapiPsk( pMac, AuthSuites, cAuthSuites, Authentication ) )
3933 {
3934 negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_PSK;
3935 }
3936 else
3937 {
3938 fAcceptableCyphers = FALSE;
3939 negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
3940 }
3941 if( ( 0 == pAuthType->numEntries ) || ( FALSE == fAcceptableCyphers ) )
3942 {
3943 //Caller doesn't care about auth type, or BSS doesn't match
3944 break;
3945 }
3946 fAcceptableCyphers = FALSE;
3947 for( i = 0 ; i < pAuthType->numEntries; i++ )
3948 {
3949 if( pAuthType->authType[i] == negAuthType )
3950 {
3951 fAcceptableCyphers = TRUE;
3952 break;
3953 }
3954 }
3955 }
3956 }while (0);
3957
3958 if ( fAcceptableCyphers )
3959 {
3960 if ( MulticastCypher )
3961 {
3962 palCopyMemory( pMac->hHdd, MulticastCypher, Multicast, CSR_WAPI_OUI_SIZE );
3963 }
3964
3965 if ( UnicastCypher )
3966 {
3967 palCopyMemory( pMac->hHdd, UnicastCypher, Unicast, CSR_WAPI_OUI_SIZE );
3968 }
3969
3970 if ( AuthSuite )
3971 {
3972 palCopyMemory( pMac->hHdd, AuthSuite, Authentication, CSR_WAPI_OUI_SIZE );
3973 }
3974
3975 if ( pNegotiatedAuthtype )
3976 {
3977 *pNegotiatedAuthtype = negAuthType;
3978 }
3979 }
3980 return( fAcceptableCyphers );
3981}
3982
3983tANI_BOOLEAN csrIsWapiMatch( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType,
3984 tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCCipher )
3985{
3986 tANI_BOOLEAN fWapiMatch = FALSE;
3987
3988 // See if the cyphers in the Bss description match with the settings in the profile.
3989 fWapiMatch = csrGetWapiInformation( hHal, pAuthType, enType, pEnMcType, &pIes->WAPI, NULL, NULL, NULL,
3990 pNegotiatedAuthType, pNegotiatedMCCipher );
3991
3992 return( fWapiMatch );
3993}
3994
3995tANI_BOOLEAN csrLookupBKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pBKId )
3996{
3997 tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE;
3998 tANI_U32 Index;
3999 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
4000
Jeff Johnson32d95a32012-09-10 13:15:23 -07004001 if(!pSession)
4002 {
4003 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
4004 return FALSE;
4005 }
4006
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 do
4008 {
4009 for( Index=0; Index < pSession->NumBkidCache; Index++ )
4010 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004011 smsLog(pMac, LOGW, "match BKID %02X-%02X-%02X-%02X-%02X-%02X to ",
Jeff Johnson295189b2012-06-20 16:38:30 -07004012 pBSSId[0], pBSSId[1], pBSSId[2], pBSSId[3], pBSSId[4], pBSSId[5]);
4013 if( palEqualMemory( pMac->hHdd, pBSSId, pSession->BkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) )
4014 {
4015 // match found
4016 fMatchFound = TRUE;
4017 break;
4018 }
4019 }
4020
4021 if( !fMatchFound ) break;
4022
4023 palCopyMemory( pMac->hHdd, pBKId, pSession->BkidCacheInfo[Index].BKID, CSR_WAPI_BKID_SIZE );
4024
4025 fRC = TRUE;
4026 }
4027 while( 0 );
4028 smsLog(pMac, LOGW, "csrLookupBKID called return match = %d pMac->roam.NumBkidCache = %d", fRC, pSession->NumBkidCache);
4029
4030 return fRC;
4031}
4032
4033tANI_U8 csrConstructWapiIe( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
4034 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe )
4035{
4036 tANI_BOOLEAN fWapiMatch = FALSE;
4037 tANI_U8 cbWapiIe = 0;
4038 tANI_U8 UnicastCypher[ CSR_WAPI_OUI_SIZE ];
4039 tANI_U8 MulticastCypher[ CSR_WAPI_OUI_SIZE ];
4040 tANI_U8 AuthSuite[ CSR_WAPI_OUI_SIZE ];
4041 tANI_U8 BKId[CSR_WAPI_BKID_SIZE];
4042 tANI_U8 *pWapi = NULL;
4043 tANI_BOOLEAN fBKIDFound = FALSE;
4044 tDot11fBeaconIEs *pIesLocal = pIes;
4045
4046 do
4047 {
4048 if ( !csrIsProfileWapi( pProfile ) ) break;
4049
4050 if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
4051 {
4052 break;
4053 }
4054
4055 // See if the cyphers in the Bss description match with the settings in the profile.
4056 fWapiMatch = csrGetWapiInformation( pMac, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType,
4057 &pProfile->mcEncryptionType, &pIesLocal->WAPI,
4058 UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL );
4059 if ( !fWapiMatch ) break;
4060
4061 palZeroMemory(pMac->hHdd, pWapiIe, sizeof(tCsrWapiIe));
4062
4063 pWapiIe->IeHeader.ElementID = DOT11F_EID_WAPI;
4064
4065 pWapiIe->Version = CSR_WAPI_VERSION_SUPPORTED;
4066
4067 pWapiIe->cAuthenticationSuites = 1;
4068 palCopyMemory( pMac->hHdd, &pWapiIe->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) );
4069
4070 pWapi = (tANI_U8 *) (&pWapiIe->AuthOui[ 1 ]);
4071
4072 *pWapi = (tANI_U16)1; //cUnicastCyphers
4073 pWapi+=2;
4074 palCopyMemory( pMac->hHdd, pWapi, UnicastCypher, sizeof( UnicastCypher ) );
4075 pWapi += sizeof( UnicastCypher );
4076
4077 palCopyMemory( pMac->hHdd, pWapi, MulticastCypher, sizeof( MulticastCypher ) );
4078 pWapi += sizeof( MulticastCypher );
4079
4080
4081 // WAPI capabilities follows the Auth Suite (two octects)
4082 // we shouldn't EVER be sending out "pre-auth supported". It is an AP only capability
4083 // & since we already did a memset pWapiIe to 0, skip these fields
4084 pWapi +=2;
4085
4086 fBKIDFound = csrLookupBKID( pMac, sessionId, pSirBssDesc->bssId, &(BKId[0]) );
4087
4088
4089 if( fBKIDFound )
4090 {
4091 /* Do we need to change the endianness here */
4092 *pWapi = (tANI_U16)1; //cBKIDs
4093 pWapi+=2;
4094 palCopyMemory( pMac->hHdd, pWapi, BKId, CSR_WAPI_BKID_SIZE );
4095 }
4096 else
4097 {
4098 *pWapi = 0;
4099 pWapi+=1;
4100 *pWapi = 0;
4101 pWapi+=1;
4102 }
4103
4104 // Add in the IE fields except the IE header
4105 // Add BKID count and BKID (if any)
4106 pWapiIe->IeHeader.Length = (tANI_U8) (sizeof( *pWapiIe ) - sizeof ( pWapiIe->IeHeader ));
4107
4108 /*2 bytes for BKID Count field*/
4109 pWapiIe->IeHeader.Length += sizeof( tANI_U16 );
4110
4111 if(fBKIDFound)
4112 {
4113 pWapiIe->IeHeader.Length += CSR_WAPI_BKID_SIZE;
4114 }
4115 // return the size of the IE header (total) constructed...
4116 cbWapiIe = pWapiIe->IeHeader.Length + sizeof( pWapiIe->IeHeader );
4117
4118 } while( 0 );
4119
4120 if( !pIes && pIesLocal )
4121 {
4122 //locally allocated
4123 palFreeMemory(pMac->hHdd, pIesLocal);
4124 }
4125
4126 return( cbWapiIe );
4127}
4128#endif /* FEATURE_WLAN_WAPI */
4129
4130tANI_BOOLEAN csrGetWpaCyphers( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption,
4131 tDot11fIEWPA *pWpaIe,
4132 tANI_U8 *UnicastCypher,
4133 tANI_U8 *MulticastCypher,
4134 tANI_U8 *AuthSuite,
4135 eCsrAuthType *pNegotiatedAuthtype,
4136 eCsrEncryptionType *pNegotiatedMCCipher )
4137{
4138 tANI_BOOLEAN fAcceptableCyphers = FALSE;
4139 tANI_U8 cUnicastCyphers = 0;
4140 tANI_U8 cMulticastCyphers = 0;
4141 tANI_U8 cAuthSuites = 0;
4142 tANI_U8 Unicast[ CSR_WPA_OUI_SIZE ];
4143 tANI_U8 Multicast[ CSR_WPA_OUI_SIZE ];
4144 tANI_U8 Authentication[ CSR_WPA_OUI_SIZE ];
4145 tANI_U8 MulticastCyphers[ 1 ][ CSR_WPA_OUI_SIZE ];
4146 tANI_U8 i;
4147 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
4148
4149 do
4150 {
4151 if ( pWpaIe->present )
4152 {
4153 cMulticastCyphers = 1;
4154 palCopyMemory(pMac->hHdd, MulticastCyphers, pWpaIe->multicast_cipher, CSR_WPA_OUI_SIZE);
4155 cUnicastCyphers = (tANI_U8)(pWpaIe->unicast_cipher_count);
4156 cAuthSuites = (tANI_U8)(pWpaIe->auth_suite_count);
4157
4158 //Check - Is requested Unicast Cipher supported by the BSS.
4159 fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, pWpaIe->unicast_ciphers, cUnicastCyphers,
4160 csrGetOUIIndexFromCipher( enType ), Unicast );
4161
4162 if( !fAcceptableCyphers ) break;
4163
4164
4165 //Unicast is supported. Pick the first matching Group cipher, if any.
4166 for( i = 0 ; i < pMCEncryption->numEntries ; i++ )
4167 {
4168 fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, MulticastCyphers, cMulticastCyphers,
4169 csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i]), Multicast );
4170 if(fAcceptableCyphers)
4171 {
4172 break;
4173 }
4174 }
4175 if( !fAcceptableCyphers ) break;
4176
4177 if( pNegotiatedMCCipher )
4178 *pNegotiatedMCCipher = pMCEncryption->encryptionType[i];
4179
4180 /* Initializing with FALSE as it has TRUE value already */
4181 fAcceptableCyphers = FALSE;
4182 for (i = 0 ; i < pAuthType->numEntries; i++)
4183 {
4184 //Ciphers are supported, Match authentication algorithm and pick first matching authtype.
4185 if ( csrIsAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
4186 {
4187 if (eCSR_AUTH_TYPE_WPA == pAuthType->authType[i])
4188 negAuthType = eCSR_AUTH_TYPE_WPA;
4189 }
4190 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthWpaPsk( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
4191 {
4192 if (eCSR_AUTH_TYPE_WPA_PSK == pAuthType->authType[i])
4193 negAuthType = eCSR_AUTH_TYPE_WPA_PSK;
4194 }
4195#ifdef FEATURE_WLAN_CCX
4196 if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsCcxCckmAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) )
4197 {
4198 if (eCSR_AUTH_TYPE_CCKM_WPA == pAuthType->authType[i])
4199 negAuthType = eCSR_AUTH_TYPE_CCKM_WPA;
4200 }
4201#endif /* FEATURE_WLAN_CCX */
4202
4203 // The 1st auth type in the APs WPA IE, to match stations connecting
4204 // profiles auth type will cause us to exit this loop
4205 // This is added as some APs advertise multiple akms in the WPA IE.
4206 if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType)
4207 {
4208 fAcceptableCyphers = TRUE;
4209 break;
4210 }
4211 } // for
4212 }
4213 }while(0);
4214
4215 if ( fAcceptableCyphers )
4216 {
4217 if ( MulticastCypher )
4218 {
4219 palCopyMemory( pMac->hHdd, (tANI_U8 **)MulticastCypher, Multicast, CSR_WPA_OUI_SIZE );
4220 }
4221
4222 if ( UnicastCypher )
4223 {
4224 palCopyMemory( pMac->hHdd, (tANI_U8 **)UnicastCypher, Unicast, CSR_WPA_OUI_SIZE );
4225 }
4226
4227 if ( AuthSuite )
4228 {
4229 palCopyMemory( pMac->hHdd, (tANI_U8 **)AuthSuite, Authentication, CSR_WPA_OUI_SIZE );
4230 }
4231
4232 if( pNegotiatedAuthtype )
4233 {
4234 *pNegotiatedAuthtype = negAuthType;
4235 }
4236 }
4237
4238 return( fAcceptableCyphers );
4239}
4240
4241
4242
4243tANI_BOOLEAN csrIsWpaEncryptionMatch( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType,
4244 tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthtype, eCsrEncryptionType *pNegotiatedMCCipher )
4245{
4246 tANI_BOOLEAN fWpaMatch = eANI_BOOLEAN_FALSE;
4247
4248 // See if the cyphers in the Bss description match with the settings in the profile.
4249 fWpaMatch = csrGetWpaCyphers( pMac, pAuthType, enType, pEnMcType, &pIes->WPA, NULL, NULL, NULL, pNegotiatedAuthtype, pNegotiatedMCCipher );
4250
4251 return( fWpaMatch );
4252}
4253
4254
4255tANI_U8 csrConstructWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc,
4256 tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe )
4257{
4258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4259 tANI_BOOLEAN fWpaMatch;
4260 tANI_U8 cbWpaIe = 0;
4261 tANI_U8 UnicastCypher[ CSR_WPA_OUI_SIZE ];
4262 tANI_U8 MulticastCypher[ CSR_WPA_OUI_SIZE ];
4263 tANI_U8 AuthSuite[ CSR_WPA_OUI_SIZE ];
4264 tCsrWpaAuthIe *pAuthSuite;
4265 tDot11fBeaconIEs *pIesLocal = pIes;
4266
4267 do
4268 {
4269 if ( !csrIsProfileWpa( pProfile ) ) break;
4270
4271 if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) )
4272 {
4273 break;
4274 }
4275 // See if the cyphers in the Bss description match with the settings in the profile.
4276 fWpaMatch = csrGetWpaCyphers( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, &pProfile->mcEncryptionType,
4277 &pIesLocal->WPA, UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL );
4278 if ( !fWpaMatch ) break;
4279
4280 pWpaIe->IeHeader.ElementID = SIR_MAC_WPA_EID;
4281
4282 palCopyMemory( pMac->hHdd, pWpaIe->Oui, csrWpaOui[01], sizeof( pWpaIe->Oui ) );
4283
4284 pWpaIe->Version = CSR_WPA_VERSION_SUPPORTED;
4285
4286 palCopyMemory( pMac->hHdd, pWpaIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ) );
4287
4288 pWpaIe->cUnicastCyphers = 1;
4289
4290 palCopyMemory( pMac->hHdd, &pWpaIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ) );
4291
4292 pAuthSuite = (tCsrWpaAuthIe *)( &pWpaIe->UnicastOui[ pWpaIe->cUnicastCyphers ] );
4293
4294 pAuthSuite->cAuthenticationSuites = 1;
4295 palCopyMemory( pMac->hHdd, &pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) );
4296
4297 // The WPA capabilities follows the Auth Suite (two octects)--
4298 // this field is optional, and we always "send" zero, so just
4299 // remove it. This is consistent with our assumptions in the
4300 // frames compiler; c.f. bug 15234:
4301 // http://gold.woodsidenet.com/bugzilla/show_bug.cgi?id=15234
4302
4303 // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length
4304 // Add in the size of the Auth suite (count plus a single OUI)
4305 pWpaIe->IeHeader.Length = sizeof( *pWpaIe ) - sizeof ( pWpaIe->IeHeader ) +
4306 sizeof( *pAuthSuite );
4307
4308 // return the size of the IE header (total) constructed...
4309 cbWpaIe = pWpaIe->IeHeader.Length + sizeof( pWpaIe->IeHeader );
4310
4311 } while( 0 );
4312
4313 if( !pIes && pIesLocal )
4314 {
4315 //locally allocated
4316 palFreeMemory(pMac->hHdd, pIesLocal);
4317 }
4318
4319 return( cbWpaIe );
4320}
4321
4322
4323tANI_BOOLEAN csrGetWpaRsnIe( tHalHandle hHal, tANI_U8 *pIes, tANI_U32 len,
4324 tANI_U8 *pWpaIe, tANI_U8 *pcbWpaIe, tANI_U8 *pRSNIe, tANI_U8 *pcbRSNIe)
4325{
4326 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4327 tDot11IEHeader *pIEHeader;
4328 tSirMacPropIE *pSirMacPropIE;
4329 tANI_U32 cbParsed;
4330 tANI_U32 cbIE;
4331 int cExpectedIEs = 0;
4332 int cFoundIEs = 0;
4333 int cbPropIETotal;
4334
4335 pIEHeader = (tDot11IEHeader *)pIes;
4336 if(pWpaIe) cExpectedIEs++;
4337 if(pRSNIe) cExpectedIEs++;
4338
4339 // bss description length includes all fields other than the length itself
4340 cbParsed = 0;
4341
4342 // Loop as long as there is data left in the IE of the Bss Description
4343 // and the number of Expected IEs is NOT found yet.
4344 while( ( (cbParsed + sizeof( *pIEHeader )) <= len ) && ( cFoundIEs < cExpectedIEs ) )
4345 {
4346 cbIE = sizeof( *pIEHeader ) + pIEHeader->Length;
4347
4348 if ( ( cbIE + cbParsed ) > len ) break;
4349
4350 if ( ( pIEHeader->Length >= gCsrIELengthTable[ pIEHeader->ElementID ].min ) &&
4351 ( pIEHeader->Length <= gCsrIELengthTable[ pIEHeader->ElementID ].max ) )
4352 {
4353 switch( pIEHeader->ElementID )
4354 {
4355 // Parse the 221 (0xdd) Proprietary IEs here...
4356 // Note that the 221 IE is overloaded, containing the WPA IE, WMM/WME IE, and the
4357 // Airgo proprietary IE information.
4358 case SIR_MAC_WPA_EID:
4359 {
4360 tANI_U32 aniOUI;
4361 tANI_U8 *pOui = (tANI_U8 *)&aniOUI;
4362
4363 pOui++;
4364 aniOUI = ANI_OUI;
4365 aniOUI = i_ntohl( aniOUI );
4366
4367 pSirMacPropIE = ( tSirMacPropIE *)pIEHeader;
4368 cbPropIETotal = pSirMacPropIE->length;
4369
4370 // Validate the ANI OUI is in the OUI field in the proprietary IE...
4371 if ( ( pSirMacPropIE->length >= WNI_CFG_MANUFACTURER_OUI_LEN ) &&
4372 pOui[ 0 ] == pSirMacPropIE->oui[ 0 ] &&
4373 pOui[ 1 ] == pSirMacPropIE->oui[ 1 ] &&
4374 pOui[ 2 ] == pSirMacPropIE->oui[ 2 ] )
4375 {
4376 }
4377 else
4378 {
4379 tCsrWpaIe *pIe = ( tCsrWpaIe * )pIEHeader;
4380
4381 if(!pWpaIe || !pcbWpaIe) break;
4382 // Check if this is a valid WPA IE. Then check that the
4383 // WPA OUI is in place and the version is one that we support.
4384 if ( ( pIe->IeHeader.Length >= SIR_MAC_WPA_IE_MIN_LENGTH ) &&
4385 ( palEqualMemory(pMac->hHdd, pIe->Oui, (void *)csrWpaOui[1], sizeof( pIe->Oui ) ) ) &&
4386 ( pIe->Version <= CSR_WPA_VERSION_SUPPORTED ) )
4387 {
4388 palCopyMemory(pMac->hHdd, pWpaIe, pIe, pIe->IeHeader.Length + sizeof( pIe->IeHeader ) );
4389 *pcbWpaIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader );
4390 cFoundIEs++;
4391
4392 break;
4393 }
4394 }
4395
4396 break;
4397 }
4398
4399 case SIR_MAC_RSN_EID:
4400 {
4401 tCsrRSNIe *pIe;
4402
4403 if(!pcbRSNIe || !pRSNIe) break;
4404 pIe = (tCsrRSNIe *)pIEHeader;
4405
4406 // Check the length of the RSN Ie to assure it is valid. Then check that the
4407 // version is one that we support.
4408
4409 if ( pIe->IeHeader.Length < SIR_MAC_RSN_IE_MIN_LENGTH ) break;
4410 if ( pIe->Version > CSR_RSN_VERSION_SUPPORTED ) break;
4411
4412 cFoundIEs++;
4413
4414 // if there is enough room in the WpaIE passed in, then copy the Wpa IE into
4415 // the buffer passed in.
4416 if ( *pcbRSNIe < pIe->IeHeader.Length + sizeof( pIe->IeHeader ) ) break;
4417 palCopyMemory(pMac->hHdd, pRSNIe, pIe, pIe->IeHeader.Length + sizeof( pIe->IeHeader ) );
4418 *pcbRSNIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader );
4419
4420 break;
4421 }
4422
4423 // Add support for other IE here...
4424 default:
4425 break;
4426 }
4427 }
4428
4429 cbParsed += cbIE;
4430
4431 pIEHeader = (tDot11IEHeader *)( ((tANI_U8 *)pIEHeader) + cbIE );
4432
4433 }
4434
4435 // return a BOOL that tells if all of the IEs asked for were found...
4436 return( cFoundIEs == cExpectedIEs );
4437}
4438
4439
4440//If a WPAIE exists in the profile, just use it. Or else construct one from the BSS
4441//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
4442tANI_U8 csrRetrieveWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc,
4443 tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe )
4444{
4445 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4446 tANI_U8 cbWpaIe = 0;
4447
4448 do
4449 {
4450 if ( !csrIsProfileWpa( pProfile ) ) break;
4451 if(pProfile->nWPAReqIELength && pProfile->pWPAReqIE)
4452 {
4453 if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nWPAReqIELength)
4454 {
4455 cbWpaIe = (tANI_U8)pProfile->nWPAReqIELength;
4456 palCopyMemory(pMac->hHdd, pWpaIe, pProfile->pWPAReqIE, cbWpaIe);
4457 }
4458 else
4459 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004460 smsLog(pMac, LOGW, " csrRetrieveWpaIe detect invalid WPA IE length (%d) ", pProfile->nWPAReqIELength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004461 }
4462 }
4463 else
4464 {
4465 cbWpaIe = csrConstructWpaIe(pMac, pProfile, pSirBssDesc, pIes, pWpaIe);
4466 }
4467 }while(0);
4468
4469 return (cbWpaIe);
4470}
4471
4472
4473//If a RSNIE exists in the profile, just use it. Or else construct one from the BSS
4474//Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE
4475tANI_U8 csrRetrieveRsnIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile,
4476 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRsnIe )
4477{
4478 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4479 tANI_U8 cbRsnIe = 0;
4480
4481 do
4482 {
4483 if ( !csrIsProfileRSN( pProfile ) ) break;
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004484#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304485 if (csrRoamIsFastRoamEnabled(pMac, sessionId))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004486 {
4487 // If "Legacy Fast Roaming" is enabled ALWAYS rebuild the RSN IE from
4488 // scratch. So it contains the current PMK-IDs
4489 cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe);
4490 }
4491 else
4492#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 if(pProfile->nRSNReqIELength && pProfile->pRSNReqIE)
4494 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004495 // If you have one started away, re-use it.
Jeff Johnson295189b2012-06-20 16:38:30 -07004496 if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nRSNReqIELength)
4497 {
4498 cbRsnIe = (tANI_U8)pProfile->nRSNReqIELength;
4499 palCopyMemory(pMac->hHdd, pRsnIe, pProfile->pRSNReqIE, cbRsnIe);
4500 }
4501 else
4502 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004503 smsLog(pMac, LOGW, " csrRetrieveRsnIe detect invalid RSN IE length (%d) ", pProfile->nRSNReqIELength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004504 }
4505 }
4506 else
4507 {
4508 cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe);
4509 }
4510 }while(0);
4511
4512 return (cbRsnIe);
4513}
4514
4515
4516#ifdef FEATURE_WLAN_WAPI
4517//If a WAPI IE exists in the profile, just use it. Or else construct one from the BSS
4518//Caller allocated memory for pWapiIe and guarrantee it can contain a max length WAPI IE
4519tANI_U8 csrRetrieveWapiIe( tHalHandle hHal, tANI_U32 sessionId,
4520 tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc,
4521 tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe )
4522{
4523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4524 tANI_U8 cbWapiIe = 0;
4525
4526 do
4527 {
4528 if ( !csrIsProfileWapi( pProfile ) ) break;
4529 if(pProfile->nWAPIReqIELength && pProfile->pWAPIReqIE)
4530 {
4531 if(DOT11F_IE_WAPI_MAX_LEN >= pProfile->nWAPIReqIELength)
4532 {
4533 cbWapiIe = (tANI_U8)pProfile->nWAPIReqIELength;
4534 palCopyMemory(pMac->hHdd, pWapiIe, pProfile->pWAPIReqIE, cbWapiIe);
4535 }
4536 else
4537 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004538 smsLog(pMac, LOGW, " csrRetrieveWapiIe detect invalid WAPI IE length (%d) ", pProfile->nWAPIReqIELength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004539 }
4540 }
4541 else
4542 {
4543 cbWapiIe = csrConstructWapiIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pWapiIe);
4544 }
4545 }while(0);
4546
4547 return (cbWapiIe);
4548}
4549#endif /* FEATURE_WLAN_WAPI */
4550
4551tANI_BOOLEAN csrSearchChannelListForTxPower(tHalHandle hHal, tSirBssDescription *pBssDescription, tCsrChannelSet *returnChannelGroup)
4552{
4553 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4554 tListElem *pEntry;
4555 tANI_U16 i;
4556 tANI_U16 startingChannel;
4557 tANI_BOOLEAN found = FALSE;
4558 tCsrChannelSet *pChannelGroup;
4559
4560 pEntry = csrLLPeekHead( &pMac->roam.channelList5G, LL_ACCESS_LOCK );
4561
4562 while ( pEntry )
4563 {
4564 pChannelGroup = GET_BASE_ADDR( pEntry, tCsrChannelSet, channelListLink );
4565 startingChannel = pChannelGroup->firstChannel;
4566 for ( i = 0; i < pChannelGroup->numChannels; i++ )
4567 {
4568 if ( startingChannel + i * pChannelGroup->interChannelOffset == pBssDescription->channelId )
4569 {
4570 found = TRUE;
4571 break;
4572 }
4573 }
4574
4575 if ( found )
4576 {
4577 palCopyMemory(pMac->hHdd, returnChannelGroup, pChannelGroup, sizeof(tCsrChannelSet));
4578 break;
4579 }
4580 else
4581 {
4582 pEntry = csrLLNext( &pMac->roam.channelList5G, pEntry, LL_ACCESS_LOCK );
4583 }
4584 }
4585
4586 return( found );
4587}
4588
4589tANI_BOOLEAN csrRatesIsDot11Rate11bSupportedRate( tANI_U8 dot11Rate )
4590{
4591 tANI_BOOLEAN fSupported = FALSE;
4592 tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) );
4593
4594 switch ( nonBasicRate )
4595 {
4596 case eCsrSuppRate_1Mbps:
4597 case eCsrSuppRate_2Mbps:
4598 case eCsrSuppRate_5_5Mbps:
4599 case eCsrSuppRate_11Mbps:
4600 fSupported = TRUE;
4601 break;
4602
4603 default:
4604 break;
4605 }
4606
4607 return( fSupported );
4608}
4609
4610tANI_BOOLEAN csrRatesIsDot11Rate11aSupportedRate( tANI_U8 dot11Rate )
4611{
4612 tANI_BOOLEAN fSupported = FALSE;
4613 tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) );
4614
4615 switch ( nonBasicRate )
4616 {
4617 case eCsrSuppRate_6Mbps:
4618 case eCsrSuppRate_9Mbps:
4619 case eCsrSuppRate_12Mbps:
4620 case eCsrSuppRate_18Mbps:
4621 case eCsrSuppRate_24Mbps:
4622 case eCsrSuppRate_36Mbps:
4623 case eCsrSuppRate_48Mbps:
4624 case eCsrSuppRate_54Mbps:
4625 fSupported = TRUE;
4626 break;
4627
4628 default:
4629 break;
4630 }
4631
4632 return( fSupported );
4633}
4634
4635
4636
4637tAniEdType csrTranslateEncryptTypeToEdType( eCsrEncryptionType EncryptType )
4638{
4639 tAniEdType edType;
4640
4641 switch ( EncryptType )
4642 {
4643 default:
4644 case eCSR_ENCRYPT_TYPE_NONE:
4645 edType = eSIR_ED_NONE;
4646 break;
4647
4648 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
4649 case eCSR_ENCRYPT_TYPE_WEP40:
4650 edType = eSIR_ED_WEP40;
4651 break;
4652
4653 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
4654 case eCSR_ENCRYPT_TYPE_WEP104:
4655 edType = eSIR_ED_WEP104;
4656 break;
4657
4658 case eCSR_ENCRYPT_TYPE_TKIP:
4659 edType = eSIR_ED_TKIP;
4660 break;
4661
4662 case eCSR_ENCRYPT_TYPE_AES:
4663 edType = eSIR_ED_CCMP;
4664 break;
4665#ifdef FEATURE_WLAN_WAPI
4666 case eCSR_ENCRYPT_TYPE_WPI:
4667 edType = eSIR_ED_WPI;
4668#endif
4669#ifdef WLAN_FEATURE_11W
4670 //11w BIP
4671 case eCSR_ENCRYPT_TYPE_AES_CMAC:
4672 edType = eSIR_ED_AES_128_CMAC;
4673 break;
4674#endif
4675 }
4676
4677 return( edType );
4678}
4679
4680
4681//pIes can be NULL
4682tANI_BOOLEAN csrValidateWep( tpAniSirGlobal pMac, eCsrEncryptionType ucEncryptionType,
4683 tCsrAuthList *pAuthList, tCsrEncryptionList *pMCEncryptionList,
4684 eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCEncryption,
4685 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes )
4686{
4687 tANI_U32 idx;
4688 tANI_BOOLEAN fMatch = FALSE;
4689 eCsrAuthType negotiatedAuth = eCSR_AUTH_TYPE_OPEN_SYSTEM;
4690 eCsrEncryptionType negotiatedMCCipher = eCSR_ENCRYPT_TYPE_UNKNOWN;
4691
4692 //This function just checks whether HDD is giving correct values for Multicast cipher and Auth.
4693
4694 do
4695 {
4696 //If privacy bit is not set, consider no match
4697 if ( !csrIsPrivacy( pSirBssDesc ) ) break;
4698
4699 for( idx = 0; idx < pMCEncryptionList->numEntries; idx++ )
4700 {
4701 switch( pMCEncryptionList->encryptionType[idx] )
4702 {
4703 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
4704 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
4705 case eCSR_ENCRYPT_TYPE_WEP40:
4706 case eCSR_ENCRYPT_TYPE_WEP104:
4707 /* Multicast list may contain WEP40/WEP104. Check whether it matches UC.
4708 */
4709 if( ucEncryptionType == pMCEncryptionList->encryptionType[idx] )
4710 {
4711 fMatch = TRUE;
4712 negotiatedMCCipher = pMCEncryptionList->encryptionType[idx];
4713 }
4714 break;
4715 default:
4716 fMatch = FALSE;
4717 break;
4718 }
4719 if(fMatch) break;
4720 }
4721
4722 if(!fMatch) break;
4723
4724 for( idx = 0; idx < pAuthList->numEntries; idx++ )
4725 {
4726 switch( pAuthList->authType[idx] )
4727 {
4728 case eCSR_AUTH_TYPE_OPEN_SYSTEM:
4729 case eCSR_AUTH_TYPE_SHARED_KEY:
4730 case eCSR_AUTH_TYPE_AUTOSWITCH:
4731 fMatch = TRUE;
4732 negotiatedAuth = pAuthList->authType[idx];
4733 break;
4734 default:
4735 fMatch = FALSE;
4736 }
4737 if (fMatch) break;
4738 }
4739
4740 if(!fMatch) break;
4741 //In case of WPA / WPA2, check whether it supports WEP as well
4742 if(pIes)
4743 {
4744 //Prepare the encryption type for WPA/WPA2 functions
4745 if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == ucEncryptionType )
4746 {
4747 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40;
4748 }
4749 else if( eCSR_ENCRYPT_TYPE_WEP104 == ucEncryptionType )
4750 {
4751 ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104;
4752 }
4753 //else we can use the encryption type directly
4754 if( pIes->WPA.present )
4755 {
4756 fMatch = palEqualMemory(pMac->hHdd, pIes->WPA.multicast_cipher,
4757 csrWpaOui[csrGetOUIIndexFromCipher( ucEncryptionType )], CSR_WPA_OUI_SIZE );
4758 if( fMatch ) break;
4759 }
4760 if( pIes->RSN.present )
4761 {
4762 fMatch = palEqualMemory(pMac->hHdd, pIes->RSN.gp_cipher_suite,
4763 csrRSNOui[csrGetOUIIndexFromCipher( ucEncryptionType )], CSR_RSN_OUI_SIZE );
4764 }
4765 }
4766
4767 }while(0);
4768
4769 if( fMatch )
4770 {
4771 if( pNegotiatedAuthType )
4772 *pNegotiatedAuthType = negotiatedAuth;
4773
4774 if( pNegotiatedMCEncryption )
4775 *pNegotiatedMCEncryption = negotiatedMCCipher;
4776 }
4777
4778
4779 return fMatch;
4780}
4781
4782
4783//pIes shall contain IEs from pSirBssDesc. It shall be returned from function csrGetParsedBssDescriptionIEs
4784tANI_BOOLEAN csrIsSecurityMatch( tHalHandle hHal, tCsrAuthList *authType, tCsrEncryptionList *pUCEncryptionType, tCsrEncryptionList *pMCEncryptionType,
4785 tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes,
4786 eCsrAuthType *negotiatedAuthtype, eCsrEncryptionType *negotiatedUCCipher, eCsrEncryptionType *negotiatedMCCipher )
4787{
4788 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4789 tANI_BOOLEAN fMatch = FALSE;
4790 tANI_U8 i,idx;
4791 eCsrEncryptionType mcCipher = eCSR_ENCRYPT_TYPE_UNKNOWN, ucCipher = eCSR_ENCRYPT_TYPE_UNKNOWN;
4792 eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN;
4793
4794 for( i = 0 ; ((i < pUCEncryptionType->numEntries) && (!fMatch)) ; i++ )
4795 {
4796 ucCipher = pUCEncryptionType->encryptionType[i];
4797 // If the Bss description shows the Privacy bit is on, then we must have some sort of encryption configured
4798 // for the profile to work. Don't attempt to join networks with Privacy bit set when profiles say NONE for
4799 // encryption type.
4800 switch ( ucCipher )
4801 {
4802 case eCSR_ENCRYPT_TYPE_NONE:
4803 {
4804 // for NO encryption, if the Bss description has the Privacy bit turned on, then encryption is
4805 // required so we have to reject this Bss.
4806 if ( csrIsPrivacy( pSirBssDesc ) )
4807 {
4808 fMatch = FALSE;
4809 }
4810 else
4811 {
4812 fMatch = TRUE;
4813 }
4814
4815 if ( fMatch )
4816 {
4817 fMatch = FALSE;
4818 //Check Multicast cipher requested and Auth type requested.
4819 for( idx = 0 ; idx < pMCEncryptionType->numEntries ; idx++ )
4820 {
4821 if( eCSR_ENCRYPT_TYPE_NONE == pMCEncryptionType->encryptionType[idx] )
4822 {
4823 fMatch = TRUE; //Multicast can only be none.
4824 mcCipher = pMCEncryptionType->encryptionType[idx];
4825 break;
4826 }
4827 }
4828 if (!fMatch) break;
4829
4830 fMatch = FALSE;
4831 //Check Auth list. It should contain AuthOpen.
4832 for( idx = 0 ; idx < authType->numEntries ; idx++ )
4833 {
4834 if( eCSR_AUTH_TYPE_OPEN_SYSTEM == authType->authType[idx] )
4835 {
4836 fMatch = TRUE;
4837 negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
4838 break;
4839 }
4840 }
4841 if (!fMatch) break;
4842
4843 }
4844 break;
4845 }
4846
4847 case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
4848 case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
4849 // !! might want to check for WEP keys set in the Profile.... ?
4850 // !! don't need to have the privacy bit in the Bss description. Many AP policies make legacy
4851 // encryption 'optional' so we don't know if we can associate or not. The AP will reject if
4852 // encryption is not allowed without the Privacy bit turned on.
4853 fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes);
4854
4855 break;
4856
4857 // these are all of the WPA encryption types...
4858 case eCSR_ENCRYPT_TYPE_WEP40:
4859 case eCSR_ENCRYPT_TYPE_WEP104:
4860 fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes);
4861 break;
4862
4863 case eCSR_ENCRYPT_TYPE_TKIP:
4864 case eCSR_ENCRYPT_TYPE_AES:
4865 {
4866 if(pIes)
4867 {
4868 // First check if there is a RSN match
4869 fMatch = csrIsRSNMatch( pMac, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
4870 if( !fMatch )
4871 {
4872 // If not RSN, then check if there is a WPA match
4873 fMatch = csrIsWpaEncryptionMatch( pMac, authType, ucCipher, pMCEncryptionType, pIes,
4874 &negAuthType, &mcCipher );
4875 }
4876 }
4877 else
4878 {
4879 fMatch = FALSE;
4880 }
4881 break;
4882 }
4883#ifdef FEATURE_WLAN_WAPI
4884 case eCSR_ENCRYPT_TYPE_WPI://WAPI
4885 {
4886 if(pIes)
4887 {
4888 fMatch = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
4889 }
4890 else
4891 {
4892 fMatch = FALSE;
4893 }
4894 break;
4895 }
4896#endif /* FEATURE_WLAN_WAPI */
4897 case eCSR_ENCRYPT_TYPE_ANY:
4898 default:
4899 {
4900 tANI_BOOLEAN fMatchAny = eANI_BOOLEAN_FALSE;
4901
4902 fMatch = eANI_BOOLEAN_TRUE;
4903 //It is allowed to match anything. Try the more secured ones first.
4904 if(pIes)
4905 {
4906 //Check AES first
4907 ucCipher = eCSR_ENCRYPT_TYPE_AES;
4908 fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
4909 if(!fMatchAny)
4910 {
4911 //Check TKIP
4912 ucCipher = eCSR_ENCRYPT_TYPE_TKIP;
4913 fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
4914 }
4915#ifdef FEATURE_WLAN_WAPI
4916 if(!fMatchAny)
4917 {
4918 //Check WAPI
4919 ucCipher = eCSR_ENCRYPT_TYPE_WPI;
4920 fMatchAny = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher );
4921 }
4922#endif /* FEATURE_WLAN_WAPI */
4923 }
4924 if(!fMatchAny)
4925 {
4926 ucCipher = eCSR_ENCRYPT_TYPE_WEP104;
4927 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
4928 {
4929 ucCipher = eCSR_ENCRYPT_TYPE_WEP40;
4930 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
4931 {
4932 ucCipher = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4933 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
4934 {
4935 ucCipher = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4936 if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes))
4937 {
4938 //It must be open and no encryption
4939 if ( csrIsPrivacy( pSirBssDesc ) )
4940 {
4941 //This is not right
4942 fMatch = eANI_BOOLEAN_FALSE;
4943 }
4944 else
4945 {
4946 negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM;
4947 mcCipher = eCSR_ENCRYPT_TYPE_NONE;
4948 ucCipher = eCSR_ENCRYPT_TYPE_NONE;
4949 }
4950 }
4951 }
4952 }
4953 }
4954 }
4955 break;
4956 }
4957 }
4958
4959 }
4960
4961 if( fMatch )
4962 {
4963 if( negotiatedUCCipher )
4964 *negotiatedUCCipher = ucCipher;
4965
4966 if( negotiatedMCCipher )
4967 *negotiatedMCCipher = mcCipher;
4968
4969 if( negotiatedAuthtype )
4970 *negotiatedAuthtype = negAuthType;
4971 }
4972
4973 return( fMatch );
4974}
4975
4976
4977tANI_BOOLEAN csrIsSsidMatch( tpAniSirGlobal pMac, tANI_U8 *ssid1, tANI_U8 ssid1Len, tANI_U8 *bssSsid,
4978 tANI_U8 bssSsidLen, tANI_BOOLEAN fSsidRequired )
4979{
4980 tANI_BOOLEAN fMatch = FALSE;
4981
4982 do {
4983
4984 // There are a few special cases. If the Bss description has a Broadcast SSID,
4985 // then our Profile must have a single SSID without Wildcards so we can program
4986 // the SSID.
4987 // SSID could be suppressed in beacons. In that case SSID IE has valid length
4988 // but the SSID value is all NULL characters. That condition is trated same
4989 // as NULL SSID
4990 if ( csrIsNULLSSID( bssSsid, bssSsidLen ) )
4991 {
4992 if ( eANI_BOOLEAN_FALSE == fSsidRequired )
4993 {
4994 fMatch = TRUE;
4995 }
4996 break;
4997 }
4998
4999 // Check for the specification of the Broadcast SSID at the beginning of the list.
5000 // If specified, then all SSIDs are matches (broadcast SSID means accept all SSIDs).
5001 if ( ssid1Len == 0 )
5002 {
5003 fMatch = TRUE;
5004 break;
5005 }
5006
5007 if(ssid1Len != bssSsidLen) break;
5008 if(palEqualMemory(pMac->hHdd, bssSsid, ssid1, bssSsidLen))
5009 {
5010 fMatch = TRUE;
5011 break;
5012 }
5013
5014 } while( 0 );
5015
5016 return( fMatch );
5017}
5018
5019
5020//Null ssid means match
5021tANI_BOOLEAN csrIsSsidInList( tHalHandle hHal, tSirMacSSid *pSsid, tCsrSSIDs *pSsidList )
5022{
5023 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5024 tANI_BOOLEAN fMatch = FALSE;
5025 tANI_U32 i;
5026
5027 if ( pSsidList && pSsid )
5028 {
5029 for(i = 0; i < pSsidList->numOfSSIDs; i++)
5030 {
5031 if(csrIsNULLSSID(pSsidList->SSIDList[i].SSID.ssId, pSsidList->SSIDList[i].SSID.length) ||
5032 ((pSsidList->SSIDList[i].SSID.length == pSsid->length) &&
5033 palEqualMemory(pMac->hHdd, pSsid->ssId, pSsidList->SSIDList[i].SSID.ssId, pSsid->length)))
5034 {
5035 fMatch = TRUE;
5036 break;
5037 }
5038 }
5039 }
5040
5041 return (fMatch);
5042}
5043
5044//like to use sirCompareMacAddr
5045tANI_BOOLEAN csrIsMacAddressZero( tpAniSirGlobal pMac, tCsrBssid *pMacAddr )
5046{
5047 tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0, 0, 0, 0, 0, 0};
5048
5049 return( palEqualMemory(pMac->hHdd, bssid, pMacAddr, WNI_CFG_BSSID_LEN));
5050}
5051
5052//like to use sirCompareMacAddr
5053tANI_BOOLEAN csrIsMacAddressBroadcast( tpAniSirGlobal pMac, tCsrBssid *pMacAddr )
5054{
5055 tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
5056
5057 return( palEqualMemory(pMac->hHdd, bssid, pMacAddr, WNI_CFG_BSSID_LEN));
5058}
5059
5060
5061//like to use sirCompareMacAddr
5062tANI_BOOLEAN csrIsMacAddressEqual( tpAniSirGlobal pMac, tCsrBssid *pMacAddr1, tCsrBssid *pMacAddr2 )
5063{
5064 return( palEqualMemory(pMac->hHdd, pMacAddr1, pMacAddr2, sizeof(tCsrBssid)) );
5065}
5066
5067
5068tANI_BOOLEAN csrIsBssidMatch( tHalHandle hHal, tCsrBssid *pProfBssid, tCsrBssid *BssBssid )
5069{
5070 tANI_BOOLEAN fMatch = FALSE;
5071 tCsrBssid ProfileBssid;
5072 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5073
5074 // for efficiency of the MAC_ADDRESS functions, move the
5075 // Bssid's into MAC_ADDRESS structs.
5076 palCopyMemory( pMac->hHdd, &ProfileBssid, pProfBssid, sizeof(tCsrBssid) );
5077
5078 do {
5079
5080 // Give the profile the benefit of the doubt... accept either all 0 or
5081 // the real broadcast Bssid (all 0xff) as broadcast Bssids (meaning to
5082 // match any Bssids).
5083 if ( csrIsMacAddressZero( pMac, &ProfileBssid ) ||
5084 csrIsMacAddressBroadcast( pMac, &ProfileBssid ) )
5085 {
5086 fMatch = TRUE;
5087 break;
5088 }
5089
5090 if ( csrIsMacAddressEqual( pMac, BssBssid, &ProfileBssid ) )
5091 {
5092 fMatch = TRUE;
5093 break;
5094 }
5095
5096 } while( 0 );
5097
5098 return( fMatch );
5099}
5100
5101
5102tANI_BOOLEAN csrIsBSSTypeMatch(eCsrRoamBssType bssType1, eCsrRoamBssType bssType2)
5103{
5104 if((eCSR_BSS_TYPE_ANY != bssType1 && eCSR_BSS_TYPE_ANY != bssType2) && (bssType1 != bssType2))
5105 return eANI_BOOLEAN_FALSE;
5106 else
5107 return eANI_BOOLEAN_TRUE;
5108}
5109
5110
5111tANI_BOOLEAN csrIsBssTypeIBSS(eCsrRoamBssType bssType)
5112{
5113 return((tANI_BOOLEAN)(eCSR_BSS_TYPE_START_IBSS == bssType || eCSR_BSS_TYPE_IBSS == bssType));
5114}
5115
5116tANI_BOOLEAN csrIsBssTypeWDS(eCsrRoamBssType bssType)
5117{
5118 return((tANI_BOOLEAN)(eCSR_BSS_TYPE_WDS_STA == bssType || eCSR_BSS_TYPE_WDS_AP == bssType));
5119}
5120
5121tANI_BOOLEAN csrIsBSSTypeCapsMatch( eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc )
5122{
5123 tANI_BOOLEAN fMatch = TRUE;
5124
5125 do
5126 {
5127 switch( bssType )
5128 {
5129 case eCSR_BSS_TYPE_ANY:
5130 break;
5131
5132 case eCSR_BSS_TYPE_INFRASTRUCTURE:
5133 case eCSR_BSS_TYPE_WDS_STA:
5134 if( !csrIsInfraBssDesc( pSirBssDesc ) )
5135 fMatch = FALSE;
5136
5137 break;
5138
5139 case eCSR_BSS_TYPE_IBSS:
5140 case eCSR_BSS_TYPE_START_IBSS:
5141 if( !csrIsIbssBssDesc( pSirBssDesc ) )
5142 fMatch = FALSE;
5143
5144 break;
5145
5146 case eCSR_BSS_TYPE_WDS_AP: //For WDS AP, no need to match anything
5147 default:
5148 fMatch = FALSE;
5149 break;
5150 }
5151 }
5152 while( 0 );
5153
5154
5155 return( fMatch );
5156}
5157
5158static tANI_BOOLEAN csrIsCapabilitiesMatch( tpAniSirGlobal pMac, eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc )
5159{
5160 return( csrIsBSSTypeCapsMatch( bssType, pSirBssDesc ) );
5161}
5162
5163
5164
5165static tANI_BOOLEAN csrIsSpecificChannelMatch( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, tANI_U8 Channel )
5166{
5167 tANI_BOOLEAN fMatch = TRUE;
5168
5169 do
5170 {
5171 // if the channel is ANY, then always match...
5172 if ( eCSR_OPERATING_CHANNEL_ANY == Channel ) break;
5173 if ( Channel == pSirBssDesc->channelId ) break;
5174
5175 // didn't match anything.. so return NO match
5176 fMatch = FALSE;
5177
5178 } while( 0 );
5179
5180 return( fMatch );
5181}
5182
5183
5184tANI_BOOLEAN csrIsChannelBandMatch( tpAniSirGlobal pMac, tANI_U8 channelId, tSirBssDescription *pSirBssDesc )
5185{
5186 tANI_BOOLEAN fMatch = TRUE;
5187
5188 do
5189 {
5190 // if the profile says Any channel AND the global settings says ANY channel, then we
5191 // always match...
5192 if ( eCSR_OPERATING_CHANNEL_ANY == channelId ) break;
5193
5194 if ( eCSR_OPERATING_CHANNEL_ANY != channelId )
5195 {
5196 fMatch = csrIsSpecificChannelMatch( pMac, pSirBssDesc, channelId );
5197 }
5198
5199 } while( 0 );
5200
5201 return( fMatch );
5202}
5203
5204
5205/**
5206 * \brief Enquire as to whether a given rate is supported by the
5207 * adapter as currently configured
5208 *
5209 *
5210 * \param nRate A rate in units of 500kbps
5211 *
5212 * \return TRUE if the adapter is currently capable of supporting this
5213 * rate, FALSE else
5214 *
5215 *
5216 * The rate encoding is just as in 802.11 Information Elements, except
5217 * that the high bit is \em not interpreted as indicating a Basic Rate,
5218 * and proprietary rates are allowed, too.
5219 *
5220 * Note that if the adapter's dot11Mode is g, we don't restrict the
5221 * rates. According to hwReadEepromParameters, this will happen when:
5222 *
5223 * ... the card is configured for ALL bands through the property
5224 * page. If this occurs, and the card is not an ABG card ,then this
5225 * code is setting the dot11Mode to assume the mode that the
5226 * hardware can support. For example, if the card is an 11BG card
5227 * and we are configured to support ALL bands, then we change the
5228 * dot11Mode to 11g because ALL in this case is only what the
5229 * hardware can support.
5230 *
5231 *
5232 */
5233
5234static tANI_BOOLEAN csrIsAggregateRateSupported( tpAniSirGlobal pMac, tANI_U16 rate )
5235{
5236 tANI_BOOLEAN fSupported = eANI_BOOLEAN_FALSE;
5237 tANI_U16 idx, newRate;
5238
5239 //In case basic rate flag is set
5240 newRate = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
5241 if ( eCSR_CFG_DOT11_MODE_11A == pMac->roam.configParam.uCfgDot11Mode )
5242 {
5243 switch ( newRate )
5244 {
5245 case eCsrSuppRate_6Mbps:
5246 case eCsrSuppRate_9Mbps:
5247 case eCsrSuppRate_12Mbps:
5248 case eCsrSuppRate_18Mbps:
5249 case eCsrSuppRate_24Mbps:
5250 case eCsrSuppRate_36Mbps:
5251 case eCsrSuppRate_48Mbps:
5252 case eCsrSuppRate_54Mbps:
5253 fSupported = TRUE;
5254 break;
5255 default:
5256 fSupported = FALSE;
5257 break;
5258 }
5259
5260 }
5261 else if( eCSR_CFG_DOT11_MODE_11B == pMac->roam.configParam.uCfgDot11Mode )
5262 {
5263 switch ( newRate )
5264 {
5265 case eCsrSuppRate_1Mbps:
5266 case eCsrSuppRate_2Mbps:
5267 case eCsrSuppRate_5_5Mbps:
5268 case eCsrSuppRate_11Mbps:
5269 fSupported = TRUE;
5270 break;
5271 default:
5272 fSupported = FALSE;
5273 break;
5274 }
5275 }
5276 else if ( !pMac->roam.configParam.ProprietaryRatesEnabled )
5277 {
5278
5279 switch ( newRate )
5280 {
5281 case eCsrSuppRate_1Mbps:
5282 case eCsrSuppRate_2Mbps:
5283 case eCsrSuppRate_5_5Mbps:
5284 case eCsrSuppRate_6Mbps:
5285 case eCsrSuppRate_9Mbps:
5286 case eCsrSuppRate_11Mbps:
5287 case eCsrSuppRate_12Mbps:
5288 case eCsrSuppRate_18Mbps:
5289 case eCsrSuppRate_24Mbps:
5290 case eCsrSuppRate_36Mbps:
5291 case eCsrSuppRate_48Mbps:
5292 case eCsrSuppRate_54Mbps:
5293 fSupported = TRUE;
5294 break;
5295 default:
5296 fSupported = FALSE;
5297 break;
5298 }
5299
5300 }
5301 else {
5302
5303 if ( eCsrSuppRate_1Mbps == newRate ||
5304 eCsrSuppRate_2Mbps == newRate ||
5305 eCsrSuppRate_5_5Mbps == newRate ||
5306 eCsrSuppRate_11Mbps == newRate )
5307 {
5308 fSupported = TRUE;
5309 }
5310 else {
5311 idx = 0x1;
5312
5313 switch ( newRate )
5314 {
5315 case eCsrSuppRate_6Mbps:
5316 fSupported = gPhyRatesSuppt[0][idx];
5317 break;
5318 case eCsrSuppRate_9Mbps:
5319 fSupported = gPhyRatesSuppt[1][idx];
5320 break;
5321 case eCsrSuppRate_12Mbps:
5322 fSupported = gPhyRatesSuppt[2][idx];
5323 break;
5324 case eCsrSuppRate_18Mbps:
5325 fSupported = gPhyRatesSuppt[3][idx];
5326 break;
5327 case eCsrSuppRate_20Mbps:
5328 fSupported = gPhyRatesSuppt[4][idx];
5329 break;
5330 case eCsrSuppRate_24Mbps:
5331 fSupported = gPhyRatesSuppt[5][idx];
5332 break;
5333 case eCsrSuppRate_36Mbps:
5334 fSupported = gPhyRatesSuppt[6][idx];
5335 break;
5336 case eCsrSuppRate_40Mbps:
5337 fSupported = gPhyRatesSuppt[7][idx];
5338 break;
5339 case eCsrSuppRate_42Mbps:
5340 fSupported = gPhyRatesSuppt[8][idx];
5341 break;
5342 case eCsrSuppRate_48Mbps:
5343 fSupported = gPhyRatesSuppt[9][idx];
5344 break;
5345 case eCsrSuppRate_54Mbps:
5346 fSupported = gPhyRatesSuppt[10][idx];
5347 break;
5348 case eCsrSuppRate_72Mbps:
5349 fSupported = gPhyRatesSuppt[11][idx];
5350 break;
5351 case eCsrSuppRate_80Mbps:
5352 fSupported = gPhyRatesSuppt[12][idx];
5353 break;
5354 case eCsrSuppRate_84Mbps:
5355 fSupported = gPhyRatesSuppt[13][idx];
5356 break;
5357 case eCsrSuppRate_96Mbps:
5358 fSupported = gPhyRatesSuppt[14][idx];
5359 break;
5360 case eCsrSuppRate_108Mbps:
5361 fSupported = gPhyRatesSuppt[15][idx];
5362 break;
5363 case eCsrSuppRate_120Mbps:
5364 fSupported = gPhyRatesSuppt[16][idx];
5365 break;
5366 case eCsrSuppRate_126Mbps:
5367 fSupported = gPhyRatesSuppt[17][idx];
5368 break;
5369 case eCsrSuppRate_144Mbps:
5370 fSupported = gPhyRatesSuppt[18][idx];
5371 break;
5372 case eCsrSuppRate_160Mbps:
5373 fSupported = gPhyRatesSuppt[19][idx];
5374 break;
5375 case eCsrSuppRate_168Mbps:
5376 fSupported = gPhyRatesSuppt[20][idx];
5377 break;
5378 case eCsrSuppRate_192Mbps:
5379 fSupported = gPhyRatesSuppt[21][idx];
5380 break;
5381 case eCsrSuppRate_216Mbps:
5382 fSupported = gPhyRatesSuppt[22][idx];
5383 break;
5384 case eCsrSuppRate_240Mbps:
5385 fSupported = gPhyRatesSuppt[23][idx];
5386 break;
5387 default:
5388 fSupported = FALSE;
5389 break;
5390 }
5391 }
5392 }
5393
5394 return fSupported;
5395}
5396
5397
5398
5399static tANI_BOOLEAN csrIsRateSetMatch( tpAniSirGlobal pMac,
5400 tDot11fIESuppRates *pBssSuppRates,
5401 tDot11fIEExtSuppRates *pBssExtSuppRates )
5402{
5403 tANI_BOOLEAN fMatch = TRUE;
5404 tANI_U32 i;
5405
5406
5407 // Validate that all of the Basic rates advertised in the Bss description are supported.
5408 if ( pBssSuppRates )
5409 {
5410 for( i = 0; i < pBssSuppRates->num_rates; i++ )
5411 {
5412 if ( CSR_IS_BASIC_RATE( pBssSuppRates->rates[ i ] ) )
5413 {
5414 if ( !csrIsAggregateRateSupported( pMac, pBssSuppRates->rates[ i ] ) )
5415 {
5416 fMatch = FALSE;
5417 break;
5418 }
5419 }
5420 }
5421 }
5422
5423 if ( fMatch && pBssExtSuppRates )
5424 {
5425 for( i = 0; i < pBssExtSuppRates->num_rates; i++ )
5426 {
5427 if ( CSR_IS_BASIC_RATE( pBssExtSuppRates->rates[ i ] ) )
5428 {
5429 if ( !csrIsAggregateRateSupported( pMac, pBssExtSuppRates->rates[ i ] ) )
5430 {
5431 fMatch = FALSE;
5432 break;
5433 }
5434 }
5435 }
5436 }
5437
5438 return( fMatch );
5439
5440}
5441
5442
5443//ppIes can be NULL. If caller want to get the *ppIes allocated by this function, pass in *ppIes = NULL
5444tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrScanResultFilter *pFilter,
5445 eCsrAuthType *pNegAuth, eCsrEncryptionType *pNegUc, eCsrEncryptionType *pNegMc,
5446 tDot11fBeaconIEs **ppIes)
5447{
5448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5449 tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck;
5450 tANI_U32 i;
5451 tDot11fBeaconIEs *pIes = NULL;
5452 tANI_U8 *pb;
5453
5454 do {
5455 if( ( NULL == ppIes ) || ( *ppIes ) == NULL )
5456 {
5457 //If no IEs passed in, get our own.
5458 if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes)))
5459 {
5460 break;
5461 }
5462 }
5463 else
5464 {
5465 //Save the one pass in for local use
5466 pIes = *ppIes;
5467 }
5468
5469 //Check if caller wants P2P
5470 fCheck = (!pFilter->p2pResult || pIes->P2PBeaconProbeRes.present);
5471 if(!fCheck) break;
5472
5473 if(pIes->SSID.present)
5474 {
5475 for(i = 0; i < pFilter->SSIDs.numOfSSIDs; i++)
5476 {
5477 fCheck = csrIsSsidMatch( pMac, pFilter->SSIDs.SSIDList[i].SSID.ssId, pFilter->SSIDs.SSIDList[i].SSID.length,
5478 pIes->SSID.ssid,
5479 pIes->SSID.num_ssid, eANI_BOOLEAN_TRUE );
5480 if ( fCheck ) break;
5481 }
5482 if(!fCheck) break;
5483 }
5484 fCheck = eANI_BOOLEAN_TRUE;
5485 for(i = 0; i < pFilter->BSSIDs.numOfBSSIDs; i++)
5486 {
5487 fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i], (tCsrBssid *)pBssDesc->bssId );
5488 if ( fCheck ) break;
5489
5490 if (pFilter->p2pResult && pIes->P2PBeaconProbeRes.present)
5491 {
5492 fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i],
5493 (tCsrBssid *)pIes->P2PBeaconProbeRes.P2PDeviceInfo.P2PDeviceAddress );
5494
5495 if ( fCheck ) break;
5496 }
5497 }
5498 if(!fCheck) break;
5499
5500 fCheck = eANI_BOOLEAN_TRUE;
5501 for(i = 0; i < pFilter->ChannelInfo.numOfChannels; i++)
5502 {
5503 fCheck = csrIsChannelBandMatch( pMac, pFilter->ChannelInfo.ChannelList[i], pBssDesc );
5504 if ( fCheck ) break;
5505 }
5506 if(!fCheck)
5507 break;
5508#if defined WLAN_FEATURE_VOWIFI
5509 /* If this is for measurement filtering */
5510 if( pFilter->fMeasurement )
5511 {
5512 fRC = eANI_BOOLEAN_TRUE;
5513 break;
5514 }
5515#endif
5516 if ( !csrIsPhyModeMatch( pMac, pFilter->phyMode, pBssDesc, NULL, NULL, pIes ) ) break;
5517 if ( (!pFilter->bWPSAssociation) &&
5518 !csrIsSecurityMatch( pMac, &pFilter->authType, &pFilter->EncryptionType, &pFilter->mcEncryptionType,
5519 pBssDesc, pIes, pNegAuth, pNegUc, pNegMc ) ) break;
5520 if ( !csrIsCapabilitiesMatch( pMac, pFilter->BSSType, pBssDesc ) ) break;
5521 if ( !csrIsRateSetMatch( pMac, &pIes->SuppRates, &pIes->ExtSuppRates ) ) break;
5522 //Tush-QoS: validate first if asked for APSD or WMM association
5523 if ( (eCsrRoamWmmQbssOnly == pMac->roam.configParam.WMMSupportMode) &&
5524 !CSR_IS_QOS_BSS(pIes) )
5525 break;
5526 //Check country. check even when pb is NULL because we may want to make sure
5527 //AP has a country code in it if fEnforceCountryCodeMatch is set.
5528 pb = ( pFilter->countryCode[0] ) ? ( pFilter->countryCode) : NULL;
5529
5530 fCheck = csrMatchCountryCode( pMac, pb, pIes );
5531 if(!fCheck)
5532 break;
5533
5534#ifdef WLAN_FEATURE_VOWIFI_11R
5535 if (pFilter->MDID.mdiePresent)
5536 {
5537 if (pBssDesc->mdiePresent)
5538 {
5539 if (pFilter->MDID.mobilityDomain != (pBssDesc->mdie[1] << 8 | pBssDesc->mdie[0]))
5540 break;
5541 }
5542 else
5543 break;
5544 }
5545#endif
5546 fRC = eANI_BOOLEAN_TRUE;
5547
5548 } while( 0 );
5549 if( ppIes )
5550 {
5551 *ppIes = pIes;
5552 }
5553 else if( pIes )
5554 {
5555 palFreeMemory(pMac->hHdd, pIes);
5556 }
5557
5558 return( fRC );
5559}
5560
5561tANI_BOOLEAN csrMatchConnectedBSSSecurity( tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile,
5562 tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes)
5563{
5564 tCsrEncryptionList ucEncryptionList, mcEncryptionList;
5565 tCsrAuthList authList;
5566
5567 ucEncryptionList.numEntries = 1;
5568 ucEncryptionList.encryptionType[0] = pProfile->EncryptionType;
5569
5570 mcEncryptionList.numEntries = 1;
5571 mcEncryptionList.encryptionType[0] = pProfile->mcEncryptionType;
5572
5573 authList.numEntries = 1;
5574 authList.authType[0] = pProfile->AuthType;
5575
5576 return( csrIsSecurityMatch( pMac, &authList, &ucEncryptionList, &mcEncryptionList, pBssDesc, pIes, NULL, NULL, NULL ));
5577
5578}
5579
5580
5581tANI_BOOLEAN csrMatchBSSToConnectProfile( tHalHandle hHal, tCsrRoamConnectedProfile *pProfile,
5582 tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes )
5583{
5584 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5585 tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck;
5586 tDot11fBeaconIEs *pIesLocal = pIes;
5587
5588 do {
5589 if( !pIes )
5590 {
5591 if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal)))
5592 {
5593 break;
5594 }
5595 }
5596 fCheck = eANI_BOOLEAN_TRUE;
5597 if(pIesLocal->SSID.present)
5598 {
5599 tANI_BOOLEAN fCheckSsid = eANI_BOOLEAN_FALSE;
5600 if(pProfile->SSID.length)
5601 {
5602 fCheckSsid = eANI_BOOLEAN_TRUE;
5603 }
5604 fCheck = csrIsSsidMatch( pMac, pProfile->SSID.ssId, pProfile->SSID.length,
5605 pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid, fCheckSsid );
5606 if(!fCheck) break;
5607 }
5608 if ( !csrMatchConnectedBSSSecurity( pMac, pProfile, pBssDesc, pIesLocal) ) break;
5609 if ( !csrIsCapabilitiesMatch( pMac, pProfile->BSSType, pBssDesc ) ) break;
5610 if ( !csrIsRateSetMatch( pMac, &pIesLocal->SuppRates, &pIesLocal->ExtSuppRates ) ) break;
5611 fCheck = csrIsChannelBandMatch( pMac, pProfile->operationChannel, pBssDesc );
5612 if(!fCheck)
5613 break;
5614
5615 fRC = eANI_BOOLEAN_TRUE;
5616
5617 } while( 0 );
5618
5619 if( !pIes && pIesLocal )
5620 {
5621 //locally allocated
5622 palFreeMemory(pMac->hHdd, pIesLocal);
5623 }
5624
5625 return( fRC );
5626}
5627
5628
5629
5630tANI_BOOLEAN csrRatesIsDot11RateSupported( tHalHandle hHal, tANI_U8 rate )
5631{
5632 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5633 tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK );
5634
5635 return csrIsAggregateRateSupported( pMac, n );
5636}
5637
5638
5639tANI_U16 csrRatesMacPropToDot11( tANI_U16 Rate )
5640{
5641 tANI_U16 ConvertedRate = Rate;
5642
5643 switch( Rate )
5644 {
5645 case SIR_MAC_RATE_1:
5646 ConvertedRate = 2;
5647 break;
5648 case SIR_MAC_RATE_2:
5649 ConvertedRate = 4;
5650 break;
5651 case SIR_MAC_RATE_5_5:
5652 ConvertedRate = 11;
5653 break;
5654 case SIR_MAC_RATE_11:
5655 ConvertedRate = 22;
5656 break;
5657
5658 case SIR_MAC_RATE_6:
5659 ConvertedRate = 12;
5660 break;
5661 case SIR_MAC_RATE_9:
5662 ConvertedRate = 18;
5663 break;
5664 case SIR_MAC_RATE_12:
5665 ConvertedRate = 24;
5666 break;
5667 case SIR_MAC_RATE_18:
5668 ConvertedRate = 36;
5669 break;
5670 case SIR_MAC_RATE_24:
5671 ConvertedRate = 48;
5672 break;
5673 case SIR_MAC_RATE_36:
5674 ConvertedRate = 72;
5675 break;
5676 case SIR_MAC_RATE_42:
5677 ConvertedRate = 84;
5678 break;
5679 case SIR_MAC_RATE_48:
5680 ConvertedRate = 96;
5681 break;
5682 case SIR_MAC_RATE_54:
5683 ConvertedRate = 108;
5684 break;
5685
5686 case SIR_MAC_RATE_72:
5687 ConvertedRate = 144;
5688 break;
5689 case SIR_MAC_RATE_84:
5690 ConvertedRate = 168;
5691 break;
5692 case SIR_MAC_RATE_96:
5693 ConvertedRate = 192;
5694 break;
5695 case SIR_MAC_RATE_108:
5696 ConvertedRate = 216;
5697 break;
5698 case SIR_MAC_RATE_126:
5699 ConvertedRate = 252;
5700 break;
5701 case SIR_MAC_RATE_144:
5702 ConvertedRate = 288;
5703 break;
5704 case SIR_MAC_RATE_168:
5705 ConvertedRate = 336;
5706 break;
5707 case SIR_MAC_RATE_192:
5708 ConvertedRate = 384;
5709 break;
5710 case SIR_MAC_RATE_216:
5711 ConvertedRate = 432;
5712 break;
5713 case SIR_MAC_RATE_240:
5714 ConvertedRate = 480;
5715 break;
5716
5717 case 0xff:
5718 ConvertedRate = 0;
5719 break;
5720 }
5721
5722 return ConvertedRate;
5723}
5724
5725
5726tANI_U16 csrRatesFindBestRate( tSirMacRateSet *pSuppRates, tSirMacRateSet *pExtRates, tSirMacPropRateSet *pPropRates )
5727{
5728 tANI_U8 i;
5729 tANI_U16 nBest;
5730
5731 nBest = pSuppRates->rate[ 0 ] & ( ~CSR_DOT11_BASIC_RATE_MASK );
5732
5733 if(pSuppRates->numRates > SIR_MAC_RATESET_EID_MAX)
5734 {
5735 pSuppRates->numRates = SIR_MAC_RATESET_EID_MAX;
5736 }
5737
5738 for ( i = 1U; i < pSuppRates->numRates; ++i )
5739 {
5740 nBest = (tANI_U16)CSR_MAX( nBest, pSuppRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) );
5741 }
5742
5743 if ( NULL != pExtRates )
5744 {
5745 for ( i = 0U; i < pExtRates->numRates; ++i )
5746 {
5747 nBest = (tANI_U16)CSR_MAX( nBest, pExtRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) );
5748 }
5749 }
5750
5751 if ( NULL != pPropRates )
5752 {
5753 for ( i = 0U; i < pPropRates->numPropRates; ++i )
5754 {
5755 nBest = (tANI_U16)CSR_MAX( nBest, csrRatesMacPropToDot11( pPropRates->propRate[ i ] ) );
5756 }
5757 }
5758
5759 return nBest;
5760}
5761
5762
5763void csrReleaseProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile)
5764{
5765 if(pProfile)
5766 {
5767 if(pProfile->BSSIDs.bssid)
5768 {
5769 palFreeMemory(pMac->hHdd, pProfile->BSSIDs.bssid);
5770 pProfile->BSSIDs.bssid = NULL;
5771 }
5772 if(pProfile->SSIDs.SSIDList)
5773 {
5774 palFreeMemory(pMac->hHdd, pProfile->SSIDs.SSIDList);
5775 pProfile->SSIDs.SSIDList = NULL;
5776 }
5777 if(pProfile->pWPAReqIE)
5778 {
5779 palFreeMemory(pMac->hHdd, pProfile->pWPAReqIE);
5780 pProfile->pWPAReqIE = NULL;
5781 }
5782 if(pProfile->pRSNReqIE)
5783 {
5784 palFreeMemory(pMac->hHdd, pProfile->pRSNReqIE);
5785 pProfile->pRSNReqIE = NULL;
5786 }
5787#ifdef FEATURE_WLAN_WAPI
5788 if(pProfile->pWAPIReqIE)
5789 {
5790 palFreeMemory(pMac->hHdd, pProfile->pWAPIReqIE);
5791 pProfile->pWAPIReqIE = NULL;
5792 }
5793#endif /* FEATURE_WLAN_WAPI */
5794
5795 if(pProfile->pAddIEScan)
5796 {
5797 palFreeMemory(pMac->hHdd, pProfile->pAddIEScan);
5798 pProfile->pAddIEScan = NULL;
5799 }
5800
5801 if(pProfile->pAddIEAssoc)
5802 {
5803 palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc);
5804 pProfile->pAddIEAssoc = NULL;
5805 }
5806 {
5807 palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc);
5808 pProfile->pAddIEAssoc = NULL;
5809 }
5810
5811 if(pProfile->ChannelInfo.ChannelList)
5812 {
5813 palFreeMemory(pMac->hHdd, pProfile->ChannelInfo.ChannelList);
5814 pProfile->ChannelInfo.ChannelList = NULL;
5815 }
5816
5817
5818 palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile));
5819 }
5820}
5821
5822void csrFreeScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
5823{
5824 if(pScanFilter->BSSIDs.bssid)
5825 {
5826 palFreeMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid);
5827 pScanFilter->BSSIDs.bssid = NULL;
5828 }
5829 if(pScanFilter->ChannelInfo.ChannelList)
5830 {
5831 palFreeMemory(pMac->hHdd, pScanFilter->ChannelInfo.ChannelList);
5832 pScanFilter->ChannelInfo.ChannelList = NULL;
5833 }
5834 if(pScanFilter->SSIDs.SSIDList)
5835 {
5836 palFreeMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList);
5837 pScanFilter->SSIDs.SSIDList = NULL;
5838 }
5839}
5840
5841
5842void csrFreeRoamProfile(tpAniSirGlobal pMac, tANI_U32 sessionId)
5843{
5844 tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId];
5845
5846 if(pSession->pCurRoamProfile)
5847 {
5848 csrReleaseProfile(pMac, pSession->pCurRoamProfile);
5849 palFreeMemory(pMac->hHdd, pSession->pCurRoamProfile);
5850 pSession->pCurRoamProfile = NULL;
5851 }
5852}
5853
5854
5855void csrFreeConnectBssDesc(tpAniSirGlobal pMac, tANI_U32 sessionId)
5856{
5857 tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId];
5858
5859 if(pSession->pConnectBssDesc)
5860 {
5861 palFreeMemory(pMac->hHdd, pSession->pConnectBssDesc);
5862 pSession->pConnectBssDesc = NULL;
5863 }
5864}
5865
5866
5867
5868tSirResultCodes csrGetDisassocRspStatusCode( tSirSmeDisassocRsp *pSmeDisassocRsp )
5869{
5870 tANI_U8 *pBuffer = (tANI_U8 *)pSmeDisassocRsp;
5871 tANI_U32 ret;
5872
5873 pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tSirMacAddr));
5874 //tSirResultCodes is an enum, assuming is 32bit
5875 //If we cannot make this assumption, use copymemory
5876 pal_get_U32( pBuffer, &ret );
5877
5878 return( ( tSirResultCodes )ret );
5879}
5880
5881
5882tSirResultCodes csrGetDeAuthRspStatusCode( tSirSmeDeauthRsp *pSmeRsp )
5883{
5884 tANI_U8 *pBuffer = (tANI_U8 *)pSmeRsp;
5885 tANI_U32 ret;
5886
5887 pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tSirMacAddr));
5888 //tSirResultCodes is an enum, assuming is 32bit
5889 //If we cannot make this assumption, use copymemory
5890 pal_get_U32( pBuffer, &ret );
5891
5892 return( ( tSirResultCodes )ret );
5893}
5894
5895#if 0
5896tSirScanType csrGetScanType(tANI_U8 chnId, eRegDomainId domainId, tANI_U8 *countryCode)
5897{
5898 tSirScanType scanType = eSIR_PASSIVE_SCAN;
5899 tANI_U8 cc = 0;
5900
5901 while (cc++ < gCsrDomainChnInfo[domainId].numChannels)
5902 {
5903 if(chnId == gCsrDomainChnInfo[domainId].chnInfo[cc].chnId)
5904 {
5905 scanType = gCsrDomainChnInfo[domainId].chnInfo[cc].scanType;
5906 break;
5907 }
5908 }
5909
5910 return (scanType);
5911}
5912#endif
5913
5914tSirScanType csrGetScanType(tpAniSirGlobal pMac, tANI_U8 chnId)
5915{
5916 tSirScanType scanType = eSIR_PASSIVE_SCAN;
5917 eNVChannelEnabledType channelEnabledType;
5918
5919 channelEnabledType = vos_nv_getChannelEnabledState(chnId);
5920 if( NV_CHANNEL_ENABLE == channelEnabledType)
5921 {
5922 scanType = eSIR_ACTIVE_SCAN;
5923 }
5924 return (scanType);
5925}
5926
5927
5928tANI_U8 csrToUpper( tANI_U8 ch )
5929{
5930 tANI_U8 chOut;
5931
5932 if ( ch >= 'a' && ch <= 'z' )
5933 {
5934 chOut = ch - 'a' + 'A';
5935 }
5936 else
5937 {
5938 chOut = ch;
5939 }
5940 return( chOut );
5941}
5942
5943
5944tSirBssType csrTranslateBsstypeToMacType(eCsrRoamBssType csrtype)
5945{
5946 tSirBssType ret;
5947
5948 switch(csrtype)
5949 {
5950 case eCSR_BSS_TYPE_INFRASTRUCTURE:
5951 ret = eSIR_INFRASTRUCTURE_MODE;
5952 break;
5953 case eCSR_BSS_TYPE_IBSS:
5954 case eCSR_BSS_TYPE_START_IBSS:
5955 ret = eSIR_IBSS_MODE;
5956 break;
5957 case eCSR_BSS_TYPE_WDS_AP:
5958 ret = eSIR_BTAMP_AP_MODE;
5959 break;
5960 case eCSR_BSS_TYPE_WDS_STA:
5961 ret = eSIR_BTAMP_STA_MODE;
5962 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005963 case eCSR_BSS_TYPE_INFRA_AP:
5964 ret = eSIR_INFRA_AP_MODE;
5965 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005966 case eCSR_BSS_TYPE_ANY:
5967 default:
5968 ret = eSIR_AUTO_MODE;
5969 break;
5970 }
5971
5972 return (ret);
5973}
5974
5975
5976//This function use the parameters to decide the CFG value.
5977//CSR never sets WNI_CFG_DOT11_MODE_ALL to the CFG
5978//So PE should not see WNI_CFG_DOT11_MODE_ALL when it gets the CFG value
Jeff Johnson295189b2012-06-20 16:38:30 -07005979eCsrCfgDot11Mode csrGetCfgDot11ModeFromCsrPhyMode(tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tANI_BOOLEAN fProprietary)
Jeff Johnson295189b2012-06-20 16:38:30 -07005980{
5981 tANI_U32 cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG;
5982
5983 switch(phyMode)
5984 {
5985 case eCSR_DOT11_MODE_11a:
5986 case eCSR_DOT11_MODE_11a_ONLY:
5987 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A;
5988 break;
5989 case eCSR_DOT11_MODE_11b:
5990 case eCSR_DOT11_MODE_11b_ONLY:
5991 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B;
5992 break;
5993 case eCSR_DOT11_MODE_11g:
5994 case eCSR_DOT11_MODE_11g_ONLY:
Jeff Johnson295189b2012-06-20 16:38:30 -07005995 if(pProfile && (CSR_IS_INFRA_AP(pProfile)) && (phyMode == eCSR_DOT11_MODE_11g_ONLY))
5996 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G_ONLY;
5997 else
Jeff Johnson295189b2012-06-20 16:38:30 -07005998 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G;
5999 break;
6000 case eCSR_DOT11_MODE_11n:
6001 if(fProprietary)
6002 {
6003 cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
6004 }
6005 else
6006 {
6007 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
6008 }
6009 break;
6010 case eCSR_DOT11_MODE_11n_ONLY:
Jeff Johnson295189b2012-06-20 16:38:30 -07006011 if(pProfile && CSR_IS_INFRA_AP(pProfile))
6012 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N_ONLY;
6013 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006014 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N;
6015 break;
6016 case eCSR_DOT11_MODE_TAURUS:
6017 cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS;
6018 break;
6019 case eCSR_DOT11_MODE_abg:
6020 cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG;
6021 break;
6022 case eCSR_DOT11_MODE_AUTO:
6023 cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO;
6024 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07006025
6026#ifdef WLAN_FEATURE_11AC
6027 case eCSR_DOT11_MODE_11ac:
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07006028 if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))
6029 {
6030 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
6031 }
6032 else
6033 {
Gopichand Nakkala681989c2013-03-06 22:27:48 -08006034 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC;
Madan Mohan Koyyalamudi1bed5982012-10-22 14:38:06 -07006035 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006036 break;
6037 case eCSR_DOT11_MODE_11ac_ONLY:
6038 cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY;
6039 break;
6040#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006041 default:
6042 //No need to assign anything here
6043 break;
6044 }
6045
6046 return (cfgDot11Mode);
6047}
6048
6049
6050eHalStatus csrSetRegulatoryDomain(tpAniSirGlobal pMac, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
6051{
6052 eHalStatus status = eHAL_STATUS_SUCCESS;
6053 tANI_BOOLEAN fRestart;
6054
6055 if(pMac->scan.domainIdCurrent == domainId)
6056 {
6057 //no change
6058 fRestart = eANI_BOOLEAN_FALSE;
6059 }
6060 else if( !pMac->roam.configParam.fEnforceDefaultDomain )
6061 {
6062 pMac->scan.domainIdCurrent = domainId;
6063 fRestart = eANI_BOOLEAN_TRUE;
6064 }
6065 else
6066 {
6067 //We cannot change the domain
6068 status = eHAL_STATUS_CSR_WRONG_STATE;
6069 fRestart = eANI_BOOLEAN_FALSE;
6070 }
6071 if(pfRestartNeeded)
6072 {
6073 *pfRestartNeeded = fRestart;
6074 }
6075
6076 return (status);
6077}
6078
6079
6080v_REGDOMAIN_t csrGetCurrentRegulatoryDomain(tpAniSirGlobal pMac)
6081{
6082 return (pMac->scan.domainIdCurrent);
6083}
6084
Jeff Johnson295189b2012-06-20 16:38:30 -07006085
6086eHalStatus csrGetRegulatoryDomainForCountry(tpAniSirGlobal pMac, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
6087{
6088 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6089 VOS_STATUS vosStatus;
6090 v_COUNTRYCODE_t countryCode;
6091 v_REGDOMAIN_t domainId;
6092
6093 if(pCountry)
6094 {
6095 countryCode[0] = pCountry[0];
6096 countryCode[1] = pCountry[1];
6097 vosStatus = vos_nv_getRegDomainFromCountryCode( &domainId, countryCode );
6098 if( VOS_IS_STATUS_SUCCESS(vosStatus) )
6099 {
6100 if( pDomainId )
6101 {
6102 *pDomainId = domainId;
6103 }
6104 status = eHAL_STATUS_SUCCESS;
6105 }
6106 else
6107 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08006108 smsLog(pMac, LOGW, FL(" doesn't match country %c%c"), pCountry[0], pCountry[1]);
Jeff Johnson295189b2012-06-20 16:38:30 -07006109 status = eHAL_STATUS_INVALID_PARAMETER;
6110 }
6111 }
6112
6113 return (status);
6114}
6115
6116//To check whether a country code matches the one in the IE
6117//Only check the first two characters, ignoring in/outdoor
6118//pCountry -- caller allocated buffer contain the country code that is checking against
6119//the one in pIes. It can be NULL.
6120//caller must provide pIes, it cannot be NULL
6121//This function always return TRUE if 11d support is not turned on.
6122tANI_BOOLEAN csrMatchCountryCode( tpAniSirGlobal pMac, tANI_U8 *pCountry, tDot11fBeaconIEs *pIes )
6123{
6124 tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
Jeff Johnson43971f52012-07-17 12:26:56 -07006125 v_REGDOMAIN_t domainId = REGDOMAIN_COUNT; //This is init to invalid value
Jeff Johnson295189b2012-06-20 16:38:30 -07006126 eHalStatus status;
6127
6128 do
6129 {
6130 if( !csrIs11dSupported( pMac) )
6131 {
6132 break;
6133 }
6134 if( !pIes )
6135 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08006136 smsLog(pMac, LOGE, FL(" No IEs"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006137 break;
6138 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006139 if( pMac->roam.configParam.fEnforceDefaultDomain ||
6140 pMac->roam.configParam.fEnforceCountryCodeMatch )
Jeff Johnson295189b2012-06-20 16:38:30 -07006141 {
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006142 //Make sure this country is recognizable
6143 if( pIes->Country.present )
Jeff Johnson295189b2012-06-20 16:38:30 -07006144 {
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006145 status = csrGetRegulatoryDomainForCountry( pMac, pIes->Country.country, &domainId );
6146 if( !HAL_STATUS_SUCCESS( status ) )
6147 {
Gowri Deepthiff9adf92012-12-13 15:09:56 -08006148 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCode11d,(v_REGDOMAIN_t *) &domainId );
6149 if( !HAL_STATUS_SUCCESS( status ) )
6150 {
6151 fRet = eANI_BOOLEAN_FALSE;
6152 break;
6153 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006154 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006155 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006156 //check whether it is needed to enforce to the default regulatory domain first
6157 if( pMac->roam.configParam.fEnforceDefaultDomain )
Jeff Johnson295189b2012-06-20 16:38:30 -07006158 {
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006159 if( domainId != pMac->scan.domainIdCurrent )
6160 {
6161 fRet = eANI_BOOLEAN_FALSE;
6162 break;
6163 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006164 }
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006165 if( pMac->roam.configParam.fEnforceCountryCodeMatch )
6166 {
Jeff Johnson43971f52012-07-17 12:26:56 -07006167 if( domainId >= REGDOMAIN_COUNT )
Madan Mohan Koyyalamudi42af1782012-10-21 12:13:23 -07006168 {
6169 fRet = eANI_BOOLEAN_FALSE;
6170 break;
6171 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006172 }
6173 }
6174 if( pCountry )
6175 {
6176 tANI_U32 i;
6177
6178 if( !pIes->Country.present )
6179 {
6180 fRet = eANI_BOOLEAN_FALSE;
6181 break;
6182 }
6183 // Convert the CountryCode characters to upper
6184 for ( i = 0; i < WNI_CFG_COUNTRY_CODE_LEN - 1; i++ )
6185 {
6186 pCountry[i] = csrToUpper( pCountry[i] );
6187 }
6188 if( !palEqualMemory(pMac->hHdd, pIes->Country.country, pCountry, WNI_CFG_COUNTRY_CODE_LEN - 1) )
6189 {
6190 fRet = eANI_BOOLEAN_FALSE;
6191 break;
6192 }
6193 }
6194 } while(0);
6195
6196 return (fRet);
6197}
6198
6199#if 0
6200eHalStatus csrSetCountryDomainMapping(tpAniSirGlobal pMac, tCsrCountryDomainMapping *pCountryDomainMapping)
6201{
6202 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6203 tANI_U32 i, j;
6204 tANI_BOOLEAN fDomainChanged = eANI_BOOLEAN_FALSE;
6205 tANI_U8 countryCode[WNI_CFG_COUNTRY_CODE_LEN];
6206
6207 i = WNI_CFG_COUNTRY_CODE_LEN;
6208 //Get the currently used country code
6209 status = ccmCfgGetStr(pMac, WNI_CFG_COUNTRY_CODE, countryCode, &i);
6210 if(HAL_STATUS_SUCCESS(status))
6211 {
6212 if(pCountryDomainMapping && pCountryDomainMapping->numEntry)
6213 {
6214 for(i = 0; i < pCountryDomainMapping->numEntry; i++)
6215 {
6216 for(j = 0; j < eCSR_NUM_COUNTRY_INDEX; j++)
6217 {
6218 if(palEqualMemory(pMac->hHdd, gCsrCountryInfo[j].countryCode,
6219 pCountryDomainMapping->pCountryInfo[i].countryCode, 2))
6220 {
6221 if(gCsrCountryInfo[j].domainId != pCountryDomainMapping->pCountryInfo[i].domainId)
6222 {
6223 gCsrCountryInfo[j].domainId = pCountryDomainMapping->pCountryInfo[i].domainId;
6224 //Check whether it matches the currently used country code
6225 //If matching, need to update base on the new domain setting.
6226 if(palEqualMemory(pMac->hHdd, countryCode,
6227 pCountryDomainMapping->pCountryInfo[i].countryCode, 2))
6228 {
6229 fDomainChanged = eANI_BOOLEAN_TRUE;
6230 }
6231 }
6232 break;
6233 }
6234 }
6235 }
6236 status = eHAL_STATUS_SUCCESS;
6237 if(fDomainChanged)
6238 {
6239 tCsrChannel *pChannelList;
6240
6241 if(pMac->scan.f11dInfoApplied)
6242 {
6243 //11d info already applied. Let's reapply with the new domain setting
6244 if(pMac->scan.channels11d.numChannels)
6245 {
6246 pChannelList = &pMac->scan.channels11d;
6247 }
6248 else
6249 {
6250 pChannelList = &pMac->scan.base20MHzChannels;
6251 }
6252 }
6253 else
6254 {
6255 //no 11d so we use the base channelist from EEPROM
6256 pChannelList = &pMac->scan.base20MHzChannels;
6257 }
6258 //set the new domain's scan requirement to CFG
6259 csrSetCfgScanControlList(pMac, countryCode, pChannelList);
6260 }
6261 }
6262 }
6263
6264 return (status);
6265}
6266
6267eHalStatus csrSetDomainScanSetting(tpAniSirGlobal pMac, tCsrDomainFreqInfo *pDomainFreqInfo)
6268{
6269 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6270 tANI_U32 i, j;
6271 tANI_U16 freq;
6272
6273 if(pDomainFreqInfo && pDomainFreqInfo->numEntry && (pDomainFreqInfo->domainId < NUM_REG_DOMAINS))
6274 {
6275 tCsrDomainChnInfo *pDomainChnInfo = &gCsrDomainChnInfo[pDomainFreqInfo->domainId];
6276
6277 for(j = 0; j < pDomainChnInfo->numChannels; j++)
6278 {
6279 if(HAL_STATUS_SUCCESS(halPhyChIdToFreqConversion(pDomainChnInfo->chnInfo[j].chnId, &freq)))
6280 {
6281 for(i = 0; i < pDomainFreqInfo->numEntry; i++)
6282 {
6283 if((pDomainFreqInfo->pCsrScanFreqInfo[i].nStartFreq <= freq) &&
6284 (freq <= pDomainFreqInfo->pCsrScanFreqInfo[i].nEndFreq))
6285 {
6286 pDomainChnInfo->chnInfo[j].scanType = pDomainFreqInfo->pCsrScanFreqInfo[i].scanType;
6287 break;
6288 }
6289 }
6290 }
6291 else
6292 {
6293 smsLog(pMac, LOGW, " Failed to get frequency of channel %d", pDomainChnInfo->chnInfo[j].chnId);
6294 }
6295 }
6296 status = eHAL_STATUS_SUCCESS;
6297 }
6298
6299 return (status);
6300}
6301#endif
6302
6303eHalStatus csrGetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
6304 tCsrRoamModifyProfileFields *pModifyProfileFields)
6305{
6306
6307 if(!pModifyProfileFields)
6308 {
6309 return eHAL_STATUS_FAILURE;
6310 }
6311
6312 palCopyMemory( pMac->hHdd, pModifyProfileFields,
6313 &pMac->roam.roamSession[sessionId].connectedProfile.modifyProfileFields,
6314 sizeof(tCsrRoamModifyProfileFields) );
6315
6316 return eHAL_STATUS_SUCCESS;
6317}
6318
6319eHalStatus csrSetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId,
6320 tCsrRoamModifyProfileFields *pModifyProfileFields)
6321{
6322 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
6323
6324 palCopyMemory( pMac->hHdd, &pSession->connectedProfile.modifyProfileFields,
6325 pModifyProfileFields,
6326 sizeof(tCsrRoamModifyProfileFields) );
6327
6328 return eHAL_STATUS_SUCCESS;
6329}
6330
6331
6332#if 0
6333/* ---------------------------------------------------------------------------
6334 \fn csrGetSupportedCountryCode
6335 \brief this function is to get a list of the country code current being supported
6336 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
6337 this has the country code list. 3 bytes for each country code. This may be NULL if
6338 caller wants to know the needed bytes.
6339 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
6340 this contains the length of the data in pBuf
6341 \return eHalStatus
6342 -------------------------------------------------------------------------------*/
6343eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen)
6344{
6345 tANI_U32 numOfCountry = sizeof( gCsrCountryInfo ) / sizeof( gCsrCountryInfo[0] );
6346 tANI_U32 numBytes = 0;
6347 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
6348
6349 if( pbLen )
6350 {
6351 numBytes = *pbLen;
6352 //Consider it ok, at least we can return the number of bytes needed;
6353 *pbLen = numOfCountry * WNI_CFG_COUNTRY_CODE_LEN;
6354 status = eHAL_STATUS_SUCCESS;
6355 if( pBuf && ( numBytes >= *pbLen ) )
6356 {
6357 //The ugly part starts.
6358 //We may need to alter the data structure and find a way to make this faster.
6359 tANI_U32 i;
6360
6361 for( i = 0; i < numOfCountry; i++ )
6362 {
6363 palCopyMemory( pMac->hHdd, pBuf + ( i * WNI_CFG_COUNTRY_CODE_LEN ),
6364 gCsrCountryInfo[i].countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6365 }
6366 }
6367 }
6368
6369 return ( status );
6370}
6371#endif
6372
6373/* ---------------------------------------------------------------------------
6374 \fn csrGetSupportedCountryCode
6375 \brief this function is to get a list of the country code current being supported
6376 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
6377 this has the country code list. 3 bytes for each country code. This may be NULL if
6378 caller wants to know the needed bytes.
6379 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
6380 this contains the length of the data in pBuf
6381 \return eHalStatus
6382 -------------------------------------------------------------------------------*/
6383eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen)
6384{
6385 eHalStatus status = eHAL_STATUS_SUCCESS;
6386 VOS_STATUS vosStatus;
6387 v_SIZE_t size = (v_SIZE_t)*pbLen;
6388
6389 vosStatus = vos_nv_getSupportedCountryCode( pBuf, &size, 1 );
6390 //eiter way, return the value back
6391 *pbLen = (tANI_U32)size;
6392
6393 //If pBuf is NULL, caller just want to get the size, consider it success
6394 if(pBuf)
6395 {
6396 if( VOS_IS_STATUS_SUCCESS( vosStatus ) )
6397 {
6398 tANI_U32 i, n = *pbLen / 3;
6399
6400 for( i = 0; i < n; i++ )
6401 {
6402 pBuf[i*3 + 2] = ' ';
6403 }
6404 }
6405 else
6406 {
6407 status = eHAL_STATUS_FAILURE;
6408 }
6409 }
6410
6411 return (status);
6412}
6413
6414
6415
6416//Upper layer to get the list of the base channels to scan for passively 11d info from csr
6417eHalStatus csrScanGetBaseChannels( tpAniSirGlobal pMac, tCsrChannelInfo * pChannelInfo )
6418{
6419 eHalStatus status = eHAL_STATUS_FAILURE;
6420
6421 do
6422 {
6423
6424 if(!pMac->scan.baseChannels.numChannels || !pChannelInfo)
6425 {
6426 break;
6427 }
6428 status = palAllocateMemory( pMac->hHdd, (void **)&pChannelInfo->ChannelList,
6429 pMac->scan.baseChannels.numChannels );
6430 if( !HAL_STATUS_SUCCESS( status ) )
6431 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08006432 smsLog( pMac, LOGE, FL("csrScanGetBaseChannels: fail to allocate memory") );
Jeff Johnson295189b2012-06-20 16:38:30 -07006433 break;
6434 }
6435 status = palCopyMemory( pMac->hHdd, pChannelInfo->ChannelList, pMac->scan.baseChannels.channelList,
6436 pMac->scan.baseChannels.numChannels );
6437 if( !HAL_STATUS_SUCCESS( status ) )
6438 {
6439 break;
6440 }
6441 pChannelInfo->numOfChannels = pMac->scan.baseChannels.numChannels;
6442
6443 }while(0);
6444
6445 return ( status );
6446}
6447
6448
6449tANI_BOOLEAN csrIsSetKeyAllowed(tpAniSirGlobal pMac, tANI_U32 sessionId)
6450{
6451 tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006452 tCsrRoamSession *pSession;
6453
6454 pSession =CSR_GET_SESSION(pMac, sessionId);
6455
6456 /*This condition is not working for infra state. When infra is in not-connected state
6457 * the pSession->pCurRoamProfile is NULL. And this function returns TRUE, that is incorrect.
6458 * Since SAP requires to set key without any BSS started, it needs this condition to be met.
6459 * In other words, this function is useless.
6460 * The current work-around is to process setcontext_rsp and removekey_rsp no matter what the
6461 * state is.
6462 */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08006463 smsLog( pMac, LOG2, FL(" is not what it intends to. Must be revisit or removed") );
Jeff Johnson295189b2012-06-20 16:38:30 -07006464 if( (NULL == pSession) ||
6465 ( csrIsConnStateDisconnected( pMac, sessionId ) &&
6466 (pSession->pCurRoamProfile != NULL) &&
6467 (!(CSR_IS_INFRA_AP(pSession->pCurRoamProfile))) )
6468 )
6469 {
6470 fRet = eANI_BOOLEAN_FALSE;
6471 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006472
6473 return ( fRet );
6474}
6475
6476//no need to acquire lock for this basic function
6477tANI_U16 sme_ChnToFreq(tANI_U8 chanNum)
6478{
6479 int i;
6480
6481 for (i = 0; i < NUM_RF_CHANNELS; i++)
6482 {
6483 if (rfChannels[i].channelNum == chanNum)
6484 {
6485 return rfChannels[i].targetFreq;
6486 }
6487 }
6488
6489 return (0);
6490}
6491
6492/* Disconnect all active sessions by sending disassoc. This is mainly used to disconnect the remaining session when we
6493 * transition from concurrent sessions to a single session. The use case is Infra STA and wifi direct multiple sessions are up and
6494 * P2P session is removed. The Infra STA session remains and should resume BMPS if BMPS is enabled by default. However, there
6495 * are some issues seen with BMPS resume during this transition and this is a workaround which will allow the Infra STA session to
6496 * disconnect and auto connect back and enter BMPS this giving the same effect as resuming BMPS
6497 */
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006498
6499//Remove this code once SLM_Sessionization is supported
6500//BMPS_WORKAROUND_NOT_NEEDED
Jeff Johnson295189b2012-06-20 16:38:30 -07006501void csrDisconnectAllActiveSessions(tpAniSirGlobal pMac)
6502{
6503 tANI_U8 i;
6504
6505 /* Disconnect all the active sessions */
6506 for (i=0; i<CSR_ROAM_SESSION_MAX; i++)
6507 {
6508 if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) )
6509 {
6510 csrRoamDisconnectInternal(pMac, i, eCSR_DISCONNECT_REASON_UNSPECIFIED);
6511 }
6512 }
6513}
Mohit Khanna349bc392012-09-11 17:24:52 -07006514
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07006515#ifdef FEATURE_WLAN_LFR
6516tANI_BOOLEAN csrIsChannelPresentInList(
6517 tANI_U8 *pChannelList,
6518 int numChannels,
6519 tANI_U8 channel
6520 )
6521{
6522 int i = 0;
6523
6524 // Check for NULL pointer
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08006525 if (!pChannelList || (numChannels == 0))
6526 {
6527 return FALSE;
6528 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07006529
6530 // Look for the channel in the list
6531 for (i = 0; i < numChannels; i++)
6532 {
6533 if (pChannelList[i] == channel)
6534 return TRUE;
6535 }
6536
6537 return FALSE;
6538}
6539
6540VOS_STATUS csrAddToChannelListFront(
6541 tANI_U8 *pChannelList,
6542 int numChannels,
6543 tANI_U8 channel
6544 )
6545{
6546 int i = 0;
6547
6548 // Check for NULL pointer
6549 if (!pChannelList) return eHAL_STATUS_E_NULL_VALUE;
6550
6551 // Make room for the addition. (Start moving from the back.)
6552 for (i = numChannels; i > 0; i--)
6553 {
6554 pChannelList[i] = pChannelList[i-1];
6555 }
6556
6557 // Now add the NEW channel...at the front
6558 pChannelList[0] = channel;
6559
6560 return eHAL_STATUS_SUCCESS;
6561}
6562#endif