Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * 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 Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | /** ------------------------------------------------------------------------- * |
| 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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 53 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 54 | #include "aniGlobal.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 55 | |
| 56 | #include "palApi.h" |
| 57 | #include "csrSupport.h" |
| 58 | #include "csrInsideApi.h" |
| 59 | #include "smsDebug.h" |
| 60 | #include "smeQosInternal.h" |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 61 | #include "wlan_qct_wda.h" |
| 62 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 63 | #ifdef FEATURE_WLAN_CCX |
| 64 | #include "vos_utils.h" |
| 65 | #include "csrCcx.h" |
| 66 | #endif /* FEATURE_WLAN_CCX */ |
| 67 | |
| 68 | tANI_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 | |
| 80 | tANI_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 |
| 97 | tANI_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 */ |
| 103 | tANI_U8 csrWmeInfoOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 104 | tANI_U8 csrWmeParmOui[ CSR_WME_OUI_SIZE ] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 105 | |
| 106 | static 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 |
| 372 | static 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. |
| 629 | tCsrDomainChnInfo 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 | |
| 1183 | extern const tRfChannelProps rfChannels[NUM_RF_CHANNELS]; |
| 1184 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1185 | //////////////////////////////////////////////////////////////////////// |
| 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 | |
| 1226 | static 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 | |
| 1260 | const char * |
| 1261 | get_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 | |
| 1279 | const char * |
| 1280 | get_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 | |
| 1304 | tANI_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 | |
| 1312 | tANI_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 | |
| 1334 | tANI_BOOLEAN csrIsConnStateConnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1335 | { |
| 1336 | return( eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED == pMac->roam.roamSession[sessionId].connectState ); |
| 1337 | } |
| 1338 | |
| 1339 | tANI_BOOLEAN csrIsConnStateDisconnectedIbss( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1340 | { |
| 1341 | return( eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState ); |
| 1342 | } |
| 1343 | |
| 1344 | tANI_BOOLEAN csrIsConnStateConnectedInfra( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1345 | { |
| 1346 | return( eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == pMac->roam.roamSession[sessionId].connectState ); |
| 1347 | } |
| 1348 | |
| 1349 | tANI_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 | |
| 1357 | tANI_BOOLEAN csrIsConnStateInfra( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1358 | { |
| 1359 | return( csrIsConnStateConnectedInfra( pMac, sessionId ) ); |
| 1360 | } |
| 1361 | |
| 1362 | tANI_BOOLEAN csrIsConnStateIbss( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1363 | { |
| 1364 | return( csrIsConnStateConnectedIbss( pMac, sessionId ) || csrIsConnStateDisconnectedIbss( pMac, sessionId ) ); |
| 1365 | } |
| 1366 | |
| 1367 | |
| 1368 | tANI_BOOLEAN csrIsConnStateConnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1369 | { |
| 1370 | return( eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED == pMac->roam.roamSession[sessionId].connectState ); |
| 1371 | } |
| 1372 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1373 | tANI_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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1378 | |
| 1379 | tANI_BOOLEAN csrIsConnStateDisconnectedWds( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1380 | { |
| 1381 | return( eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED == pMac->roam.roamSession[sessionId].connectState ); |
| 1382 | } |
| 1383 | |
| 1384 | tANI_BOOLEAN csrIsConnStateWds( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1385 | { |
| 1386 | return( csrIsConnStateConnectedWds( pMac, sessionId ) || |
| 1387 | csrIsConnStateDisconnectedWds( pMac, sessionId ) ); |
| 1388 | } |
| 1389 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1390 | tANI_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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1403 | tANI_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 Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1410 | if( CSR_IS_SESSION_VALID( pMac, i ) && |
| 1411 | ( csrIsConnStateInfra( pMac, i ) |
| 1412 | || csrIsConnStateIbss( pMac, i ) |
| 1413 | || csrIsConnStateAp( pMac, i) ) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1414 | { |
| 1415 | fRc = eANI_BOOLEAN_TRUE; |
| 1416 | break; |
| 1417 | } |
| 1418 | } |
| 1419 | |
| 1420 | return ( fRc ); |
| 1421 | } |
| 1422 | |
| 1423 | tANI_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 | |
| 1440 | tANI_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 | |
| 1458 | tANI_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 | |
| 1488 | tANI_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 Koyyalamudi | 48081ef | 2012-12-04 16:49:55 -0800 | [diff] [blame] | 1505 | tANI_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 | |
| 1537 | tANI_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 Koyyalamudi | d3d2259 | 2012-09-24 14:01:29 -0700 | [diff] [blame] | 1575 | tANI_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 Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1595 | |
| 1596 | tANI_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 | |
| 1613 | tANI_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 | |
| 1636 | tANI_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 | |
| 1654 | tANI_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 Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1671 | tANI_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 Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1701 | tANI_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 Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1719 | tANI_BOOLEAN csrIsBTAMP( tpAniSirGlobal pMac, tANI_U32 sessionId ) |
| 1720 | { |
| 1721 | return ( csrIsConnStateConnectedWds( pMac, sessionId ) ); |
| 1722 | } |
| 1723 | |
| 1724 | |
| 1725 | tANI_BOOLEAN csrIsConnStateDisconnected(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 1726 | { |
| 1727 | return (eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED == pMac->roam.roamSession[sessionId].connectState); |
| 1728 | } |
| 1729 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1730 | tANI_BOOLEAN csrIsValidMcConcurrentSession(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 1731 | tSirBssDescription *pBssDesc) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1732 | { |
| 1733 | tCsrRoamSession *pSession = NULL; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1734 | eAniBoolean status = eANI_BOOLEAN_FALSE; |
| 1735 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1736 | //Check for MCC support |
| 1737 | if (!pMac->roam.configParam.fenableMCCMode) |
| 1738 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1739 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1740 | } |
| 1741 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1742 | //Validate BeaconInterval |
| 1743 | if( CSR_IS_SESSION_VALID( pMac, sessionId ) ) |
| 1744 | { |
| 1745 | pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 1746 | if (NULL != pSession->pCurRoamProfile) |
| 1747 | { |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 1748 | if (csrIsconcurrentsessionValid (pMac, sessionId, |
| 1749 | pSession->pCurRoamProfile->csrPersona) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1750 | == eHAL_STATUS_SUCCESS ) |
| 1751 | { |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 1752 | if (csrValidateMCCBeaconInterval( pMac, pBssDesc->channelId, |
| 1753 | &pBssDesc->beaconInterval, sessionId, |
| 1754 | pSession->pCurRoamProfile->csrPersona) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1755 | != eHAL_STATUS_SUCCESS) |
| 1756 | { |
| 1757 | status = eANI_BOOLEAN_FALSE; |
| 1758 | } |
| 1759 | else |
| 1760 | { |
| 1761 | status = eANI_BOOLEAN_TRUE; |
| 1762 | } |
| 1763 | } |
| 1764 | else |
| 1765 | { |
| 1766 | status = eANI_BOOLEAN_FALSE; |
| 1767 | } |
| 1768 | } |
| 1769 | } |
| 1770 | return status; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1771 | } |
| 1772 | |
| 1773 | static tSirMacCapabilityInfo csrGetBssCapabilities( tSirBssDescription *pSirBssDesc ) |
| 1774 | { |
| 1775 | tSirMacCapabilityInfo dot11Caps; |
| 1776 | |
| 1777 | //tSirMacCapabilityInfo is 16-bit |
| 1778 | pal_get_U16( (tANI_U8 *)&pSirBssDesc->capabilityInfo, (tANI_U16 *)&dot11Caps ); |
| 1779 | |
| 1780 | return( dot11Caps ); |
| 1781 | } |
| 1782 | |
| 1783 | tANI_BOOLEAN csrIsInfraBssDesc( tSirBssDescription *pSirBssDesc ) |
| 1784 | { |
| 1785 | tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc ); |
| 1786 | |
| 1787 | return( (tANI_BOOLEAN)dot11Caps.ess ); |
| 1788 | } |
| 1789 | |
| 1790 | |
| 1791 | tANI_BOOLEAN csrIsIbssBssDesc( tSirBssDescription *pSirBssDesc ) |
| 1792 | { |
| 1793 | tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc ); |
| 1794 | |
| 1795 | return( (tANI_BOOLEAN)dot11Caps.ibss ); |
| 1796 | } |
| 1797 | |
| 1798 | tANI_BOOLEAN csrIsQoSBssDesc( tSirBssDescription *pSirBssDesc ) |
| 1799 | { |
| 1800 | tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc ); |
| 1801 | |
| 1802 | return( (tANI_BOOLEAN)dot11Caps.qos ); |
| 1803 | } |
| 1804 | |
| 1805 | tANI_BOOLEAN csrIsPrivacy( tSirBssDescription *pSirBssDesc ) |
| 1806 | { |
| 1807 | tSirMacCapabilityInfo dot11Caps = csrGetBssCapabilities( pSirBssDesc ); |
| 1808 | |
| 1809 | return( (tANI_BOOLEAN)dot11Caps.privacy ); |
| 1810 | } |
| 1811 | |
| 1812 | |
| 1813 | tANI_BOOLEAN csrIs11dSupported(tpAniSirGlobal pMac) |
| 1814 | { |
| 1815 | return(pMac->roam.configParam.Is11dSupportEnabled); |
| 1816 | } |
| 1817 | |
| 1818 | |
| 1819 | tANI_BOOLEAN csrIs11hSupported(tpAniSirGlobal pMac) |
| 1820 | { |
| 1821 | return(pMac->roam.configParam.Is11hSupportEnabled); |
| 1822 | } |
| 1823 | |
| 1824 | |
| 1825 | tANI_BOOLEAN csrIs11eSupported(tpAniSirGlobal pMac) |
| 1826 | { |
| 1827 | return(pMac->roam.configParam.Is11eSupportEnabled); |
| 1828 | } |
| 1829 | |
| 1830 | tANI_BOOLEAN csrIsMCCSupported ( tpAniSirGlobal pMac ) |
| 1831 | { |
| 1832 | return(pMac->roam.configParam.fenableMCCMode); |
| 1833 | |
| 1834 | } |
| 1835 | |
| 1836 | tANI_BOOLEAN csrIsWmmSupported(tpAniSirGlobal pMac) |
| 1837 | { |
| 1838 | if(eCsrRoamWmmNoQos == pMac->roam.configParam.WMMSupportMode) |
| 1839 | { |
| 1840 | return eANI_BOOLEAN_FALSE; |
| 1841 | } |
| 1842 | else |
| 1843 | { |
| 1844 | return eANI_BOOLEAN_TRUE; |
| 1845 | } |
| 1846 | } |
| 1847 | |
| 1848 | |
| 1849 | |
| 1850 | |
| 1851 | //pIes is the IEs for pSirBssDesc2 |
| 1852 | tANI_BOOLEAN csrIsSsidEqual( tHalHandle hHal, tSirBssDescription *pSirBssDesc1, |
| 1853 | tSirBssDescription *pSirBssDesc2, tDot11fBeaconIEs *pIes2 ) |
| 1854 | { |
| 1855 | tANI_BOOLEAN fEqual = FALSE; |
| 1856 | tSirMacSSid Ssid1, Ssid2; |
| 1857 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1858 | tDot11fBeaconIEs *pIes1 = NULL; |
| 1859 | tDot11fBeaconIEs *pIesLocal = pIes2; |
| 1860 | |
| 1861 | do { |
| 1862 | if( ( NULL == pSirBssDesc1 ) || ( NULL == pSirBssDesc2 ) ) break; |
| 1863 | if( !pIesLocal && !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc2, &pIesLocal)) ) |
| 1864 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1865 | smsLog(pMac, LOGE, FL(" fail to parse IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1866 | break; |
| 1867 | } |
| 1868 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc1, &pIes1))) |
| 1869 | { |
| 1870 | break; |
| 1871 | } |
| 1872 | if( ( !pIes1->SSID.present ) || ( !pIesLocal->SSID.present ) ) break; |
| 1873 | if ( pIes1->SSID.num_ssid != pIesLocal->SSID.num_ssid ) break; |
| 1874 | palCopyMemory(pMac->hHdd, Ssid1.ssId, pIes1->SSID.ssid, pIes1->SSID.num_ssid); |
| 1875 | palCopyMemory(pMac->hHdd, Ssid2.ssId, pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid); |
| 1876 | |
| 1877 | fEqual = palEqualMemory(pMac->hHdd, Ssid1.ssId, Ssid2.ssId, pIesLocal->SSID.num_ssid ); |
| 1878 | |
| 1879 | } while( 0 ); |
| 1880 | if(pIes1) |
| 1881 | { |
| 1882 | palFreeMemory(pMac->hHdd, pIes1); |
| 1883 | } |
| 1884 | if( pIesLocal && !pIes2 ) |
| 1885 | { |
| 1886 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 1887 | } |
| 1888 | |
| 1889 | return( fEqual ); |
| 1890 | } |
| 1891 | |
| 1892 | tANI_BOOLEAN csrIsAniWmeSupported(tDot11fIEAirgo *pIeAirgo) |
| 1893 | { |
| 1894 | tANI_BOOLEAN fRet = eANI_BOOLEAN_FALSE; |
| 1895 | |
| 1896 | if(pIeAirgo && pIeAirgo->present && pIeAirgo->PropCapability.present) |
| 1897 | { |
| 1898 | fRet = (tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability )); |
| 1899 | } |
| 1900 | |
| 1901 | return fRet; |
| 1902 | } |
| 1903 | |
| 1904 | |
| 1905 | |
| 1906 | |
| 1907 | //pIes can be passed in as NULL if the caller doesn't have one prepared |
| 1908 | tANI_BOOLEAN csrIsBssDescriptionWme( tHalHandle hHal, tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes ) |
| 1909 | { |
| 1910 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 1911 | // Assume that WME is found... |
| 1912 | tANI_BOOLEAN fWme = TRUE; |
| 1913 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 1914 | |
| 1915 | do |
| 1916 | { |
| 1917 | if(pIesTemp == NULL) |
| 1918 | { |
| 1919 | if( !HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesTemp)) ) |
| 1920 | { |
| 1921 | fWme = FALSE; |
| 1922 | break; |
| 1923 | } |
| 1924 | } |
| 1925 | // if the AirgoProprietary indicator is found, then WME is supported... |
| 1926 | if ( csrIsAniWmeSupported(&pIesTemp->Airgo) ) break; |
| 1927 | // if the Wme Info IE is found, then WME is supported... |
| 1928 | if ( CSR_IS_QOS_BSS(pIesTemp) ) break; |
| 1929 | // if none of these are found, then WME is NOT supported... |
| 1930 | fWme = FALSE; |
| 1931 | } while( 0 ); |
| 1932 | if( !csrIsWmmSupported( pMac ) && fWme) |
| 1933 | { |
| 1934 | if( !pIesTemp->HTCaps.present ) |
| 1935 | { |
| 1936 | fWme = FALSE; |
| 1937 | } |
| 1938 | } |
| 1939 | if( ( pIes == NULL ) && ( NULL != pIesTemp ) ) |
| 1940 | { |
| 1941 | //we allocate memory here so free it before returning |
| 1942 | palFreeMemory(pMac->hHdd, pIesTemp); |
| 1943 | } |
| 1944 | |
| 1945 | return( fWme ); |
| 1946 | } |
| 1947 | |
| 1948 | tANI_BOOLEAN csrIsHcfEnabled( tDot11fIEAirgo *pIeAirgo ) |
| 1949 | { |
| 1950 | tANI_BOOLEAN fHcfSupported = FALSE; |
| 1951 | |
| 1952 | fHcfSupported = ((tANI_BOOLEAN)(PROP_CAPABILITY_GET( WME, pIeAirgo->PropCapability.capability )) || |
| 1953 | (pIeAirgo->present && pIeAirgo->HCF.present && pIeAirgo->HCF.enabled)); |
| 1954 | |
| 1955 | return( fHcfSupported ); |
| 1956 | } |
| 1957 | |
| 1958 | |
| 1959 | eCsrMediaAccessType csrGetQoSFromBssDesc( tHalHandle hHal, tSirBssDescription *pSirBssDesc, |
| 1960 | tDot11fBeaconIEs *pIes ) |
| 1961 | { |
| 1962 | eCsrMediaAccessType qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 1963 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1964 | VOS_ASSERT( pIes != NULL ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1965 | |
| 1966 | do |
| 1967 | { |
| 1968 | // if we find WMM in the Bss Description, then we let this |
| 1969 | // override and use WMM. |
| 1970 | if ( csrIsBssDescriptionWme( hHal, pSirBssDesc, pIes ) ) |
| 1971 | { |
| 1972 | qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
| 1973 | } |
| 1974 | else |
| 1975 | { |
| 1976 | // if the QoS bit is on, then the AP is advertising 11E QoS... |
| 1977 | if ( csrIsQoSBssDesc( pSirBssDesc ) ) |
| 1978 | { |
| 1979 | // which could be HCF or eDCF. |
| 1980 | if ( csrIsHcfEnabled( &pIes->Airgo ) ) |
| 1981 | { |
| 1982 | qosType = eCSR_MEDIUM_ACCESS_11e_HCF; |
| 1983 | } |
| 1984 | else |
| 1985 | { |
| 1986 | qosType = eCSR_MEDIUM_ACCESS_11e_eDCF; |
| 1987 | } |
| 1988 | } |
| 1989 | else |
| 1990 | { |
| 1991 | qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 1992 | } |
| 1993 | // scale back based on the types turned on for the adapter... |
| 1994 | if ( eCSR_MEDIUM_ACCESS_11e_eDCF == qosType && !csrIs11eSupported( hHal ) ) |
| 1995 | { |
| 1996 | qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 1997 | } |
| 1998 | } |
| 1999 | |
| 2000 | } while(0); |
| 2001 | |
| 2002 | return( qosType ); |
| 2003 | } |
| 2004 | |
| 2005 | |
| 2006 | |
| 2007 | |
| 2008 | //Caller allocates memory for pIEStruct |
| 2009 | eHalStatus csrParseBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIEStruct) |
| 2010 | { |
| 2011 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 2012 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2013 | int ieLen = (int)(pBssDesc->length + sizeof( pBssDesc->length ) - GET_FIELD_OFFSET( tSirBssDescription, ieFields )); |
| 2014 | |
| 2015 | if(ieLen > 0 && pIEStruct) |
| 2016 | { |
| 2017 | if(!DOT11F_FAILED(dot11fUnpackBeaconIEs( pMac, (tANI_U8 *)pBssDesc->ieFields, ieLen, pIEStruct ))) |
| 2018 | { |
| 2019 | status = eHAL_STATUS_SUCCESS; |
| 2020 | } |
| 2021 | } |
| 2022 | |
| 2023 | return (status); |
| 2024 | } |
| 2025 | |
| 2026 | |
| 2027 | //This function will allocate memory for the parsed IEs to the caller. Caller must free the memory |
| 2028 | //after it is done with the data only if this function succeeds |
| 2029 | eHalStatus csrGetParsedBssDescriptionIEs(tHalHandle hHal, tSirBssDescription *pBssDesc, tDot11fBeaconIEs **ppIEStruct) |
| 2030 | { |
| 2031 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 2032 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2033 | |
| 2034 | if(pBssDesc && ppIEStruct) |
| 2035 | { |
| 2036 | status = palAllocateMemory(pMac->hHdd, (void **)ppIEStruct, sizeof(tDot11fBeaconIEs)); |
| 2037 | if(HAL_STATUS_SUCCESS(status)) |
| 2038 | { |
| 2039 | palZeroMemory(pMac->hHdd, (void *)*ppIEStruct, sizeof(tDot11fBeaconIEs)); |
| 2040 | status = csrParseBssDescriptionIEs(hHal, pBssDesc, *ppIEStruct); |
| 2041 | if(!HAL_STATUS_SUCCESS(status)) |
| 2042 | { |
| 2043 | palFreeMemory(pMac->hHdd, *ppIEStruct); |
| 2044 | *ppIEStruct = NULL; |
| 2045 | } |
| 2046 | } |
| 2047 | else |
| 2048 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2049 | smsLog( pMac, LOGE, FL(" failed to allocate memory") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2050 | VOS_ASSERT( 0 ); |
| 2051 | } |
| 2052 | } |
| 2053 | |
| 2054 | return (status); |
| 2055 | } |
| 2056 | |
| 2057 | |
| 2058 | |
| 2059 | |
| 2060 | tANI_BOOLEAN csrIsNULLSSID( tANI_U8 *pBssSsid, tANI_U8 len ) |
| 2061 | { |
| 2062 | tANI_BOOLEAN fNullSsid = FALSE; |
| 2063 | |
| 2064 | tANI_U32 SsidLength; |
| 2065 | tANI_U8 *pSsidStr; |
| 2066 | |
| 2067 | do |
| 2068 | { |
| 2069 | if ( 0 == len ) |
| 2070 | { |
| 2071 | fNullSsid = TRUE; |
| 2072 | break; |
| 2073 | } |
| 2074 | |
| 2075 | //Consider 0 or space for hidden SSID |
| 2076 | if ( 0 == pBssSsid[0] ) |
| 2077 | { |
| 2078 | fNullSsid = TRUE; |
| 2079 | break; |
| 2080 | } |
| 2081 | |
| 2082 | SsidLength = len; |
| 2083 | pSsidStr = pBssSsid; |
| 2084 | |
| 2085 | while ( SsidLength ) |
| 2086 | { |
| 2087 | if( *pSsidStr ) |
| 2088 | break; |
| 2089 | |
| 2090 | pSsidStr++; |
| 2091 | SsidLength--; |
| 2092 | } |
| 2093 | |
| 2094 | if( 0 == SsidLength ) |
| 2095 | { |
| 2096 | fNullSsid = TRUE; |
| 2097 | break; |
| 2098 | } |
| 2099 | } |
| 2100 | while( 0 ); |
| 2101 | |
| 2102 | return fNullSsid; |
| 2103 | } |
| 2104 | |
| 2105 | |
| 2106 | tANI_U32 csrGetFragThresh( tHalHandle hHal ) |
| 2107 | { |
| 2108 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2109 | |
| 2110 | return pMac->roam.configParam.FragmentationThreshold; |
| 2111 | } |
| 2112 | |
| 2113 | tANI_U32 csrGetRTSThresh( tHalHandle hHal ) |
| 2114 | { |
| 2115 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2116 | |
| 2117 | return pMac->roam.configParam.RTSThreshold; |
| 2118 | } |
| 2119 | |
| 2120 | eCsrPhyMode csrTranslateToPhyModeFromBssDesc( tSirBssDescription *pSirBssDesc ) |
| 2121 | { |
| 2122 | eCsrPhyMode phyMode; |
| 2123 | |
| 2124 | switch ( pSirBssDesc->nwType ) |
| 2125 | { |
| 2126 | case eSIR_11A_NW_TYPE: |
| 2127 | phyMode = eCSR_DOT11_MODE_11a; |
| 2128 | break; |
| 2129 | |
| 2130 | case eSIR_11B_NW_TYPE: |
| 2131 | phyMode = eCSR_DOT11_MODE_11b; |
| 2132 | break; |
| 2133 | |
| 2134 | case eSIR_11G_NW_TYPE: |
| 2135 | phyMode = eCSR_DOT11_MODE_11g; |
| 2136 | break; |
| 2137 | |
| 2138 | case eSIR_11N_NW_TYPE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2139 | phyMode = eCSR_DOT11_MODE_11n; |
| 2140 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2141 | #ifdef WLAN_FEATURE_11AC |
| 2142 | case eSIR_11AC_NW_TYPE: |
| 2143 | default: |
| 2144 | phyMode = eCSR_DOT11_MODE_11ac; |
| 2145 | #else |
| 2146 | default: |
| 2147 | phyMode = eCSR_DOT11_MODE_11n; |
| 2148 | #endif |
| 2149 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2150 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2151 | return( phyMode ); |
| 2152 | } |
| 2153 | |
| 2154 | |
| 2155 | tANI_U32 csrTranslateToWNICfgDot11Mode(tpAniSirGlobal pMac, eCsrCfgDot11Mode csrDot11Mode) |
| 2156 | { |
| 2157 | tANI_U32 ret; |
| 2158 | |
| 2159 | switch(csrDot11Mode) |
| 2160 | { |
| 2161 | case eCSR_CFG_DOT11_MODE_AUTO: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2162 | smsLog(pMac, LOGW, FL(" Warning: sees eCSR_CFG_DOT11_MODE_AUTO ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2163 | //We cannot decide until now. |
| 2164 | if(pMac->roam.configParam.ProprietaryRatesEnabled) |
| 2165 | { |
| 2166 | ret = WNI_CFG_DOT11_MODE_TAURUS; |
| 2167 | } |
| 2168 | else |
| 2169 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 2170 | ret = WNI_CFG_DOT11_MODE_11AC; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2171 | } |
| 2172 | break; |
| 2173 | case eCSR_CFG_DOT11_MODE_TAURUS: |
| 2174 | ret = WNI_CFG_DOT11_MODE_TAURUS; |
| 2175 | break; |
| 2176 | case eCSR_CFG_DOT11_MODE_11A: |
| 2177 | ret = WNI_CFG_DOT11_MODE_11A; |
| 2178 | break; |
| 2179 | case eCSR_CFG_DOT11_MODE_11B: |
| 2180 | ret = WNI_CFG_DOT11_MODE_11B; |
| 2181 | break; |
| 2182 | case eCSR_CFG_DOT11_MODE_11G: |
| 2183 | ret = WNI_CFG_DOT11_MODE_11G; |
| 2184 | break; |
| 2185 | case eCSR_CFG_DOT11_MODE_11N: |
| 2186 | ret = WNI_CFG_DOT11_MODE_11N; |
| 2187 | break; |
| 2188 | case eCSR_CFG_DOT11_MODE_POLARIS: |
| 2189 | ret = WNI_CFG_DOT11_MODE_POLARIS; |
| 2190 | break; |
| 2191 | case eCSR_CFG_DOT11_MODE_TITAN: |
| 2192 | ret = WNI_CFG_DOT11_MODE_TITAN; |
| 2193 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2194 | case eCSR_CFG_DOT11_MODE_11G_ONLY: |
| 2195 | ret = WNI_CFG_DOT11_MODE_11G_ONLY; |
| 2196 | break; |
| 2197 | case eCSR_CFG_DOT11_MODE_11N_ONLY: |
| 2198 | ret = WNI_CFG_DOT11_MODE_11N_ONLY; |
| 2199 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2200 | |
| 2201 | #ifdef WLAN_FEATURE_11AC |
| 2202 | case eCSR_CFG_DOT11_MODE_11AC_ONLY: |
| 2203 | ret = WNI_CFG_DOT11_MODE_11AC_ONLY; |
| 2204 | break; |
| 2205 | case eCSR_CFG_DOT11_MODE_11AC: |
| 2206 | ret = WNI_CFG_DOT11_MODE_11AC; |
| 2207 | break; |
| 2208 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2209 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2210 | smsLog(pMac, LOGW, FL("doesn't expect %d as csrDo11Mode"), csrDot11Mode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2211 | if(eCSR_BAND_24 == pMac->roam.configParam.eBand) |
| 2212 | { |
| 2213 | ret = WNI_CFG_DOT11_MODE_11G; |
| 2214 | } |
| 2215 | else |
| 2216 | { |
| 2217 | ret = WNI_CFG_DOT11_MODE_11A; |
| 2218 | } |
| 2219 | break; |
| 2220 | } |
| 2221 | |
| 2222 | return (ret); |
| 2223 | } |
| 2224 | |
| 2225 | |
| 2226 | //This function should only return the super set of supported modes. 11n implies 11b/g/a/n. |
| 2227 | eHalStatus csrGetPhyModeFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBSSDescription, |
| 2228 | eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes) |
| 2229 | { |
| 2230 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2231 | eCsrPhyMode phyMode = csrTranslateToPhyModeFromBssDesc(pBSSDescription); |
| 2232 | |
| 2233 | if( pIes ) |
| 2234 | { |
| 2235 | if(pIes->Airgo.present) |
| 2236 | { |
| 2237 | if(pIes->Airgo.PropCapability.present) |
| 2238 | { |
| 2239 | if( PROP_CAPABILITY_GET( TAURUS, pIes->Airgo.PropCapability.capability )) |
| 2240 | { |
| 2241 | phyMode = eCSR_DOT11_MODE_TAURUS; |
| 2242 | } |
| 2243 | } |
| 2244 | } |
| 2245 | if(pIes->HTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode)) |
| 2246 | { |
| 2247 | phyMode = eCSR_DOT11_MODE_11n; |
| 2248 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2249 | |
| 2250 | #ifdef WLAN_FEATURE_11AC |
| 2251 | if ( pIes->VHTCaps.present && (eCSR_DOT11_MODE_TAURUS != phyMode)) |
| 2252 | { |
| 2253 | phyMode = eCSR_DOT11_MODE_11ac; |
| 2254 | } |
| 2255 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2256 | *pPhyMode = phyMode; |
| 2257 | } |
| 2258 | |
| 2259 | return (status); |
| 2260 | |
| 2261 | } |
| 2262 | |
| 2263 | |
| 2264 | //This function returns the correct eCSR_CFG_DOT11_MODE is the two phyModes matches |
| 2265 | //bssPhyMode is the mode derived from the BSS description |
| 2266 | //f5GhzBand is derived from the channel id of BSS description |
| 2267 | tANI_BOOLEAN csrGetPhyModeInUse( eCsrPhyMode phyModeIn, eCsrPhyMode bssPhyMode, tANI_BOOLEAN f5GhzBand, |
| 2268 | eCsrCfgDot11Mode *pCfgDot11ModeToUse ) |
| 2269 | { |
| 2270 | tANI_BOOLEAN fMatch = FALSE; |
| 2271 | eCsrCfgDot11Mode cfgDot11Mode; |
| 2272 | |
| 2273 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; // to suppress compiler warning |
| 2274 | |
| 2275 | switch( phyModeIn ) |
| 2276 | { |
| 2277 | case eCSR_DOT11_MODE_abg: //11a or 11b or 11g |
| 2278 | if( f5GhzBand ) |
| 2279 | { |
| 2280 | fMatch = TRUE; |
| 2281 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2282 | } |
| 2283 | else if( eCSR_DOT11_MODE_11b == bssPhyMode ) |
| 2284 | { |
| 2285 | fMatch = TRUE; |
| 2286 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2287 | } |
| 2288 | else |
| 2289 | { |
| 2290 | fMatch = TRUE; |
| 2291 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2292 | } |
| 2293 | break; |
| 2294 | |
| 2295 | case eCSR_DOT11_MODE_11a: //11a |
| 2296 | if( f5GhzBand ) |
| 2297 | { |
| 2298 | fMatch = TRUE; |
| 2299 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2300 | } |
| 2301 | break; |
| 2302 | |
| 2303 | case eCSR_DOT11_MODE_11a_ONLY: //11a |
| 2304 | if( eCSR_DOT11_MODE_11a == bssPhyMode ) |
| 2305 | { |
| 2306 | fMatch = TRUE; |
| 2307 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2308 | } |
| 2309 | break; |
| 2310 | |
| 2311 | case eCSR_DOT11_MODE_11g: |
| 2312 | if(!f5GhzBand) |
| 2313 | { |
| 2314 | if( eCSR_DOT11_MODE_11b == bssPhyMode ) |
| 2315 | { |
| 2316 | fMatch = TRUE; |
| 2317 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2318 | } |
| 2319 | else |
| 2320 | { |
| 2321 | fMatch = TRUE; |
| 2322 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2323 | } |
| 2324 | } |
| 2325 | break; |
| 2326 | |
| 2327 | case eCSR_DOT11_MODE_11g_ONLY: |
| 2328 | if( eCSR_DOT11_MODE_11g == bssPhyMode ) |
| 2329 | { |
| 2330 | fMatch = TRUE; |
| 2331 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2332 | } |
| 2333 | break; |
| 2334 | |
| 2335 | case eCSR_DOT11_MODE_11b: |
| 2336 | if( !f5GhzBand ) |
| 2337 | { |
| 2338 | fMatch = TRUE; |
| 2339 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2340 | } |
| 2341 | break; |
| 2342 | |
| 2343 | case eCSR_DOT11_MODE_11b_ONLY: |
| 2344 | if( eCSR_DOT11_MODE_11b == bssPhyMode ) |
| 2345 | { |
| 2346 | fMatch = TRUE; |
| 2347 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2348 | } |
| 2349 | break; |
| 2350 | |
| 2351 | case eCSR_DOT11_MODE_11n: |
| 2352 | fMatch = TRUE; |
| 2353 | switch(bssPhyMode) |
| 2354 | { |
| 2355 | case eCSR_DOT11_MODE_11g: |
| 2356 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2357 | break; |
| 2358 | case eCSR_DOT11_MODE_11b: |
| 2359 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2360 | break; |
| 2361 | case eCSR_DOT11_MODE_11a: |
| 2362 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2363 | break; |
| 2364 | case eCSR_DOT11_MODE_11n: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2365 | #ifdef WLAN_FEATURE_11AC |
| 2366 | case eCSR_DOT11_MODE_11ac: |
| 2367 | #endif |
| 2368 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 2369 | break; |
| 2370 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2371 | case eCSR_DOT11_MODE_TAURUS: |
| 2372 | default: |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2373 | #ifdef WLAN_FEATURE_11AC |
| 2374 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 2375 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2376 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2377 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2378 | break; |
| 2379 | } |
| 2380 | break; |
| 2381 | |
| 2382 | case eCSR_DOT11_MODE_11n_ONLY: |
| 2383 | if((eCSR_DOT11_MODE_11n == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode)) |
| 2384 | { |
| 2385 | fMatch = TRUE; |
| 2386 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2387 | |
| 2388 | } |
| 2389 | |
| 2390 | break; |
| 2391 | #ifdef WLAN_FEATURE_11AC |
| 2392 | case eCSR_DOT11_MODE_11ac: |
| 2393 | fMatch = TRUE; |
| 2394 | switch(bssPhyMode) |
| 2395 | { |
| 2396 | case eCSR_DOT11_MODE_11g: |
| 2397 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2398 | break; |
| 2399 | case eCSR_DOT11_MODE_11b: |
| 2400 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2401 | break; |
| 2402 | case eCSR_DOT11_MODE_11a: |
| 2403 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2404 | break; |
| 2405 | case eCSR_DOT11_MODE_11n: |
| 2406 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 2407 | break; |
| 2408 | case eCSR_DOT11_MODE_11ac: |
| 2409 | case eCSR_DOT11_MODE_TAURUS: |
| 2410 | default: |
| 2411 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 2412 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2413 | } |
| 2414 | break; |
| 2415 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2416 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 2417 | if((eCSR_DOT11_MODE_11ac == bssPhyMode) || (eCSR_DOT11_MODE_TAURUS == bssPhyMode)) |
| 2418 | { |
| 2419 | fMatch = TRUE; |
| 2420 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 2421 | } |
| 2422 | break; |
| 2423 | #endif |
| 2424 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2425 | case eCSR_DOT11_MODE_TAURUS: |
| 2426 | default: |
| 2427 | fMatch = TRUE; |
| 2428 | switch(bssPhyMode) |
| 2429 | { |
| 2430 | case eCSR_DOT11_MODE_11g: |
| 2431 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2432 | break; |
| 2433 | case eCSR_DOT11_MODE_11b: |
| 2434 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2435 | break; |
| 2436 | case eCSR_DOT11_MODE_11a: |
| 2437 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2438 | break; |
| 2439 | case eCSR_DOT11_MODE_11n: |
| 2440 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 2441 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2442 | #ifdef WLAN_FEATURE_11AC |
| 2443 | case eCSR_DOT11_MODE_11ac: |
| 2444 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 2445 | break; |
| 2446 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2447 | case eCSR_DOT11_MODE_TAURUS: |
| 2448 | default: |
| 2449 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 2450 | break; |
| 2451 | } |
| 2452 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2453 | } |
| 2454 | |
| 2455 | if ( fMatch && pCfgDot11ModeToUse ) |
| 2456 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2457 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | ef5dd97 | 2012-10-11 15:06:09 -0700 | [diff] [blame] | 2458 | if(cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC && (!IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2459 | { |
| 2460 | *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
| 2461 | } |
| 2462 | else |
| 2463 | #endif |
| 2464 | { |
| 2465 | *pCfgDot11ModeToUse = cfgDot11Mode; |
| 2466 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2467 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2468 | return( fMatch ); |
| 2469 | } |
| 2470 | |
| 2471 | |
| 2472 | //This function decides whether the one of the bit of phyMode is matching the mode in the BSS and allowed by the user |
| 2473 | //setting, pMac->roam.configParam.uCfgDot11Mode. It returns the mode that fits the criteria. |
| 2474 | tANI_BOOLEAN csrIsPhyModeMatch( tpAniSirGlobal pMac, tANI_U32 phyMode, |
| 2475 | tSirBssDescription *pSirBssDesc, tCsrRoamProfile *pProfile, |
| 2476 | eCsrCfgDot11Mode *pReturnCfgDot11Mode, |
| 2477 | tDot11fBeaconIEs *pIes) |
| 2478 | { |
| 2479 | tANI_BOOLEAN fMatch = FALSE; |
| 2480 | eCsrPhyMode phyModeInBssDesc, phyMode2; |
| 2481 | eCsrCfgDot11Mode cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_TAURUS; |
| 2482 | tANI_U32 bitMask, loopCount; |
| 2483 | |
| 2484 | if(HAL_STATUS_SUCCESS(csrGetPhyModeFromBss(pMac, pSirBssDesc, &phyModeInBssDesc, pIes ))) |
| 2485 | { |
| 2486 | //In case some change change eCSR_DOT11_MODE_TAURUS to non-0 |
| 2487 | if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode)) |
| 2488 | { |
| 2489 | //Taurus means anything |
| 2490 | if ( eCSR_CFG_DOT11_MODE_ABG == pMac->roam.configParam.uCfgDot11Mode ) |
| 2491 | { |
| 2492 | phyMode = eCSR_DOT11_MODE_abg; |
| 2493 | } |
| 2494 | else if(eCSR_CFG_DOT11_MODE_AUTO == pMac->roam.configParam.uCfgDot11Mode) |
| 2495 | { |
| 2496 | if(pMac->roam.configParam.ProprietaryRatesEnabled) |
| 2497 | { |
| 2498 | phyMode = eCSR_DOT11_MODE_TAURUS; |
| 2499 | } |
| 2500 | else |
| 2501 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2502 | |
| 2503 | #ifdef WLAN_FEATURE_11AC |
| 2504 | phyMode = eCSR_DOT11_MODE_11ac; |
| 2505 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2506 | phyMode = eCSR_DOT11_MODE_11n; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2507 | #endif |
| 2508 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2509 | } |
| 2510 | } |
| 2511 | else |
| 2512 | { |
| 2513 | //user's pick |
| 2514 | phyMode = pMac->roam.configParam.phyMode; |
| 2515 | } |
| 2516 | } |
| 2517 | if ( (0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode) || (eCSR_DOT11_MODE_TAURUS & phyMode) ) |
| 2518 | { |
| 2519 | if(0 != phyMode) |
| 2520 | { |
| 2521 | if(eCSR_DOT11_MODE_AUTO & phyMode) |
| 2522 | { |
| 2523 | phyMode2 = eCSR_DOT11_MODE_AUTO & phyMode; |
| 2524 | } |
| 2525 | else |
| 2526 | { |
| 2527 | phyMode2 = eCSR_DOT11_MODE_TAURUS & phyMode; |
| 2528 | } |
| 2529 | } |
| 2530 | else |
| 2531 | { |
| 2532 | phyMode2 = phyMode; |
| 2533 | } |
| 2534 | fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId), |
| 2535 | &cfgDot11ModeToUse ); |
| 2536 | } |
| 2537 | else |
| 2538 | { |
| 2539 | bitMask = 1; |
| 2540 | loopCount = 0; |
| 2541 | while(loopCount < eCSR_NUM_PHY_MODE) |
| 2542 | { |
| 2543 | if(0 != ( phyMode2 = (phyMode & (bitMask << loopCount++)) )) |
| 2544 | { |
| 2545 | fMatch = csrGetPhyModeInUse( phyMode2, phyModeInBssDesc, CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId), |
| 2546 | &cfgDot11ModeToUse ); |
| 2547 | if(fMatch) break; |
| 2548 | } |
| 2549 | } |
| 2550 | } |
| 2551 | if ( fMatch && pReturnCfgDot11Mode ) |
| 2552 | { |
| 2553 | if( pProfile ) |
| 2554 | { |
| 2555 | /* IEEE 11n spec (8.4.3): HT STA shall eliminate TKIP as a |
| 2556 | * choice for the pairwise cipher suite if CCMP is advertised |
| 2557 | * by the AP or if the AP included an HT capabilities element |
| 2558 | * in its Beacons and Probe Response. |
| 2559 | */ |
| 2560 | if( (!CSR_IS_11n_ALLOWED( pProfile->negotiatedUCEncryptionType )) && |
| 2561 | ((eCSR_CFG_DOT11_MODE_11N == cfgDot11ModeToUse) || |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2562 | #ifdef WLAN_FEATURE_11AC |
| 2563 | (eCSR_CFG_DOT11_MODE_11AC == cfgDot11ModeToUse) || |
| 2564 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2565 | (eCSR_CFG_DOT11_MODE_TAURUS == cfgDot11ModeToUse)) ) |
| 2566 | { |
| 2567 | //We cannot do 11n here |
| 2568 | if( !CSR_IS_CHANNEL_5GHZ(pSirBssDesc->channelId) ) |
| 2569 | { |
| 2570 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G; |
| 2571 | } |
| 2572 | else |
| 2573 | { |
| 2574 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A; |
| 2575 | } |
| 2576 | } |
| 2577 | } |
| 2578 | *pReturnCfgDot11Mode = cfgDot11ModeToUse; |
| 2579 | } |
| 2580 | } |
| 2581 | |
| 2582 | return( fMatch ); |
| 2583 | } |
| 2584 | |
| 2585 | |
| 2586 | eCsrCfgDot11Mode csrFindBestPhyMode( tpAniSirGlobal pMac, tANI_U32 phyMode ) |
| 2587 | { |
| 2588 | eCsrCfgDot11Mode cfgDot11ModeToUse; |
| 2589 | eCsrBand eBand = pMac->roam.configParam.eBand; |
| 2590 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2591 | |
| 2592 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | ef5dd97 | 2012-10-11 15:06:09 -0700 | [diff] [blame] | 2593 | if ((0 == phyMode) || ((eCSR_DOT11_MODE_AUTO & phyMode) && (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))) |
| 2594 | || ((eCSR_DOT11_MODE_11ac & phyMode) && (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)))) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2595 | { |
| 2596 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC; |
| 2597 | } |
| 2598 | else |
| 2599 | #endif |
| 2600 | |
Madan Mohan Koyyalamudi | ef5dd97 | 2012-10-11 15:06:09 -0700 | [diff] [blame] | 2601 | if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2602 | { |
| 2603 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
| 2604 | } |
| 2605 | else |
| 2606 | { |
| 2607 | if( ( eCSR_DOT11_MODE_11n | eCSR_DOT11_MODE_11n_ONLY ) & phyMode ) |
| 2608 | { |
| 2609 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
| 2610 | } |
| 2611 | else if ( eCSR_DOT11_MODE_abg & phyMode ) |
| 2612 | { |
| 2613 | if( eCSR_BAND_24 != eBand ) |
| 2614 | { |
| 2615 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A; |
| 2616 | } |
| 2617 | else |
| 2618 | { |
| 2619 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G; |
| 2620 | } |
| 2621 | } |
| 2622 | else if( ( eCSR_DOT11_MODE_11a | eCSR_DOT11_MODE_11a_ONLY ) & phyMode ) |
| 2623 | { |
| 2624 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A; |
| 2625 | } |
| 2626 | else if( ( eCSR_DOT11_MODE_11g | eCSR_DOT11_MODE_11g_ONLY ) & phyMode ) |
| 2627 | { |
| 2628 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G; |
| 2629 | } |
| 2630 | else |
| 2631 | { |
| 2632 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11B; |
| 2633 | } |
| 2634 | } |
| 2635 | |
| 2636 | return ( cfgDot11ModeToUse ); |
| 2637 | } |
| 2638 | |
| 2639 | |
| 2640 | |
| 2641 | |
| 2642 | tANI_U32 csrGet11hPowerConstraint( tHalHandle hHal, tDot11fIEPowerConstraints *pPowerConstraint ) |
| 2643 | { |
| 2644 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 2645 | tANI_U32 localPowerConstraint = 0; |
| 2646 | |
| 2647 | // check if .11h support is enabled, if not, the power constraint is 0. |
| 2648 | if(pMac->roam.configParam.Is11hSupportEnabled && pPowerConstraint->present) |
| 2649 | { |
| 2650 | localPowerConstraint = pPowerConstraint->localPowerConstraints; |
| 2651 | } |
| 2652 | |
| 2653 | return( localPowerConstraint ); |
| 2654 | } |
| 2655 | |
| 2656 | |
| 2657 | tANI_BOOLEAN csrIsProfileWpa( tCsrRoamProfile *pProfile ) |
| 2658 | { |
| 2659 | tANI_BOOLEAN fWpaProfile = FALSE; |
| 2660 | |
| 2661 | switch ( pProfile->negotiatedAuthType ) |
| 2662 | { |
| 2663 | case eCSR_AUTH_TYPE_WPA: |
| 2664 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2665 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2666 | #ifdef FEATURE_WLAN_CCX |
| 2667 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 2668 | #endif |
| 2669 | fWpaProfile = TRUE; |
| 2670 | break; |
| 2671 | |
| 2672 | default: |
| 2673 | fWpaProfile = FALSE; |
| 2674 | break; |
| 2675 | } |
| 2676 | |
| 2677 | if ( fWpaProfile ) |
| 2678 | { |
| 2679 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 2680 | { |
| 2681 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 2682 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 2683 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 2684 | case eCSR_ENCRYPT_TYPE_AES: |
| 2685 | fWpaProfile = TRUE; |
| 2686 | break; |
| 2687 | |
| 2688 | default: |
| 2689 | fWpaProfile = FALSE; |
| 2690 | break; |
| 2691 | } |
| 2692 | } |
| 2693 | return( fWpaProfile ); |
| 2694 | } |
| 2695 | |
| 2696 | tANI_BOOLEAN csrIsProfileRSN( tCsrRoamProfile *pProfile ) |
| 2697 | { |
| 2698 | tANI_BOOLEAN fRSNProfile = FALSE; |
| 2699 | |
| 2700 | switch ( pProfile->negotiatedAuthType ) |
| 2701 | { |
| 2702 | case eCSR_AUTH_TYPE_RSN: |
| 2703 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 2704 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2705 | case eCSR_AUTH_TYPE_FT_RSN: |
| 2706 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 2707 | #endif |
| 2708 | #ifdef FEATURE_WLAN_CCX |
| 2709 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 2710 | #endif |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 2711 | #ifdef WLAN_FEATURE_11W |
| 2712 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 2713 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2714 | fRSNProfile = TRUE; |
| 2715 | break; |
| 2716 | |
| 2717 | default: |
| 2718 | fRSNProfile = FALSE; |
| 2719 | break; |
| 2720 | } |
| 2721 | |
| 2722 | if ( fRSNProfile ) |
| 2723 | { |
| 2724 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 2725 | { |
| 2726 | // !!REVIEW - For WPA2, use of RSN IE mandates |
| 2727 | // use of AES as encryption. Here, we qualify |
| 2728 | // even if encryption type is WEP or TKIP |
| 2729 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 2730 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 2731 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 2732 | case eCSR_ENCRYPT_TYPE_AES: |
| 2733 | fRSNProfile = TRUE; |
| 2734 | break; |
| 2735 | |
| 2736 | default: |
| 2737 | fRSNProfile = FALSE; |
| 2738 | break; |
| 2739 | } |
| 2740 | } |
| 2741 | return( fRSNProfile ); |
| 2742 | } |
| 2743 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2744 | eHalStatus |
| 2745 | csrIsconcurrentsessionValid(tpAniSirGlobal pMac,tANI_U32 cursessionId, |
| 2746 | tVOS_CON_MODE currBssPersona) |
| 2747 | { |
| 2748 | tANI_U32 sessionId = 0; |
| 2749 | |
| 2750 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 2751 | { |
| 2752 | if (cursessionId != sessionId ) |
| 2753 | { |
| 2754 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 2755 | { |
| 2756 | continue; |
| 2757 | } |
| 2758 | |
| 2759 | switch (currBssPersona) |
| 2760 | { |
| 2761 | case VOS_STA_MODE: |
| 2762 | if(pMac->roam.roamSession[sessionId].pCurRoamProfile && |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2763 | (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2764 | == VOS_STA_MODE)) //check for P2P client mode |
| 2765 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2766 | smsLog(pMac, LOGE, FL(" ****STA mode already exists ****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2767 | return eHAL_STATUS_FAILURE; |
| 2768 | } |
| 2769 | break; |
| 2770 | |
| 2771 | case VOS_STA_SAP_MODE: |
Gopichand Nakkala | 53fefcd | 2013-02-28 12:35:20 +0530 | [diff] [blame] | 2772 | if((pMac->roam.roamSession[sessionId].bssParams.bssPersona |
| 2773 | == VOS_STA_SAP_MODE)&& |
| 2774 | (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2775 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2776 | smsLog(pMac, LOGE, FL(" ****SoftAP mode already exists ****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2777 | return eHAL_STATUS_FAILURE; |
| 2778 | } |
| 2779 | |
Gopichand Nakkala | 53fefcd | 2013-02-28 12:35:20 +0530 | [diff] [blame] | 2780 | else if((pMac->roam.roamSession[sessionId].bssParams.bssPersona |
| 2781 | == VOS_P2P_GO_MODE) && |
| 2782 | (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2783 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2784 | smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2785 | return eHAL_STATUS_FAILURE; |
| 2786 | } |
| 2787 | break; |
| 2788 | |
| 2789 | case VOS_P2P_CLIENT_MODE: |
| 2790 | if(pMac->roam.roamSession[sessionId].pCurRoamProfile && |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2791 | (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2792 | == VOS_P2P_CLIENT_MODE)) //check for P2P client mode |
| 2793 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2794 | smsLog(pMac, LOGE, FL(" ****CLIENT mode already exists ****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2795 | return eHAL_STATUS_FAILURE; |
| 2796 | } |
| 2797 | break; |
| 2798 | |
| 2799 | case VOS_P2P_GO_MODE: |
Gopichand Nakkala | 53fefcd | 2013-02-28 12:35:20 +0530 | [diff] [blame] | 2800 | if((pMac->roam.roamSession[sessionId].bssParams.bssPersona |
| 2801 | == VOS_P2P_GO_MODE) && |
| 2802 | (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2803 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2804 | smsLog(pMac, LOGE, FL(" ****P2P GO mode already exists ****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2805 | return eHAL_STATUS_FAILURE; |
| 2806 | } |
Gopichand Nakkala | 53fefcd | 2013-02-28 12:35:20 +0530 | [diff] [blame] | 2807 | else if((pMac->roam.roamSession[sessionId].bssParams.bssPersona |
| 2808 | == VOS_STA_SAP_MODE) && |
| 2809 | (pMac->roam.roamSession[sessionId].connectState != eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED)) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2810 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2811 | smsLog(pMac, LOGE, FL(" ****Cannot start Multiple Beaconing Role ****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2812 | return eHAL_STATUS_FAILURE; |
| 2813 | } |
| 2814 | break; |
| 2815 | |
| 2816 | default : |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2817 | smsLog(pMac, LOGE, FL("***Persona not handled = %d*****"),currBssPersona); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2818 | break; |
| 2819 | } |
| 2820 | } |
| 2821 | } |
| 2822 | return eHAL_STATUS_SUCCESS; |
| 2823 | |
| 2824 | } |
| 2825 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2826 | eHalStatus csrUpdateMCCp2pBeaconInterval(tpAniSirGlobal pMac) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2827 | { |
| 2828 | tANI_U32 sessionId = 0; |
| 2829 | |
| 2830 | //If MCC is not supported just break and return SUCCESS |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2831 | if ( !pMac->roam.configParam.fenableMCCMode){ |
| 2832 | return eHAL_STATUS_FAILURE; |
| 2833 | } |
| 2834 | |
| 2835 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 2836 | { |
| 2837 | /* If GO in MCC support different beacon interval, |
| 2838 | * change the BI of the P2P-GO */ |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2839 | if (pMac->roam.roamSession[sessionId].bssParams.bssPersona |
| 2840 | == VOS_P2P_GO_MODE) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2841 | { |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2842 | /* Handle different BI scneario based on the configuration set. |
| 2843 | * If Config is set to 0x02 then Disconnect all the P2P clients |
| 2844 | * associated. If config is set to 0x04 then update the BI |
| 2845 | * without disconnecting all the clients |
| 2846 | */ |
| 2847 | if ((pMac->roam.configParam.fAllowMCCGODiffBI == 0x04) && |
| 2848 | (pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval)) |
| 2849 | { |
| 2850 | return csrSendChngMCCBeaconInterval( pMac, sessionId); |
| 2851 | } |
| 2852 | //If the configuration of fAllowMCCGODiffBI is set to other than 0x04 |
| 2853 | else if ( pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval) |
| 2854 | { |
| 2855 | return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS, eCSR_ROAM_RESULT_NONE); |
| 2856 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2857 | } |
| 2858 | } |
| 2859 | return eHAL_STATUS_FAILURE; |
| 2860 | } |
| 2861 | |
| 2862 | tANI_U16 csrCalculateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U16 sta_bi, tANI_U16 go_gbi) |
| 2863 | { |
| 2864 | tANI_U8 num_beacons = 0; |
| 2865 | tANI_U8 is_multiple = 0; |
| 2866 | tANI_U16 go_cbi = 0; |
| 2867 | tANI_U16 go_fbi = 0; |
| 2868 | tANI_U16 sta_cbi = 0; |
| 2869 | |
| 2870 | //If GO's given beacon Interval is less than 100 |
| 2871 | if(go_gbi < 100) |
| 2872 | go_cbi = 100; |
| 2873 | //if GO's given beacon Interval is greater than or equal to 100 |
| 2874 | else |
| 2875 | go_cbi = 100 + (go_gbi % 100); |
| 2876 | |
| 2877 | // check, if either one is multiple of another |
| 2878 | if (sta_bi > go_cbi) |
| 2879 | { |
| 2880 | is_multiple = !(sta_bi % go_cbi); |
| 2881 | } |
| 2882 | else |
| 2883 | { |
| 2884 | is_multiple = !(go_cbi % sta_bi); |
| 2885 | } |
Madan Mohan Koyyalamudi | 48081ef | 2012-12-04 16:49:55 -0800 | [diff] [blame] | 2886 | // if it is multiple, then accept GO's beacon interval range [100,199] as it is |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2887 | if (is_multiple) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2888 | { |
| 2889 | return go_cbi; |
| 2890 | } |
| 2891 | //else , if it is not multiple, then then check for number of beacons to be |
| 2892 | //inserted based on sta BI |
| 2893 | num_beacons = sta_bi / 100; |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2894 | if (num_beacons) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2895 | { |
Madan Mohan Koyyalamudi | 48081ef | 2012-12-04 16:49:55 -0800 | [diff] [blame] | 2896 | // GO's final beacon interval will be aligned to sta beacon interval, but |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2897 | //in the range of [100, 199]. |
| 2898 | sta_cbi = sta_bi / num_beacons; |
| 2899 | go_fbi = sta_cbi; |
| 2900 | } |
| 2901 | else |
| 2902 | { |
Madan Mohan Koyyalamudi | 48081ef | 2012-12-04 16:49:55 -0800 | [diff] [blame] | 2903 | // if STA beacon interval is less than 100, use GO's change bacon interval |
| 2904 | //instead of updating to STA's beacon interval. |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2905 | go_fbi = go_cbi; |
| 2906 | } |
| 2907 | return go_fbi; |
| 2908 | } |
| 2909 | |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2910 | eHalStatus csrValidateMCCBeaconInterval(tpAniSirGlobal pMac, tANI_U8 channelId, |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2911 | tANI_U16 *beaconInterval, tANI_U32 cursessionId, |
| 2912 | tVOS_CON_MODE currBssPersona) |
| 2913 | { |
| 2914 | tANI_U32 sessionId = 0; |
| 2915 | tANI_U16 new_beaconInterval = 0; |
| 2916 | |
| 2917 | //If MCC is not supported just break |
| 2918 | if (!pMac->roam.configParam.fenableMCCMode){ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2919 | return eHAL_STATUS_FAILURE; |
| 2920 | } |
| 2921 | |
| 2922 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++ ) |
| 2923 | { |
| 2924 | if (cursessionId != sessionId ) |
| 2925 | { |
| 2926 | if (!CSR_IS_SESSION_VALID( pMac, sessionId )) |
| 2927 | { |
| 2928 | continue; |
| 2929 | } |
| 2930 | |
| 2931 | switch (currBssPersona) |
| 2932 | { |
| 2933 | case VOS_STA_MODE: |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2934 | if (pMac->roam.roamSession[sessionId].pCurRoamProfile && |
| 2935 | (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2936 | == VOS_P2P_CLIENT_MODE)) //check for P2P client mode |
| 2937 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2938 | smsLog(pMac, LOG1, FL(" Beacon Interval Validation not required for STA/CLIENT")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2939 | } |
| 2940 | //IF SAP has started and STA wants to connect on different channel MCC should |
| 2941 | //MCC should not be enabled so making it false to enforce on same channel |
| 2942 | else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona |
| 2943 | == VOS_STA_SAP_MODE) |
| 2944 | { |
| 2945 | if (pMac->roam.roamSession[sessionId].bssParams.operationChn |
| 2946 | != channelId ) |
| 2947 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2948 | smsLog(pMac, LOGE, FL("***MCC is not enabled for SAP +STA****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2949 | return eHAL_STATUS_FAILURE; |
| 2950 | } |
| 2951 | } |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2952 | else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2953 | == VOS_P2P_GO_MODE) //Check for P2P go scenario |
| 2954 | { |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2955 | /* if GO in MCC support different beacon interval, |
| 2956 | * change the BI of the P2P-GO */ |
| 2957 | if ((pMac->roam.roamSession[sessionId].bssParams.operationChn |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2958 | != channelId ) && |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2959 | (pMac->roam.roamSession[sessionId].bssParams.beaconInterval |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2960 | != *beaconInterval)) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2961 | { |
| 2962 | /* if GO in MCC support different beacon interval, return success */ |
| 2963 | if ( pMac->roam.configParam.fAllowMCCGODiffBI == 0x01) |
| 2964 | { |
| 2965 | return eHAL_STATUS_SUCCESS; |
| 2966 | } |
| 2967 | // Send only Broadcast disassoc and update beaconInterval |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2968 | //If configuration is set to 0x04 then dont |
| 2969 | // disconnect all the station |
| 2970 | else if ((pMac->roam.configParam.fAllowMCCGODiffBI == 0x02) || |
| 2971 | (pMac->roam.configParam.fAllowMCCGODiffBI == 0x04)) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2972 | { |
| 2973 | //Check to pass the right beacon Interval |
| 2974 | new_beaconInterval = csrCalculateMCCBeaconInterval(pMac, *beaconInterval, |
| 2975 | pMac->roam.roamSession[sessionId].bssParams.beaconInterval); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2976 | smsLog(pMac, LOG1, FL(" Peer AP BI : %d, new Beacon Interval: %d"),*beaconInterval,new_beaconInterval ); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2977 | //Update the becon Interval |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2978 | if (new_beaconInterval != pMac->roam.roamSession[sessionId].bssParams.beaconInterval) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2979 | { |
| 2980 | //Update the beaconInterval now |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2981 | smsLog(pMac, LOGE, FL(" Beacon Interval got changed config used: %d\n"), |
| 2982 | pMac->roam.configParam.fAllowMCCGODiffBI); |
| 2983 | |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2984 | pMac->roam.roamSession[sessionId].bssParams.beaconInterval = new_beaconInterval; |
| 2985 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_TRUE; |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2986 | return csrUpdateMCCp2pBeaconInterval(pMac); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2987 | } |
| 2988 | return eHAL_STATUS_SUCCESS; |
| 2989 | } |
| 2990 | //Disconnect the P2P session |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 2991 | else if (pMac->roam.configParam.fAllowMCCGODiffBI == 0x03) |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2992 | { |
| 2993 | pMac->roam.roamSession[sessionId].bssParams.updatebeaconInterval = eANI_BOOLEAN_FALSE; |
| 2994 | return csrRoamCallCallback(pMac, sessionId, NULL, 0, eCSR_ROAM_SEND_P2P_STOP_BSS, eCSR_ROAM_RESULT_NONE); |
| 2995 | } |
| 2996 | else |
| 2997 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2998 | smsLog(pMac, LOGE, FL("BeaconInterval is different cannot connect to preferred AP...")); |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 2999 | return eHAL_STATUS_FAILURE; |
| 3000 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3001 | } |
| 3002 | } |
| 3003 | break; |
| 3004 | |
| 3005 | case VOS_P2P_CLIENT_MODE: |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 3006 | if (pMac->roam.roamSession[sessionId].pCurRoamProfile && |
| 3007 | (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3008 | == VOS_STA_MODE)) //check for P2P client mode |
| 3009 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3010 | smsLog(pMac, LOG1, FL(" Ignore Beacon Interval Validation...")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3011 | } |
| 3012 | //IF SAP has started and STA wants to connect on different channel MCC should |
| 3013 | //MCC should not be enabled so making it false to enforce on same channel |
| 3014 | else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona |
| 3015 | == VOS_STA_SAP_MODE) |
| 3016 | { |
| 3017 | if (pMac->roam.roamSession[sessionId].bssParams.operationChn |
| 3018 | != channelId ) |
| 3019 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3020 | smsLog(pMac, LOGE, FL("***MCC is not enabled for SAP + CLIENT****")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3021 | return eHAL_STATUS_FAILURE; |
| 3022 | } |
| 3023 | } |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 3024 | else if (pMac->roam.roamSession[sessionId].bssParams.bssPersona |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3025 | == VOS_P2P_GO_MODE) //Check for P2P go scenario |
| 3026 | { |
| 3027 | if ((pMac->roam.roamSession[sessionId].bssParams.operationChn |
| 3028 | != channelId ) && |
| 3029 | (pMac->roam.roamSession[sessionId].bssParams.beaconInterval |
| 3030 | != *beaconInterval)) |
| 3031 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3032 | smsLog(pMac, LOGE, FL("BeaconInterval is different cannot connect to P2P_GO network ...")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3033 | return eHAL_STATUS_FAILURE; |
| 3034 | } |
| 3035 | } |
| 3036 | break; |
| 3037 | |
| 3038 | case VOS_P2P_GO_MODE : |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 3039 | { |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 3040 | if (pMac->roam.roamSession[sessionId].pCurRoamProfile && |
| 3041 | ((pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 3042 | == VOS_P2P_CLIENT_MODE) || |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 3043 | (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3044 | == VOS_STA_MODE))) //check for P2P_client scenario |
| 3045 | { |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 3046 | if ((pMac->roam.roamSession[sessionId].connectedProfile.operationChannel |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3047 | == 0 )&& |
| 3048 | (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval |
| 3049 | == 0)) |
| 3050 | { |
| 3051 | continue; |
| 3052 | } |
| 3053 | |
| 3054 | |
| 3055 | if (csrIsConnStateConnectedInfra(pMac, sessionId) && |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 3056 | (pMac->roam.roamSession[sessionId].connectedProfile.operationChannel |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3057 | != channelId ) && |
Sudhir Sattayappa Kohalli | d9a4df6 | 2013-04-04 14:47:54 -0700 | [diff] [blame^] | 3058 | (pMac->roam.roamSession[sessionId].connectedProfile.beaconInterval |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3059 | != *beaconInterval)) |
| 3060 | { |
| 3061 | /* |
| 3062 | * Updated beaconInterval should be used only when we are starting a new BSS |
| 3063 | * not incase of client or STA case |
| 3064 | */ |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 3065 | //Calculate beacon Interval for P2P-GO incase of MCC |
| 3066 | new_beaconInterval = csrCalculateMCCBeaconInterval(pMac, |
| 3067 | pMac->roam.roamSession[sessionId].bssParams.beaconInterval, |
| 3068 | *beaconInterval ); |
| 3069 | if(*beaconInterval != new_beaconInterval) |
| 3070 | *beaconInterval = new_beaconInterval; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3071 | return eHAL_STATUS_SUCCESS; |
| 3072 | } |
| 3073 | } |
Madan Mohan Koyyalamudi | 167b95e | 2012-11-27 15:53:38 -0800 | [diff] [blame] | 3074 | } |
| 3075 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3076 | |
| 3077 | default : |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3078 | smsLog(pMac, LOG1, FL(" Persona not supported : %d"),currBssPersona); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3079 | return eHAL_STATUS_FAILURE; |
| 3080 | } |
| 3081 | } |
| 3082 | } |
| 3083 | |
| 3084 | return eHAL_STATUS_SUCCESS; |
| 3085 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3086 | |
| 3087 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3088 | /* Function to return TRUE if the authtype is 11r */ |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3089 | tANI_BOOLEAN csrIsAuthType11r( eCsrAuthType AuthType, tANI_U8 mdiePresent) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3090 | { |
| 3091 | switch ( AuthType ) |
| 3092 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3093 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 3094 | if(mdiePresent) |
| 3095 | return TRUE; |
| 3096 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3097 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 3098 | case eCSR_AUTH_TYPE_FT_RSN: |
| 3099 | return TRUE; |
| 3100 | break; |
| 3101 | default: |
| 3102 | break; |
| 3103 | } |
| 3104 | return FALSE; |
| 3105 | } |
| 3106 | |
| 3107 | /* Function to return TRUE if the profile is 11r */ |
| 3108 | tANI_BOOLEAN csrIsProfile11r( tCsrRoamProfile *pProfile ) |
| 3109 | { |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3110 | return csrIsAuthType11r( pProfile->negotiatedAuthType, pProfile->MDID.mdiePresent ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3111 | } |
| 3112 | |
| 3113 | #endif |
| 3114 | |
| 3115 | #ifdef FEATURE_WLAN_CCX |
| 3116 | |
| 3117 | /* Function to return TRUE if the authtype is CCX */ |
| 3118 | tANI_BOOLEAN csrIsAuthTypeCCX( eCsrAuthType AuthType ) |
| 3119 | { |
| 3120 | switch ( AuthType ) |
| 3121 | { |
| 3122 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 3123 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 3124 | return TRUE; |
| 3125 | break; |
| 3126 | default: |
| 3127 | break; |
| 3128 | } |
| 3129 | return FALSE; |
| 3130 | } |
| 3131 | |
| 3132 | /* Function to return TRUE if the profile is CCX */ |
| 3133 | tANI_BOOLEAN csrIsProfileCCX( tCsrRoamProfile *pProfile ) |
| 3134 | { |
| 3135 | return (csrIsAuthTypeCCX( pProfile->negotiatedAuthType )); |
| 3136 | } |
| 3137 | |
| 3138 | #endif |
| 3139 | |
| 3140 | #ifdef FEATURE_WLAN_WAPI |
| 3141 | tANI_BOOLEAN csrIsProfileWapi( tCsrRoamProfile *pProfile ) |
| 3142 | { |
| 3143 | tANI_BOOLEAN fWapiProfile = FALSE; |
| 3144 | |
| 3145 | switch ( pProfile->negotiatedAuthType ) |
| 3146 | { |
| 3147 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 3148 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 3149 | fWapiProfile = TRUE; |
| 3150 | break; |
| 3151 | |
| 3152 | default: |
| 3153 | fWapiProfile = FALSE; |
| 3154 | break; |
| 3155 | } |
| 3156 | |
| 3157 | if ( fWapiProfile ) |
| 3158 | { |
| 3159 | switch ( pProfile->negotiatedUCEncryptionType ) |
| 3160 | { |
| 3161 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3162 | fWapiProfile = TRUE; |
| 3163 | break; |
| 3164 | |
| 3165 | default: |
| 3166 | fWapiProfile = FALSE; |
| 3167 | break; |
| 3168 | } |
| 3169 | } |
| 3170 | return( fWapiProfile ); |
| 3171 | } |
| 3172 | |
| 3173 | static tANI_BOOLEAN csrIsWapiOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 ) |
| 3174 | { |
| 3175 | return( palEqualMemory(pMac->hHdd, Oui1, Oui2, CSR_WAPI_OUI_SIZE ) ); |
| 3176 | } |
| 3177 | |
| 3178 | static tANI_BOOLEAN csrIsWapiOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE], |
| 3179 | tANI_U8 cAllCyphers, |
| 3180 | tANI_U8 Cypher[], |
| 3181 | tANI_U8 Oui[] ) |
| 3182 | { |
| 3183 | tANI_BOOLEAN fYes = FALSE; |
| 3184 | tANI_U8 idx; |
| 3185 | |
| 3186 | for ( idx = 0; idx < cAllCyphers; idx++ ) |
| 3187 | { |
| 3188 | if ( csrIsWapiOuiEqual( pMac, AllCyphers[ idx ], Cypher ) ) |
| 3189 | { |
| 3190 | fYes = TRUE; |
| 3191 | break; |
| 3192 | } |
| 3193 | } |
| 3194 | |
| 3195 | if ( fYes && Oui ) |
| 3196 | { |
| 3197 | palCopyMemory( pMac->hHdd, Oui, AllCyphers[ idx ], CSR_WAPI_OUI_SIZE ); |
| 3198 | } |
| 3199 | |
| 3200 | return( fYes ); |
| 3201 | } |
| 3202 | #endif /* FEATURE_WLAN_WAPI */ |
| 3203 | |
| 3204 | static tANI_BOOLEAN csrIsWpaOuiEqual( tpAniSirGlobal pMac, tANI_U8 *Oui1, tANI_U8 *Oui2 ) |
| 3205 | { |
| 3206 | return( palEqualMemory(pMac->hHdd, Oui1, Oui2, CSR_WPA_OUI_SIZE ) ); |
| 3207 | } |
| 3208 | |
| 3209 | static tANI_BOOLEAN csrIsOuiMatch( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE], |
| 3210 | tANI_U8 cAllCyphers, |
| 3211 | tANI_U8 Cypher[], |
| 3212 | tANI_U8 Oui[] ) |
| 3213 | { |
| 3214 | tANI_BOOLEAN fYes = FALSE; |
| 3215 | tANI_U8 idx; |
| 3216 | |
| 3217 | for ( idx = 0; idx < cAllCyphers; idx++ ) |
| 3218 | { |
| 3219 | if ( csrIsWpaOuiEqual( pMac, AllCyphers[ idx ], Cypher ) ) |
| 3220 | { |
| 3221 | fYes = TRUE; |
| 3222 | break; |
| 3223 | } |
| 3224 | } |
| 3225 | |
| 3226 | if ( fYes && Oui ) |
| 3227 | { |
| 3228 | palCopyMemory( pMac->hHdd, Oui, AllCyphers[ idx ], CSR_WPA_OUI_SIZE ); |
| 3229 | } |
| 3230 | |
| 3231 | return( fYes ); |
| 3232 | } |
| 3233 | |
| 3234 | static tANI_BOOLEAN csrMatchRSNOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3235 | tANI_U8 cAllCyphers, tANI_U8 ouiIndex, |
| 3236 | tANI_U8 Oui[] ) |
| 3237 | { |
| 3238 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui[ouiIndex], Oui ) ); |
| 3239 | |
| 3240 | } |
| 3241 | |
| 3242 | #ifdef FEATURE_WLAN_WAPI |
| 3243 | static tANI_BOOLEAN csrMatchWapiOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WAPI_OUI_SIZE], |
| 3244 | tANI_U8 cAllCyphers, tANI_U8 ouiIndex, |
| 3245 | tANI_U8 Oui[] ) |
| 3246 | { |
| 3247 | return( csrIsWapiOuiMatch( pMac, AllCyphers, cAllCyphers, csrWapiOui[ouiIndex], Oui ) ); |
| 3248 | |
| 3249 | } |
| 3250 | #endif /* FEATURE_WLAN_WAPI */ |
| 3251 | |
| 3252 | static tANI_BOOLEAN csrMatchWPAOUIIndex( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3253 | tANI_U8 cAllCyphers, tANI_U8 ouiIndex, |
| 3254 | tANI_U8 Oui[] ) |
| 3255 | { |
| 3256 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui[ouiIndex], Oui ) ); |
| 3257 | |
| 3258 | } |
| 3259 | |
| 3260 | #if 0 |
| 3261 | static tANI_BOOLEAN csrIsRSNUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3262 | tANI_U8 cAllCyphers, |
| 3263 | tANI_U8 Oui[] ) |
| 3264 | { |
| 3265 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui00, Oui ) ); |
| 3266 | } |
| 3267 | |
| 3268 | static tANI_BOOLEAN csrIsRSNMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3269 | tANI_U8 cAllCyphers, |
| 3270 | tANI_U8 Oui[] ) |
| 3271 | { |
| 3272 | tANI_BOOLEAN fYes = FALSE; |
| 3273 | |
| 3274 | // Check Wep 104 first, if fails, then check Wep40. |
| 3275 | fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui05, Oui ); |
| 3276 | |
| 3277 | if ( !fYes ) |
| 3278 | { |
| 3279 | // if not Wep-104, check Wep-40 |
| 3280 | fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui01, Oui ); |
| 3281 | } |
| 3282 | |
| 3283 | return( fYes ); |
| 3284 | } |
| 3285 | |
| 3286 | |
| 3287 | static tANI_BOOLEAN csrIsRSNUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3288 | tANI_U8 cAllCyphers, |
| 3289 | tANI_U8 Oui[] ) |
| 3290 | { |
| 3291 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) ); |
| 3292 | } |
| 3293 | |
| 3294 | |
| 3295 | static tANI_BOOLEAN csrIsRSNMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3296 | tANI_U8 cAllCyphers, |
| 3297 | tANI_U8 Oui[] ) |
| 3298 | { |
| 3299 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui02, Oui ) ); |
| 3300 | } |
| 3301 | |
| 3302 | static tANI_BOOLEAN csrIsRSNUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3303 | tANI_U8 cAllCyphers, |
| 3304 | tANI_U8 Oui[] ) |
| 3305 | { |
| 3306 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) ); |
| 3307 | } |
| 3308 | |
| 3309 | static tANI_BOOLEAN csrIsRSNMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_RSN_OUI_SIZE], |
| 3310 | tANI_U8 cAllCyphers, |
| 3311 | tANI_U8 Oui[] ) |
| 3312 | { |
| 3313 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrRSNOui04, Oui ) ); |
| 3314 | } |
| 3315 | #endif |
| 3316 | #ifdef FEATURE_WLAN_WAPI |
| 3317 | static tANI_BOOLEAN csrIsAuthWapiCert( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE], |
| 3318 | tANI_U8 cAllSuites, |
| 3319 | tANI_U8 Oui[] ) |
| 3320 | { |
| 3321 | return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[1], Oui ) ); |
| 3322 | } |
| 3323 | static tANI_BOOLEAN csrIsAuthWapiPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WAPI_OUI_SIZE], |
| 3324 | tANI_U8 cAllSuites, |
| 3325 | tANI_U8 Oui[] ) |
| 3326 | { |
| 3327 | return( csrIsWapiOuiMatch( pMac, AllSuites, cAllSuites, csrWapiOui[2], Oui ) ); |
| 3328 | } |
| 3329 | #endif /* FEATURE_WLAN_WAPI */ |
| 3330 | |
| 3331 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3332 | |
| 3333 | /* |
| 3334 | * Function for 11R FT Authentication. We match the FT Authentication Cipher suite |
| 3335 | * here. This matches for FT Auth with the 802.1X exchange. |
| 3336 | * |
| 3337 | */ |
| 3338 | static tANI_BOOLEAN csrIsFTAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE], |
| 3339 | tANI_U8 cAllSuites, |
| 3340 | tANI_U8 Oui[] ) |
| 3341 | { |
| 3342 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[03], Oui ) ); |
| 3343 | } |
| 3344 | |
| 3345 | /* |
| 3346 | * Function for 11R FT Authentication. We match the FT Authentication Cipher suite |
| 3347 | * here. This matches for FT Auth with the PSK. |
| 3348 | * |
| 3349 | */ |
| 3350 | static tANI_BOOLEAN csrIsFTAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE], |
| 3351 | tANI_U8 cAllSuites, |
| 3352 | tANI_U8 Oui[] ) |
| 3353 | { |
| 3354 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[04], Oui ) ); |
| 3355 | } |
| 3356 | |
| 3357 | #endif |
| 3358 | |
| 3359 | #ifdef FEATURE_WLAN_CCX |
| 3360 | |
| 3361 | /* |
| 3362 | * Function for CCX CCKM AKM Authentication. We match the CCKM AKM Authentication Key Management suite |
| 3363 | * here. This matches for CCKM AKM Auth with the 802.1X exchange. |
| 3364 | * |
| 3365 | */ |
| 3366 | static tANI_BOOLEAN csrIsCcxCckmAuthRSN( 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[06], Oui ) ); |
| 3371 | } |
| 3372 | |
| 3373 | static tANI_BOOLEAN csrIsCcxCckmAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE], |
| 3374 | tANI_U8 cAllSuites, |
| 3375 | tANI_U8 Oui[] ) |
| 3376 | { |
| 3377 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[06], Oui ) ); |
| 3378 | } |
| 3379 | |
| 3380 | #endif |
| 3381 | |
| 3382 | static tANI_BOOLEAN csrIsAuthRSN( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE], |
| 3383 | tANI_U8 cAllSuites, |
| 3384 | tANI_U8 Oui[] ) |
| 3385 | { |
| 3386 | #ifdef WLAN_FEATURE_11W |
| 3387 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[01], Oui ) || |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3388 | csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3389 | #else |
| 3390 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[01], Oui ) ); |
| 3391 | #endif |
| 3392 | } |
| 3393 | static tANI_BOOLEAN csrIsAuthRSNPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE], |
| 3394 | tANI_U8 cAllSuites, |
| 3395 | tANI_U8 Oui[] ) |
| 3396 | { |
| 3397 | #ifdef WLAN_FEATURE_11W |
| 3398 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[02], Oui ) || |
| 3399 | csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ) ); |
| 3400 | #else |
| 3401 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[02], Oui ) ); |
| 3402 | #endif |
| 3403 | } |
| 3404 | |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3405 | #ifdef WLAN_FEATURE_11W |
| 3406 | static tANI_BOOLEAN csrIsAuthRSNPskSha256( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_RSN_OUI_SIZE], |
| 3407 | tANI_U8 cAllSuites, |
| 3408 | tANI_U8 Oui[] ) |
| 3409 | { |
Chet Lanctot | b2b0d55 | 2013-03-22 16:58:44 -0700 | [diff] [blame] | 3410 | return csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrRSNOui[06], Oui ); |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3411 | } |
| 3412 | #endif |
| 3413 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3414 | static tANI_BOOLEAN csrIsAuthWpa( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE], |
| 3415 | tANI_U8 cAllSuites, |
| 3416 | tANI_U8 Oui[] ) |
| 3417 | { |
| 3418 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[01], Oui ) ); |
| 3419 | } |
| 3420 | |
| 3421 | #ifdef NOT_CURRENTLY_USED |
| 3422 | static tANI_BOOLEAN csrIsAuth802_1x( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE], |
| 3423 | tANI_U8 cAllSuites, |
| 3424 | tANI_U8 Oui[] ) |
| 3425 | { |
| 3426 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[00], Oui ) ); |
| 3427 | } |
| 3428 | #endif // NOT_CURRENTLY_USED |
| 3429 | |
| 3430 | static tANI_BOOLEAN csrIsAuthWpaPsk( tpAniSirGlobal pMac, tANI_U8 AllSuites[][CSR_WPA_OUI_SIZE], |
| 3431 | tANI_U8 cAllSuites, |
| 3432 | tANI_U8 Oui[] ) |
| 3433 | { |
| 3434 | return( csrIsOuiMatch( pMac, AllSuites, cAllSuites, csrWpaOui[02], Oui ) ); |
| 3435 | } |
| 3436 | #if 0 |
| 3437 | static tANI_BOOLEAN csrIsUnicastNone( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE], |
| 3438 | tANI_U8 cAllCyphers, |
| 3439 | tANI_U8 Oui[] ) |
| 3440 | { |
| 3441 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui00, Oui ) ); |
| 3442 | } |
| 3443 | |
| 3444 | static tANI_BOOLEAN csrIsUnicastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE], |
| 3445 | tANI_U8 cAllCyphers, |
| 3446 | tANI_U8 Oui[] ) |
| 3447 | { |
| 3448 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) ); |
| 3449 | } |
| 3450 | |
| 3451 | static tANI_BOOLEAN csrIsUnicastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE], |
| 3452 | tANI_U8 cAllCyphers, |
| 3453 | tANI_U8 Oui[] ) |
| 3454 | { |
| 3455 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) ); |
| 3456 | } |
| 3457 | |
| 3458 | |
| 3459 | static tANI_BOOLEAN csrIsMulticastWep( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE], |
| 3460 | tANI_U8 cAllCyphers, |
| 3461 | tANI_U8 Oui[] ) |
| 3462 | { |
| 3463 | tANI_BOOLEAN fYes = FALSE; |
| 3464 | |
| 3465 | // Check Wep 104 first, if fails, then check Wep40. |
| 3466 | fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui05, Oui ); |
| 3467 | |
| 3468 | if ( !fYes ) |
| 3469 | { |
| 3470 | // if not Wep-104, check Wep-40 |
| 3471 | fYes = csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui01, Oui ); |
| 3472 | } |
| 3473 | |
| 3474 | return( fYes ); |
| 3475 | } |
| 3476 | |
| 3477 | |
| 3478 | static tANI_BOOLEAN csrIsMulticastTkip( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE], |
| 3479 | tANI_U8 cAllCyphers, |
| 3480 | tANI_U8 Oui[] ) |
| 3481 | { |
| 3482 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui02, Oui ) ); |
| 3483 | } |
| 3484 | |
| 3485 | |
| 3486 | static tANI_BOOLEAN csrIsMulticastAes( tpAniSirGlobal pMac, tANI_U8 AllCyphers[][CSR_WPA_OUI_SIZE], |
| 3487 | tANI_U8 cAllCyphers, |
| 3488 | tANI_U8 Oui[] ) |
| 3489 | { |
| 3490 | return( csrIsOuiMatch( pMac, AllCyphers, cAllCyphers, csrWpaOui04, Oui ) ); |
| 3491 | } |
| 3492 | |
| 3493 | #endif |
| 3494 | |
| 3495 | tANI_U8 csrGetOUIIndexFromCipher( eCsrEncryptionType enType ) |
| 3496 | { |
| 3497 | tANI_U8 OUIIndex; |
| 3498 | |
| 3499 | switch ( enType ) |
| 3500 | { |
| 3501 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 3502 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 3503 | OUIIndex = CSR_OUI_WEP40_OR_1X_INDEX; |
| 3504 | break; |
| 3505 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 3506 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 3507 | OUIIndex = CSR_OUI_WEP104_INDEX; |
| 3508 | break; |
| 3509 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3510 | OUIIndex = CSR_OUI_TKIP_OR_PSK_INDEX; |
| 3511 | break; |
| 3512 | case eCSR_ENCRYPT_TYPE_AES: |
| 3513 | OUIIndex = CSR_OUI_AES_INDEX; |
| 3514 | break; |
| 3515 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3516 | OUIIndex = CSR_OUI_USE_GROUP_CIPHER_INDEX; |
| 3517 | break; |
| 3518 | #ifdef FEATURE_WLAN_WAPI |
| 3519 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3520 | OUIIndex = CSR_OUI_WAPI_WAI_CERT_OR_SMS4_INDEX; |
| 3521 | break; |
| 3522 | #endif /* FEATURE_WLAN_WAPI */ |
| 3523 | default: //HOWTO handle this? |
| 3524 | OUIIndex = CSR_OUI_RESERVED_INDEX; |
| 3525 | break; |
| 3526 | }//switch |
| 3527 | |
| 3528 | return OUIIndex; |
| 3529 | } |
| 3530 | |
| 3531 | tANI_BOOLEAN csrGetRSNInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption, |
| 3532 | tDot11fIERSN *pRSNIe, |
| 3533 | tANI_U8 *UnicastCypher, |
| 3534 | tANI_U8 *MulticastCypher, |
| 3535 | tANI_U8 *AuthSuite, |
| 3536 | tCsrRSNCapabilities *Capabilities, |
| 3537 | eCsrAuthType *pNegotiatedAuthtype, |
| 3538 | eCsrEncryptionType *pNegotiatedMCCipher ) |
| 3539 | { |
| 3540 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3541 | tANI_BOOLEAN fAcceptableCyphers = FALSE; |
| 3542 | tANI_U8 cUnicastCyphers = 0; |
| 3543 | tANI_U8 cMulticastCyphers = 0; |
| 3544 | tANI_U8 cAuthSuites = 0, i; |
| 3545 | tANI_U8 Unicast[ CSR_RSN_OUI_SIZE ]; |
| 3546 | tANI_U8 Multicast[ CSR_RSN_OUI_SIZE ]; |
| 3547 | tANI_U8 AuthSuites[ CSR_RSN_MAX_AUTH_SUITES ][ CSR_RSN_OUI_SIZE ]; |
| 3548 | tANI_U8 Authentication[ CSR_RSN_OUI_SIZE ]; |
| 3549 | tANI_U8 MulticastCyphers[ CSR_RSN_MAX_MULTICAST_CYPHERS ][ CSR_RSN_OUI_SIZE ]; |
| 3550 | eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 3551 | |
| 3552 | do{ |
| 3553 | if ( pRSNIe->present ) |
| 3554 | { |
| 3555 | cMulticastCyphers++; |
| 3556 | palCopyMemory(pMac->hHdd, MulticastCyphers, pRSNIe->gp_cipher_suite, CSR_RSN_OUI_SIZE); |
| 3557 | cUnicastCyphers = (tANI_U8)(pRSNIe->pwise_cipher_suite_count); |
| 3558 | cAuthSuites = (tANI_U8)(pRSNIe->akm_suite_count); |
| 3559 | for(i = 0; i < cAuthSuites && i < CSR_RSN_MAX_AUTH_SUITES; i++) |
| 3560 | { |
| 3561 | palCopyMemory(pMac->hHdd, (void *)&AuthSuites[i], |
| 3562 | (void *)&pRSNIe->akm_suites[i], CSR_RSN_OUI_SIZE); |
| 3563 | } |
| 3564 | |
| 3565 | //Check - Is requested Unicast Cipher supported by the BSS. |
| 3566 | fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, pRSNIe->pwise_cipher_suites, cUnicastCyphers, |
| 3567 | csrGetOUIIndexFromCipher( enType ), Unicast ); |
| 3568 | |
| 3569 | if( !fAcceptableCyphers ) break; |
| 3570 | |
| 3571 | |
| 3572 | //Unicast is supported. Pick the first matching Group cipher, if any. |
| 3573 | for( i = 0 ; i < pMCEncryption->numEntries ; i++ ) |
| 3574 | { |
| 3575 | fAcceptableCyphers = csrMatchRSNOUIIndex( pMac, MulticastCyphers, cMulticastCyphers, |
| 3576 | csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast ); |
| 3577 | if(fAcceptableCyphers) |
| 3578 | { |
| 3579 | break; |
| 3580 | } |
| 3581 | } |
| 3582 | if( !fAcceptableCyphers ) break; |
| 3583 | |
| 3584 | if( pNegotiatedMCCipher ) |
| 3585 | *pNegotiatedMCCipher = pMCEncryption->encryptionType[i]; |
| 3586 | |
| 3587 | /* Initializing with FALSE as it has TRUE value already */ |
| 3588 | fAcceptableCyphers = FALSE; |
| 3589 | for (i = 0 ; i < pAuthType->numEntries; i++) |
| 3590 | { |
| 3591 | //Ciphers are supported, Match authentication algorithm and pick first matching authtype. |
| 3592 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3593 | /* Changed the AKM suites according to order of preference */ |
| 3594 | if ( csrIsFTAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3595 | { |
| 3596 | if (eCSR_AUTH_TYPE_FT_RSN == pAuthType->authType[i]) |
| 3597 | negAuthType = eCSR_AUTH_TYPE_FT_RSN; |
| 3598 | } |
| 3599 | if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsFTAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3600 | { |
| 3601 | if (eCSR_AUTH_TYPE_FT_RSN_PSK == pAuthType->authType[i]) |
| 3602 | negAuthType = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 3603 | } |
| 3604 | #endif |
| 3605 | #ifdef FEATURE_WLAN_CCX |
| 3606 | /* CCX only supports 802.1X. No PSK. */ |
| 3607 | if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsCcxCckmAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3608 | { |
| 3609 | if (eCSR_AUTH_TYPE_CCKM_RSN == pAuthType->authType[i]) |
| 3610 | negAuthType = eCSR_AUTH_TYPE_CCKM_RSN; |
| 3611 | } |
| 3612 | #endif |
| 3613 | if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSN( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3614 | { |
| 3615 | if (eCSR_AUTH_TYPE_RSN == pAuthType->authType[i]) |
| 3616 | negAuthType = eCSR_AUTH_TYPE_RSN; |
| 3617 | } |
| 3618 | if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSNPsk( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3619 | { |
| 3620 | if (eCSR_AUTH_TYPE_RSN_PSK == pAuthType->authType[i]) |
| 3621 | negAuthType = eCSR_AUTH_TYPE_RSN_PSK; |
| 3622 | } |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3623 | #ifdef WLAN_FEATURE_11W |
| 3624 | if ((negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthRSNPskSha256( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3625 | { |
| 3626 | if (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == pAuthType->authType[i]) |
| 3627 | negAuthType = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 3628 | } |
| 3629 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3630 | |
| 3631 | // The 1st auth type in the APs RSN IE, to match stations connecting |
| 3632 | // profiles auth type will cause us to exit this loop |
| 3633 | // This is added as some APs advertise multiple akms in the RSN IE. |
| 3634 | if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType) |
| 3635 | { |
| 3636 | fAcceptableCyphers = TRUE; |
| 3637 | break; |
| 3638 | } |
| 3639 | } // for |
| 3640 | } |
| 3641 | |
| 3642 | }while (0); |
| 3643 | |
| 3644 | if ( fAcceptableCyphers ) |
| 3645 | { |
| 3646 | if ( MulticastCypher ) |
| 3647 | { |
| 3648 | palCopyMemory( pMac->hHdd, MulticastCypher, Multicast, CSR_RSN_OUI_SIZE ); |
| 3649 | } |
| 3650 | |
| 3651 | if ( UnicastCypher ) |
| 3652 | { |
| 3653 | palCopyMemory( pMac->hHdd, UnicastCypher, Unicast, CSR_RSN_OUI_SIZE ); |
| 3654 | } |
| 3655 | |
| 3656 | if ( AuthSuite ) |
| 3657 | { |
| 3658 | palCopyMemory( pMac->hHdd, AuthSuite, Authentication, CSR_RSN_OUI_SIZE ); |
| 3659 | } |
| 3660 | |
| 3661 | if ( pNegotiatedAuthtype ) |
| 3662 | { |
| 3663 | *pNegotiatedAuthtype = negAuthType; |
| 3664 | } |
| 3665 | if ( Capabilities ) |
| 3666 | { |
Venkata Prathyusha Kuntupalli | ea7098e | 2013-01-31 16:08:13 -0800 | [diff] [blame] | 3667 | Capabilities->PreAuthSupported = (pRSNIe->RSN_Cap[0] >> 0) & 0x1 ; // Bit 0 PreAuthentication |
| 3668 | Capabilities->NoPairwise = (pRSNIe->RSN_Cap[0] >> 1) & 0x1 ; // Bit 1 No Pairwise |
| 3669 | Capabilities->PTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 2) & 0x3 ; // Bit 2, 3 PTKSA Replay Counter |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3670 | Capabilities->GTKSAReplayCounter = (pRSNIe->RSN_Cap[0] >> 4) & 0x3 ; // Bit 4, 5 GTKSA Replay Counter |
| 3671 | #ifdef WLAN_FEATURE_11W |
| 3672 | Capabilities->MFPRequired = (pRSNIe->RSN_Cap[0] >> 6) & 0x1 ; // Bit 6 MFPR |
| 3673 | Capabilities->MFPCapable = (pRSNIe->RSN_Cap[0] >> 7) & 0x1 ; // Bit 7 MFPC |
| 3674 | #endif |
| 3675 | Capabilities->Reserved = pRSNIe->RSN_Cap[1] & 0xff ; // remaining reserved |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3676 | } |
| 3677 | } |
| 3678 | return( fAcceptableCyphers ); |
| 3679 | } |
| 3680 | |
| 3681 | |
| 3682 | tANI_BOOLEAN csrIsRSNMatch( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType, |
| 3683 | tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCCipher ) |
| 3684 | { |
| 3685 | tANI_BOOLEAN fRSNMatch = FALSE; |
| 3686 | |
| 3687 | // See if the cyphers in the Bss description match with the settings in the profile. |
| 3688 | fRSNMatch = csrGetRSNInformation( hHal, pAuthType, enType, pEnMcType, &pIes->RSN, NULL, NULL, NULL, NULL, |
| 3689 | pNegotiatedAuthType, pNegotiatedMCCipher ); |
| 3690 | |
| 3691 | return( fRSNMatch ); |
| 3692 | } |
| 3693 | |
| 3694 | |
| 3695 | tANI_BOOLEAN csrLookupPMKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pPMKId ) |
| 3696 | { |
| 3697 | tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE; |
| 3698 | tANI_U32 Index; |
| 3699 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3700 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3701 | if(!pSession) |
| 3702 | { |
| 3703 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3704 | return FALSE; |
| 3705 | } |
Madan Mohan Koyyalamudi | ea22cdc | 2012-10-18 21:02:23 -0700 | [diff] [blame] | 3706 | /* to force the AP initiate fresh 802.1x authentication after re-association should not |
| 3707 | * fill the PMKID from cache this is needed |
| 3708 | * by the HS 2.0 passpoint certification 5.2.a and b testcases */ |
| 3709 | |
| 3710 | if(pSession->fIgnorePMKIDCache) |
| 3711 | { |
| 3712 | pSession->fIgnorePMKIDCache = FALSE; |
| 3713 | return fRC; |
| 3714 | } |
| 3715 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3716 | do |
| 3717 | { |
| 3718 | for( Index=0; Index < pSession->NumPmkidCache; Index++ ) |
| 3719 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3720 | smsLog(pMac, LOGW, "match PMKID %02X-%02X-%02X-%02X-%02X-%02X to ", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3721 | pBSSId[0], pBSSId[1], pBSSId[2], pBSSId[3], pBSSId[4], pBSSId[5]); |
| 3722 | if( palEqualMemory( pMac->hHdd, pBSSId, pSession->PmkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) ) |
| 3723 | { |
| 3724 | // match found |
| 3725 | fMatchFound = TRUE; |
| 3726 | break; |
| 3727 | } |
| 3728 | } |
| 3729 | |
| 3730 | if( !fMatchFound ) break; |
| 3731 | |
| 3732 | palCopyMemory( pMac->hHdd, pPMKId, pSession->PmkidCacheInfo[Index].PMKID, CSR_RSN_PMKID_SIZE ); |
| 3733 | |
| 3734 | fRC = TRUE; |
| 3735 | } |
| 3736 | while( 0 ); |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3737 | smsLog(pMac, LOGW, "csrLookupPMKID called return match = %d pMac->roam.NumPmkidCache = %d", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3738 | fRC, pSession->NumPmkidCache); |
| 3739 | |
| 3740 | return fRC; |
| 3741 | } |
| 3742 | |
| 3743 | |
| 3744 | tANI_U8 csrConstructRSNIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 3745 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe ) |
| 3746 | { |
| 3747 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3748 | tANI_BOOLEAN fRSNMatch; |
| 3749 | tANI_U8 cbRSNIe = 0; |
| 3750 | tANI_U8 UnicastCypher[ CSR_RSN_OUI_SIZE ]; |
| 3751 | tANI_U8 MulticastCypher[ CSR_RSN_OUI_SIZE ]; |
| 3752 | tANI_U8 AuthSuite[ CSR_RSN_OUI_SIZE ]; |
| 3753 | tCsrRSNAuthIe *pAuthSuite; |
| 3754 | tCsrRSNCapabilities RSNCapabilities; |
| 3755 | tCsrRSNPMKIe *pPMK; |
| 3756 | tANI_U8 PMKId[CSR_RSN_PMKID_SIZE]; |
| 3757 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 3758 | |
Madan Mohan Koyyalamudi | 87054ba | 2012-11-02 13:24:12 -0700 | [diff] [blame] | 3759 | smsLog(pMac, LOGW, "%s called...", __func__); |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3760 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3761 | do |
| 3762 | { |
| 3763 | if ( !csrIsProfileRSN( pProfile ) ) break; |
| 3764 | |
| 3765 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 3766 | { |
| 3767 | break; |
| 3768 | } |
| 3769 | |
| 3770 | // See if the cyphers in the Bss description match with the settings in the profile. |
| 3771 | fRSNMatch = csrGetRSNInformation( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, |
| 3772 | &pProfile->mcEncryptionType, &pIesLocal->RSN, |
| 3773 | UnicastCypher, MulticastCypher, AuthSuite, &RSNCapabilities, NULL, NULL ); |
| 3774 | if ( !fRSNMatch ) break; |
| 3775 | |
| 3776 | pRSNIe->IeHeader.ElementID = SIR_MAC_RSN_EID; |
| 3777 | |
| 3778 | pRSNIe->Version = CSR_RSN_VERSION_SUPPORTED; |
| 3779 | |
| 3780 | palCopyMemory( pMac->hHdd, pRSNIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ) ); |
| 3781 | |
| 3782 | pRSNIe->cUnicastCyphers = 1; |
| 3783 | |
| 3784 | palCopyMemory( pMac->hHdd, &pRSNIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ) ); |
| 3785 | |
| 3786 | pAuthSuite = (tCsrRSNAuthIe *)( &pRSNIe->UnicastOui[ pRSNIe->cUnicastCyphers ] ); |
| 3787 | |
| 3788 | pAuthSuite->cAuthenticationSuites = 1; |
| 3789 | palCopyMemory( pMac->hHdd, &pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) ); |
| 3790 | |
| 3791 | // RSN capabilities follows the Auth Suite (two octects) |
| 3792 | // !!REVIEW - What should STA put in RSN capabilities, currently |
| 3793 | // just putting back APs capabilities |
| 3794 | // For one, we shouldn't EVER be sending out "pre-auth supported". It is an AP only capability |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3795 | // For another, we should use the Management Frame Protection values given by the supplicant |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3796 | RSNCapabilities.PreAuthSupported = 0; |
Chet Lanctot | 186b573 | 2013-03-18 10:26:30 -0700 | [diff] [blame] | 3797 | #ifdef WLAN_FEATURE_11W |
| 3798 | RSNCapabilities.MFPRequired = pProfile->MFPRequired; |
| 3799 | RSNCapabilities.MFPCapable = pProfile->MFPCapable; |
| 3800 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3801 | *(tANI_U16 *)( &pAuthSuite->AuthOui[ 1 ] ) = *((tANI_U16 *)(&RSNCapabilities)); |
| 3802 | |
| 3803 | pPMK = (tCsrRSNPMKIe *)( ((tANI_U8 *)(&pAuthSuite->AuthOui[ 1 ])) + sizeof(tANI_U16) ); |
| 3804 | |
| 3805 | if( csrLookupPMKID( pMac, sessionId, pSirBssDesc->bssId, &(PMKId[0]) ) ) |
| 3806 | { |
| 3807 | pPMK->cPMKIDs = 1; |
| 3808 | |
| 3809 | palCopyMemory( pMac->hHdd, pPMK->PMKIDList[0].PMKID, PMKId, CSR_RSN_PMKID_SIZE ); |
| 3810 | } |
| 3811 | else |
| 3812 | { |
| 3813 | pPMK->cPMKIDs = 0; |
| 3814 | } |
| 3815 | |
| 3816 | // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length |
| 3817 | // Add in the size of the Auth suite (count plus a single OUI) |
| 3818 | // Add in the RSN caps field. |
| 3819 | // Add PMKID count and PMKID (if any) |
| 3820 | pRSNIe->IeHeader.Length = (tANI_U8) (sizeof( *pRSNIe ) - sizeof ( pRSNIe->IeHeader ) + |
| 3821 | sizeof( *pAuthSuite ) + |
| 3822 | sizeof( tCsrRSNCapabilities )); |
| 3823 | if(pPMK->cPMKIDs) |
| 3824 | { |
| 3825 | pRSNIe->IeHeader.Length += (tANI_U8)(sizeof( tANI_U16 ) + |
| 3826 | (pPMK->cPMKIDs * CSR_RSN_PMKID_SIZE)); |
| 3827 | } |
| 3828 | // return the size of the IE header (total) constructed... |
| 3829 | cbRSNIe = pRSNIe->IeHeader.Length + sizeof( pRSNIe->IeHeader ); |
| 3830 | |
| 3831 | } while( 0 ); |
| 3832 | |
| 3833 | if( !pIes && pIesLocal ) |
| 3834 | { |
| 3835 | //locally allocated |
| 3836 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 3837 | } |
| 3838 | |
| 3839 | return( cbRSNIe ); |
| 3840 | } |
| 3841 | |
| 3842 | |
| 3843 | #ifdef FEATURE_WLAN_WAPI |
| 3844 | tANI_BOOLEAN csrGetWapiInformation( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption, |
| 3845 | tDot11fIEWAPI *pWapiIe, |
| 3846 | tANI_U8 *UnicastCypher, |
| 3847 | tANI_U8 *MulticastCypher, |
| 3848 | tANI_U8 *AuthSuite, |
| 3849 | eCsrAuthType *pNegotiatedAuthtype, |
| 3850 | eCsrEncryptionType *pNegotiatedMCCipher ) |
| 3851 | { |
| 3852 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 3853 | tANI_BOOLEAN fAcceptableCyphers = FALSE; |
| 3854 | tANI_U8 cUnicastCyphers = 0; |
| 3855 | tANI_U8 cMulticastCyphers = 0; |
| 3856 | tANI_U8 cAuthSuites = 0, i; |
| 3857 | tANI_U8 Unicast[ CSR_WAPI_OUI_SIZE ]; |
| 3858 | tANI_U8 Multicast[ CSR_WAPI_OUI_SIZE ]; |
| 3859 | tANI_U8 AuthSuites[ CSR_WAPI_MAX_AUTH_SUITES ][ CSR_WAPI_OUI_SIZE ]; |
| 3860 | tANI_U8 Authentication[ CSR_WAPI_OUI_SIZE ]; |
| 3861 | tANI_U8 MulticastCyphers[ CSR_WAPI_MAX_MULTICAST_CYPHERS ][ CSR_WAPI_OUI_SIZE ]; |
| 3862 | eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 3863 | |
| 3864 | do{ |
| 3865 | if ( pWapiIe->present ) |
| 3866 | { |
| 3867 | cMulticastCyphers++; |
| 3868 | palCopyMemory(pMac->hHdd, MulticastCyphers, pWapiIe->multicast_cipher_suite, CSR_WAPI_OUI_SIZE); |
| 3869 | cUnicastCyphers = (tANI_U8)(pWapiIe->unicast_cipher_suite_count); |
| 3870 | cAuthSuites = (tANI_U8)(pWapiIe->akm_suite_count); |
| 3871 | for(i = 0; i < cAuthSuites && i < CSR_WAPI_MAX_AUTH_SUITES; i++) |
| 3872 | { |
| 3873 | palCopyMemory(pMac->hHdd, (void *)&AuthSuites[i], |
| 3874 | (void *)&pWapiIe->akm_suites[i], CSR_WAPI_OUI_SIZE); |
| 3875 | } |
| 3876 | |
| 3877 | //Check - Is requested Unicast Cipher supported by the BSS. |
| 3878 | fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, pWapiIe->unicast_cipher_suites, cUnicastCyphers, |
| 3879 | csrGetOUIIndexFromCipher( enType ), Unicast ); |
| 3880 | |
| 3881 | if( !fAcceptableCyphers ) break; |
| 3882 | |
| 3883 | |
| 3884 | //Unicast is supported. Pick the first matching Group cipher, if any. |
| 3885 | for( i = 0 ; i < pMCEncryption->numEntries ; i++ ) |
| 3886 | { |
| 3887 | fAcceptableCyphers = csrMatchWapiOUIIndex( pMac, MulticastCyphers, cMulticastCyphers, |
| 3888 | csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i] ), Multicast ); |
| 3889 | if(fAcceptableCyphers) |
| 3890 | { |
| 3891 | break; |
| 3892 | } |
| 3893 | } |
| 3894 | if( !fAcceptableCyphers ) break; |
| 3895 | |
| 3896 | if( pNegotiatedMCCipher ) |
| 3897 | *pNegotiatedMCCipher = pMCEncryption->encryptionType[i]; |
| 3898 | |
| 3899 | //Ciphers are supported, Match authentication algorithm and pick first matching authtype. |
| 3900 | if ( csrIsAuthWapiCert( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3901 | { |
| 3902 | negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 3903 | } |
| 3904 | else if ( csrIsAuthWapiPsk( pMac, AuthSuites, cAuthSuites, Authentication ) ) |
| 3905 | { |
| 3906 | negAuthType = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 3907 | } |
| 3908 | else |
| 3909 | { |
| 3910 | fAcceptableCyphers = FALSE; |
| 3911 | negAuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 3912 | } |
| 3913 | if( ( 0 == pAuthType->numEntries ) || ( FALSE == fAcceptableCyphers ) ) |
| 3914 | { |
| 3915 | //Caller doesn't care about auth type, or BSS doesn't match |
| 3916 | break; |
| 3917 | } |
| 3918 | fAcceptableCyphers = FALSE; |
| 3919 | for( i = 0 ; i < pAuthType->numEntries; i++ ) |
| 3920 | { |
| 3921 | if( pAuthType->authType[i] == negAuthType ) |
| 3922 | { |
| 3923 | fAcceptableCyphers = TRUE; |
| 3924 | break; |
| 3925 | } |
| 3926 | } |
| 3927 | } |
| 3928 | }while (0); |
| 3929 | |
| 3930 | if ( fAcceptableCyphers ) |
| 3931 | { |
| 3932 | if ( MulticastCypher ) |
| 3933 | { |
| 3934 | palCopyMemory( pMac->hHdd, MulticastCypher, Multicast, CSR_WAPI_OUI_SIZE ); |
| 3935 | } |
| 3936 | |
| 3937 | if ( UnicastCypher ) |
| 3938 | { |
| 3939 | palCopyMemory( pMac->hHdd, UnicastCypher, Unicast, CSR_WAPI_OUI_SIZE ); |
| 3940 | } |
| 3941 | |
| 3942 | if ( AuthSuite ) |
| 3943 | { |
| 3944 | palCopyMemory( pMac->hHdd, AuthSuite, Authentication, CSR_WAPI_OUI_SIZE ); |
| 3945 | } |
| 3946 | |
| 3947 | if ( pNegotiatedAuthtype ) |
| 3948 | { |
| 3949 | *pNegotiatedAuthtype = negAuthType; |
| 3950 | } |
| 3951 | } |
| 3952 | return( fAcceptableCyphers ); |
| 3953 | } |
| 3954 | |
| 3955 | tANI_BOOLEAN csrIsWapiMatch( tHalHandle hHal, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType, |
| 3956 | tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCCipher ) |
| 3957 | { |
| 3958 | tANI_BOOLEAN fWapiMatch = FALSE; |
| 3959 | |
| 3960 | // See if the cyphers in the Bss description match with the settings in the profile. |
| 3961 | fWapiMatch = csrGetWapiInformation( hHal, pAuthType, enType, pEnMcType, &pIes->WAPI, NULL, NULL, NULL, |
| 3962 | pNegotiatedAuthType, pNegotiatedMCCipher ); |
| 3963 | |
| 3964 | return( fWapiMatch ); |
| 3965 | } |
| 3966 | |
| 3967 | tANI_BOOLEAN csrLookupBKID( tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pBSSId, tANI_U8 *pBKId ) |
| 3968 | { |
| 3969 | tANI_BOOLEAN fRC = FALSE, fMatchFound = FALSE; |
| 3970 | tANI_U32 Index; |
| 3971 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 3972 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 3973 | if(!pSession) |
| 3974 | { |
| 3975 | smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); |
| 3976 | return FALSE; |
| 3977 | } |
| 3978 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3979 | do |
| 3980 | { |
| 3981 | for( Index=0; Index < pSession->NumBkidCache; Index++ ) |
| 3982 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3983 | smsLog(pMac, LOGW, "match BKID %02X-%02X-%02X-%02X-%02X-%02X to ", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3984 | pBSSId[0], pBSSId[1], pBSSId[2], pBSSId[3], pBSSId[4], pBSSId[5]); |
| 3985 | if( palEqualMemory( pMac->hHdd, pBSSId, pSession->BkidCacheInfo[Index].BSSID, sizeof(tCsrBssid) ) ) |
| 3986 | { |
| 3987 | // match found |
| 3988 | fMatchFound = TRUE; |
| 3989 | break; |
| 3990 | } |
| 3991 | } |
| 3992 | |
| 3993 | if( !fMatchFound ) break; |
| 3994 | |
| 3995 | palCopyMemory( pMac->hHdd, pBKId, pSession->BkidCacheInfo[Index].BKID, CSR_WAPI_BKID_SIZE ); |
| 3996 | |
| 3997 | fRC = TRUE; |
| 3998 | } |
| 3999 | while( 0 ); |
| 4000 | smsLog(pMac, LOGW, "csrLookupBKID called return match = %d pMac->roam.NumBkidCache = %d", fRC, pSession->NumBkidCache); |
| 4001 | |
| 4002 | return fRC; |
| 4003 | } |
| 4004 | |
| 4005 | tANI_U8 csrConstructWapiIe( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 4006 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe ) |
| 4007 | { |
| 4008 | tANI_BOOLEAN fWapiMatch = FALSE; |
| 4009 | tANI_U8 cbWapiIe = 0; |
| 4010 | tANI_U8 UnicastCypher[ CSR_WAPI_OUI_SIZE ]; |
| 4011 | tANI_U8 MulticastCypher[ CSR_WAPI_OUI_SIZE ]; |
| 4012 | tANI_U8 AuthSuite[ CSR_WAPI_OUI_SIZE ]; |
| 4013 | tANI_U8 BKId[CSR_WAPI_BKID_SIZE]; |
| 4014 | tANI_U8 *pWapi = NULL; |
| 4015 | tANI_BOOLEAN fBKIDFound = FALSE; |
| 4016 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 4017 | |
| 4018 | do |
| 4019 | { |
| 4020 | if ( !csrIsProfileWapi( pProfile ) ) break; |
| 4021 | |
| 4022 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4023 | { |
| 4024 | break; |
| 4025 | } |
| 4026 | |
| 4027 | // See if the cyphers in the Bss description match with the settings in the profile. |
| 4028 | fWapiMatch = csrGetWapiInformation( pMac, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, |
| 4029 | &pProfile->mcEncryptionType, &pIesLocal->WAPI, |
| 4030 | UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL ); |
| 4031 | if ( !fWapiMatch ) break; |
| 4032 | |
| 4033 | palZeroMemory(pMac->hHdd, pWapiIe, sizeof(tCsrWapiIe)); |
| 4034 | |
| 4035 | pWapiIe->IeHeader.ElementID = DOT11F_EID_WAPI; |
| 4036 | |
| 4037 | pWapiIe->Version = CSR_WAPI_VERSION_SUPPORTED; |
| 4038 | |
| 4039 | pWapiIe->cAuthenticationSuites = 1; |
| 4040 | palCopyMemory( pMac->hHdd, &pWapiIe->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) ); |
| 4041 | |
| 4042 | pWapi = (tANI_U8 *) (&pWapiIe->AuthOui[ 1 ]); |
| 4043 | |
| 4044 | *pWapi = (tANI_U16)1; //cUnicastCyphers |
| 4045 | pWapi+=2; |
| 4046 | palCopyMemory( pMac->hHdd, pWapi, UnicastCypher, sizeof( UnicastCypher ) ); |
| 4047 | pWapi += sizeof( UnicastCypher ); |
| 4048 | |
| 4049 | palCopyMemory( pMac->hHdd, pWapi, MulticastCypher, sizeof( MulticastCypher ) ); |
| 4050 | pWapi += sizeof( MulticastCypher ); |
| 4051 | |
| 4052 | |
| 4053 | // WAPI capabilities follows the Auth Suite (two octects) |
| 4054 | // we shouldn't EVER be sending out "pre-auth supported". It is an AP only capability |
| 4055 | // & since we already did a memset pWapiIe to 0, skip these fields |
| 4056 | pWapi +=2; |
| 4057 | |
| 4058 | fBKIDFound = csrLookupBKID( pMac, sessionId, pSirBssDesc->bssId, &(BKId[0]) ); |
| 4059 | |
| 4060 | |
| 4061 | if( fBKIDFound ) |
| 4062 | { |
| 4063 | /* Do we need to change the endianness here */ |
| 4064 | *pWapi = (tANI_U16)1; //cBKIDs |
| 4065 | pWapi+=2; |
| 4066 | palCopyMemory( pMac->hHdd, pWapi, BKId, CSR_WAPI_BKID_SIZE ); |
| 4067 | } |
| 4068 | else |
| 4069 | { |
| 4070 | *pWapi = 0; |
| 4071 | pWapi+=1; |
| 4072 | *pWapi = 0; |
| 4073 | pWapi+=1; |
| 4074 | } |
| 4075 | |
| 4076 | // Add in the IE fields except the IE header |
| 4077 | // Add BKID count and BKID (if any) |
| 4078 | pWapiIe->IeHeader.Length = (tANI_U8) (sizeof( *pWapiIe ) - sizeof ( pWapiIe->IeHeader )); |
| 4079 | |
| 4080 | /*2 bytes for BKID Count field*/ |
| 4081 | pWapiIe->IeHeader.Length += sizeof( tANI_U16 ); |
| 4082 | |
| 4083 | if(fBKIDFound) |
| 4084 | { |
| 4085 | pWapiIe->IeHeader.Length += CSR_WAPI_BKID_SIZE; |
| 4086 | } |
| 4087 | // return the size of the IE header (total) constructed... |
| 4088 | cbWapiIe = pWapiIe->IeHeader.Length + sizeof( pWapiIe->IeHeader ); |
| 4089 | |
| 4090 | } while( 0 ); |
| 4091 | |
| 4092 | if( !pIes && pIesLocal ) |
| 4093 | { |
| 4094 | //locally allocated |
| 4095 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4096 | } |
| 4097 | |
| 4098 | return( cbWapiIe ); |
| 4099 | } |
| 4100 | #endif /* FEATURE_WLAN_WAPI */ |
| 4101 | |
| 4102 | tANI_BOOLEAN csrGetWpaCyphers( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pMCEncryption, |
| 4103 | tDot11fIEWPA *pWpaIe, |
| 4104 | tANI_U8 *UnicastCypher, |
| 4105 | tANI_U8 *MulticastCypher, |
| 4106 | tANI_U8 *AuthSuite, |
| 4107 | eCsrAuthType *pNegotiatedAuthtype, |
| 4108 | eCsrEncryptionType *pNegotiatedMCCipher ) |
| 4109 | { |
| 4110 | tANI_BOOLEAN fAcceptableCyphers = FALSE; |
| 4111 | tANI_U8 cUnicastCyphers = 0; |
| 4112 | tANI_U8 cMulticastCyphers = 0; |
| 4113 | tANI_U8 cAuthSuites = 0; |
| 4114 | tANI_U8 Unicast[ CSR_WPA_OUI_SIZE ]; |
| 4115 | tANI_U8 Multicast[ CSR_WPA_OUI_SIZE ]; |
| 4116 | tANI_U8 Authentication[ CSR_WPA_OUI_SIZE ]; |
| 4117 | tANI_U8 MulticastCyphers[ 1 ][ CSR_WPA_OUI_SIZE ]; |
| 4118 | tANI_U8 i; |
| 4119 | eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 4120 | |
| 4121 | do |
| 4122 | { |
| 4123 | if ( pWpaIe->present ) |
| 4124 | { |
| 4125 | cMulticastCyphers = 1; |
| 4126 | palCopyMemory(pMac->hHdd, MulticastCyphers, pWpaIe->multicast_cipher, CSR_WPA_OUI_SIZE); |
| 4127 | cUnicastCyphers = (tANI_U8)(pWpaIe->unicast_cipher_count); |
| 4128 | cAuthSuites = (tANI_U8)(pWpaIe->auth_suite_count); |
| 4129 | |
| 4130 | //Check - Is requested Unicast Cipher supported by the BSS. |
| 4131 | fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, pWpaIe->unicast_ciphers, cUnicastCyphers, |
| 4132 | csrGetOUIIndexFromCipher( enType ), Unicast ); |
| 4133 | |
| 4134 | if( !fAcceptableCyphers ) break; |
| 4135 | |
| 4136 | |
| 4137 | //Unicast is supported. Pick the first matching Group cipher, if any. |
| 4138 | for( i = 0 ; i < pMCEncryption->numEntries ; i++ ) |
| 4139 | { |
| 4140 | fAcceptableCyphers = csrMatchWPAOUIIndex( pMac, MulticastCyphers, cMulticastCyphers, |
| 4141 | csrGetOUIIndexFromCipher( pMCEncryption->encryptionType[i]), Multicast ); |
| 4142 | if(fAcceptableCyphers) |
| 4143 | { |
| 4144 | break; |
| 4145 | } |
| 4146 | } |
| 4147 | if( !fAcceptableCyphers ) break; |
| 4148 | |
| 4149 | if( pNegotiatedMCCipher ) |
| 4150 | *pNegotiatedMCCipher = pMCEncryption->encryptionType[i]; |
| 4151 | |
| 4152 | /* Initializing with FALSE as it has TRUE value already */ |
| 4153 | fAcceptableCyphers = FALSE; |
| 4154 | for (i = 0 ; i < pAuthType->numEntries; i++) |
| 4155 | { |
| 4156 | //Ciphers are supported, Match authentication algorithm and pick first matching authtype. |
| 4157 | if ( csrIsAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) ) |
| 4158 | { |
| 4159 | if (eCSR_AUTH_TYPE_WPA == pAuthType->authType[i]) |
| 4160 | negAuthType = eCSR_AUTH_TYPE_WPA; |
| 4161 | } |
| 4162 | if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsAuthWpaPsk( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) ) |
| 4163 | { |
| 4164 | if (eCSR_AUTH_TYPE_WPA_PSK == pAuthType->authType[i]) |
| 4165 | negAuthType = eCSR_AUTH_TYPE_WPA_PSK; |
| 4166 | } |
| 4167 | #ifdef FEATURE_WLAN_CCX |
| 4168 | if ( (negAuthType == eCSR_AUTH_TYPE_UNKNOWN) && csrIsCcxCckmAuthWpa( pMac, pWpaIe->auth_suites, cAuthSuites, Authentication ) ) |
| 4169 | { |
| 4170 | if (eCSR_AUTH_TYPE_CCKM_WPA == pAuthType->authType[i]) |
| 4171 | negAuthType = eCSR_AUTH_TYPE_CCKM_WPA; |
| 4172 | } |
| 4173 | #endif /* FEATURE_WLAN_CCX */ |
| 4174 | |
| 4175 | // The 1st auth type in the APs WPA IE, to match stations connecting |
| 4176 | // profiles auth type will cause us to exit this loop |
| 4177 | // This is added as some APs advertise multiple akms in the WPA IE. |
| 4178 | if (eCSR_AUTH_TYPE_UNKNOWN != negAuthType) |
| 4179 | { |
| 4180 | fAcceptableCyphers = TRUE; |
| 4181 | break; |
| 4182 | } |
| 4183 | } // for |
| 4184 | } |
| 4185 | }while(0); |
| 4186 | |
| 4187 | if ( fAcceptableCyphers ) |
| 4188 | { |
| 4189 | if ( MulticastCypher ) |
| 4190 | { |
| 4191 | palCopyMemory( pMac->hHdd, (tANI_U8 **)MulticastCypher, Multicast, CSR_WPA_OUI_SIZE ); |
| 4192 | } |
| 4193 | |
| 4194 | if ( UnicastCypher ) |
| 4195 | { |
| 4196 | palCopyMemory( pMac->hHdd, (tANI_U8 **)UnicastCypher, Unicast, CSR_WPA_OUI_SIZE ); |
| 4197 | } |
| 4198 | |
| 4199 | if ( AuthSuite ) |
| 4200 | { |
| 4201 | palCopyMemory( pMac->hHdd, (tANI_U8 **)AuthSuite, Authentication, CSR_WPA_OUI_SIZE ); |
| 4202 | } |
| 4203 | |
| 4204 | if( pNegotiatedAuthtype ) |
| 4205 | { |
| 4206 | *pNegotiatedAuthtype = negAuthType; |
| 4207 | } |
| 4208 | } |
| 4209 | |
| 4210 | return( fAcceptableCyphers ); |
| 4211 | } |
| 4212 | |
| 4213 | |
| 4214 | |
| 4215 | tANI_BOOLEAN csrIsWpaEncryptionMatch( tpAniSirGlobal pMac, tCsrAuthList *pAuthType, eCsrEncryptionType enType, tCsrEncryptionList *pEnMcType, |
| 4216 | tDot11fBeaconIEs *pIes, eCsrAuthType *pNegotiatedAuthtype, eCsrEncryptionType *pNegotiatedMCCipher ) |
| 4217 | { |
| 4218 | tANI_BOOLEAN fWpaMatch = eANI_BOOLEAN_FALSE; |
| 4219 | |
| 4220 | // See if the cyphers in the Bss description match with the settings in the profile. |
| 4221 | fWpaMatch = csrGetWpaCyphers( pMac, pAuthType, enType, pEnMcType, &pIes->WPA, NULL, NULL, NULL, pNegotiatedAuthtype, pNegotiatedMCCipher ); |
| 4222 | |
| 4223 | return( fWpaMatch ); |
| 4224 | } |
| 4225 | |
| 4226 | |
| 4227 | tANI_U8 csrConstructWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, |
| 4228 | tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe ) |
| 4229 | { |
| 4230 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4231 | tANI_BOOLEAN fWpaMatch; |
| 4232 | tANI_U8 cbWpaIe = 0; |
| 4233 | tANI_U8 UnicastCypher[ CSR_WPA_OUI_SIZE ]; |
| 4234 | tANI_U8 MulticastCypher[ CSR_WPA_OUI_SIZE ]; |
| 4235 | tANI_U8 AuthSuite[ CSR_WPA_OUI_SIZE ]; |
| 4236 | tCsrWpaAuthIe *pAuthSuite; |
| 4237 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 4238 | |
| 4239 | do |
| 4240 | { |
| 4241 | if ( !csrIsProfileWpa( pProfile ) ) break; |
| 4242 | |
| 4243 | if( !pIesLocal && (!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pSirBssDesc, &pIesLocal))) ) |
| 4244 | { |
| 4245 | break; |
| 4246 | } |
| 4247 | // See if the cyphers in the Bss description match with the settings in the profile. |
| 4248 | fWpaMatch = csrGetWpaCyphers( hHal, &pProfile->AuthType, pProfile->negotiatedUCEncryptionType, &pProfile->mcEncryptionType, |
| 4249 | &pIesLocal->WPA, UnicastCypher, MulticastCypher, AuthSuite, NULL, NULL ); |
| 4250 | if ( !fWpaMatch ) break; |
| 4251 | |
| 4252 | pWpaIe->IeHeader.ElementID = SIR_MAC_WPA_EID; |
| 4253 | |
| 4254 | palCopyMemory( pMac->hHdd, pWpaIe->Oui, csrWpaOui[01], sizeof( pWpaIe->Oui ) ); |
| 4255 | |
| 4256 | pWpaIe->Version = CSR_WPA_VERSION_SUPPORTED; |
| 4257 | |
| 4258 | palCopyMemory( pMac->hHdd, pWpaIe->MulticastOui, MulticastCypher, sizeof( MulticastCypher ) ); |
| 4259 | |
| 4260 | pWpaIe->cUnicastCyphers = 1; |
| 4261 | |
| 4262 | palCopyMemory( pMac->hHdd, &pWpaIe->UnicastOui[ 0 ], UnicastCypher, sizeof( UnicastCypher ) ); |
| 4263 | |
| 4264 | pAuthSuite = (tCsrWpaAuthIe *)( &pWpaIe->UnicastOui[ pWpaIe->cUnicastCyphers ] ); |
| 4265 | |
| 4266 | pAuthSuite->cAuthenticationSuites = 1; |
| 4267 | palCopyMemory( pMac->hHdd, &pAuthSuite->AuthOui[ 0 ], AuthSuite, sizeof( AuthSuite ) ); |
| 4268 | |
| 4269 | // The WPA capabilities follows the Auth Suite (two octects)-- |
| 4270 | // this field is optional, and we always "send" zero, so just |
| 4271 | // remove it. This is consistent with our assumptions in the |
| 4272 | // frames compiler; c.f. bug 15234: |
| 4273 | // http://gold.woodsidenet.com/bugzilla/show_bug.cgi?id=15234 |
| 4274 | |
| 4275 | // Add in the fixed fields plus 1 Unicast cypher, less the IE Header length |
| 4276 | // Add in the size of the Auth suite (count plus a single OUI) |
| 4277 | pWpaIe->IeHeader.Length = sizeof( *pWpaIe ) - sizeof ( pWpaIe->IeHeader ) + |
| 4278 | sizeof( *pAuthSuite ); |
| 4279 | |
| 4280 | // return the size of the IE header (total) constructed... |
| 4281 | cbWpaIe = pWpaIe->IeHeader.Length + sizeof( pWpaIe->IeHeader ); |
| 4282 | |
| 4283 | } while( 0 ); |
| 4284 | |
| 4285 | if( !pIes && pIesLocal ) |
| 4286 | { |
| 4287 | //locally allocated |
| 4288 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 4289 | } |
| 4290 | |
| 4291 | return( cbWpaIe ); |
| 4292 | } |
| 4293 | |
| 4294 | |
| 4295 | tANI_BOOLEAN csrGetWpaRsnIe( tHalHandle hHal, tANI_U8 *pIes, tANI_U32 len, |
| 4296 | tANI_U8 *pWpaIe, tANI_U8 *pcbWpaIe, tANI_U8 *pRSNIe, tANI_U8 *pcbRSNIe) |
| 4297 | { |
| 4298 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4299 | tDot11IEHeader *pIEHeader; |
| 4300 | tSirMacPropIE *pSirMacPropIE; |
| 4301 | tANI_U32 cbParsed; |
| 4302 | tANI_U32 cbIE; |
| 4303 | int cExpectedIEs = 0; |
| 4304 | int cFoundIEs = 0; |
| 4305 | int cbPropIETotal; |
| 4306 | |
| 4307 | pIEHeader = (tDot11IEHeader *)pIes; |
| 4308 | if(pWpaIe) cExpectedIEs++; |
| 4309 | if(pRSNIe) cExpectedIEs++; |
| 4310 | |
| 4311 | // bss description length includes all fields other than the length itself |
| 4312 | cbParsed = 0; |
| 4313 | |
| 4314 | // Loop as long as there is data left in the IE of the Bss Description |
| 4315 | // and the number of Expected IEs is NOT found yet. |
| 4316 | while( ( (cbParsed + sizeof( *pIEHeader )) <= len ) && ( cFoundIEs < cExpectedIEs ) ) |
| 4317 | { |
| 4318 | cbIE = sizeof( *pIEHeader ) + pIEHeader->Length; |
| 4319 | |
| 4320 | if ( ( cbIE + cbParsed ) > len ) break; |
| 4321 | |
| 4322 | if ( ( pIEHeader->Length >= gCsrIELengthTable[ pIEHeader->ElementID ].min ) && |
| 4323 | ( pIEHeader->Length <= gCsrIELengthTable[ pIEHeader->ElementID ].max ) ) |
| 4324 | { |
| 4325 | switch( pIEHeader->ElementID ) |
| 4326 | { |
| 4327 | // Parse the 221 (0xdd) Proprietary IEs here... |
| 4328 | // Note that the 221 IE is overloaded, containing the WPA IE, WMM/WME IE, and the |
| 4329 | // Airgo proprietary IE information. |
| 4330 | case SIR_MAC_WPA_EID: |
| 4331 | { |
| 4332 | tANI_U32 aniOUI; |
| 4333 | tANI_U8 *pOui = (tANI_U8 *)&aniOUI; |
| 4334 | |
| 4335 | pOui++; |
| 4336 | aniOUI = ANI_OUI; |
| 4337 | aniOUI = i_ntohl( aniOUI ); |
| 4338 | |
| 4339 | pSirMacPropIE = ( tSirMacPropIE *)pIEHeader; |
| 4340 | cbPropIETotal = pSirMacPropIE->length; |
| 4341 | |
| 4342 | // Validate the ANI OUI is in the OUI field in the proprietary IE... |
| 4343 | if ( ( pSirMacPropIE->length >= WNI_CFG_MANUFACTURER_OUI_LEN ) && |
| 4344 | pOui[ 0 ] == pSirMacPropIE->oui[ 0 ] && |
| 4345 | pOui[ 1 ] == pSirMacPropIE->oui[ 1 ] && |
| 4346 | pOui[ 2 ] == pSirMacPropIE->oui[ 2 ] ) |
| 4347 | { |
| 4348 | } |
| 4349 | else |
| 4350 | { |
| 4351 | tCsrWpaIe *pIe = ( tCsrWpaIe * )pIEHeader; |
| 4352 | |
| 4353 | if(!pWpaIe || !pcbWpaIe) break; |
| 4354 | // Check if this is a valid WPA IE. Then check that the |
| 4355 | // WPA OUI is in place and the version is one that we support. |
| 4356 | if ( ( pIe->IeHeader.Length >= SIR_MAC_WPA_IE_MIN_LENGTH ) && |
| 4357 | ( palEqualMemory(pMac->hHdd, pIe->Oui, (void *)csrWpaOui[1], sizeof( pIe->Oui ) ) ) && |
| 4358 | ( pIe->Version <= CSR_WPA_VERSION_SUPPORTED ) ) |
| 4359 | { |
| 4360 | palCopyMemory(pMac->hHdd, pWpaIe, pIe, pIe->IeHeader.Length + sizeof( pIe->IeHeader ) ); |
| 4361 | *pcbWpaIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader ); |
| 4362 | cFoundIEs++; |
| 4363 | |
| 4364 | break; |
| 4365 | } |
| 4366 | } |
| 4367 | |
| 4368 | break; |
| 4369 | } |
| 4370 | |
| 4371 | case SIR_MAC_RSN_EID: |
| 4372 | { |
| 4373 | tCsrRSNIe *pIe; |
| 4374 | |
| 4375 | if(!pcbRSNIe || !pRSNIe) break; |
| 4376 | pIe = (tCsrRSNIe *)pIEHeader; |
| 4377 | |
| 4378 | // Check the length of the RSN Ie to assure it is valid. Then check that the |
| 4379 | // version is one that we support. |
| 4380 | |
| 4381 | if ( pIe->IeHeader.Length < SIR_MAC_RSN_IE_MIN_LENGTH ) break; |
| 4382 | if ( pIe->Version > CSR_RSN_VERSION_SUPPORTED ) break; |
| 4383 | |
| 4384 | cFoundIEs++; |
| 4385 | |
| 4386 | // if there is enough room in the WpaIE passed in, then copy the Wpa IE into |
| 4387 | // the buffer passed in. |
| 4388 | if ( *pcbRSNIe < pIe->IeHeader.Length + sizeof( pIe->IeHeader ) ) break; |
| 4389 | palCopyMemory(pMac->hHdd, pRSNIe, pIe, pIe->IeHeader.Length + sizeof( pIe->IeHeader ) ); |
| 4390 | *pcbRSNIe = pIe->IeHeader.Length + sizeof( pIe->IeHeader ); |
| 4391 | |
| 4392 | break; |
| 4393 | } |
| 4394 | |
| 4395 | // Add support for other IE here... |
| 4396 | default: |
| 4397 | break; |
| 4398 | } |
| 4399 | } |
| 4400 | |
| 4401 | cbParsed += cbIE; |
| 4402 | |
| 4403 | pIEHeader = (tDot11IEHeader *)( ((tANI_U8 *)pIEHeader) + cbIE ); |
| 4404 | |
| 4405 | } |
| 4406 | |
| 4407 | // return a BOOL that tells if all of the IEs asked for were found... |
| 4408 | return( cFoundIEs == cExpectedIEs ); |
| 4409 | } |
| 4410 | |
| 4411 | |
| 4412 | //If a WPAIE exists in the profile, just use it. Or else construct one from the BSS |
| 4413 | //Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE |
| 4414 | tANI_U8 csrRetrieveWpaIe( tHalHandle hHal, tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, |
| 4415 | tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe ) |
| 4416 | { |
| 4417 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4418 | tANI_U8 cbWpaIe = 0; |
| 4419 | |
| 4420 | do |
| 4421 | { |
| 4422 | if ( !csrIsProfileWpa( pProfile ) ) break; |
| 4423 | if(pProfile->nWPAReqIELength && pProfile->pWPAReqIE) |
| 4424 | { |
| 4425 | if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nWPAReqIELength) |
| 4426 | { |
| 4427 | cbWpaIe = (tANI_U8)pProfile->nWPAReqIELength; |
| 4428 | palCopyMemory(pMac->hHdd, pWpaIe, pProfile->pWPAReqIE, cbWpaIe); |
| 4429 | } |
| 4430 | else |
| 4431 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4432 | smsLog(pMac, LOGW, " csrRetrieveWpaIe detect invalid WPA IE length (%d) ", pProfile->nWPAReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4433 | } |
| 4434 | } |
| 4435 | else |
| 4436 | { |
| 4437 | cbWpaIe = csrConstructWpaIe(pMac, pProfile, pSirBssDesc, pIes, pWpaIe); |
| 4438 | } |
| 4439 | }while(0); |
| 4440 | |
| 4441 | return (cbWpaIe); |
| 4442 | } |
| 4443 | |
| 4444 | |
| 4445 | //If a RSNIE exists in the profile, just use it. Or else construct one from the BSS |
| 4446 | //Caller allocated memory for pWpaIe and guarrantee it can contain a max length WPA IE |
| 4447 | tANI_U8 csrRetrieveRsnIe( tHalHandle hHal, tANI_U32 sessionId, tCsrRoamProfile *pProfile, |
| 4448 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, tCsrRSNIe *pRsnIe ) |
| 4449 | { |
| 4450 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4451 | tANI_U8 cbRsnIe = 0; |
| 4452 | |
| 4453 | do |
| 4454 | { |
| 4455 | if ( !csrIsProfileRSN( pProfile ) ) break; |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4456 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4457 | if (csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4458 | { |
| 4459 | // If "Legacy Fast Roaming" is enabled ALWAYS rebuild the RSN IE from |
| 4460 | // scratch. So it contains the current PMK-IDs |
| 4461 | cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe); |
| 4462 | } |
| 4463 | else |
| 4464 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4465 | if(pProfile->nRSNReqIELength && pProfile->pRSNReqIE) |
| 4466 | { |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4467 | // If you have one started away, re-use it. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4468 | if(SIR_MAC_WPA_IE_MAX_LENGTH >= pProfile->nRSNReqIELength) |
| 4469 | { |
| 4470 | cbRsnIe = (tANI_U8)pProfile->nRSNReqIELength; |
| 4471 | palCopyMemory(pMac->hHdd, pRsnIe, pProfile->pRSNReqIE, cbRsnIe); |
| 4472 | } |
| 4473 | else |
| 4474 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4475 | smsLog(pMac, LOGW, " csrRetrieveRsnIe detect invalid RSN IE length (%d) ", pProfile->nRSNReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4476 | } |
| 4477 | } |
| 4478 | else |
| 4479 | { |
| 4480 | cbRsnIe = csrConstructRSNIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pRsnIe); |
| 4481 | } |
| 4482 | }while(0); |
| 4483 | |
| 4484 | return (cbRsnIe); |
| 4485 | } |
| 4486 | |
| 4487 | |
| 4488 | #ifdef FEATURE_WLAN_WAPI |
| 4489 | //If a WAPI IE exists in the profile, just use it. Or else construct one from the BSS |
| 4490 | //Caller allocated memory for pWapiIe and guarrantee it can contain a max length WAPI IE |
| 4491 | tANI_U8 csrRetrieveWapiIe( tHalHandle hHal, tANI_U32 sessionId, |
| 4492 | tCsrRoamProfile *pProfile, tSirBssDescription *pSirBssDesc, |
| 4493 | tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe ) |
| 4494 | { |
| 4495 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4496 | tANI_U8 cbWapiIe = 0; |
| 4497 | |
| 4498 | do |
| 4499 | { |
| 4500 | if ( !csrIsProfileWapi( pProfile ) ) break; |
| 4501 | if(pProfile->nWAPIReqIELength && pProfile->pWAPIReqIE) |
| 4502 | { |
| 4503 | if(DOT11F_IE_WAPI_MAX_LEN >= pProfile->nWAPIReqIELength) |
| 4504 | { |
| 4505 | cbWapiIe = (tANI_U8)pProfile->nWAPIReqIELength; |
| 4506 | palCopyMemory(pMac->hHdd, pWapiIe, pProfile->pWAPIReqIE, cbWapiIe); |
| 4507 | } |
| 4508 | else |
| 4509 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4510 | smsLog(pMac, LOGW, " csrRetrieveWapiIe detect invalid WAPI IE length (%d) ", pProfile->nWAPIReqIELength); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4511 | } |
| 4512 | } |
| 4513 | else |
| 4514 | { |
| 4515 | cbWapiIe = csrConstructWapiIe(pMac, sessionId, pProfile, pSirBssDesc, pIes, pWapiIe); |
| 4516 | } |
| 4517 | }while(0); |
| 4518 | |
| 4519 | return (cbWapiIe); |
| 4520 | } |
| 4521 | #endif /* FEATURE_WLAN_WAPI */ |
| 4522 | |
| 4523 | tANI_BOOLEAN csrSearchChannelListForTxPower(tHalHandle hHal, tSirBssDescription *pBssDescription, tCsrChannelSet *returnChannelGroup) |
| 4524 | { |
| 4525 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4526 | tListElem *pEntry; |
| 4527 | tANI_U16 i; |
| 4528 | tANI_U16 startingChannel; |
| 4529 | tANI_BOOLEAN found = FALSE; |
| 4530 | tCsrChannelSet *pChannelGroup; |
| 4531 | |
| 4532 | pEntry = csrLLPeekHead( &pMac->roam.channelList5G, LL_ACCESS_LOCK ); |
| 4533 | |
| 4534 | while ( pEntry ) |
| 4535 | { |
| 4536 | pChannelGroup = GET_BASE_ADDR( pEntry, tCsrChannelSet, channelListLink ); |
| 4537 | startingChannel = pChannelGroup->firstChannel; |
| 4538 | for ( i = 0; i < pChannelGroup->numChannels; i++ ) |
| 4539 | { |
| 4540 | if ( startingChannel + i * pChannelGroup->interChannelOffset == pBssDescription->channelId ) |
| 4541 | { |
| 4542 | found = TRUE; |
| 4543 | break; |
| 4544 | } |
| 4545 | } |
| 4546 | |
| 4547 | if ( found ) |
| 4548 | { |
| 4549 | palCopyMemory(pMac->hHdd, returnChannelGroup, pChannelGroup, sizeof(tCsrChannelSet)); |
| 4550 | break; |
| 4551 | } |
| 4552 | else |
| 4553 | { |
| 4554 | pEntry = csrLLNext( &pMac->roam.channelList5G, pEntry, LL_ACCESS_LOCK ); |
| 4555 | } |
| 4556 | } |
| 4557 | |
| 4558 | return( found ); |
| 4559 | } |
| 4560 | |
| 4561 | tANI_BOOLEAN csrRatesIsDot11Rate11bSupportedRate( tANI_U8 dot11Rate ) |
| 4562 | { |
| 4563 | tANI_BOOLEAN fSupported = FALSE; |
| 4564 | tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) ); |
| 4565 | |
| 4566 | switch ( nonBasicRate ) |
| 4567 | { |
| 4568 | case eCsrSuppRate_1Mbps: |
| 4569 | case eCsrSuppRate_2Mbps: |
| 4570 | case eCsrSuppRate_5_5Mbps: |
| 4571 | case eCsrSuppRate_11Mbps: |
| 4572 | fSupported = TRUE; |
| 4573 | break; |
| 4574 | |
| 4575 | default: |
| 4576 | break; |
| 4577 | } |
| 4578 | |
| 4579 | return( fSupported ); |
| 4580 | } |
| 4581 | |
| 4582 | tANI_BOOLEAN csrRatesIsDot11Rate11aSupportedRate( tANI_U8 dot11Rate ) |
| 4583 | { |
| 4584 | tANI_BOOLEAN fSupported = FALSE; |
| 4585 | tANI_U16 nonBasicRate = (tANI_U16)( BITS_OFF( dot11Rate, CSR_DOT11_BASIC_RATE_MASK ) ); |
| 4586 | |
| 4587 | switch ( nonBasicRate ) |
| 4588 | { |
| 4589 | case eCsrSuppRate_6Mbps: |
| 4590 | case eCsrSuppRate_9Mbps: |
| 4591 | case eCsrSuppRate_12Mbps: |
| 4592 | case eCsrSuppRate_18Mbps: |
| 4593 | case eCsrSuppRate_24Mbps: |
| 4594 | case eCsrSuppRate_36Mbps: |
| 4595 | case eCsrSuppRate_48Mbps: |
| 4596 | case eCsrSuppRate_54Mbps: |
| 4597 | fSupported = TRUE; |
| 4598 | break; |
| 4599 | |
| 4600 | default: |
| 4601 | break; |
| 4602 | } |
| 4603 | |
| 4604 | return( fSupported ); |
| 4605 | } |
| 4606 | |
| 4607 | |
| 4608 | |
| 4609 | tAniEdType csrTranslateEncryptTypeToEdType( eCsrEncryptionType EncryptType ) |
| 4610 | { |
| 4611 | tAniEdType edType; |
| 4612 | |
| 4613 | switch ( EncryptType ) |
| 4614 | { |
| 4615 | default: |
| 4616 | case eCSR_ENCRYPT_TYPE_NONE: |
| 4617 | edType = eSIR_ED_NONE; |
| 4618 | break; |
| 4619 | |
| 4620 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 4621 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 4622 | edType = eSIR_ED_WEP40; |
| 4623 | break; |
| 4624 | |
| 4625 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 4626 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 4627 | edType = eSIR_ED_WEP104; |
| 4628 | break; |
| 4629 | |
| 4630 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 4631 | edType = eSIR_ED_TKIP; |
| 4632 | break; |
| 4633 | |
| 4634 | case eCSR_ENCRYPT_TYPE_AES: |
| 4635 | edType = eSIR_ED_CCMP; |
| 4636 | break; |
| 4637 | #ifdef FEATURE_WLAN_WAPI |
| 4638 | case eCSR_ENCRYPT_TYPE_WPI: |
| 4639 | edType = eSIR_ED_WPI; |
| 4640 | #endif |
| 4641 | #ifdef WLAN_FEATURE_11W |
| 4642 | //11w BIP |
| 4643 | case eCSR_ENCRYPT_TYPE_AES_CMAC: |
| 4644 | edType = eSIR_ED_AES_128_CMAC; |
| 4645 | break; |
| 4646 | #endif |
| 4647 | } |
| 4648 | |
| 4649 | return( edType ); |
| 4650 | } |
| 4651 | |
| 4652 | |
| 4653 | //pIes can be NULL |
| 4654 | tANI_BOOLEAN csrValidateWep( tpAniSirGlobal pMac, eCsrEncryptionType ucEncryptionType, |
| 4655 | tCsrAuthList *pAuthList, tCsrEncryptionList *pMCEncryptionList, |
| 4656 | eCsrAuthType *pNegotiatedAuthType, eCsrEncryptionType *pNegotiatedMCEncryption, |
| 4657 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes ) |
| 4658 | { |
| 4659 | tANI_U32 idx; |
| 4660 | tANI_BOOLEAN fMatch = FALSE; |
| 4661 | eCsrAuthType negotiatedAuth = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4662 | eCsrEncryptionType negotiatedMCCipher = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 4663 | |
| 4664 | //This function just checks whether HDD is giving correct values for Multicast cipher and Auth. |
| 4665 | |
| 4666 | do |
| 4667 | { |
| 4668 | //If privacy bit is not set, consider no match |
| 4669 | if ( !csrIsPrivacy( pSirBssDesc ) ) break; |
| 4670 | |
| 4671 | for( idx = 0; idx < pMCEncryptionList->numEntries; idx++ ) |
| 4672 | { |
| 4673 | switch( pMCEncryptionList->encryptionType[idx] ) |
| 4674 | { |
| 4675 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 4676 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 4677 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 4678 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 4679 | /* Multicast list may contain WEP40/WEP104. Check whether it matches UC. |
| 4680 | */ |
| 4681 | if( ucEncryptionType == pMCEncryptionList->encryptionType[idx] ) |
| 4682 | { |
| 4683 | fMatch = TRUE; |
| 4684 | negotiatedMCCipher = pMCEncryptionList->encryptionType[idx]; |
| 4685 | } |
| 4686 | break; |
| 4687 | default: |
| 4688 | fMatch = FALSE; |
| 4689 | break; |
| 4690 | } |
| 4691 | if(fMatch) break; |
| 4692 | } |
| 4693 | |
| 4694 | if(!fMatch) break; |
| 4695 | |
| 4696 | for( idx = 0; idx < pAuthList->numEntries; idx++ ) |
| 4697 | { |
| 4698 | switch( pAuthList->authType[idx] ) |
| 4699 | { |
| 4700 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 4701 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 4702 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 4703 | fMatch = TRUE; |
| 4704 | negotiatedAuth = pAuthList->authType[idx]; |
| 4705 | break; |
| 4706 | default: |
| 4707 | fMatch = FALSE; |
| 4708 | } |
| 4709 | if (fMatch) break; |
| 4710 | } |
| 4711 | |
| 4712 | if(!fMatch) break; |
| 4713 | //In case of WPA / WPA2, check whether it supports WEP as well |
| 4714 | if(pIes) |
| 4715 | { |
| 4716 | //Prepare the encryption type for WPA/WPA2 functions |
| 4717 | if( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == ucEncryptionType ) |
| 4718 | { |
| 4719 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP40; |
| 4720 | } |
| 4721 | else if( eCSR_ENCRYPT_TYPE_WEP104 == ucEncryptionType ) |
| 4722 | { |
| 4723 | ucEncryptionType = eCSR_ENCRYPT_TYPE_WEP104; |
| 4724 | } |
| 4725 | //else we can use the encryption type directly |
| 4726 | if( pIes->WPA.present ) |
| 4727 | { |
| 4728 | fMatch = palEqualMemory(pMac->hHdd, pIes->WPA.multicast_cipher, |
| 4729 | csrWpaOui[csrGetOUIIndexFromCipher( ucEncryptionType )], CSR_WPA_OUI_SIZE ); |
| 4730 | if( fMatch ) break; |
| 4731 | } |
| 4732 | if( pIes->RSN.present ) |
| 4733 | { |
| 4734 | fMatch = palEqualMemory(pMac->hHdd, pIes->RSN.gp_cipher_suite, |
| 4735 | csrRSNOui[csrGetOUIIndexFromCipher( ucEncryptionType )], CSR_RSN_OUI_SIZE ); |
| 4736 | } |
| 4737 | } |
| 4738 | |
| 4739 | }while(0); |
| 4740 | |
| 4741 | if( fMatch ) |
| 4742 | { |
| 4743 | if( pNegotiatedAuthType ) |
| 4744 | *pNegotiatedAuthType = negotiatedAuth; |
| 4745 | |
| 4746 | if( pNegotiatedMCEncryption ) |
| 4747 | *pNegotiatedMCEncryption = negotiatedMCCipher; |
| 4748 | } |
| 4749 | |
| 4750 | |
| 4751 | return fMatch; |
| 4752 | } |
| 4753 | |
| 4754 | |
| 4755 | //pIes shall contain IEs from pSirBssDesc. It shall be returned from function csrGetParsedBssDescriptionIEs |
| 4756 | tANI_BOOLEAN csrIsSecurityMatch( tHalHandle hHal, tCsrAuthList *authType, tCsrEncryptionList *pUCEncryptionType, tCsrEncryptionList *pMCEncryptionType, |
| 4757 | tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes, |
| 4758 | eCsrAuthType *negotiatedAuthtype, eCsrEncryptionType *negotiatedUCCipher, eCsrEncryptionType *negotiatedMCCipher ) |
| 4759 | { |
| 4760 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4761 | tANI_BOOLEAN fMatch = FALSE; |
| 4762 | tANI_U8 i,idx; |
| 4763 | eCsrEncryptionType mcCipher = eCSR_ENCRYPT_TYPE_UNKNOWN, ucCipher = eCSR_ENCRYPT_TYPE_UNKNOWN; |
| 4764 | eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN; |
| 4765 | |
| 4766 | for( i = 0 ; ((i < pUCEncryptionType->numEntries) && (!fMatch)) ; i++ ) |
| 4767 | { |
| 4768 | ucCipher = pUCEncryptionType->encryptionType[i]; |
| 4769 | // If the Bss description shows the Privacy bit is on, then we must have some sort of encryption configured |
| 4770 | // for the profile to work. Don't attempt to join networks with Privacy bit set when profiles say NONE for |
| 4771 | // encryption type. |
| 4772 | switch ( ucCipher ) |
| 4773 | { |
| 4774 | case eCSR_ENCRYPT_TYPE_NONE: |
| 4775 | { |
| 4776 | // for NO encryption, if the Bss description has the Privacy bit turned on, then encryption is |
| 4777 | // required so we have to reject this Bss. |
| 4778 | if ( csrIsPrivacy( pSirBssDesc ) ) |
| 4779 | { |
| 4780 | fMatch = FALSE; |
| 4781 | } |
| 4782 | else |
| 4783 | { |
| 4784 | fMatch = TRUE; |
| 4785 | } |
| 4786 | |
| 4787 | if ( fMatch ) |
| 4788 | { |
| 4789 | fMatch = FALSE; |
| 4790 | //Check Multicast cipher requested and Auth type requested. |
| 4791 | for( idx = 0 ; idx < pMCEncryptionType->numEntries ; idx++ ) |
| 4792 | { |
| 4793 | if( eCSR_ENCRYPT_TYPE_NONE == pMCEncryptionType->encryptionType[idx] ) |
| 4794 | { |
| 4795 | fMatch = TRUE; //Multicast can only be none. |
| 4796 | mcCipher = pMCEncryptionType->encryptionType[idx]; |
| 4797 | break; |
| 4798 | } |
| 4799 | } |
| 4800 | if (!fMatch) break; |
| 4801 | |
| 4802 | fMatch = FALSE; |
| 4803 | //Check Auth list. It should contain AuthOpen. |
| 4804 | for( idx = 0 ; idx < authType->numEntries ; idx++ ) |
| 4805 | { |
| 4806 | if( eCSR_AUTH_TYPE_OPEN_SYSTEM == authType->authType[idx] ) |
| 4807 | { |
| 4808 | fMatch = TRUE; |
| 4809 | negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4810 | break; |
| 4811 | } |
| 4812 | } |
| 4813 | if (!fMatch) break; |
| 4814 | |
| 4815 | } |
| 4816 | break; |
| 4817 | } |
| 4818 | |
| 4819 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 4820 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 4821 | // !! might want to check for WEP keys set in the Profile.... ? |
| 4822 | // !! don't need to have the privacy bit in the Bss description. Many AP policies make legacy |
| 4823 | // encryption 'optional' so we don't know if we can associate or not. The AP will reject if |
| 4824 | // encryption is not allowed without the Privacy bit turned on. |
| 4825 | fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes); |
| 4826 | |
| 4827 | break; |
| 4828 | |
| 4829 | // these are all of the WPA encryption types... |
| 4830 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 4831 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 4832 | fMatch = csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes); |
| 4833 | break; |
| 4834 | |
| 4835 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 4836 | case eCSR_ENCRYPT_TYPE_AES: |
| 4837 | { |
| 4838 | if(pIes) |
| 4839 | { |
| 4840 | // First check if there is a RSN match |
| 4841 | fMatch = csrIsRSNMatch( pMac, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher ); |
| 4842 | if( !fMatch ) |
| 4843 | { |
| 4844 | // If not RSN, then check if there is a WPA match |
| 4845 | fMatch = csrIsWpaEncryptionMatch( pMac, authType, ucCipher, pMCEncryptionType, pIes, |
| 4846 | &negAuthType, &mcCipher ); |
| 4847 | } |
| 4848 | } |
| 4849 | else |
| 4850 | { |
| 4851 | fMatch = FALSE; |
| 4852 | } |
| 4853 | break; |
| 4854 | } |
| 4855 | #ifdef FEATURE_WLAN_WAPI |
| 4856 | case eCSR_ENCRYPT_TYPE_WPI://WAPI |
| 4857 | { |
| 4858 | if(pIes) |
| 4859 | { |
| 4860 | fMatch = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher ); |
| 4861 | } |
| 4862 | else |
| 4863 | { |
| 4864 | fMatch = FALSE; |
| 4865 | } |
| 4866 | break; |
| 4867 | } |
| 4868 | #endif /* FEATURE_WLAN_WAPI */ |
| 4869 | case eCSR_ENCRYPT_TYPE_ANY: |
| 4870 | default: |
| 4871 | { |
| 4872 | tANI_BOOLEAN fMatchAny = eANI_BOOLEAN_FALSE; |
| 4873 | |
| 4874 | fMatch = eANI_BOOLEAN_TRUE; |
| 4875 | //It is allowed to match anything. Try the more secured ones first. |
| 4876 | if(pIes) |
| 4877 | { |
| 4878 | //Check AES first |
| 4879 | ucCipher = eCSR_ENCRYPT_TYPE_AES; |
| 4880 | fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher ); |
| 4881 | if(!fMatchAny) |
| 4882 | { |
| 4883 | //Check TKIP |
| 4884 | ucCipher = eCSR_ENCRYPT_TYPE_TKIP; |
| 4885 | fMatchAny = csrIsRSNMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher ); |
| 4886 | } |
| 4887 | #ifdef FEATURE_WLAN_WAPI |
| 4888 | if(!fMatchAny) |
| 4889 | { |
| 4890 | //Check WAPI |
| 4891 | ucCipher = eCSR_ENCRYPT_TYPE_WPI; |
| 4892 | fMatchAny = csrIsWapiMatch( hHal, authType, ucCipher, pMCEncryptionType, pIes, &negAuthType, &mcCipher ); |
| 4893 | } |
| 4894 | #endif /* FEATURE_WLAN_WAPI */ |
| 4895 | } |
| 4896 | if(!fMatchAny) |
| 4897 | { |
| 4898 | ucCipher = eCSR_ENCRYPT_TYPE_WEP104; |
| 4899 | if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes)) |
| 4900 | { |
| 4901 | ucCipher = eCSR_ENCRYPT_TYPE_WEP40; |
| 4902 | if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes)) |
| 4903 | { |
| 4904 | ucCipher = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4905 | if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes)) |
| 4906 | { |
| 4907 | ucCipher = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4908 | if(!csrValidateWep( pMac, ucCipher, authType, pMCEncryptionType, &negAuthType, &mcCipher, pSirBssDesc, pIes)) |
| 4909 | { |
| 4910 | //It must be open and no encryption |
| 4911 | if ( csrIsPrivacy( pSirBssDesc ) ) |
| 4912 | { |
| 4913 | //This is not right |
| 4914 | fMatch = eANI_BOOLEAN_FALSE; |
| 4915 | } |
| 4916 | else |
| 4917 | { |
| 4918 | negAuthType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 4919 | mcCipher = eCSR_ENCRYPT_TYPE_NONE; |
| 4920 | ucCipher = eCSR_ENCRYPT_TYPE_NONE; |
| 4921 | } |
| 4922 | } |
| 4923 | } |
| 4924 | } |
| 4925 | } |
| 4926 | } |
| 4927 | break; |
| 4928 | } |
| 4929 | } |
| 4930 | |
| 4931 | } |
| 4932 | |
| 4933 | if( fMatch ) |
| 4934 | { |
| 4935 | if( negotiatedUCCipher ) |
| 4936 | *negotiatedUCCipher = ucCipher; |
| 4937 | |
| 4938 | if( negotiatedMCCipher ) |
| 4939 | *negotiatedMCCipher = mcCipher; |
| 4940 | |
| 4941 | if( negotiatedAuthtype ) |
| 4942 | *negotiatedAuthtype = negAuthType; |
| 4943 | } |
| 4944 | |
| 4945 | return( fMatch ); |
| 4946 | } |
| 4947 | |
| 4948 | |
| 4949 | tANI_BOOLEAN csrIsSsidMatch( tpAniSirGlobal pMac, tANI_U8 *ssid1, tANI_U8 ssid1Len, tANI_U8 *bssSsid, |
| 4950 | tANI_U8 bssSsidLen, tANI_BOOLEAN fSsidRequired ) |
| 4951 | { |
| 4952 | tANI_BOOLEAN fMatch = FALSE; |
| 4953 | |
| 4954 | do { |
| 4955 | |
| 4956 | // There are a few special cases. If the Bss description has a Broadcast SSID, |
| 4957 | // then our Profile must have a single SSID without Wildcards so we can program |
| 4958 | // the SSID. |
| 4959 | // SSID could be suppressed in beacons. In that case SSID IE has valid length |
| 4960 | // but the SSID value is all NULL characters. That condition is trated same |
| 4961 | // as NULL SSID |
| 4962 | if ( csrIsNULLSSID( bssSsid, bssSsidLen ) ) |
| 4963 | { |
| 4964 | if ( eANI_BOOLEAN_FALSE == fSsidRequired ) |
| 4965 | { |
| 4966 | fMatch = TRUE; |
| 4967 | } |
| 4968 | break; |
| 4969 | } |
| 4970 | |
| 4971 | // Check for the specification of the Broadcast SSID at the beginning of the list. |
| 4972 | // If specified, then all SSIDs are matches (broadcast SSID means accept all SSIDs). |
| 4973 | if ( ssid1Len == 0 ) |
| 4974 | { |
| 4975 | fMatch = TRUE; |
| 4976 | break; |
| 4977 | } |
| 4978 | |
| 4979 | if(ssid1Len != bssSsidLen) break; |
| 4980 | if(palEqualMemory(pMac->hHdd, bssSsid, ssid1, bssSsidLen)) |
| 4981 | { |
| 4982 | fMatch = TRUE; |
| 4983 | break; |
| 4984 | } |
| 4985 | |
| 4986 | } while( 0 ); |
| 4987 | |
| 4988 | return( fMatch ); |
| 4989 | } |
| 4990 | |
| 4991 | |
| 4992 | //Null ssid means match |
| 4993 | tANI_BOOLEAN csrIsSsidInList( tHalHandle hHal, tSirMacSSid *pSsid, tCsrSSIDs *pSsidList ) |
| 4994 | { |
| 4995 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 4996 | tANI_BOOLEAN fMatch = FALSE; |
| 4997 | tANI_U32 i; |
| 4998 | |
| 4999 | if ( pSsidList && pSsid ) |
| 5000 | { |
| 5001 | for(i = 0; i < pSsidList->numOfSSIDs; i++) |
| 5002 | { |
| 5003 | if(csrIsNULLSSID(pSsidList->SSIDList[i].SSID.ssId, pSsidList->SSIDList[i].SSID.length) || |
| 5004 | ((pSsidList->SSIDList[i].SSID.length == pSsid->length) && |
| 5005 | palEqualMemory(pMac->hHdd, pSsid->ssId, pSsidList->SSIDList[i].SSID.ssId, pSsid->length))) |
| 5006 | { |
| 5007 | fMatch = TRUE; |
| 5008 | break; |
| 5009 | } |
| 5010 | } |
| 5011 | } |
| 5012 | |
| 5013 | return (fMatch); |
| 5014 | } |
| 5015 | |
| 5016 | //like to use sirCompareMacAddr |
| 5017 | tANI_BOOLEAN csrIsMacAddressZero( tpAniSirGlobal pMac, tCsrBssid *pMacAddr ) |
| 5018 | { |
| 5019 | tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0, 0, 0, 0, 0, 0}; |
| 5020 | |
| 5021 | return( palEqualMemory(pMac->hHdd, bssid, pMacAddr, WNI_CFG_BSSID_LEN)); |
| 5022 | } |
| 5023 | |
| 5024 | //like to use sirCompareMacAddr |
| 5025 | tANI_BOOLEAN csrIsMacAddressBroadcast( tpAniSirGlobal pMac, tCsrBssid *pMacAddr ) |
| 5026 | { |
| 5027 | tANI_U8 bssid[WNI_CFG_BSSID_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 5028 | |
| 5029 | return( palEqualMemory(pMac->hHdd, bssid, pMacAddr, WNI_CFG_BSSID_LEN)); |
| 5030 | } |
| 5031 | |
| 5032 | |
| 5033 | //like to use sirCompareMacAddr |
| 5034 | tANI_BOOLEAN csrIsMacAddressEqual( tpAniSirGlobal pMac, tCsrBssid *pMacAddr1, tCsrBssid *pMacAddr2 ) |
| 5035 | { |
| 5036 | return( palEqualMemory(pMac->hHdd, pMacAddr1, pMacAddr2, sizeof(tCsrBssid)) ); |
| 5037 | } |
| 5038 | |
| 5039 | |
| 5040 | tANI_BOOLEAN csrIsBssidMatch( tHalHandle hHal, tCsrBssid *pProfBssid, tCsrBssid *BssBssid ) |
| 5041 | { |
| 5042 | tANI_BOOLEAN fMatch = FALSE; |
| 5043 | tCsrBssid ProfileBssid; |
| 5044 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5045 | |
| 5046 | // for efficiency of the MAC_ADDRESS functions, move the |
| 5047 | // Bssid's into MAC_ADDRESS structs. |
| 5048 | palCopyMemory( pMac->hHdd, &ProfileBssid, pProfBssid, sizeof(tCsrBssid) ); |
| 5049 | |
| 5050 | do { |
| 5051 | |
| 5052 | // Give the profile the benefit of the doubt... accept either all 0 or |
| 5053 | // the real broadcast Bssid (all 0xff) as broadcast Bssids (meaning to |
| 5054 | // match any Bssids). |
| 5055 | if ( csrIsMacAddressZero( pMac, &ProfileBssid ) || |
| 5056 | csrIsMacAddressBroadcast( pMac, &ProfileBssid ) ) |
| 5057 | { |
| 5058 | fMatch = TRUE; |
| 5059 | break; |
| 5060 | } |
| 5061 | |
| 5062 | if ( csrIsMacAddressEqual( pMac, BssBssid, &ProfileBssid ) ) |
| 5063 | { |
| 5064 | fMatch = TRUE; |
| 5065 | break; |
| 5066 | } |
| 5067 | |
| 5068 | } while( 0 ); |
| 5069 | |
| 5070 | return( fMatch ); |
| 5071 | } |
| 5072 | |
| 5073 | |
| 5074 | tANI_BOOLEAN csrIsBSSTypeMatch(eCsrRoamBssType bssType1, eCsrRoamBssType bssType2) |
| 5075 | { |
| 5076 | if((eCSR_BSS_TYPE_ANY != bssType1 && eCSR_BSS_TYPE_ANY != bssType2) && (bssType1 != bssType2)) |
| 5077 | return eANI_BOOLEAN_FALSE; |
| 5078 | else |
| 5079 | return eANI_BOOLEAN_TRUE; |
| 5080 | } |
| 5081 | |
| 5082 | |
| 5083 | tANI_BOOLEAN csrIsBssTypeIBSS(eCsrRoamBssType bssType) |
| 5084 | { |
| 5085 | return((tANI_BOOLEAN)(eCSR_BSS_TYPE_START_IBSS == bssType || eCSR_BSS_TYPE_IBSS == bssType)); |
| 5086 | } |
| 5087 | |
| 5088 | tANI_BOOLEAN csrIsBssTypeWDS(eCsrRoamBssType bssType) |
| 5089 | { |
| 5090 | return((tANI_BOOLEAN)(eCSR_BSS_TYPE_WDS_STA == bssType || eCSR_BSS_TYPE_WDS_AP == bssType)); |
| 5091 | } |
| 5092 | |
| 5093 | tANI_BOOLEAN csrIsBSSTypeCapsMatch( eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc ) |
| 5094 | { |
| 5095 | tANI_BOOLEAN fMatch = TRUE; |
| 5096 | |
| 5097 | do |
| 5098 | { |
| 5099 | switch( bssType ) |
| 5100 | { |
| 5101 | case eCSR_BSS_TYPE_ANY: |
| 5102 | break; |
| 5103 | |
| 5104 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 5105 | case eCSR_BSS_TYPE_WDS_STA: |
| 5106 | if( !csrIsInfraBssDesc( pSirBssDesc ) ) |
| 5107 | fMatch = FALSE; |
| 5108 | |
| 5109 | break; |
| 5110 | |
| 5111 | case eCSR_BSS_TYPE_IBSS: |
| 5112 | case eCSR_BSS_TYPE_START_IBSS: |
| 5113 | if( !csrIsIbssBssDesc( pSirBssDesc ) ) |
| 5114 | fMatch = FALSE; |
| 5115 | |
| 5116 | break; |
| 5117 | |
| 5118 | case eCSR_BSS_TYPE_WDS_AP: //For WDS AP, no need to match anything |
| 5119 | default: |
| 5120 | fMatch = FALSE; |
| 5121 | break; |
| 5122 | } |
| 5123 | } |
| 5124 | while( 0 ); |
| 5125 | |
| 5126 | |
| 5127 | return( fMatch ); |
| 5128 | } |
| 5129 | |
| 5130 | static tANI_BOOLEAN csrIsCapabilitiesMatch( tpAniSirGlobal pMac, eCsrRoamBssType bssType, tSirBssDescription *pSirBssDesc ) |
| 5131 | { |
| 5132 | return( csrIsBSSTypeCapsMatch( bssType, pSirBssDesc ) ); |
| 5133 | } |
| 5134 | |
| 5135 | |
| 5136 | |
| 5137 | static tANI_BOOLEAN csrIsSpecificChannelMatch( tpAniSirGlobal pMac, tSirBssDescription *pSirBssDesc, tANI_U8 Channel ) |
| 5138 | { |
| 5139 | tANI_BOOLEAN fMatch = TRUE; |
| 5140 | |
| 5141 | do |
| 5142 | { |
| 5143 | // if the channel is ANY, then always match... |
| 5144 | if ( eCSR_OPERATING_CHANNEL_ANY == Channel ) break; |
| 5145 | if ( Channel == pSirBssDesc->channelId ) break; |
| 5146 | |
| 5147 | // didn't match anything.. so return NO match |
| 5148 | fMatch = FALSE; |
| 5149 | |
| 5150 | } while( 0 ); |
| 5151 | |
| 5152 | return( fMatch ); |
| 5153 | } |
| 5154 | |
| 5155 | |
| 5156 | tANI_BOOLEAN csrIsChannelBandMatch( tpAniSirGlobal pMac, tANI_U8 channelId, tSirBssDescription *pSirBssDesc ) |
| 5157 | { |
| 5158 | tANI_BOOLEAN fMatch = TRUE; |
| 5159 | |
| 5160 | do |
| 5161 | { |
| 5162 | // if the profile says Any channel AND the global settings says ANY channel, then we |
| 5163 | // always match... |
| 5164 | if ( eCSR_OPERATING_CHANNEL_ANY == channelId ) break; |
| 5165 | |
| 5166 | if ( eCSR_OPERATING_CHANNEL_ANY != channelId ) |
| 5167 | { |
| 5168 | fMatch = csrIsSpecificChannelMatch( pMac, pSirBssDesc, channelId ); |
| 5169 | } |
| 5170 | |
| 5171 | } while( 0 ); |
| 5172 | |
| 5173 | return( fMatch ); |
| 5174 | } |
| 5175 | |
| 5176 | |
| 5177 | /** |
| 5178 | * \brief Enquire as to whether a given rate is supported by the |
| 5179 | * adapter as currently configured |
| 5180 | * |
| 5181 | * |
| 5182 | * \param nRate A rate in units of 500kbps |
| 5183 | * |
| 5184 | * \return TRUE if the adapter is currently capable of supporting this |
| 5185 | * rate, FALSE else |
| 5186 | * |
| 5187 | * |
| 5188 | * The rate encoding is just as in 802.11 Information Elements, except |
| 5189 | * that the high bit is \em not interpreted as indicating a Basic Rate, |
| 5190 | * and proprietary rates are allowed, too. |
| 5191 | * |
| 5192 | * Note that if the adapter's dot11Mode is g, we don't restrict the |
| 5193 | * rates. According to hwReadEepromParameters, this will happen when: |
| 5194 | * |
| 5195 | * ... the card is configured for ALL bands through the property |
| 5196 | * page. If this occurs, and the card is not an ABG card ,then this |
| 5197 | * code is setting the dot11Mode to assume the mode that the |
| 5198 | * hardware can support. For example, if the card is an 11BG card |
| 5199 | * and we are configured to support ALL bands, then we change the |
| 5200 | * dot11Mode to 11g because ALL in this case is only what the |
| 5201 | * hardware can support. |
| 5202 | * |
| 5203 | * |
| 5204 | */ |
| 5205 | |
| 5206 | static tANI_BOOLEAN csrIsAggregateRateSupported( tpAniSirGlobal pMac, tANI_U16 rate ) |
| 5207 | { |
| 5208 | tANI_BOOLEAN fSupported = eANI_BOOLEAN_FALSE; |
| 5209 | tANI_U16 idx, newRate; |
| 5210 | |
| 5211 | //In case basic rate flag is set |
| 5212 | newRate = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK); |
| 5213 | if ( eCSR_CFG_DOT11_MODE_11A == pMac->roam.configParam.uCfgDot11Mode ) |
| 5214 | { |
| 5215 | switch ( newRate ) |
| 5216 | { |
| 5217 | case eCsrSuppRate_6Mbps: |
| 5218 | case eCsrSuppRate_9Mbps: |
| 5219 | case eCsrSuppRate_12Mbps: |
| 5220 | case eCsrSuppRate_18Mbps: |
| 5221 | case eCsrSuppRate_24Mbps: |
| 5222 | case eCsrSuppRate_36Mbps: |
| 5223 | case eCsrSuppRate_48Mbps: |
| 5224 | case eCsrSuppRate_54Mbps: |
| 5225 | fSupported = TRUE; |
| 5226 | break; |
| 5227 | default: |
| 5228 | fSupported = FALSE; |
| 5229 | break; |
| 5230 | } |
| 5231 | |
| 5232 | } |
| 5233 | else if( eCSR_CFG_DOT11_MODE_11B == pMac->roam.configParam.uCfgDot11Mode ) |
| 5234 | { |
| 5235 | switch ( newRate ) |
| 5236 | { |
| 5237 | case eCsrSuppRate_1Mbps: |
| 5238 | case eCsrSuppRate_2Mbps: |
| 5239 | case eCsrSuppRate_5_5Mbps: |
| 5240 | case eCsrSuppRate_11Mbps: |
| 5241 | fSupported = TRUE; |
| 5242 | break; |
| 5243 | default: |
| 5244 | fSupported = FALSE; |
| 5245 | break; |
| 5246 | } |
| 5247 | } |
| 5248 | else if ( !pMac->roam.configParam.ProprietaryRatesEnabled ) |
| 5249 | { |
| 5250 | |
| 5251 | switch ( newRate ) |
| 5252 | { |
| 5253 | case eCsrSuppRate_1Mbps: |
| 5254 | case eCsrSuppRate_2Mbps: |
| 5255 | case eCsrSuppRate_5_5Mbps: |
| 5256 | case eCsrSuppRate_6Mbps: |
| 5257 | case eCsrSuppRate_9Mbps: |
| 5258 | case eCsrSuppRate_11Mbps: |
| 5259 | case eCsrSuppRate_12Mbps: |
| 5260 | case eCsrSuppRate_18Mbps: |
| 5261 | case eCsrSuppRate_24Mbps: |
| 5262 | case eCsrSuppRate_36Mbps: |
| 5263 | case eCsrSuppRate_48Mbps: |
| 5264 | case eCsrSuppRate_54Mbps: |
| 5265 | fSupported = TRUE; |
| 5266 | break; |
| 5267 | default: |
| 5268 | fSupported = FALSE; |
| 5269 | break; |
| 5270 | } |
| 5271 | |
| 5272 | } |
| 5273 | else { |
| 5274 | |
| 5275 | if ( eCsrSuppRate_1Mbps == newRate || |
| 5276 | eCsrSuppRate_2Mbps == newRate || |
| 5277 | eCsrSuppRate_5_5Mbps == newRate || |
| 5278 | eCsrSuppRate_11Mbps == newRate ) |
| 5279 | { |
| 5280 | fSupported = TRUE; |
| 5281 | } |
| 5282 | else { |
| 5283 | idx = 0x1; |
| 5284 | |
| 5285 | switch ( newRate ) |
| 5286 | { |
| 5287 | case eCsrSuppRate_6Mbps: |
| 5288 | fSupported = gPhyRatesSuppt[0][idx]; |
| 5289 | break; |
| 5290 | case eCsrSuppRate_9Mbps: |
| 5291 | fSupported = gPhyRatesSuppt[1][idx]; |
| 5292 | break; |
| 5293 | case eCsrSuppRate_12Mbps: |
| 5294 | fSupported = gPhyRatesSuppt[2][idx]; |
| 5295 | break; |
| 5296 | case eCsrSuppRate_18Mbps: |
| 5297 | fSupported = gPhyRatesSuppt[3][idx]; |
| 5298 | break; |
| 5299 | case eCsrSuppRate_20Mbps: |
| 5300 | fSupported = gPhyRatesSuppt[4][idx]; |
| 5301 | break; |
| 5302 | case eCsrSuppRate_24Mbps: |
| 5303 | fSupported = gPhyRatesSuppt[5][idx]; |
| 5304 | break; |
| 5305 | case eCsrSuppRate_36Mbps: |
| 5306 | fSupported = gPhyRatesSuppt[6][idx]; |
| 5307 | break; |
| 5308 | case eCsrSuppRate_40Mbps: |
| 5309 | fSupported = gPhyRatesSuppt[7][idx]; |
| 5310 | break; |
| 5311 | case eCsrSuppRate_42Mbps: |
| 5312 | fSupported = gPhyRatesSuppt[8][idx]; |
| 5313 | break; |
| 5314 | case eCsrSuppRate_48Mbps: |
| 5315 | fSupported = gPhyRatesSuppt[9][idx]; |
| 5316 | break; |
| 5317 | case eCsrSuppRate_54Mbps: |
| 5318 | fSupported = gPhyRatesSuppt[10][idx]; |
| 5319 | break; |
| 5320 | case eCsrSuppRate_72Mbps: |
| 5321 | fSupported = gPhyRatesSuppt[11][idx]; |
| 5322 | break; |
| 5323 | case eCsrSuppRate_80Mbps: |
| 5324 | fSupported = gPhyRatesSuppt[12][idx]; |
| 5325 | break; |
| 5326 | case eCsrSuppRate_84Mbps: |
| 5327 | fSupported = gPhyRatesSuppt[13][idx]; |
| 5328 | break; |
| 5329 | case eCsrSuppRate_96Mbps: |
| 5330 | fSupported = gPhyRatesSuppt[14][idx]; |
| 5331 | break; |
| 5332 | case eCsrSuppRate_108Mbps: |
| 5333 | fSupported = gPhyRatesSuppt[15][idx]; |
| 5334 | break; |
| 5335 | case eCsrSuppRate_120Mbps: |
| 5336 | fSupported = gPhyRatesSuppt[16][idx]; |
| 5337 | break; |
| 5338 | case eCsrSuppRate_126Mbps: |
| 5339 | fSupported = gPhyRatesSuppt[17][idx]; |
| 5340 | break; |
| 5341 | case eCsrSuppRate_144Mbps: |
| 5342 | fSupported = gPhyRatesSuppt[18][idx]; |
| 5343 | break; |
| 5344 | case eCsrSuppRate_160Mbps: |
| 5345 | fSupported = gPhyRatesSuppt[19][idx]; |
| 5346 | break; |
| 5347 | case eCsrSuppRate_168Mbps: |
| 5348 | fSupported = gPhyRatesSuppt[20][idx]; |
| 5349 | break; |
| 5350 | case eCsrSuppRate_192Mbps: |
| 5351 | fSupported = gPhyRatesSuppt[21][idx]; |
| 5352 | break; |
| 5353 | case eCsrSuppRate_216Mbps: |
| 5354 | fSupported = gPhyRatesSuppt[22][idx]; |
| 5355 | break; |
| 5356 | case eCsrSuppRate_240Mbps: |
| 5357 | fSupported = gPhyRatesSuppt[23][idx]; |
| 5358 | break; |
| 5359 | default: |
| 5360 | fSupported = FALSE; |
| 5361 | break; |
| 5362 | } |
| 5363 | } |
| 5364 | } |
| 5365 | |
| 5366 | return fSupported; |
| 5367 | } |
| 5368 | |
| 5369 | |
| 5370 | |
| 5371 | static tANI_BOOLEAN csrIsRateSetMatch( tpAniSirGlobal pMac, |
| 5372 | tDot11fIESuppRates *pBssSuppRates, |
| 5373 | tDot11fIEExtSuppRates *pBssExtSuppRates ) |
| 5374 | { |
| 5375 | tANI_BOOLEAN fMatch = TRUE; |
| 5376 | tANI_U32 i; |
| 5377 | |
| 5378 | |
| 5379 | // Validate that all of the Basic rates advertised in the Bss description are supported. |
| 5380 | if ( pBssSuppRates ) |
| 5381 | { |
| 5382 | for( i = 0; i < pBssSuppRates->num_rates; i++ ) |
| 5383 | { |
| 5384 | if ( CSR_IS_BASIC_RATE( pBssSuppRates->rates[ i ] ) ) |
| 5385 | { |
| 5386 | if ( !csrIsAggregateRateSupported( pMac, pBssSuppRates->rates[ i ] ) ) |
| 5387 | { |
| 5388 | fMatch = FALSE; |
| 5389 | break; |
| 5390 | } |
| 5391 | } |
| 5392 | } |
| 5393 | } |
| 5394 | |
| 5395 | if ( fMatch && pBssExtSuppRates ) |
| 5396 | { |
| 5397 | for( i = 0; i < pBssExtSuppRates->num_rates; i++ ) |
| 5398 | { |
| 5399 | if ( CSR_IS_BASIC_RATE( pBssExtSuppRates->rates[ i ] ) ) |
| 5400 | { |
| 5401 | if ( !csrIsAggregateRateSupported( pMac, pBssExtSuppRates->rates[ i ] ) ) |
| 5402 | { |
| 5403 | fMatch = FALSE; |
| 5404 | break; |
| 5405 | } |
| 5406 | } |
| 5407 | } |
| 5408 | } |
| 5409 | |
| 5410 | return( fMatch ); |
| 5411 | |
| 5412 | } |
| 5413 | |
| 5414 | |
| 5415 | //ppIes can be NULL. If caller want to get the *ppIes allocated by this function, pass in *ppIes = NULL |
| 5416 | tANI_BOOLEAN csrMatchBSS( tHalHandle hHal, tSirBssDescription *pBssDesc, tCsrScanResultFilter *pFilter, |
| 5417 | eCsrAuthType *pNegAuth, eCsrEncryptionType *pNegUc, eCsrEncryptionType *pNegMc, |
| 5418 | tDot11fBeaconIEs **ppIes) |
| 5419 | { |
| 5420 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5421 | tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck; |
| 5422 | tANI_U32 i; |
| 5423 | tDot11fBeaconIEs *pIes = NULL; |
| 5424 | tANI_U8 *pb; |
| 5425 | |
| 5426 | do { |
| 5427 | if( ( NULL == ppIes ) || ( *ppIes ) == NULL ) |
| 5428 | { |
| 5429 | //If no IEs passed in, get our own. |
| 5430 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIes))) |
| 5431 | { |
| 5432 | break; |
| 5433 | } |
| 5434 | } |
| 5435 | else |
| 5436 | { |
| 5437 | //Save the one pass in for local use |
| 5438 | pIes = *ppIes; |
| 5439 | } |
| 5440 | |
| 5441 | //Check if caller wants P2P |
| 5442 | fCheck = (!pFilter->p2pResult || pIes->P2PBeaconProbeRes.present); |
| 5443 | if(!fCheck) break; |
| 5444 | |
| 5445 | if(pIes->SSID.present) |
| 5446 | { |
| 5447 | for(i = 0; i < pFilter->SSIDs.numOfSSIDs; i++) |
| 5448 | { |
| 5449 | fCheck = csrIsSsidMatch( pMac, pFilter->SSIDs.SSIDList[i].SSID.ssId, pFilter->SSIDs.SSIDList[i].SSID.length, |
| 5450 | pIes->SSID.ssid, |
| 5451 | pIes->SSID.num_ssid, eANI_BOOLEAN_TRUE ); |
| 5452 | if ( fCheck ) break; |
| 5453 | } |
| 5454 | if(!fCheck) break; |
| 5455 | } |
| 5456 | fCheck = eANI_BOOLEAN_TRUE; |
| 5457 | for(i = 0; i < pFilter->BSSIDs.numOfBSSIDs; i++) |
| 5458 | { |
| 5459 | fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i], (tCsrBssid *)pBssDesc->bssId ); |
| 5460 | if ( fCheck ) break; |
| 5461 | |
| 5462 | if (pFilter->p2pResult && pIes->P2PBeaconProbeRes.present) |
| 5463 | { |
| 5464 | fCheck = csrIsBssidMatch( pMac, (tCsrBssid *)&pFilter->BSSIDs.bssid[i], |
| 5465 | (tCsrBssid *)pIes->P2PBeaconProbeRes.P2PDeviceInfo.P2PDeviceAddress ); |
| 5466 | |
| 5467 | if ( fCheck ) break; |
| 5468 | } |
| 5469 | } |
| 5470 | if(!fCheck) break; |
| 5471 | |
| 5472 | fCheck = eANI_BOOLEAN_TRUE; |
| 5473 | for(i = 0; i < pFilter->ChannelInfo.numOfChannels; i++) |
| 5474 | { |
| 5475 | fCheck = csrIsChannelBandMatch( pMac, pFilter->ChannelInfo.ChannelList[i], pBssDesc ); |
| 5476 | if ( fCheck ) break; |
| 5477 | } |
| 5478 | if(!fCheck) |
| 5479 | break; |
| 5480 | #if defined WLAN_FEATURE_VOWIFI |
| 5481 | /* If this is for measurement filtering */ |
| 5482 | if( pFilter->fMeasurement ) |
| 5483 | { |
| 5484 | fRC = eANI_BOOLEAN_TRUE; |
| 5485 | break; |
| 5486 | } |
| 5487 | #endif |
| 5488 | if ( !csrIsPhyModeMatch( pMac, pFilter->phyMode, pBssDesc, NULL, NULL, pIes ) ) break; |
| 5489 | if ( (!pFilter->bWPSAssociation) && |
| 5490 | !csrIsSecurityMatch( pMac, &pFilter->authType, &pFilter->EncryptionType, &pFilter->mcEncryptionType, |
| 5491 | pBssDesc, pIes, pNegAuth, pNegUc, pNegMc ) ) break; |
| 5492 | if ( !csrIsCapabilitiesMatch( pMac, pFilter->BSSType, pBssDesc ) ) break; |
| 5493 | if ( !csrIsRateSetMatch( pMac, &pIes->SuppRates, &pIes->ExtSuppRates ) ) break; |
| 5494 | //Tush-QoS: validate first if asked for APSD or WMM association |
| 5495 | if ( (eCsrRoamWmmQbssOnly == pMac->roam.configParam.WMMSupportMode) && |
| 5496 | !CSR_IS_QOS_BSS(pIes) ) |
| 5497 | break; |
| 5498 | //Check country. check even when pb is NULL because we may want to make sure |
| 5499 | //AP has a country code in it if fEnforceCountryCodeMatch is set. |
| 5500 | pb = ( pFilter->countryCode[0] ) ? ( pFilter->countryCode) : NULL; |
| 5501 | |
| 5502 | fCheck = csrMatchCountryCode( pMac, pb, pIes ); |
| 5503 | if(!fCheck) |
| 5504 | break; |
| 5505 | |
| 5506 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 5507 | if (pFilter->MDID.mdiePresent) |
| 5508 | { |
| 5509 | if (pBssDesc->mdiePresent) |
| 5510 | { |
| 5511 | if (pFilter->MDID.mobilityDomain != (pBssDesc->mdie[1] << 8 | pBssDesc->mdie[0])) |
| 5512 | break; |
| 5513 | } |
| 5514 | else |
| 5515 | break; |
| 5516 | } |
| 5517 | #endif |
| 5518 | fRC = eANI_BOOLEAN_TRUE; |
| 5519 | |
| 5520 | } while( 0 ); |
| 5521 | if( ppIes ) |
| 5522 | { |
| 5523 | *ppIes = pIes; |
| 5524 | } |
| 5525 | else if( pIes ) |
| 5526 | { |
| 5527 | palFreeMemory(pMac->hHdd, pIes); |
| 5528 | } |
| 5529 | |
| 5530 | return( fRC ); |
| 5531 | } |
| 5532 | |
| 5533 | tANI_BOOLEAN csrMatchConnectedBSSSecurity( tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile, |
| 5534 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes) |
| 5535 | { |
| 5536 | tCsrEncryptionList ucEncryptionList, mcEncryptionList; |
| 5537 | tCsrAuthList authList; |
| 5538 | |
| 5539 | ucEncryptionList.numEntries = 1; |
| 5540 | ucEncryptionList.encryptionType[0] = pProfile->EncryptionType; |
| 5541 | |
| 5542 | mcEncryptionList.numEntries = 1; |
| 5543 | mcEncryptionList.encryptionType[0] = pProfile->mcEncryptionType; |
| 5544 | |
| 5545 | authList.numEntries = 1; |
| 5546 | authList.authType[0] = pProfile->AuthType; |
| 5547 | |
| 5548 | return( csrIsSecurityMatch( pMac, &authList, &ucEncryptionList, &mcEncryptionList, pBssDesc, pIes, NULL, NULL, NULL )); |
| 5549 | |
| 5550 | } |
| 5551 | |
| 5552 | |
| 5553 | tANI_BOOLEAN csrMatchBSSToConnectProfile( tHalHandle hHal, tCsrRoamConnectedProfile *pProfile, |
| 5554 | tSirBssDescription *pBssDesc, tDot11fBeaconIEs *pIes ) |
| 5555 | { |
| 5556 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5557 | tANI_BOOLEAN fRC = eANI_BOOLEAN_FALSE, fCheck; |
| 5558 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 5559 | |
| 5560 | do { |
| 5561 | if( !pIes ) |
| 5562 | { |
| 5563 | if(!HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, pBssDesc, &pIesLocal))) |
| 5564 | { |
| 5565 | break; |
| 5566 | } |
| 5567 | } |
| 5568 | fCheck = eANI_BOOLEAN_TRUE; |
| 5569 | if(pIesLocal->SSID.present) |
| 5570 | { |
| 5571 | tANI_BOOLEAN fCheckSsid = eANI_BOOLEAN_FALSE; |
| 5572 | if(pProfile->SSID.length) |
| 5573 | { |
| 5574 | fCheckSsid = eANI_BOOLEAN_TRUE; |
| 5575 | } |
| 5576 | fCheck = csrIsSsidMatch( pMac, pProfile->SSID.ssId, pProfile->SSID.length, |
| 5577 | pIesLocal->SSID.ssid, pIesLocal->SSID.num_ssid, fCheckSsid ); |
| 5578 | if(!fCheck) break; |
| 5579 | } |
| 5580 | if ( !csrMatchConnectedBSSSecurity( pMac, pProfile, pBssDesc, pIesLocal) ) break; |
| 5581 | if ( !csrIsCapabilitiesMatch( pMac, pProfile->BSSType, pBssDesc ) ) break; |
| 5582 | if ( !csrIsRateSetMatch( pMac, &pIesLocal->SuppRates, &pIesLocal->ExtSuppRates ) ) break; |
| 5583 | fCheck = csrIsChannelBandMatch( pMac, pProfile->operationChannel, pBssDesc ); |
| 5584 | if(!fCheck) |
| 5585 | break; |
| 5586 | |
| 5587 | fRC = eANI_BOOLEAN_TRUE; |
| 5588 | |
| 5589 | } while( 0 ); |
| 5590 | |
| 5591 | if( !pIes && pIesLocal ) |
| 5592 | { |
| 5593 | //locally allocated |
| 5594 | palFreeMemory(pMac->hHdd, pIesLocal); |
| 5595 | } |
| 5596 | |
| 5597 | return( fRC ); |
| 5598 | } |
| 5599 | |
| 5600 | |
| 5601 | |
| 5602 | tANI_BOOLEAN csrRatesIsDot11RateSupported( tHalHandle hHal, tANI_U8 rate ) |
| 5603 | { |
| 5604 | tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); |
| 5605 | tANI_U16 n = BITS_OFF( rate, CSR_DOT11_BASIC_RATE_MASK ); |
| 5606 | |
| 5607 | return csrIsAggregateRateSupported( pMac, n ); |
| 5608 | } |
| 5609 | |
| 5610 | |
| 5611 | tANI_U16 csrRatesMacPropToDot11( tANI_U16 Rate ) |
| 5612 | { |
| 5613 | tANI_U16 ConvertedRate = Rate; |
| 5614 | |
| 5615 | switch( Rate ) |
| 5616 | { |
| 5617 | case SIR_MAC_RATE_1: |
| 5618 | ConvertedRate = 2; |
| 5619 | break; |
| 5620 | case SIR_MAC_RATE_2: |
| 5621 | ConvertedRate = 4; |
| 5622 | break; |
| 5623 | case SIR_MAC_RATE_5_5: |
| 5624 | ConvertedRate = 11; |
| 5625 | break; |
| 5626 | case SIR_MAC_RATE_11: |
| 5627 | ConvertedRate = 22; |
| 5628 | break; |
| 5629 | |
| 5630 | case SIR_MAC_RATE_6: |
| 5631 | ConvertedRate = 12; |
| 5632 | break; |
| 5633 | case SIR_MAC_RATE_9: |
| 5634 | ConvertedRate = 18; |
| 5635 | break; |
| 5636 | case SIR_MAC_RATE_12: |
| 5637 | ConvertedRate = 24; |
| 5638 | break; |
| 5639 | case SIR_MAC_RATE_18: |
| 5640 | ConvertedRate = 36; |
| 5641 | break; |
| 5642 | case SIR_MAC_RATE_24: |
| 5643 | ConvertedRate = 48; |
| 5644 | break; |
| 5645 | case SIR_MAC_RATE_36: |
| 5646 | ConvertedRate = 72; |
| 5647 | break; |
| 5648 | case SIR_MAC_RATE_42: |
| 5649 | ConvertedRate = 84; |
| 5650 | break; |
| 5651 | case SIR_MAC_RATE_48: |
| 5652 | ConvertedRate = 96; |
| 5653 | break; |
| 5654 | case SIR_MAC_RATE_54: |
| 5655 | ConvertedRate = 108; |
| 5656 | break; |
| 5657 | |
| 5658 | case SIR_MAC_RATE_72: |
| 5659 | ConvertedRate = 144; |
| 5660 | break; |
| 5661 | case SIR_MAC_RATE_84: |
| 5662 | ConvertedRate = 168; |
| 5663 | break; |
| 5664 | case SIR_MAC_RATE_96: |
| 5665 | ConvertedRate = 192; |
| 5666 | break; |
| 5667 | case SIR_MAC_RATE_108: |
| 5668 | ConvertedRate = 216; |
| 5669 | break; |
| 5670 | case SIR_MAC_RATE_126: |
| 5671 | ConvertedRate = 252; |
| 5672 | break; |
| 5673 | case SIR_MAC_RATE_144: |
| 5674 | ConvertedRate = 288; |
| 5675 | break; |
| 5676 | case SIR_MAC_RATE_168: |
| 5677 | ConvertedRate = 336; |
| 5678 | break; |
| 5679 | case SIR_MAC_RATE_192: |
| 5680 | ConvertedRate = 384; |
| 5681 | break; |
| 5682 | case SIR_MAC_RATE_216: |
| 5683 | ConvertedRate = 432; |
| 5684 | break; |
| 5685 | case SIR_MAC_RATE_240: |
| 5686 | ConvertedRate = 480; |
| 5687 | break; |
| 5688 | |
| 5689 | case 0xff: |
| 5690 | ConvertedRate = 0; |
| 5691 | break; |
| 5692 | } |
| 5693 | |
| 5694 | return ConvertedRate; |
| 5695 | } |
| 5696 | |
| 5697 | |
| 5698 | tANI_U16 csrRatesFindBestRate( tSirMacRateSet *pSuppRates, tSirMacRateSet *pExtRates, tSirMacPropRateSet *pPropRates ) |
| 5699 | { |
| 5700 | tANI_U8 i; |
| 5701 | tANI_U16 nBest; |
| 5702 | |
| 5703 | nBest = pSuppRates->rate[ 0 ] & ( ~CSR_DOT11_BASIC_RATE_MASK ); |
| 5704 | |
| 5705 | if(pSuppRates->numRates > SIR_MAC_RATESET_EID_MAX) |
| 5706 | { |
| 5707 | pSuppRates->numRates = SIR_MAC_RATESET_EID_MAX; |
| 5708 | } |
| 5709 | |
| 5710 | for ( i = 1U; i < pSuppRates->numRates; ++i ) |
| 5711 | { |
| 5712 | nBest = (tANI_U16)CSR_MAX( nBest, pSuppRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) ); |
| 5713 | } |
| 5714 | |
| 5715 | if ( NULL != pExtRates ) |
| 5716 | { |
| 5717 | for ( i = 0U; i < pExtRates->numRates; ++i ) |
| 5718 | { |
| 5719 | nBest = (tANI_U16)CSR_MAX( nBest, pExtRates->rate[ i ] & ( ~CSR_DOT11_BASIC_RATE_MASK ) ); |
| 5720 | } |
| 5721 | } |
| 5722 | |
| 5723 | if ( NULL != pPropRates ) |
| 5724 | { |
| 5725 | for ( i = 0U; i < pPropRates->numPropRates; ++i ) |
| 5726 | { |
| 5727 | nBest = (tANI_U16)CSR_MAX( nBest, csrRatesMacPropToDot11( pPropRates->propRate[ i ] ) ); |
| 5728 | } |
| 5729 | } |
| 5730 | |
| 5731 | return nBest; |
| 5732 | } |
| 5733 | |
| 5734 | |
| 5735 | void csrReleaseProfile(tpAniSirGlobal pMac, tCsrRoamProfile *pProfile) |
| 5736 | { |
| 5737 | if(pProfile) |
| 5738 | { |
| 5739 | if(pProfile->BSSIDs.bssid) |
| 5740 | { |
| 5741 | palFreeMemory(pMac->hHdd, pProfile->BSSIDs.bssid); |
| 5742 | pProfile->BSSIDs.bssid = NULL; |
| 5743 | } |
| 5744 | if(pProfile->SSIDs.SSIDList) |
| 5745 | { |
| 5746 | palFreeMemory(pMac->hHdd, pProfile->SSIDs.SSIDList); |
| 5747 | pProfile->SSIDs.SSIDList = NULL; |
| 5748 | } |
| 5749 | if(pProfile->pWPAReqIE) |
| 5750 | { |
| 5751 | palFreeMemory(pMac->hHdd, pProfile->pWPAReqIE); |
| 5752 | pProfile->pWPAReqIE = NULL; |
| 5753 | } |
| 5754 | if(pProfile->pRSNReqIE) |
| 5755 | { |
| 5756 | palFreeMemory(pMac->hHdd, pProfile->pRSNReqIE); |
| 5757 | pProfile->pRSNReqIE = NULL; |
| 5758 | } |
| 5759 | #ifdef FEATURE_WLAN_WAPI |
| 5760 | if(pProfile->pWAPIReqIE) |
| 5761 | { |
| 5762 | palFreeMemory(pMac->hHdd, pProfile->pWAPIReqIE); |
| 5763 | pProfile->pWAPIReqIE = NULL; |
| 5764 | } |
| 5765 | #endif /* FEATURE_WLAN_WAPI */ |
| 5766 | |
| 5767 | if(pProfile->pAddIEScan) |
| 5768 | { |
| 5769 | palFreeMemory(pMac->hHdd, pProfile->pAddIEScan); |
| 5770 | pProfile->pAddIEScan = NULL; |
| 5771 | } |
| 5772 | |
| 5773 | if(pProfile->pAddIEAssoc) |
| 5774 | { |
| 5775 | palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc); |
| 5776 | pProfile->pAddIEAssoc = NULL; |
| 5777 | } |
| 5778 | { |
| 5779 | palFreeMemory(pMac->hHdd, pProfile->pAddIEAssoc); |
| 5780 | pProfile->pAddIEAssoc = NULL; |
| 5781 | } |
| 5782 | |
| 5783 | if(pProfile->ChannelInfo.ChannelList) |
| 5784 | { |
| 5785 | palFreeMemory(pMac->hHdd, pProfile->ChannelInfo.ChannelList); |
| 5786 | pProfile->ChannelInfo.ChannelList = NULL; |
| 5787 | } |
| 5788 | |
| 5789 | |
| 5790 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile)); |
| 5791 | } |
| 5792 | } |
| 5793 | |
| 5794 | void csrFreeScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter) |
| 5795 | { |
| 5796 | if(pScanFilter->BSSIDs.bssid) |
| 5797 | { |
| 5798 | palFreeMemory(pMac->hHdd, pScanFilter->BSSIDs.bssid); |
| 5799 | pScanFilter->BSSIDs.bssid = NULL; |
| 5800 | } |
| 5801 | if(pScanFilter->ChannelInfo.ChannelList) |
| 5802 | { |
| 5803 | palFreeMemory(pMac->hHdd, pScanFilter->ChannelInfo.ChannelList); |
| 5804 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 5805 | } |
| 5806 | if(pScanFilter->SSIDs.SSIDList) |
| 5807 | { |
| 5808 | palFreeMemory(pMac->hHdd, pScanFilter->SSIDs.SSIDList); |
| 5809 | pScanFilter->SSIDs.SSIDList = NULL; |
| 5810 | } |
| 5811 | } |
| 5812 | |
| 5813 | |
| 5814 | void csrFreeRoamProfile(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 5815 | { |
| 5816 | tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId]; |
| 5817 | |
| 5818 | if(pSession->pCurRoamProfile) |
| 5819 | { |
| 5820 | csrReleaseProfile(pMac, pSession->pCurRoamProfile); |
| 5821 | palFreeMemory(pMac->hHdd, pSession->pCurRoamProfile); |
| 5822 | pSession->pCurRoamProfile = NULL; |
| 5823 | } |
| 5824 | } |
| 5825 | |
| 5826 | |
| 5827 | void csrFreeConnectBssDesc(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 5828 | { |
| 5829 | tCsrRoamSession *pSession = &pMac->roam.roamSession[sessionId]; |
| 5830 | |
| 5831 | if(pSession->pConnectBssDesc) |
| 5832 | { |
| 5833 | palFreeMemory(pMac->hHdd, pSession->pConnectBssDesc); |
| 5834 | pSession->pConnectBssDesc = NULL; |
| 5835 | } |
| 5836 | } |
| 5837 | |
| 5838 | |
| 5839 | |
| 5840 | tSirResultCodes csrGetDisassocRspStatusCode( tSirSmeDisassocRsp *pSmeDisassocRsp ) |
| 5841 | { |
| 5842 | tANI_U8 *pBuffer = (tANI_U8 *)pSmeDisassocRsp; |
| 5843 | tANI_U32 ret; |
| 5844 | |
| 5845 | pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tSirMacAddr)); |
| 5846 | //tSirResultCodes is an enum, assuming is 32bit |
| 5847 | //If we cannot make this assumption, use copymemory |
| 5848 | pal_get_U32( pBuffer, &ret ); |
| 5849 | |
| 5850 | return( ( tSirResultCodes )ret ); |
| 5851 | } |
| 5852 | |
| 5853 | |
| 5854 | tSirResultCodes csrGetDeAuthRspStatusCode( tSirSmeDeauthRsp *pSmeRsp ) |
| 5855 | { |
| 5856 | tANI_U8 *pBuffer = (tANI_U8 *)pSmeRsp; |
| 5857 | tANI_U32 ret; |
| 5858 | |
| 5859 | pBuffer += (sizeof(tANI_U16) + sizeof(tANI_U16) + sizeof(tSirMacAddr)); |
| 5860 | //tSirResultCodes is an enum, assuming is 32bit |
| 5861 | //If we cannot make this assumption, use copymemory |
| 5862 | pal_get_U32( pBuffer, &ret ); |
| 5863 | |
| 5864 | return( ( tSirResultCodes )ret ); |
| 5865 | } |
| 5866 | |
| 5867 | #if 0 |
| 5868 | tSirScanType csrGetScanType(tANI_U8 chnId, eRegDomainId domainId, tANI_U8 *countryCode) |
| 5869 | { |
| 5870 | tSirScanType scanType = eSIR_PASSIVE_SCAN; |
| 5871 | tANI_U8 cc = 0; |
| 5872 | |
| 5873 | while (cc++ < gCsrDomainChnInfo[domainId].numChannels) |
| 5874 | { |
| 5875 | if(chnId == gCsrDomainChnInfo[domainId].chnInfo[cc].chnId) |
| 5876 | { |
| 5877 | scanType = gCsrDomainChnInfo[domainId].chnInfo[cc].scanType; |
| 5878 | break; |
| 5879 | } |
| 5880 | } |
| 5881 | |
| 5882 | return (scanType); |
| 5883 | } |
| 5884 | #endif |
| 5885 | |
| 5886 | tSirScanType csrGetScanType(tpAniSirGlobal pMac, tANI_U8 chnId) |
| 5887 | { |
| 5888 | tSirScanType scanType = eSIR_PASSIVE_SCAN; |
| 5889 | eNVChannelEnabledType channelEnabledType; |
| 5890 | |
| 5891 | channelEnabledType = vos_nv_getChannelEnabledState(chnId); |
| 5892 | if( NV_CHANNEL_ENABLE == channelEnabledType) |
| 5893 | { |
| 5894 | scanType = eSIR_ACTIVE_SCAN; |
| 5895 | } |
| 5896 | return (scanType); |
| 5897 | } |
| 5898 | |
| 5899 | |
| 5900 | tANI_U8 csrToUpper( tANI_U8 ch ) |
| 5901 | { |
| 5902 | tANI_U8 chOut; |
| 5903 | |
| 5904 | if ( ch >= 'a' && ch <= 'z' ) |
| 5905 | { |
| 5906 | chOut = ch - 'a' + 'A'; |
| 5907 | } |
| 5908 | else |
| 5909 | { |
| 5910 | chOut = ch; |
| 5911 | } |
| 5912 | return( chOut ); |
| 5913 | } |
| 5914 | |
| 5915 | |
| 5916 | tSirBssType csrTranslateBsstypeToMacType(eCsrRoamBssType csrtype) |
| 5917 | { |
| 5918 | tSirBssType ret; |
| 5919 | |
| 5920 | switch(csrtype) |
| 5921 | { |
| 5922 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 5923 | ret = eSIR_INFRASTRUCTURE_MODE; |
| 5924 | break; |
| 5925 | case eCSR_BSS_TYPE_IBSS: |
| 5926 | case eCSR_BSS_TYPE_START_IBSS: |
| 5927 | ret = eSIR_IBSS_MODE; |
| 5928 | break; |
| 5929 | case eCSR_BSS_TYPE_WDS_AP: |
| 5930 | ret = eSIR_BTAMP_AP_MODE; |
| 5931 | break; |
| 5932 | case eCSR_BSS_TYPE_WDS_STA: |
| 5933 | ret = eSIR_BTAMP_STA_MODE; |
| 5934 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5935 | case eCSR_BSS_TYPE_INFRA_AP: |
| 5936 | ret = eSIR_INFRA_AP_MODE; |
| 5937 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5938 | case eCSR_BSS_TYPE_ANY: |
| 5939 | default: |
| 5940 | ret = eSIR_AUTO_MODE; |
| 5941 | break; |
| 5942 | } |
| 5943 | |
| 5944 | return (ret); |
| 5945 | } |
| 5946 | |
| 5947 | |
| 5948 | //This function use the parameters to decide the CFG value. |
| 5949 | //CSR never sets WNI_CFG_DOT11_MODE_ALL to the CFG |
| 5950 | //So PE should not see WNI_CFG_DOT11_MODE_ALL when it gets the CFG value |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5951 | eCsrCfgDot11Mode csrGetCfgDot11ModeFromCsrPhyMode(tCsrRoamProfile *pProfile, eCsrPhyMode phyMode, tANI_BOOLEAN fProprietary) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5952 | { |
| 5953 | tANI_U32 cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG; |
| 5954 | |
| 5955 | switch(phyMode) |
| 5956 | { |
| 5957 | case eCSR_DOT11_MODE_11a: |
| 5958 | case eCSR_DOT11_MODE_11a_ONLY: |
| 5959 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 5960 | break; |
| 5961 | case eCSR_DOT11_MODE_11b: |
| 5962 | case eCSR_DOT11_MODE_11b_ONLY: |
| 5963 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 5964 | break; |
| 5965 | case eCSR_DOT11_MODE_11g: |
| 5966 | case eCSR_DOT11_MODE_11g_ONLY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5967 | if(pProfile && (CSR_IS_INFRA_AP(pProfile)) && (phyMode == eCSR_DOT11_MODE_11g_ONLY)) |
| 5968 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G_ONLY; |
| 5969 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5970 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 5971 | break; |
| 5972 | case eCSR_DOT11_MODE_11n: |
| 5973 | if(fProprietary) |
| 5974 | { |
| 5975 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 5976 | } |
| 5977 | else |
| 5978 | { |
| 5979 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 5980 | } |
| 5981 | break; |
| 5982 | case eCSR_DOT11_MODE_11n_ONLY: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5983 | if(pProfile && CSR_IS_INFRA_AP(pProfile)) |
| 5984 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N_ONLY; |
| 5985 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5986 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 5987 | break; |
| 5988 | case eCSR_DOT11_MODE_TAURUS: |
| 5989 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_TAURUS; |
| 5990 | break; |
| 5991 | case eCSR_DOT11_MODE_abg: |
| 5992 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG; |
| 5993 | break; |
| 5994 | case eCSR_DOT11_MODE_AUTO: |
| 5995 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO; |
| 5996 | break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5997 | |
| 5998 | #ifdef WLAN_FEATURE_11AC |
| 5999 | case eCSR_DOT11_MODE_11ac: |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 6000 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 6001 | { |
| 6002 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 6003 | } |
| 6004 | else |
| 6005 | { |
Gopichand Nakkala | 681989c | 2013-03-06 22:27:48 -0800 | [diff] [blame] | 6006 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 6007 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 6008 | break; |
| 6009 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 6010 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY; |
| 6011 | break; |
| 6012 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6013 | default: |
| 6014 | //No need to assign anything here |
| 6015 | break; |
| 6016 | } |
| 6017 | |
| 6018 | return (cfgDot11Mode); |
| 6019 | } |
| 6020 | |
| 6021 | |
| 6022 | eHalStatus csrSetRegulatoryDomain(tpAniSirGlobal pMac, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded) |
| 6023 | { |
| 6024 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6025 | tANI_BOOLEAN fRestart; |
| 6026 | |
| 6027 | if(pMac->scan.domainIdCurrent == domainId) |
| 6028 | { |
| 6029 | //no change |
| 6030 | fRestart = eANI_BOOLEAN_FALSE; |
| 6031 | } |
| 6032 | else if( !pMac->roam.configParam.fEnforceDefaultDomain ) |
| 6033 | { |
| 6034 | pMac->scan.domainIdCurrent = domainId; |
| 6035 | fRestart = eANI_BOOLEAN_TRUE; |
| 6036 | } |
| 6037 | else |
| 6038 | { |
| 6039 | //We cannot change the domain |
| 6040 | status = eHAL_STATUS_CSR_WRONG_STATE; |
| 6041 | fRestart = eANI_BOOLEAN_FALSE; |
| 6042 | } |
| 6043 | if(pfRestartNeeded) |
| 6044 | { |
| 6045 | *pfRestartNeeded = fRestart; |
| 6046 | } |
| 6047 | |
| 6048 | return (status); |
| 6049 | } |
| 6050 | |
| 6051 | |
| 6052 | v_REGDOMAIN_t csrGetCurrentRegulatoryDomain(tpAniSirGlobal pMac) |
| 6053 | { |
| 6054 | return (pMac->scan.domainIdCurrent); |
| 6055 | } |
| 6056 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6057 | |
| 6058 | eHalStatus csrGetRegulatoryDomainForCountry(tpAniSirGlobal pMac, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId) |
| 6059 | { |
| 6060 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 6061 | VOS_STATUS vosStatus; |
| 6062 | v_COUNTRYCODE_t countryCode; |
| 6063 | v_REGDOMAIN_t domainId; |
| 6064 | |
| 6065 | if(pCountry) |
| 6066 | { |
| 6067 | countryCode[0] = pCountry[0]; |
| 6068 | countryCode[1] = pCountry[1]; |
| 6069 | vosStatus = vos_nv_getRegDomainFromCountryCode( &domainId, countryCode ); |
| 6070 | if( VOS_IS_STATUS_SUCCESS(vosStatus) ) |
| 6071 | { |
| 6072 | if( pDomainId ) |
| 6073 | { |
| 6074 | *pDomainId = domainId; |
| 6075 | } |
| 6076 | status = eHAL_STATUS_SUCCESS; |
| 6077 | } |
| 6078 | else |
| 6079 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6080 | smsLog(pMac, LOGW, FL(" doesn't match country %c%c"), pCountry[0], pCountry[1]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6081 | status = eHAL_STATUS_INVALID_PARAMETER; |
| 6082 | } |
| 6083 | } |
| 6084 | |
| 6085 | return (status); |
| 6086 | } |
| 6087 | |
| 6088 | //To check whether a country code matches the one in the IE |
| 6089 | //Only check the first two characters, ignoring in/outdoor |
| 6090 | //pCountry -- caller allocated buffer contain the country code that is checking against |
| 6091 | //the one in pIes. It can be NULL. |
| 6092 | //caller must provide pIes, it cannot be NULL |
| 6093 | //This function always return TRUE if 11d support is not turned on. |
| 6094 | tANI_BOOLEAN csrMatchCountryCode( tpAniSirGlobal pMac, tANI_U8 *pCountry, tDot11fBeaconIEs *pIes ) |
| 6095 | { |
| 6096 | tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 6097 | v_REGDOMAIN_t domainId = REGDOMAIN_COUNT; //This is init to invalid value |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6098 | eHalStatus status; |
| 6099 | |
| 6100 | do |
| 6101 | { |
| 6102 | if( !csrIs11dSupported( pMac) ) |
| 6103 | { |
| 6104 | break; |
| 6105 | } |
| 6106 | if( !pIes ) |
| 6107 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6108 | smsLog(pMac, LOGE, FL(" No IEs")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6109 | break; |
| 6110 | } |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6111 | if( pMac->roam.configParam.fEnforceDefaultDomain || |
| 6112 | pMac->roam.configParam.fEnforceCountryCodeMatch ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6113 | { |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6114 | //Make sure this country is recognizable |
| 6115 | if( pIes->Country.present ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6116 | { |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6117 | status = csrGetRegulatoryDomainForCountry( pMac, pIes->Country.country, &domainId ); |
| 6118 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6119 | { |
Gowri Deepthi | ff9adf9 | 2012-12-13 15:09:56 -0800 | [diff] [blame] | 6120 | status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCode11d,(v_REGDOMAIN_t *) &domainId ); |
| 6121 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6122 | { |
| 6123 | fRet = eANI_BOOLEAN_FALSE; |
| 6124 | break; |
| 6125 | } |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6126 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6127 | } |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6128 | //check whether it is needed to enforce to the default regulatory domain first |
| 6129 | if( pMac->roam.configParam.fEnforceDefaultDomain ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6130 | { |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6131 | if( domainId != pMac->scan.domainIdCurrent ) |
| 6132 | { |
| 6133 | fRet = eANI_BOOLEAN_FALSE; |
| 6134 | break; |
| 6135 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6136 | } |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6137 | if( pMac->roam.configParam.fEnforceCountryCodeMatch ) |
| 6138 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 6139 | if( domainId >= REGDOMAIN_COUNT ) |
Madan Mohan Koyyalamudi | 42af178 | 2012-10-21 12:13:23 -0700 | [diff] [blame] | 6140 | { |
| 6141 | fRet = eANI_BOOLEAN_FALSE; |
| 6142 | break; |
| 6143 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6144 | } |
| 6145 | } |
| 6146 | if( pCountry ) |
| 6147 | { |
| 6148 | tANI_U32 i; |
| 6149 | |
| 6150 | if( !pIes->Country.present ) |
| 6151 | { |
| 6152 | fRet = eANI_BOOLEAN_FALSE; |
| 6153 | break; |
| 6154 | } |
| 6155 | // Convert the CountryCode characters to upper |
| 6156 | for ( i = 0; i < WNI_CFG_COUNTRY_CODE_LEN - 1; i++ ) |
| 6157 | { |
| 6158 | pCountry[i] = csrToUpper( pCountry[i] ); |
| 6159 | } |
| 6160 | if( !palEqualMemory(pMac->hHdd, pIes->Country.country, pCountry, WNI_CFG_COUNTRY_CODE_LEN - 1) ) |
| 6161 | { |
| 6162 | fRet = eANI_BOOLEAN_FALSE; |
| 6163 | break; |
| 6164 | } |
| 6165 | } |
| 6166 | } while(0); |
| 6167 | |
| 6168 | return (fRet); |
| 6169 | } |
| 6170 | |
| 6171 | #if 0 |
| 6172 | eHalStatus csrSetCountryDomainMapping(tpAniSirGlobal pMac, tCsrCountryDomainMapping *pCountryDomainMapping) |
| 6173 | { |
| 6174 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 6175 | tANI_U32 i, j; |
| 6176 | tANI_BOOLEAN fDomainChanged = eANI_BOOLEAN_FALSE; |
| 6177 | tANI_U8 countryCode[WNI_CFG_COUNTRY_CODE_LEN]; |
| 6178 | |
| 6179 | i = WNI_CFG_COUNTRY_CODE_LEN; |
| 6180 | //Get the currently used country code |
| 6181 | status = ccmCfgGetStr(pMac, WNI_CFG_COUNTRY_CODE, countryCode, &i); |
| 6182 | if(HAL_STATUS_SUCCESS(status)) |
| 6183 | { |
| 6184 | if(pCountryDomainMapping && pCountryDomainMapping->numEntry) |
| 6185 | { |
| 6186 | for(i = 0; i < pCountryDomainMapping->numEntry; i++) |
| 6187 | { |
| 6188 | for(j = 0; j < eCSR_NUM_COUNTRY_INDEX; j++) |
| 6189 | { |
| 6190 | if(palEqualMemory(pMac->hHdd, gCsrCountryInfo[j].countryCode, |
| 6191 | pCountryDomainMapping->pCountryInfo[i].countryCode, 2)) |
| 6192 | { |
| 6193 | if(gCsrCountryInfo[j].domainId != pCountryDomainMapping->pCountryInfo[i].domainId) |
| 6194 | { |
| 6195 | gCsrCountryInfo[j].domainId = pCountryDomainMapping->pCountryInfo[i].domainId; |
| 6196 | //Check whether it matches the currently used country code |
| 6197 | //If matching, need to update base on the new domain setting. |
| 6198 | if(palEqualMemory(pMac->hHdd, countryCode, |
| 6199 | pCountryDomainMapping->pCountryInfo[i].countryCode, 2)) |
| 6200 | { |
| 6201 | fDomainChanged = eANI_BOOLEAN_TRUE; |
| 6202 | } |
| 6203 | } |
| 6204 | break; |
| 6205 | } |
| 6206 | } |
| 6207 | } |
| 6208 | status = eHAL_STATUS_SUCCESS; |
| 6209 | if(fDomainChanged) |
| 6210 | { |
| 6211 | tCsrChannel *pChannelList; |
| 6212 | |
| 6213 | if(pMac->scan.f11dInfoApplied) |
| 6214 | { |
| 6215 | //11d info already applied. Let's reapply with the new domain setting |
| 6216 | if(pMac->scan.channels11d.numChannels) |
| 6217 | { |
| 6218 | pChannelList = &pMac->scan.channels11d; |
| 6219 | } |
| 6220 | else |
| 6221 | { |
| 6222 | pChannelList = &pMac->scan.base20MHzChannels; |
| 6223 | } |
| 6224 | } |
| 6225 | else |
| 6226 | { |
| 6227 | //no 11d so we use the base channelist from EEPROM |
| 6228 | pChannelList = &pMac->scan.base20MHzChannels; |
| 6229 | } |
| 6230 | //set the new domain's scan requirement to CFG |
| 6231 | csrSetCfgScanControlList(pMac, countryCode, pChannelList); |
| 6232 | } |
| 6233 | } |
| 6234 | } |
| 6235 | |
| 6236 | return (status); |
| 6237 | } |
| 6238 | |
| 6239 | eHalStatus csrSetDomainScanSetting(tpAniSirGlobal pMac, tCsrDomainFreqInfo *pDomainFreqInfo) |
| 6240 | { |
| 6241 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 6242 | tANI_U32 i, j; |
| 6243 | tANI_U16 freq; |
| 6244 | |
| 6245 | if(pDomainFreqInfo && pDomainFreqInfo->numEntry && (pDomainFreqInfo->domainId < NUM_REG_DOMAINS)) |
| 6246 | { |
| 6247 | tCsrDomainChnInfo *pDomainChnInfo = &gCsrDomainChnInfo[pDomainFreqInfo->domainId]; |
| 6248 | |
| 6249 | for(j = 0; j < pDomainChnInfo->numChannels; j++) |
| 6250 | { |
| 6251 | if(HAL_STATUS_SUCCESS(halPhyChIdToFreqConversion(pDomainChnInfo->chnInfo[j].chnId, &freq))) |
| 6252 | { |
| 6253 | for(i = 0; i < pDomainFreqInfo->numEntry; i++) |
| 6254 | { |
| 6255 | if((pDomainFreqInfo->pCsrScanFreqInfo[i].nStartFreq <= freq) && |
| 6256 | (freq <= pDomainFreqInfo->pCsrScanFreqInfo[i].nEndFreq)) |
| 6257 | { |
| 6258 | pDomainChnInfo->chnInfo[j].scanType = pDomainFreqInfo->pCsrScanFreqInfo[i].scanType; |
| 6259 | break; |
| 6260 | } |
| 6261 | } |
| 6262 | } |
| 6263 | else |
| 6264 | { |
| 6265 | smsLog(pMac, LOGW, " Failed to get frequency of channel %d", pDomainChnInfo->chnInfo[j].chnId); |
| 6266 | } |
| 6267 | } |
| 6268 | status = eHAL_STATUS_SUCCESS; |
| 6269 | } |
| 6270 | |
| 6271 | return (status); |
| 6272 | } |
| 6273 | #endif |
| 6274 | |
| 6275 | eHalStatus csrGetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 6276 | tCsrRoamModifyProfileFields *pModifyProfileFields) |
| 6277 | { |
| 6278 | |
| 6279 | if(!pModifyProfileFields) |
| 6280 | { |
| 6281 | return eHAL_STATUS_FAILURE; |
| 6282 | } |
| 6283 | |
| 6284 | palCopyMemory( pMac->hHdd, pModifyProfileFields, |
| 6285 | &pMac->roam.roamSession[sessionId].connectedProfile.modifyProfileFields, |
| 6286 | sizeof(tCsrRoamModifyProfileFields) ); |
| 6287 | |
| 6288 | return eHAL_STATUS_SUCCESS; |
| 6289 | } |
| 6290 | |
| 6291 | eHalStatus csrSetModifyProfileFields(tpAniSirGlobal pMac, tANI_U32 sessionId, |
| 6292 | tCsrRoamModifyProfileFields *pModifyProfileFields) |
| 6293 | { |
| 6294 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); |
| 6295 | |
| 6296 | palCopyMemory( pMac->hHdd, &pSession->connectedProfile.modifyProfileFields, |
| 6297 | pModifyProfileFields, |
| 6298 | sizeof(tCsrRoamModifyProfileFields) ); |
| 6299 | |
| 6300 | return eHAL_STATUS_SUCCESS; |
| 6301 | } |
| 6302 | |
| 6303 | |
| 6304 | #if 0 |
| 6305 | /* --------------------------------------------------------------------------- |
| 6306 | \fn csrGetSupportedCountryCode |
| 6307 | \brief this function is to get a list of the country code current being supported |
| 6308 | \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, |
| 6309 | this has the country code list. 3 bytes for each country code. This may be NULL if |
| 6310 | caller wants to know the needed bytes. |
| 6311 | \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return, |
| 6312 | this contains the length of the data in pBuf |
| 6313 | \return eHalStatus |
| 6314 | -------------------------------------------------------------------------------*/ |
| 6315 | eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen) |
| 6316 | { |
| 6317 | tANI_U32 numOfCountry = sizeof( gCsrCountryInfo ) / sizeof( gCsrCountryInfo[0] ); |
| 6318 | tANI_U32 numBytes = 0; |
| 6319 | eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; |
| 6320 | |
| 6321 | if( pbLen ) |
| 6322 | { |
| 6323 | numBytes = *pbLen; |
| 6324 | //Consider it ok, at least we can return the number of bytes needed; |
| 6325 | *pbLen = numOfCountry * WNI_CFG_COUNTRY_CODE_LEN; |
| 6326 | status = eHAL_STATUS_SUCCESS; |
| 6327 | if( pBuf && ( numBytes >= *pbLen ) ) |
| 6328 | { |
| 6329 | //The ugly part starts. |
| 6330 | //We may need to alter the data structure and find a way to make this faster. |
| 6331 | tANI_U32 i; |
| 6332 | |
| 6333 | for( i = 0; i < numOfCountry; i++ ) |
| 6334 | { |
| 6335 | palCopyMemory( pMac->hHdd, pBuf + ( i * WNI_CFG_COUNTRY_CODE_LEN ), |
| 6336 | gCsrCountryInfo[i].countryCode, WNI_CFG_COUNTRY_CODE_LEN ); |
| 6337 | } |
| 6338 | } |
| 6339 | } |
| 6340 | |
| 6341 | return ( status ); |
| 6342 | } |
| 6343 | #endif |
| 6344 | |
| 6345 | /* --------------------------------------------------------------------------- |
| 6346 | \fn csrGetSupportedCountryCode |
| 6347 | \brief this function is to get a list of the country code current being supported |
| 6348 | \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return, |
| 6349 | this has the country code list. 3 bytes for each country code. This may be NULL if |
| 6350 | caller wants to know the needed bytes. |
| 6351 | \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return, |
| 6352 | this contains the length of the data in pBuf |
| 6353 | \return eHalStatus |
| 6354 | -------------------------------------------------------------------------------*/ |
| 6355 | eHalStatus csrGetSupportedCountryCode(tpAniSirGlobal pMac, tANI_U8 *pBuf, tANI_U32 *pbLen) |
| 6356 | { |
| 6357 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 6358 | VOS_STATUS vosStatus; |
| 6359 | v_SIZE_t size = (v_SIZE_t)*pbLen; |
| 6360 | |
| 6361 | vosStatus = vos_nv_getSupportedCountryCode( pBuf, &size, 1 ); |
| 6362 | //eiter way, return the value back |
| 6363 | *pbLen = (tANI_U32)size; |
| 6364 | |
| 6365 | //If pBuf is NULL, caller just want to get the size, consider it success |
| 6366 | if(pBuf) |
| 6367 | { |
| 6368 | if( VOS_IS_STATUS_SUCCESS( vosStatus ) ) |
| 6369 | { |
| 6370 | tANI_U32 i, n = *pbLen / 3; |
| 6371 | |
| 6372 | for( i = 0; i < n; i++ ) |
| 6373 | { |
| 6374 | pBuf[i*3 + 2] = ' '; |
| 6375 | } |
| 6376 | } |
| 6377 | else |
| 6378 | { |
| 6379 | status = eHAL_STATUS_FAILURE; |
| 6380 | } |
| 6381 | } |
| 6382 | |
| 6383 | return (status); |
| 6384 | } |
| 6385 | |
| 6386 | |
| 6387 | |
| 6388 | //Upper layer to get the list of the base channels to scan for passively 11d info from csr |
| 6389 | eHalStatus csrScanGetBaseChannels( tpAniSirGlobal pMac, tCsrChannelInfo * pChannelInfo ) |
| 6390 | { |
| 6391 | eHalStatus status = eHAL_STATUS_FAILURE; |
| 6392 | |
| 6393 | do |
| 6394 | { |
| 6395 | |
| 6396 | if(!pMac->scan.baseChannels.numChannels || !pChannelInfo) |
| 6397 | { |
| 6398 | break; |
| 6399 | } |
| 6400 | status = palAllocateMemory( pMac->hHdd, (void **)&pChannelInfo->ChannelList, |
| 6401 | pMac->scan.baseChannels.numChannels ); |
| 6402 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6403 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6404 | smsLog( pMac, LOGE, FL("csrScanGetBaseChannels: fail to allocate memory") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6405 | break; |
| 6406 | } |
| 6407 | status = palCopyMemory( pMac->hHdd, pChannelInfo->ChannelList, pMac->scan.baseChannels.channelList, |
| 6408 | pMac->scan.baseChannels.numChannels ); |
| 6409 | if( !HAL_STATUS_SUCCESS( status ) ) |
| 6410 | { |
| 6411 | break; |
| 6412 | } |
| 6413 | pChannelInfo->numOfChannels = pMac->scan.baseChannels.numChannels; |
| 6414 | |
| 6415 | }while(0); |
| 6416 | |
| 6417 | return ( status ); |
| 6418 | } |
| 6419 | |
| 6420 | |
| 6421 | tANI_BOOLEAN csrIsSetKeyAllowed(tpAniSirGlobal pMac, tANI_U32 sessionId) |
| 6422 | { |
| 6423 | tANI_BOOLEAN fRet = eANI_BOOLEAN_TRUE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6424 | tCsrRoamSession *pSession; |
| 6425 | |
| 6426 | pSession =CSR_GET_SESSION(pMac, sessionId); |
| 6427 | |
| 6428 | /*This condition is not working for infra state. When infra is in not-connected state |
| 6429 | * the pSession->pCurRoamProfile is NULL. And this function returns TRUE, that is incorrect. |
| 6430 | * Since SAP requires to set key without any BSS started, it needs this condition to be met. |
| 6431 | * In other words, this function is useless. |
| 6432 | * The current work-around is to process setcontext_rsp and removekey_rsp no matter what the |
| 6433 | * state is. |
| 6434 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 6435 | smsLog( pMac, LOG2, FL(" is not what it intends to. Must be revisit or removed") ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6436 | if( (NULL == pSession) || |
| 6437 | ( csrIsConnStateDisconnected( pMac, sessionId ) && |
| 6438 | (pSession->pCurRoamProfile != NULL) && |
| 6439 | (!(CSR_IS_INFRA_AP(pSession->pCurRoamProfile))) ) |
| 6440 | ) |
| 6441 | { |
| 6442 | fRet = eANI_BOOLEAN_FALSE; |
| 6443 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6444 | |
| 6445 | return ( fRet ); |
| 6446 | } |
| 6447 | |
| 6448 | //no need to acquire lock for this basic function |
| 6449 | tANI_U16 sme_ChnToFreq(tANI_U8 chanNum) |
| 6450 | { |
| 6451 | int i; |
| 6452 | |
| 6453 | for (i = 0; i < NUM_RF_CHANNELS; i++) |
| 6454 | { |
| 6455 | if (rfChannels[i].channelNum == chanNum) |
| 6456 | { |
| 6457 | return rfChannels[i].targetFreq; |
| 6458 | } |
| 6459 | } |
| 6460 | |
| 6461 | return (0); |
| 6462 | } |
| 6463 | |
| 6464 | /* Disconnect all active sessions by sending disassoc. This is mainly used to disconnect the remaining session when we |
| 6465 | * transition from concurrent sessions to a single session. The use case is Infra STA and wifi direct multiple sessions are up and |
| 6466 | * P2P session is removed. The Infra STA session remains and should resume BMPS if BMPS is enabled by default. However, there |
| 6467 | * are some issues seen with BMPS resume during this transition and this is a workaround which will allow the Infra STA session to |
| 6468 | * disconnect and auto connect back and enter BMPS this giving the same effect as resuming BMPS |
| 6469 | */ |
Madan Mohan Koyyalamudi | 96dd30d | 2012-10-05 17:24:51 -0700 | [diff] [blame] | 6470 | |
| 6471 | //Remove this code once SLM_Sessionization is supported |
| 6472 | //BMPS_WORKAROUND_NOT_NEEDED |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 6473 | void csrDisconnectAllActiveSessions(tpAniSirGlobal pMac) |
| 6474 | { |
| 6475 | tANI_U8 i; |
| 6476 | |
| 6477 | /* Disconnect all the active sessions */ |
| 6478 | for (i=0; i<CSR_ROAM_SESSION_MAX; i++) |
| 6479 | { |
| 6480 | if( CSR_IS_SESSION_VALID( pMac, i ) && !csrIsConnStateDisconnected( pMac, i ) ) |
| 6481 | { |
| 6482 | csrRoamDisconnectInternal(pMac, i, eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 6483 | } |
| 6484 | } |
| 6485 | } |
Mohit Khanna | 349bc39 | 2012-09-11 17:24:52 -0700 | [diff] [blame] | 6486 | |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 6487 | #ifdef FEATURE_WLAN_LFR |
| 6488 | tANI_BOOLEAN csrIsChannelPresentInList( |
| 6489 | tANI_U8 *pChannelList, |
| 6490 | int numChannels, |
| 6491 | tANI_U8 channel |
| 6492 | ) |
| 6493 | { |
| 6494 | int i = 0; |
| 6495 | |
| 6496 | // Check for NULL pointer |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 6497 | if (!pChannelList || (numChannels == 0)) |
| 6498 | { |
| 6499 | return FALSE; |
| 6500 | } |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 6501 | |
| 6502 | // Look for the channel in the list |
| 6503 | for (i = 0; i < numChannels; i++) |
| 6504 | { |
| 6505 | if (pChannelList[i] == channel) |
| 6506 | return TRUE; |
| 6507 | } |
| 6508 | |
| 6509 | return FALSE; |
| 6510 | } |
| 6511 | |
| 6512 | VOS_STATUS csrAddToChannelListFront( |
| 6513 | tANI_U8 *pChannelList, |
| 6514 | int numChannels, |
| 6515 | tANI_U8 channel |
| 6516 | ) |
| 6517 | { |
| 6518 | int i = 0; |
| 6519 | |
| 6520 | // Check for NULL pointer |
| 6521 | if (!pChannelList) return eHAL_STATUS_E_NULL_VALUE; |
| 6522 | |
| 6523 | // Make room for the addition. (Start moving from the back.) |
| 6524 | for (i = numChannels; i > 0; i--) |
| 6525 | { |
| 6526 | pChannelList[i] = pChannelList[i-1]; |
| 6527 | } |
| 6528 | |
| 6529 | // Now add the NEW channel...at the front |
| 6530 | pChannelList[0] = channel; |
| 6531 | |
| 6532 | return eHAL_STATUS_SUCCESS; |
| 6533 | } |
| 6534 | #endif |