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