Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Abhishek Singh | ed55b24 | 2017-12-20 11:02:34 +0530 | [diff] [blame] | 2 | * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
| 19 | /* |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 20 | * DOC: csr_util.c |
| 21 | * |
| 22 | * Implementation supporting routines for CSR. |
| 23 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 24 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 25 | #include "ani_global.h" |
| 26 | |
| 27 | #include "csr_support.h" |
| 28 | #include "csr_inside_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 29 | #include "sme_qos_internal.h" |
| 30 | #include "wma_types.h" |
| 31 | #include "cds_utils.h" |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 32 | #include "wlan_policy_mgr_api.h" |
Varun Reddy Yeturu | 35c07f9 | 2017-02-28 10:35:00 -0800 | [diff] [blame] | 33 | #include "wlan_serialization_legacy_api.h" |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 34 | #include "wlan_reg_services_api.h" |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 35 | #include "wlan_crypto_global_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 36 | |
| 37 | |
| 38 | uint8_t csr_wpa_oui[][CSR_WPA_OUI_SIZE] = { |
| 39 | {0x00, 0x50, 0xf2, 0x00} |
| 40 | , |
| 41 | {0x00, 0x50, 0xf2, 0x01} |
| 42 | , |
| 43 | {0x00, 0x50, 0xf2, 0x02} |
| 44 | , |
| 45 | {0x00, 0x50, 0xf2, 0x03} |
| 46 | , |
| 47 | {0x00, 0x50, 0xf2, 0x04} |
| 48 | , |
| 49 | {0x00, 0x50, 0xf2, 0x05} |
| 50 | , |
| 51 | #ifdef FEATURE_WLAN_ESE |
| 52 | {0x00, 0x40, 0x96, 0x00} |
| 53 | , /* CCKM */ |
| 54 | #endif /* FEATURE_WLAN_ESE */ |
| 55 | }; |
| 56 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 57 | /* |
| 58 | * PLEASE DO NOT ADD THE #IFDEF IN BELOW TABLE, |
| 59 | * IF STILL REQUIRE THEN PLEASE ADD NULL ENTRIES |
| 60 | * OTHERWISE IT WILL BREAK OTHER LOWER |
| 61 | * SECUIRTY MODES. |
| 62 | */ |
| 63 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 64 | uint8_t csr_rsn_oui[][CSR_RSN_OUI_SIZE] = { |
| 65 | {0x00, 0x0F, 0xAC, 0x00} |
| 66 | , /* group cipher */ |
| 67 | {0x00, 0x0F, 0xAC, 0x01} |
| 68 | , /* WEP-40 or RSN */ |
| 69 | {0x00, 0x0F, 0xAC, 0x02} |
| 70 | , /* TKIP or RSN-PSK */ |
| 71 | {0x00, 0x0F, 0xAC, 0x03} |
| 72 | , /* Reserved */ |
| 73 | {0x00, 0x0F, 0xAC, 0x04} |
| 74 | , /* AES-CCMP */ |
| 75 | {0x00, 0x0F, 0xAC, 0x05} |
| 76 | , /* WEP-104 */ |
| 77 | {0x00, 0x40, 0x96, 0x00} |
| 78 | , /* CCKM */ |
| 79 | {0x00, 0x0F, 0xAC, 0x06} |
| 80 | , /* BIP (encryption type) or |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 81 | * RSN-PSK-SHA256 (authentication type) |
| 82 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 83 | /* RSN-8021X-SHA256 (authentication type) */ |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 84 | {0x00, 0x0F, 0xAC, 0x05}, |
| 85 | #ifdef WLAN_FEATURE_FILS_SK |
| 86 | #define ENUM_FILS_SHA256 9 |
| 87 | /* FILS SHA256 */ |
| 88 | {0x00, 0x0F, 0xAC, 0x0E}, |
| 89 | #define ENUM_FILS_SHA384 10 |
| 90 | /* FILS SHA384 */ |
| 91 | {0x00, 0x0F, 0xAC, 0x0F}, |
| 92 | #define ENUM_FT_FILS_SHA256 11 |
| 93 | /* FILS FT SHA256 */ |
| 94 | {0x00, 0x0F, 0xAC, 0x10}, |
| 95 | #define ENUM_FT_FILS_SHA384 12 |
| 96 | /* FILS FT SHA384 */ |
| 97 | {0x00, 0x0F, 0xAC, 0x11}, |
| 98 | #else |
| 99 | {0x00, 0x00, 0x00, 0x00}, |
| 100 | {0x00, 0x00, 0x00, 0x00}, |
| 101 | {0x00, 0x00, 0x00, 0x00}, |
| 102 | {0x00, 0x00, 0x00, 0x00}, |
| 103 | #endif |
| 104 | /* AES GCMP */ |
| 105 | {0x00, 0x0F, 0xAC, 0x08}, |
| 106 | /* AES GCMP-256 */ |
| 107 | {0x00, 0x0F, 0xAC, 0x09}, |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 108 | #define ENUM_DPP_RSN 15 |
| 109 | /* DPP RSN */ |
| 110 | {0x50, 0x6F, 0x9A, 0x02}, |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 111 | #define ENUM_OWE 16 |
| 112 | /* OWE https://tools.ietf.org/html/rfc8110 */ |
| 113 | {0x00, 0x0F, 0xAC, 0x12}, |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 114 | #define ENUM_SUITEB_EAP256 17 |
| 115 | {0x00, 0x0F, 0xAC, 0x0B}, |
| 116 | #define ENUM_SUITEB_EAP384 18 |
| 117 | {0x00, 0x0F, 0xAC, 0x0C}, |
| 118 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 119 | #ifdef WLAN_FEATURE_SAE |
| 120 | #define ENUM_SAE 19 |
| 121 | /* SAE */ |
| 122 | {0x00, 0x0F, 0xAC, 0x08}, |
| 123 | #define ENUM_FT_SAE 20 |
| 124 | /* FT SAE */ |
| 125 | {0x00, 0x0F, 0xAC, 0x09}, |
| 126 | #else |
| 127 | {0x00, 0x00, 0x00, 0x00}, |
| 128 | {0x00, 0x00, 0x00, 0x00}, |
| 129 | #endif |
| 130 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 131 | /* define new oui here, update #define CSR_OUI_***_INDEX */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 132 | }; |
| 133 | |
| 134 | #ifdef FEATURE_WLAN_WAPI |
| 135 | uint8_t csr_wapi_oui[][CSR_WAPI_OUI_SIZE] = { |
| 136 | {0x00, 0x14, 0x72, 0x00} |
| 137 | , /* Reserved */ |
| 138 | {0x00, 0x14, 0x72, 0x01} |
| 139 | , /* WAI certificate or SMS4 */ |
| 140 | {0x00, 0x14, 0x72, 0x02} /* WAI PSK */ |
| 141 | }; |
| 142 | #endif /* FEATURE_WLAN_WAPI */ |
| 143 | uint8_t csr_wme_info_oui[CSR_WME_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 144 | uint8_t csr_wme_parm_oui[CSR_WME_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 145 | |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 146 | uint8_t csr_group_mgmt_oui[][CSR_RSN_OUI_SIZE] = { |
| 147 | #define ENUM_CMAC 0 |
| 148 | {0x00, 0x0F, 0xAC, 0x06}, |
| 149 | #define ENUM_GMAC_128 1 |
| 150 | {0x00, 0x0F, 0xAC, 0x0B}, |
| 151 | #define ENUM_GMAC_256 2 |
| 152 | {0x00, 0x0F, 0xAC, 0x0C}, |
| 153 | }; |
| 154 | |
| 155 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 156 | /* ////////////////////////////////////////////////////////////////////// */ |
| 157 | |
| 158 | /** |
| 159 | * \var g_phy_rates_suppt |
| 160 | * |
| 161 | * \brief Rate support lookup table |
| 162 | * |
| 163 | * |
| 164 | * This is a lookup table indexing rates & configuration parameters to |
| 165 | * support. Given a rate (in unites of 0.5Mpbs) & three bools (MIMO |
| 166 | * Enabled, Channel Bonding Enabled, & Concatenation Enabled), one can |
| 167 | * determine whether the given rate is supported by computing two |
| 168 | * indices. The first maps the rate to table row as indicated below |
| 169 | * (i.e. eHddSuppRate_6Mbps maps to row zero, eHddSuppRate_9Mbps to row |
| 170 | * 1, and so on). Index two can be computed like so: |
| 171 | * |
| 172 | * \code |
| 173 | * idx2 = ( fEsf ? 0x4 : 0x0 ) | |
| 174 | * ( fCb ? 0x2 : 0x0 ) | |
| 175 | * ( fMimo ? 0x1 : 0x0 ); |
| 176 | * \endcode |
| 177 | * |
| 178 | * |
| 179 | * Given that: |
| 180 | * |
| 181 | * \code |
| 182 | * fSupported = g_phy_rates_suppt[idx1][idx2]; |
| 183 | * \endcode |
| 184 | * |
| 185 | * |
| 186 | * This table is based on the document "PHY Supported Rates.doc". This |
| 187 | * table is permissive in that a rate is reflected as being supported |
| 188 | * even when turning off an enabled feature would be required. For |
| 189 | * instance, "PHY Supported Rates" lists 42Mpbs as unsupported when CB, |
| 190 | * ESF, & MIMO are all on. However, if we turn off either of CB or |
| 191 | * MIMO, it then becomes supported. Therefore, we mark it as supported |
| 192 | * even in index 7 of this table. |
| 193 | * |
| 194 | * |
| 195 | */ |
| 196 | |
| 197 | static const bool g_phy_rates_suppt[24][8] = { |
| 198 | |
| 199 | /* SSF SSF SSF SSF ESF ESF ESF ESF */ |
| 200 | /* SIMO MIMO SIMO MIMO SIMO MIMO SIMO MIMO */ |
| 201 | /* No CB No CB CB CB No CB No CB CB CB */ |
| 202 | {true, true, true, true, true, true, true, true}, /* 6Mbps */ |
| 203 | {true, true, true, true, true, true, true, true}, /* 9Mbps */ |
| 204 | {true, true, true, true, true, true, true, true}, /* 12Mbps */ |
| 205 | {true, true, true, true, true, true, true, true}, /* 18Mbps */ |
| 206 | {false, false, true, true, false, false, true, true}, /* 20Mbps */ |
| 207 | {true, true, true, true, true, true, true, true}, /* 24Mbps */ |
| 208 | {true, true, true, true, true, true, true, true}, /* 36Mbps */ |
| 209 | {false, false, true, true, false, true, true, true}, /* 40Mbps */ |
| 210 | {false, false, true, true, false, true, true, true}, /* 42Mbps */ |
| 211 | {true, true, true, true, true, true, true, true}, /* 48Mbps */ |
| 212 | {true, true, true, true, true, true, true, true}, /* 54Mbps */ |
| 213 | {false, true, true, true, false, true, true, true}, /* 72Mbps */ |
| 214 | {false, false, true, true, false, true, true, true}, /* 80Mbps */ |
| 215 | {false, false, true, true, false, true, true, true}, /* 84Mbps */ |
| 216 | {false, true, true, true, false, true, true, true}, /* 96Mbps */ |
| 217 | {false, true, true, true, false, true, true, true}, /* 108Mbps */ |
| 218 | {false, false, true, true, false, true, true, true}, /* 120Mbps */ |
| 219 | {false, false, true, true, false, true, true, true}, /* 126Mbps */ |
| 220 | {false, false, false, true, false, false, false, true}, /* 144Mbps */ |
| 221 | {false, false, false, true, false, false, false, true}, /* 160Mbps */ |
| 222 | {false, false, false, true, false, false, false, true}, /* 168Mbps */ |
| 223 | {false, false, false, true, false, false, false, true}, /* 192Mbps */ |
| 224 | {false, false, false, true, false, false, false, true}, /* 216Mbps */ |
| 225 | {false, false, false, true, false, false, false, true}, /* 240Mbps */ |
| 226 | |
| 227 | }; |
| 228 | |
| 229 | #define CASE_RETURN_STR(n) {\ |
| 230 | case (n): return (# n);\ |
| 231 | } |
| 232 | |
| 233 | const char *get_e_roam_cmd_status_str(eRoamCmdStatus val) |
| 234 | { |
| 235 | switch (val) { |
| 236 | CASE_RETURN_STR(eCSR_ROAM_CANCELLED); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 237 | CASE_RETURN_STR(eCSR_ROAM_FAILED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 238 | CASE_RETURN_STR(eCSR_ROAM_ROAMING_START); |
| 239 | CASE_RETURN_STR(eCSR_ROAM_ROAMING_COMPLETION); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 240 | CASE_RETURN_STR(eCSR_ROAM_CONNECT_COMPLETION); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 241 | CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_START); |
| 242 | CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_COMPLETION); |
| 243 | CASE_RETURN_STR(eCSR_ROAM_DISASSOCIATED); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 244 | CASE_RETURN_STR(eCSR_ROAM_ASSOCIATION_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 245 | CASE_RETURN_STR(eCSR_ROAM_SHOULD_ROAM); |
| 246 | CASE_RETURN_STR(eCSR_ROAM_SCAN_FOUND_NEW_BSS); |
| 247 | CASE_RETURN_STR(eCSR_ROAM_LOSTLINK); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 248 | CASE_RETURN_STR(eCSR_ROAM_LOSTLINK_DETECTED); |
| 249 | CASE_RETURN_STR(eCSR_ROAM_MIC_ERROR_IND); |
| 250 | CASE_RETURN_STR(eCSR_ROAM_IBSS_IND); |
| 251 | CASE_RETURN_STR(eCSR_ROAM_CONNECT_STATUS_UPDATE); |
| 252 | CASE_RETURN_STR(eCSR_ROAM_GEN_INFO); |
| 253 | CASE_RETURN_STR(eCSR_ROAM_SET_KEY_COMPLETE); |
| 254 | CASE_RETURN_STR(eCSR_ROAM_IBSS_LEAVE); |
| 255 | CASE_RETURN_STR(eCSR_ROAM_INFRA_IND); |
| 256 | CASE_RETURN_STR(eCSR_ROAM_WPS_PBC_PROBE_REQ_IND); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 257 | CASE_RETURN_STR(eCSR_ROAM_FT_RESPONSE); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 258 | CASE_RETURN_STR(eCSR_ROAM_FT_START); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 259 | CASE_RETURN_STR(eCSR_ROAM_SESSION_OPENED); |
| 260 | CASE_RETURN_STR(eCSR_ROAM_FT_REASSOC_FAILED); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 261 | CASE_RETURN_STR(eCSR_ROAM_PMK_NOTIFY); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 262 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 263 | CASE_RETURN_STR(eCSR_ROAM_PREAUTH_INIT_NOTIFY); |
| 264 | CASE_RETURN_STR(eCSR_ROAM_PREAUTH_STATUS_SUCCESS); |
| 265 | CASE_RETURN_STR(eCSR_ROAM_PREAUTH_STATUS_FAILURE); |
| 266 | CASE_RETURN_STR(eCSR_ROAM_HANDOVER_SUCCESS); |
| 267 | #endif |
| 268 | #ifdef FEATURE_WLAN_TDLS |
| 269 | CASE_RETURN_STR(eCSR_ROAM_TDLS_STATUS_UPDATE); |
| 270 | CASE_RETURN_STR(eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND); |
| 271 | #endif |
| 272 | CASE_RETURN_STR(eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS); |
| 273 | CASE_RETURN_STR(eCSR_ROAM_SEND_P2P_STOP_BSS); |
| 274 | #ifdef WLAN_FEATURE_11W |
| 275 | CASE_RETURN_STR(eCSR_ROAM_UNPROT_MGMT_FRAME_IND); |
| 276 | #endif |
| 277 | #ifdef WLAN_FEATURE_RMC |
| 278 | CASE_RETURN_STR(eCSR_ROAM_IBSS_PEER_INFO_COMPLETE); |
| 279 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 280 | #ifdef FEATURE_WLAN_ESE |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 281 | CASE_RETURN_STR(eCSR_ROAM_TSM_IE_IND); |
| 282 | CASE_RETURN_STR(eCSR_ROAM_CCKM_PREAUTH_NOTIFY); |
| 283 | CASE_RETURN_STR(eCSR_ROAM_ESE_ADJ_AP_REPORT_IND); |
| 284 | CASE_RETURN_STR(eCSR_ROAM_ESE_BCN_REPORT_IND); |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 285 | #endif /* FEATURE_WLAN_ESE */ |
Sreelakshmi Konamki | 2d67be2 | 2017-03-15 18:23:05 +0530 | [diff] [blame] | 286 | CASE_RETURN_STR(eCSR_ROAM_DFS_RADAR_IND); |
| 287 | CASE_RETURN_STR(eCSR_ROAM_SET_CHANNEL_RSP); |
| 288 | CASE_RETURN_STR(eCSR_ROAM_DFS_CHAN_SW_NOTIFY); |
| 289 | CASE_RETURN_STR(eCSR_ROAM_EXT_CHG_CHNL_IND); |
| 290 | CASE_RETURN_STR(eCSR_ROAM_STA_CHANNEL_SWITCH); |
| 291 | CASE_RETURN_STR(eCSR_ROAM_NDP_STATUS_UPDATE); |
| 292 | CASE_RETURN_STR(eCSR_ROAM_UPDATE_SCAN_RESULT); |
| 293 | CASE_RETURN_STR(eCSR_ROAM_START); |
| 294 | CASE_RETURN_STR(eCSR_ROAM_ABORT); |
| 295 | CASE_RETURN_STR(eCSR_ROAM_NAPI_OFF); |
| 296 | CASE_RETURN_STR(eCSR_ROAM_CHANNEL_COMPLETE_IND); |
Padma, Santhosh Kumar | b38ab51 | 2018-01-16 16:16:46 +0530 | [diff] [blame] | 297 | CASE_RETURN_STR(eCSR_ROAM_SAE_COMPUTE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 298 | default: |
| 299 | return "unknown"; |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | const char *get_e_csr_roam_result_str(eCsrRoamResult val) |
| 304 | { |
| 305 | switch (val) { |
| 306 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NONE); |
| 307 | CASE_RETURN_STR(eCSR_ROAM_RESULT_FAILURE); |
| 308 | CASE_RETURN_STR(eCSR_ROAM_RESULT_ASSOCIATED); |
| 309 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NOT_ASSOCIATED); |
| 310 | CASE_RETURN_STR(eCSR_ROAM_RESULT_MIC_FAILURE); |
| 311 | CASE_RETURN_STR(eCSR_ROAM_RESULT_FORCED); |
| 312 | CASE_RETURN_STR(eCSR_ROAM_RESULT_DISASSOC_IND); |
| 313 | CASE_RETURN_STR(eCSR_ROAM_RESULT_DEAUTH_IND); |
| 314 | CASE_RETURN_STR(eCSR_ROAM_RESULT_CAP_CHANGED); |
Sreelakshmi Konamki | 2d67be2 | 2017-03-15 18:23:05 +0530 | [diff] [blame] | 315 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_STARTED); |
| 316 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_START_FAILED); |
| 317 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS); |
| 318 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_JOIN_FAILED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 319 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_CONNECT); |
| 320 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_INACTIVE); |
| 321 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_NEW_PEER); |
Sreelakshmi Konamki | 2d67be2 | 2017-03-15 18:23:05 +0530 | [diff] [blame] | 322 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_COALESCED); |
Sreelakshmi Konamki | 2d67be2 | 2017-03-15 18:23:05 +0530 | [diff] [blame] | 324 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_STOP); |
| 325 | CASE_RETURN_STR(eCSR_ROAM_RESULT_LOSTLINK); |
| 326 | CASE_RETURN_STR(eCSR_ROAM_RESULT_MIC_ERROR_UNICAST); |
| 327 | CASE_RETURN_STR(eCSR_ROAM_RESULT_MIC_ERROR_GROUP); |
| 328 | CASE_RETURN_STR(eCSR_ROAM_RESULT_AUTHENTICATED); |
| 329 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NEW_RSN_BSS); |
| 330 | #ifdef FEATURE_WLAN_WAPI |
| 331 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NEW_WAPI_BSS); |
| 332 | #endif /* FEATURE_WLAN_WAPI */ |
| 333 | CASE_RETURN_STR(eCSR_ROAM_RESULT_INFRA_STARTED); |
| 334 | CASE_RETURN_STR(eCSR_ROAM_RESULT_INFRA_START_FAILED); |
| 335 | CASE_RETURN_STR(eCSR_ROAM_RESULT_INFRA_STOPPED); |
| 336 | CASE_RETURN_STR(eCSR_ROAM_RESULT_INFRA_ASSOCIATION_IND); |
| 337 | CASE_RETURN_STR(eCSR_ROAM_RESULT_INFRA_ASSOCIATION_CNF); |
| 338 | CASE_RETURN_STR(eCSR_ROAM_RESULT_INFRA_DISASSOCIATED); |
| 339 | CASE_RETURN_STR(eCSR_ROAM_RESULT_WPS_PBC_PROBE_REQ_IND); |
| 340 | CASE_RETURN_STR(eCSR_ROAM_RESULT_SEND_ACTION_FAIL); |
| 341 | CASE_RETURN_STR(eCSR_ROAM_RESULT_MAX_ASSOC_EXCEEDED); |
| 342 | CASE_RETURN_STR(eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL); |
| 343 | CASE_RETURN_STR(eCSR_ROAM_RESULT_ADD_TDLS_PEER); |
| 344 | CASE_RETURN_STR(eCSR_ROAM_RESULT_UPDATE_TDLS_PEER); |
| 345 | CASE_RETURN_STR(eCSR_ROAM_RESULT_DELETE_TDLS_PEER); |
| 346 | CASE_RETURN_STR(eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND); |
| 347 | CASE_RETURN_STR(eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND); |
| 348 | CASE_RETURN_STR(eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP); |
| 349 | CASE_RETURN_STR(eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER); |
| 350 | CASE_RETURN_STR(eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN); |
| 351 | CASE_RETURN_STR(eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED); |
| 352 | CASE_RETURN_STR |
| 353 | (eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION); |
| 354 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_PEER_INFO_SUCCESS); |
| 355 | CASE_RETURN_STR(eCSR_ROAM_RESULT_IBSS_PEER_INFO_FAILED); |
| 356 | CASE_RETURN_STR(eCSR_ROAM_RESULT_DFS_RADAR_FOUND_IND); |
| 357 | CASE_RETURN_STR(eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS); |
| 358 | CASE_RETURN_STR(eCSR_ROAM_RESULT_CHANNEL_CHANGE_FAILURE); |
Abhishek Singh | 20a8e44 | 2018-09-12 15:50:44 +0530 | [diff] [blame] | 359 | CASE_RETURN_STR(eCSR_ROAM_RESULT_CSA_RESTART_RSP); |
Sreelakshmi Konamki | 2d67be2 | 2017-03-15 18:23:05 +0530 | [diff] [blame] | 360 | CASE_RETURN_STR(eCSR_ROAM_RESULT_DFS_CHANSW_UPDATE_SUCCESS); |
| 361 | CASE_RETURN_STR(eCSR_ROAM_EXT_CHG_CHNL_UPDATE_IND); |
| 362 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDI_CREATE_RSP); |
| 363 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDI_DELETE_RSP); |
| 364 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_INITIATOR_RSP); |
| 365 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_NEW_PEER_IND); |
| 366 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_CONFIRM_IND); |
| 367 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_INDICATION); |
| 368 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_SCHED_UPDATE_RSP); |
| 369 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_RESPONDER_RSP); |
| 370 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_END_RSP); |
| 371 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_PEER_DEPARTED_IND); |
| 372 | CASE_RETURN_STR(eCSR_ROAM_RESULT_NDP_END_IND); |
| 373 | CASE_RETURN_STR(eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 374 | default: |
| 375 | return "unknown"; |
| 376 | } |
| 377 | } |
| 378 | |
wadesong | cb0ded2 | 2018-02-02 17:57:20 +0800 | [diff] [blame] | 379 | const char *csr_phy_mode_str(eCsrPhyMode phy_mode) |
| 380 | { |
| 381 | switch (phy_mode) { |
| 382 | case eCSR_DOT11_MODE_abg: |
| 383 | return "abg"; |
| 384 | case eCSR_DOT11_MODE_11a: |
| 385 | return "11a"; |
| 386 | case eCSR_DOT11_MODE_11b: |
| 387 | return "11b"; |
| 388 | case eCSR_DOT11_MODE_11g: |
| 389 | return "11g"; |
| 390 | case eCSR_DOT11_MODE_11n: |
| 391 | return "11n"; |
| 392 | case eCSR_DOT11_MODE_11g_ONLY: |
| 393 | return "11g_only"; |
| 394 | case eCSR_DOT11_MODE_11n_ONLY: |
| 395 | return "11n_only"; |
| 396 | case eCSR_DOT11_MODE_11b_ONLY: |
| 397 | return "11b_only"; |
| 398 | case eCSR_DOT11_MODE_11ac: |
| 399 | return "11ac"; |
| 400 | case eCSR_DOT11_MODE_11ac_ONLY: |
| 401 | return "11ac_only"; |
| 402 | case eCSR_DOT11_MODE_AUTO: |
| 403 | return "auto"; |
| 404 | case eCSR_DOT11_MODE_11ax: |
| 405 | return "11ax"; |
| 406 | case eCSR_DOT11_MODE_11ax_ONLY: |
| 407 | return "11ax_only"; |
| 408 | default: |
| 409 | return "unknown"; |
| 410 | } |
| 411 | } |
| 412 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 413 | void csr_purge_vdev_pending_ser_cmd_list(struct mac_context *mac_ctx, |
Abhishek Singh | 13bf0ce | 2018-10-24 14:26:14 +0530 | [diff] [blame] | 414 | uint32_t vdev_id) |
Sandeep Puligilla | ef41536 | 2017-08-30 16:37:13 -0700 | [diff] [blame] | 415 | { |
Sandeep Puligilla | ef41536 | 2017-08-30 16:37:13 -0700 | [diff] [blame] | 416 | wlan_serialization_purge_cmd_list_by_vdev_id(mac_ctx->psoc, vdev_id, |
Abhishek Singh | 13bf0ce | 2018-10-24 14:26:14 +0530 | [diff] [blame] | 417 | false, true, false, |
| 418 | true, false); |
Sandeep Puligilla | ef41536 | 2017-08-30 16:37:13 -0700 | [diff] [blame] | 419 | } |
| 420 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 421 | void csr_purge_vdev_all_ser_cmd_list(struct mac_context *mac_ctx, |
Abhishek Singh | 13bf0ce | 2018-10-24 14:26:14 +0530 | [diff] [blame] | 422 | uint32_t vdev_id) |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 423 | { |
Krunal Soni | 3378790 | 2017-08-29 11:39:28 -0700 | [diff] [blame] | 424 | wlan_serialization_purge_cmd_list_by_vdev_id(mac_ctx->psoc, vdev_id, |
Abhishek Singh | 13bf0ce | 2018-10-24 14:26:14 +0530 | [diff] [blame] | 425 | true, true, true, |
| 426 | true, true); |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 427 | } |
| 428 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 429 | void csr_purge_vdev_all_scan_ser_cmd_list(struct mac_context *mac_ctx, |
Abhishek Singh | 13bf0ce | 2018-10-24 14:26:14 +0530 | [diff] [blame] | 430 | uint32_t vdev_id) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 431 | { |
Krunal Soni | 3378790 | 2017-08-29 11:39:28 -0700 | [diff] [blame] | 432 | wlan_serialization_purge_cmd_list_by_vdev_id(mac_ctx->psoc, vdev_id, |
Abhishek Singh | 13bf0ce | 2018-10-24 14:26:14 +0530 | [diff] [blame] | 433 | true, true, false, |
| 434 | false, false); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 435 | } |
| 436 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 437 | void csr_purge_pdev_all_ser_cmd_list(struct mac_context *mac_ctx) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 438 | { |
Abhishek Singh | 13bf0ce | 2018-10-24 14:26:14 +0530 | [diff] [blame] | 439 | wlan_serialization_purge_cmd_list(mac_ctx->psoc, NULL, true, true, |
| 440 | true, true, true); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 441 | } |
| 442 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 443 | void csr_nonscan_active_ll_insert_head(struct mac_context *mac_ctx, |
| 444 | tListElem *entry, bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 445 | { |
| 446 | } |
| 447 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 448 | void csr_nonscan_pending_ll_insert_head(struct mac_context *mac_ctx, |
| 449 | tListElem *entry, bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 450 | { |
| 451 | } |
| 452 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 453 | void csr_nonscan_pending_ll_insert_tail(struct mac_context *mac_ctx, |
| 454 | tListElem *entry, bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 455 | { |
| 456 | } |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 457 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 458 | void csr_nonscan_pending_ll_unlock(struct mac_context *mac_ctx) |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 459 | { |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 460 | } |
| 461 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 462 | void csr_nonscan_active_ll_unlock(struct mac_context *mac_ctx) |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 463 | { |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 464 | } |
| 465 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 466 | void csr_nonscan_pending_ll_lock(struct mac_context *mac_ctx) |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 467 | { |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 468 | } |
| 469 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 470 | void csr_nonscan_active_ll_lock(struct mac_context *mac_ctx) |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 471 | { |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 472 | } |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 473 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 474 | uint32_t csr_nonscan_active_ll_count(struct mac_context *mac_ctx) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 475 | { |
| 476 | return wlan_serialization_get_active_list_count(mac_ctx->psoc, false); |
| 477 | } |
| 478 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 479 | uint32_t csr_nonscan_pending_ll_count(struct mac_context *mac_ctx) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 480 | { |
| 481 | return wlan_serialization_get_pending_list_count(mac_ctx->psoc, false); |
| 482 | } |
| 483 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 484 | bool csr_nonscan_active_ll_is_list_empty(struct mac_context *mac_ctx, |
| 485 | bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 486 | { |
| 487 | return !wlan_serialization_get_active_list_count(mac_ctx->psoc, false); |
| 488 | } |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 489 | |
| 490 | bool csr_nonscan_pending_ll_is_list_empty(struct mac_context *mac_ctx, |
| 491 | bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 492 | { |
| 493 | return !wlan_serialization_get_pending_list_count(mac_ctx->psoc, false); |
| 494 | } |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 495 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 496 | tListElem *csr_nonscan_active_ll_peek_head(struct mac_context *mac_ctx, |
| 497 | bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 498 | { |
| 499 | struct wlan_serialization_command *cmd; |
| 500 | tSmeCmd *sme_cmd; |
| 501 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 502 | cmd = wlan_serialization_peek_head_active_cmd_using_psoc(mac_ctx->psoc, |
| 503 | false); |
| 504 | if (!cmd) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 505 | sme_err("No cmd found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 506 | return NULL; |
| 507 | } |
| 508 | sme_cmd = cmd->umac_cmd; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 509 | |
| 510 | return &sme_cmd->Link; |
| 511 | } |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 512 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 513 | tListElem *csr_nonscan_pending_ll_peek_head(struct mac_context *mac_ctx, |
| 514 | bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 515 | { |
| 516 | struct wlan_serialization_command *cmd; |
| 517 | tSmeCmd *sme_cmd; |
| 518 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 519 | cmd = wlan_serialization_peek_head_pending_cmd_using_psoc(mac_ctx->psoc, |
| 520 | false); |
Dustin Brown | 1e3ec6b | 2018-08-07 11:18:47 -0700 | [diff] [blame] | 521 | if (!cmd) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 522 | return NULL; |
Dustin Brown | 1e3ec6b | 2018-08-07 11:18:47 -0700 | [diff] [blame] | 523 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 524 | sme_cmd = cmd->umac_cmd; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 525 | |
| 526 | return &sme_cmd->Link; |
| 527 | } |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 528 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 529 | bool csr_nonscan_active_ll_remove_entry(struct mac_context *mac_ctx, |
| 530 | tListElem *entry, bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 531 | { |
| 532 | tListElem *head; |
| 533 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 534 | head = csr_nonscan_active_ll_peek_head(mac_ctx, inter_locked); |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 535 | if (head == entry) |
| 536 | return true; |
| 537 | |
| 538 | return false; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 539 | } |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 540 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 541 | tListElem *csr_nonscan_active_ll_remove_head(struct mac_context *mac_ctx, |
| 542 | bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 543 | { |
| 544 | return csr_nonscan_active_ll_peek_head(mac_ctx, inter_locked); |
| 545 | } |
Krunal Soni | 81f068c | 2017-02-23 19:51:55 -0800 | [diff] [blame] | 546 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 547 | tListElem *csr_nonscan_pending_ll_remove_head(struct mac_context *mac_ctx, |
| 548 | bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 549 | { |
| 550 | return csr_nonscan_pending_ll_peek_head(mac_ctx, inter_locked); |
| 551 | } |
| 552 | |
Jeff Johnson | 009c40f | 2018-11-05 09:54:37 -0800 | [diff] [blame] | 553 | tListElem *csr_nonscan_pending_ll_next(struct mac_context *mac_ctx, |
| 554 | tListElem *entry, bool inter_locked) |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 555 | { |
| 556 | tSmeCmd *sme_cmd; |
| 557 | struct wlan_serialization_command cmd, *tcmd; |
| 558 | |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 559 | if (!entry) |
| 560 | return NULL; |
| 561 | sme_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link); |
Krunal Soni | da0e1e7 | 2018-06-01 10:50:38 -0700 | [diff] [blame] | 562 | cmd.cmd_id = sme_cmd->cmd_id; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 563 | cmd.cmd_type = csr_get_cmd_type(sme_cmd); |
Jianmin Zhu | 9058c52 | 2018-09-18 20:24:35 +0800 | [diff] [blame] | 564 | cmd.vdev = wlan_objmgr_get_vdev_by_id_from_psoc_no_state( |
| 565 | mac_ctx->psoc, |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 566 | sme_cmd->sessionId, WLAN_LEGACY_SME_ID); |
| 567 | tcmd = wlan_serialization_get_pending_list_next_node_using_psoc( |
| 568 | mac_ctx->psoc, &cmd, false); |
Krunal Soni | d8e8e3d | 2017-02-23 19:52:28 -0800 | [diff] [blame] | 569 | if (cmd.vdev) |
| 570 | wlan_objmgr_vdev_release_ref(cmd.vdev, WLAN_LEGACY_SME_ID); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 571 | if (!tcmd) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 572 | sme_err("No cmd found"); |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 573 | return NULL; |
| 574 | } |
| 575 | sme_cmd = tcmd->umac_cmd; |
Krunal Soni | a8270f5 | 2017-02-23 19:51:25 -0800 | [diff] [blame] | 576 | return &sme_cmd->Link; |
Krunal Soni | 20126cb | 2017-02-15 16:26:57 -0800 | [diff] [blame] | 577 | } |
| 578 | |
Jeff Johnson | 20ac1c4 | 2018-06-03 12:09:02 -0700 | [diff] [blame] | 579 | bool csr_get_bss_id_bss_desc(tSirBssDescription *pSirBssDesc, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 580 | struct qdf_mac_addr *pBssId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 581 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 582 | qdf_mem_copy(pBssId, &pSirBssDesc->bssId[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 583 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 584 | return true; |
| 585 | } |
| 586 | |
Jeff Johnson | 8aef3f6 | 2018-06-03 13:21:15 -0700 | [diff] [blame] | 587 | bool csr_is_bss_id_equal(tSirBssDescription *pSirBssDesc1, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 588 | tSirBssDescription *pSirBssDesc2) |
| 589 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 590 | bool fEqual = false; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 591 | struct qdf_mac_addr bssId1; |
| 592 | struct qdf_mac_addr bssId2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 593 | |
| 594 | do { |
| 595 | if (!pSirBssDesc1) |
| 596 | break; |
| 597 | if (!pSirBssDesc2) |
| 598 | break; |
| 599 | |
Jeff Johnson | 20ac1c4 | 2018-06-03 12:09:02 -0700 | [diff] [blame] | 600 | if (!csr_get_bss_id_bss_desc(pSirBssDesc1, &bssId1)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 601 | break; |
Jeff Johnson | 20ac1c4 | 2018-06-03 12:09:02 -0700 | [diff] [blame] | 602 | if (!csr_get_bss_id_bss_desc(pSirBssDesc2, &bssId2)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 603 | break; |
| 604 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 605 | fEqual = qdf_is_macaddr_equal(&bssId1, &bssId2); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 606 | } while (0); |
| 607 | |
| 608 | return fEqual; |
| 609 | } |
| 610 | |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 611 | static bool csr_is_conn_state(tpAniSirGlobal mac_ctx, uint32_t session_id, |
| 612 | eCsrConnectState state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 613 | { |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 614 | QDF_BUG(session_id < CSR_ROAM_SESSION_MAX); |
| 615 | if (session_id >= CSR_ROAM_SESSION_MAX) |
| 616 | return false; |
| 617 | |
| 618 | return mac_ctx->roam.roamSession[session_id].connectState == state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 619 | } |
| 620 | |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 621 | bool csr_is_conn_state_connected_ibss(tpAniSirGlobal mac_ctx, |
| 622 | uint32_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 623 | { |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 624 | return csr_is_conn_state(mac_ctx, session_id, |
| 625 | eCSR_ASSOC_STATE_TYPE_IBSS_CONNECTED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 626 | } |
| 627 | |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 628 | bool csr_is_conn_state_disconnected_ibss(tpAniSirGlobal mac_ctx, |
| 629 | uint32_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 630 | { |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 631 | return csr_is_conn_state(mac_ctx, session_id, |
| 632 | eCSR_ASSOC_STATE_TYPE_IBSS_DISCONNECTED); |
| 633 | } |
| 634 | |
| 635 | bool csr_is_conn_state_connected_infra(tpAniSirGlobal mac_ctx, |
| 636 | uint32_t session_id) |
| 637 | { |
| 638 | return csr_is_conn_state(mac_ctx, session_id, |
| 639 | eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 640 | } |
| 641 | |
| 642 | bool csr_is_conn_state_connected(tpAniSirGlobal pMac, uint32_t sessionId) |
| 643 | { |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 644 | return csr_is_conn_state_connected_ibss(pMac, sessionId) || |
| 645 | csr_is_conn_state_connected_infra(pMac, sessionId) || |
| 646 | csr_is_conn_state_connected_wds(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 647 | } |
| 648 | |
| 649 | bool csr_is_conn_state_infra(tpAniSirGlobal pMac, uint32_t sessionId) |
| 650 | { |
| 651 | return csr_is_conn_state_connected_infra(pMac, sessionId); |
| 652 | } |
| 653 | |
| 654 | bool csr_is_conn_state_ibss(tpAniSirGlobal pMac, uint32_t sessionId) |
| 655 | { |
| 656 | return csr_is_conn_state_connected_ibss(pMac, sessionId) || |
| 657 | csr_is_conn_state_disconnected_ibss(pMac, sessionId); |
| 658 | } |
| 659 | |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 660 | bool csr_is_conn_state_connected_wds(tpAniSirGlobal mac_ctx, |
| 661 | uint32_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 662 | { |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 663 | return csr_is_conn_state(mac_ctx, session_id, |
| 664 | eCSR_ASSOC_STATE_TYPE_WDS_CONNECTED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 665 | } |
| 666 | |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 667 | bool csr_is_conn_state_connected_infra_ap(tpAniSirGlobal mac_ctx, |
| 668 | uint32_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 669 | { |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 670 | return csr_is_conn_state(mac_ctx, session_id, |
| 671 | eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED) || |
| 672 | csr_is_conn_state(mac_ctx, session_id, |
| 673 | eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 674 | } |
| 675 | |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 676 | bool csr_is_conn_state_disconnected_wds(tpAniSirGlobal mac_ctx, |
| 677 | uint32_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 678 | { |
Dustin Brown | 6619bc2 | 2018-07-18 15:04:33 -0700 | [diff] [blame] | 679 | return csr_is_conn_state(mac_ctx, session_id, |
| 680 | eCSR_ASSOC_STATE_TYPE_WDS_DISCONNECTED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | bool csr_is_conn_state_wds(tpAniSirGlobal pMac, uint32_t sessionId) |
| 684 | { |
| 685 | return csr_is_conn_state_connected_wds(pMac, sessionId) || |
| 686 | csr_is_conn_state_disconnected_wds(pMac, sessionId); |
| 687 | } |
| 688 | |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 689 | static bool csr_is_conn_state_ap(tpAniSirGlobal pMac, uint32_t sessionId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 690 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 691 | struct csr_roam_session *pSession; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 692 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 693 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 694 | if (!pSession) |
| 695 | return false; |
| 696 | if (CSR_IS_INFRA_AP(&pSession->connectedProfile)) |
| 697 | return true; |
| 698 | return false; |
| 699 | } |
| 700 | |
| 701 | bool csr_is_any_session_in_connect_state(tpAniSirGlobal pMac) |
| 702 | { |
| 703 | uint32_t i; |
| 704 | bool fRc = false; |
| 705 | |
| 706 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 707 | if (CSR_IS_SESSION_VALID(pMac, i) && |
| 708 | (csr_is_conn_state_infra(pMac, i) |
| 709 | || csr_is_conn_state_ibss(pMac, i) |
| 710 | || csr_is_conn_state_ap(pMac, i))) { |
| 711 | fRc = true; |
| 712 | break; |
| 713 | } |
| 714 | } |
| 715 | |
| 716 | return fRc; |
| 717 | } |
| 718 | |
| 719 | int8_t csr_get_infra_session_id(tpAniSirGlobal pMac) |
| 720 | { |
| 721 | uint8_t i; |
| 722 | int8_t sessionid = -1; |
| 723 | |
| 724 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 725 | if (CSR_IS_SESSION_VALID(pMac, i) |
| 726 | && csr_is_conn_state_infra(pMac, i)) { |
| 727 | sessionid = i; |
| 728 | break; |
| 729 | } |
| 730 | } |
| 731 | |
| 732 | return sessionid; |
| 733 | } |
| 734 | |
| 735 | uint8_t csr_get_infra_operation_channel(tpAniSirGlobal pMac, uint8_t sessionId) |
| 736 | { |
| 737 | uint8_t channel; |
| 738 | |
| 739 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 740 | channel = |
| 741 | pMac->roam.roamSession[sessionId].connectedProfile. |
| 742 | operationChannel; |
| 743 | } else { |
| 744 | channel = 0; |
| 745 | } |
| 746 | return channel; |
| 747 | } |
| 748 | |
| 749 | bool csr_is_session_client_and_connected(tpAniSirGlobal pMac, uint8_t sessionId) |
| 750 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 751 | struct csr_roam_session *pSession = NULL; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 752 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 753 | if (CSR_IS_SESSION_VALID(pMac, sessionId) |
| 754 | && csr_is_conn_state_infra(pMac, sessionId)) { |
| 755 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 756 | if (NULL != pSession->pCurRoamProfile) { |
| 757 | if ((pSession->pCurRoamProfile->csrPersona == |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 758 | QDF_STA_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 759 | || (pSession->pCurRoamProfile->csrPersona == |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 760 | QDF_P2P_CLIENT_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 761 | return true; |
| 762 | } |
| 763 | } |
| 764 | return false; |
| 765 | } |
| 766 | |
| 767 | /** |
| 768 | * csr_get_concurrent_operation_channel() - To get concurrent operating channel |
| 769 | * @mac_ctx: Pointer to mac context |
| 770 | * |
| 771 | * This routine will return operating channel on FIRST BSS that is |
| 772 | * active/operating to be used for concurrency mode. |
| 773 | * If other BSS is not up or not connected it will return 0 |
| 774 | * |
| 775 | * Return: uint8_t |
| 776 | */ |
| 777 | uint8_t csr_get_concurrent_operation_channel(tpAniSirGlobal mac_ctx) |
| 778 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 779 | struct csr_roam_session *session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 780 | uint8_t i = 0; |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 781 | enum QDF_OPMODE persona; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 782 | |
| 783 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 784 | if (!CSR_IS_SESSION_VALID(mac_ctx, i)) |
| 785 | continue; |
| 786 | session = CSR_GET_SESSION(mac_ctx, i); |
| 787 | if (NULL == session->pCurRoamProfile) |
| 788 | continue; |
| 789 | persona = session->pCurRoamProfile->csrPersona; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 790 | if ((((persona == QDF_STA_MODE) || |
| 791 | (persona == QDF_P2P_CLIENT_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 792 | (session->connectState == |
| 793 | eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED)) || |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 794 | (((persona == QDF_P2P_GO_MODE) || |
| 795 | (persona == QDF_SAP_MODE)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 796 | && (session->connectState != |
| 797 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))) |
| 798 | return session->connectedProfile.operationChannel; |
| 799 | |
| 800 | } |
| 801 | return 0; |
| 802 | } |
| 803 | |
| 804 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 805 | |
| 806 | #define HALF_BW_OF(eCSR_bw_val) ((eCSR_bw_val)/2) |
| 807 | |
| 808 | /* calculation of center channel based on V/HT BW and WIFI channel bw=5MHz) */ |
| 809 | |
| 810 | #define CSR_GET_HT40_PLUS_CCH(och) ((och)+2) |
| 811 | #define CSR_GET_HT40_MINUS_CCH(och) ((och)-2) |
| 812 | |
| 813 | #define CSR_GET_HT80_PLUS_LL_CCH(och) ((och)+6) |
| 814 | #define CSR_GET_HT80_PLUS_HL_CCH(och) ((och)+2) |
| 815 | #define CSR_GET_HT80_MINUS_LH_CCH(och) ((och)-2) |
| 816 | #define CSR_GET_HT80_MINUS_HH_CCH(och) ((och)-6) |
| 817 | |
| 818 | /** |
| 819 | * csr_get_ch_from_ht_profile() - to get channel from HT profile |
| 820 | * @pMac: pointer to Mac context |
| 821 | * @htp: pointer to HT profile |
| 822 | * @och: operating channel |
| 823 | * @cfreq: channel frequency |
| 824 | * @hbw: half bandwidth |
| 825 | * |
| 826 | * This function will fill half bandwidth and channel frequency based |
| 827 | * on the HT profile |
| 828 | * |
| 829 | * Return: none |
| 830 | */ |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 831 | static void csr_get_ch_from_ht_profile(tpAniSirGlobal pMac, |
| 832 | tCsrRoamHTProfile *htp, |
| 833 | uint16_t och, uint16_t *cfreq, |
| 834 | uint16_t *hbw) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 835 | { |
| 836 | uint16_t cch, ch_bond; |
| 837 | |
| 838 | if (och > 14) |
| 839 | ch_bond = pMac->roam.configParam.channelBondingMode5GHz; |
| 840 | else |
| 841 | ch_bond = pMac->roam.configParam.channelBondingMode24GHz; |
| 842 | |
| 843 | cch = och; |
| 844 | *hbw = HALF_BW_OF(eCSR_BW_20MHz_VAL); |
| 845 | |
| 846 | if (!ch_bond) |
| 847 | goto ret; |
| 848 | |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 849 | sme_debug("HTC: %d scbw: %d rcbw: %d sco: %d VHTC: %d apc: %d apbw: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 850 | htp->htCapability, htp->htSupportedChannelWidthSet, |
| 851 | htp->htRecommendedTxWidthSet, |
| 852 | htp->htSecondaryChannelOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 853 | htp->vhtCapability, htp->apCenterChan, htp->apChanWidth |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 854 | ); |
| 855 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 856 | if (htp->vhtCapability) { |
| 857 | cch = htp->apCenterChan; |
| 858 | if (htp->apChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) |
| 859 | *hbw = HALF_BW_OF(eCSR_BW_80MHz_VAL); |
| 860 | else if (htp->apChanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ) |
| 861 | *hbw = HALF_BW_OF(eCSR_BW_160MHz_VAL); |
| 862 | |
| 863 | if (!*hbw && htp->htCapability) { |
| 864 | if (htp->htSupportedChannelWidthSet == |
| 865 | eHT_CHANNEL_WIDTH_40MHZ) |
| 866 | *hbw = HALF_BW_OF(eCSR_BW_40MHz_VAL); |
| 867 | else |
| 868 | *hbw = HALF_BW_OF(eCSR_BW_20MHz_VAL); |
| 869 | } |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 870 | } else if (htp->htCapability) { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 871 | if (htp->htSupportedChannelWidthSet == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 872 | eHT_CHANNEL_WIDTH_40MHZ) { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 873 | *hbw = HALF_BW_OF(eCSR_BW_40MHz_VAL); |
| 874 | if (htp->htSecondaryChannelOffset == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 875 | PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 876 | cch = CSR_GET_HT40_PLUS_CCH(och); |
| 877 | else if (htp->htSecondaryChannelOffset == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 878 | PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 879 | cch = CSR_GET_HT40_MINUS_CCH(och); |
| 880 | } else { |
| 881 | cch = och; |
| 882 | *hbw = HALF_BW_OF(eCSR_BW_20MHz_VAL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 883 | } |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 884 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 885 | |
| 886 | ret: |
| 887 | *cfreq = cds_chan_to_freq(cch); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | /** |
| 891 | * csr_calc_chb_for_sap_phymode() - to calc channel bandwidth for sap phymode |
| 892 | * @mac_ctx: pointer to mac context |
| 893 | * @sap_ch: SAP operating channel |
| 894 | * @sap_phymode: SAP physical mode |
| 895 | * @sap_cch: concurrency channel |
| 896 | * @sap_hbw: SAP half bw |
| 897 | * @chb: channel bandwidth |
| 898 | * |
| 899 | * This routine is called to calculate channel bandwidth |
| 900 | * |
| 901 | * Return: none |
| 902 | */ |
| 903 | static void csr_calc_chb_for_sap_phymode(tpAniSirGlobal mac_ctx, |
| 904 | uint16_t *sap_ch, eCsrPhyMode *sap_phymode, |
| 905 | uint16_t *sap_cch, uint16_t *sap_hbw, uint8_t *chb) |
| 906 | { |
| 907 | if (*sap_phymode == eCSR_DOT11_MODE_11n || |
| 908 | *sap_phymode == eCSR_DOT11_MODE_11n_ONLY) { |
| 909 | |
| 910 | *sap_hbw = HALF_BW_OF(eCSR_BW_40MHz_VAL); |
| 911 | if (*chb == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 912 | *sap_cch = CSR_GET_HT40_PLUS_CCH(*sap_ch); |
| 913 | else if (*chb == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 914 | *sap_cch = CSR_GET_HT40_MINUS_CCH(*sap_ch); |
| 915 | |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 916 | } else if (*sap_phymode == eCSR_DOT11_MODE_11ac || |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 917 | *sap_phymode == eCSR_DOT11_MODE_11ac_ONLY || |
| 918 | *sap_phymode == eCSR_DOT11_MODE_11ax || |
| 919 | *sap_phymode == eCSR_DOT11_MODE_11ax_ONLY) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 920 | /*11AC only 80/40/20 Mhz supported in Rome */ |
| 921 | if (mac_ctx->roam.configParam.nVhtChannelWidth == |
| 922 | (WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1)) { |
| 923 | *sap_hbw = HALF_BW_OF(eCSR_BW_80MHz_VAL); |
| 924 | if (*chb == |
| 925 | (PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1)) |
| 926 | *sap_cch = CSR_GET_HT80_PLUS_LL_CCH(*sap_ch); |
| 927 | else if (*chb == |
| 928 | (PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW |
| 929 | - 1)) |
| 930 | *sap_cch = CSR_GET_HT80_PLUS_HL_CCH(*sap_ch); |
| 931 | else if (*chb == |
| 932 | (PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH |
| 933 | - 1)) |
| 934 | *sap_cch = CSR_GET_HT80_MINUS_LH_CCH(*sap_ch); |
| 935 | else if (*chb == |
| 936 | (PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH |
| 937 | - 1)) |
| 938 | *sap_cch = CSR_GET_HT80_MINUS_HH_CCH(*sap_ch); |
| 939 | } else { |
| 940 | *sap_hbw = HALF_BW_OF(eCSR_BW_40MHz_VAL); |
| 941 | if (*chb == (PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW |
| 942 | - 1)) |
| 943 | *sap_cch = CSR_GET_HT40_PLUS_CCH(*sap_ch); |
| 944 | else if (*chb == |
| 945 | (PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW |
| 946 | - 1)) |
| 947 | *sap_cch = CSR_GET_HT40_MINUS_CCH(*sap_ch); |
| 948 | else if (*chb == |
| 949 | (PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH |
| 950 | - 1)) |
| 951 | *sap_cch = CSR_GET_HT40_PLUS_CCH(*sap_ch); |
| 952 | else if (*chb == |
| 953 | (PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH |
| 954 | - 1)) |
| 955 | *sap_cch = CSR_GET_HT40_MINUS_CCH(*sap_ch); |
| 956 | } |
| 957 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 958 | } |
| 959 | |
| 960 | /** |
| 961 | * csr_handle_conc_chnl_overlap_for_sap_go - To handle overlap for AP+AP |
| 962 | * @mac_ctx: pointer to mac context |
| 963 | * @session: Current session |
| 964 | * @sap_ch: SAP/GO operating channel |
| 965 | * @sap_hbw: SAP/GO half bw |
| 966 | * @sap_cfreq: SAP/GO channel frequency |
| 967 | * @intf_ch: concurrent SAP/GO operating channel |
| 968 | * @intf_hbw: concurrent SAP/GO half bw |
| 969 | * @intf_cfreq: concurrent SAP/GO channel frequency |
| 970 | * |
| 971 | * This routine is called to check if one SAP/GO channel is overlapping with |
| 972 | * other SAP/GO channel |
| 973 | * |
| 974 | * Return: none |
| 975 | */ |
| 976 | static void csr_handle_conc_chnl_overlap_for_sap_go(tpAniSirGlobal mac_ctx, |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 977 | struct csr_roam_session *session, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 978 | uint16_t *sap_ch, uint16_t *sap_hbw, uint16_t *sap_cfreq, |
| 979 | uint16_t *intf_ch, uint16_t *intf_hbw, uint16_t *intf_cfreq) |
| 980 | { |
| 981 | /* |
| 982 | * if conc_custom_rule1 is defined then we don't |
| 983 | * want p2pgo to follow SAP's channel or SAP to |
| 984 | * follow P2PGO's channel. |
| 985 | */ |
| 986 | if (0 == mac_ctx->roam.configParam.conc_custom_rule1 && |
| 987 | 0 == mac_ctx->roam.configParam.conc_custom_rule2) { |
| 988 | if (*sap_ch == 0) { |
| 989 | *sap_ch = session->connectedProfile.operationChannel; |
| 990 | csr_get_ch_from_ht_profile(mac_ctx, |
| 991 | &session->connectedProfile.HTProfile, |
| 992 | *sap_ch, sap_cfreq, sap_hbw); |
| 993 | } else if (*sap_ch != |
| 994 | session->connectedProfile.operationChannel) { |
| 995 | *intf_ch = session->connectedProfile.operationChannel; |
| 996 | csr_get_ch_from_ht_profile(mac_ctx, |
| 997 | &session->connectedProfile.HTProfile, |
| 998 | *intf_ch, intf_cfreq, intf_hbw); |
| 999 | } |
| 1000 | } else if (*sap_ch == 0 && |
| 1001 | (session->pCurRoamProfile->csrPersona == |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1002 | QDF_SAP_MODE)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | *sap_ch = session->connectedProfile.operationChannel; |
| 1004 | csr_get_ch_from_ht_profile(mac_ctx, |
| 1005 | &session->connectedProfile.HTProfile, |
| 1006 | *sap_ch, sap_cfreq, sap_hbw); |
| 1007 | } |
| 1008 | } |
| 1009 | |
| 1010 | |
| 1011 | /** |
| 1012 | * csr_check_concurrent_channel_overlap() - To check concurrent overlap chnls |
| 1013 | * @mac_ctx: Pointer to mac context |
| 1014 | * @sap_ch: SAP channel |
| 1015 | * @sap_phymode: SAP phy mode |
| 1016 | * @cc_switch_mode: concurrent switch mode |
| 1017 | * |
| 1018 | * This routine will be called to check concurrent overlap channels |
| 1019 | * |
| 1020 | * Return: uint16_t |
| 1021 | */ |
| 1022 | uint16_t csr_check_concurrent_channel_overlap(tpAniSirGlobal mac_ctx, |
| 1023 | uint16_t sap_ch, eCsrPhyMode sap_phymode, |
| 1024 | uint8_t cc_switch_mode) |
| 1025 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1026 | struct csr_roam_session *session = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1027 | uint8_t i = 0, chb = PHY_SINGLE_CHANNEL_CENTERED; |
| 1028 | uint16_t intf_ch = 0, sap_hbw = 0, intf_hbw = 0, intf_cfreq = 0; |
| 1029 | uint16_t sap_cfreq = 0; |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 1030 | uint16_t sap_lfreq, sap_hfreq, intf_lfreq, intf_hfreq, sap_cch = 0; |
Manishekar Chandrasekaran | 1db3abe | 2016-06-24 03:27:07 +0530 | [diff] [blame] | 1031 | QDF_STATUS status; |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 1032 | |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1033 | sme_debug("sap_ch: %d sap_phymode: %d", sap_ch, sap_phymode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1034 | |
| 1035 | if (mac_ctx->roam.configParam.cc_switch_mode == |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1036 | QDF_MCC_TO_SCC_SWITCH_DISABLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1037 | return 0; |
| 1038 | |
| 1039 | if (sap_ch != 0) { |
| 1040 | sap_cch = sap_ch; |
| 1041 | sap_hbw = HALF_BW_OF(eCSR_BW_20MHz_VAL); |
| 1042 | |
| 1043 | if (sap_ch > 14) |
| 1044 | chb = mac_ctx->roam.configParam.channelBondingMode5GHz; |
| 1045 | else |
| 1046 | chb = mac_ctx->roam.configParam.channelBondingMode24GHz; |
| 1047 | |
| 1048 | if (chb) |
| 1049 | csr_calc_chb_for_sap_phymode(mac_ctx, &sap_ch, |
| 1050 | &sap_phymode, &sap_cch, &sap_hbw, &chb); |
| 1051 | sap_cfreq = cds_chan_to_freq(sap_cch); |
| 1052 | } |
| 1053 | |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1054 | sme_debug("sap_ch:%d sap_phymode:%d sap_cch:%d sap_hbw:%d chb:%d", |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 1055 | sap_ch, sap_phymode, sap_cch, sap_hbw, chb); |
| 1056 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1057 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1058 | if (!CSR_IS_SESSION_VALID(mac_ctx, i)) |
| 1059 | continue; |
| 1060 | |
| 1061 | session = CSR_GET_SESSION(mac_ctx, i); |
| 1062 | if (NULL == session->pCurRoamProfile) |
| 1063 | continue; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1064 | if (((session->pCurRoamProfile->csrPersona == QDF_STA_MODE) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1065 | (session->pCurRoamProfile->csrPersona == |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1066 | QDF_P2P_CLIENT_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | (session->connectState == |
| 1068 | eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED)) { |
| 1069 | intf_ch = session->connectedProfile.operationChannel; |
| 1070 | csr_get_ch_from_ht_profile(mac_ctx, |
| 1071 | &session->connectedProfile.HTProfile, |
| 1072 | intf_ch, &intf_cfreq, &intf_hbw); |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1073 | sme_debug("%d: intf_ch:%d intf_cfreq:%d intf_hbw:%d", |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 1074 | i, intf_ch, intf_cfreq, intf_hbw); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1075 | } else if (((session->pCurRoamProfile->csrPersona == |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1076 | QDF_P2P_GO_MODE) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1077 | (session->pCurRoamProfile->csrPersona == |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1078 | QDF_SAP_MODE)) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1079 | (session->connectState != |
| 1080 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED)) { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1081 | if (session->ch_switch_in_progress) |
| 1082 | continue; |
Edhar, Mahesh Kumar | df2ec12 | 2015-11-16 11:33:16 +0530 | [diff] [blame] | 1083 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1084 | csr_handle_conc_chnl_overlap_for_sap_go(mac_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1085 | session, &sap_ch, &sap_hbw, &sap_cfreq, |
| 1086 | &intf_ch, &intf_hbw, &intf_cfreq); |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 1087 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1088 | sme_debug("%d: sap_ch:%d sap_hbw:%d sap_cfreq:%d intf_ch:%d intf_hbw:%d, intf_cfreq:%d", |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 1089 | i, sap_ch, sap_hbw, sap_cfreq, |
| 1090 | intf_ch, intf_hbw, intf_cfreq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1091 | } |
Rachit Kankane | 11ac4bc | 2017-09-18 19:58:07 +0530 | [diff] [blame] | 1092 | if (intf_ch && ((intf_ch > 14 && sap_ch > 14) || |
| 1093 | (intf_ch <= 14 && sap_ch <= 14))) |
| 1094 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1095 | } |
| 1096 | |
Ganesh Kondabattini | b2eabe3 | 2017-09-13 15:16:44 +0530 | [diff] [blame] | 1097 | sme_debug("intf_ch:%d sap_ch:%d cc_switch_mode:%d, dbs:%d", |
| 1098 | intf_ch, sap_ch, cc_switch_mode, |
| 1099 | policy_mgr_is_dbs_enable(mac_ctx->psoc)); |
Chandrasekaran Manishekar | 068e25e | 2016-03-07 11:51:07 +0530 | [diff] [blame] | 1100 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1101 | if (intf_ch && sap_ch != intf_ch && |
Bala Venkatesh | b816ce8 | 2018-06-28 17:00:54 +0530 | [diff] [blame] | 1102 | !policy_mgr_is_force_scc(mac_ctx->psoc)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1103 | sap_lfreq = sap_cfreq - sap_hbw; |
| 1104 | sap_hfreq = sap_cfreq + sap_hbw; |
| 1105 | intf_lfreq = intf_cfreq - intf_hbw; |
| 1106 | intf_hfreq = intf_cfreq + intf_hbw; |
| 1107 | |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1108 | sme_err("SAP: OCH: %03d OCF: %d CCH: %03d CF: %d BW: %d LF: %d HF: %d INTF: OCH: %03d OCF: %d CCH: %03d CF: %d BW: %d LF: %d HF: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1109 | sap_ch, cds_chan_to_freq(sap_ch), |
| 1110 | cds_freq_to_chan(sap_cfreq), sap_cfreq, sap_hbw * 2, |
| 1111 | sap_lfreq, sap_hfreq, intf_ch, |
| 1112 | cds_chan_to_freq(intf_ch), cds_freq_to_chan(intf_cfreq), |
| 1113 | intf_cfreq, intf_hbw * 2, intf_lfreq, intf_hfreq); |
| 1114 | |
| 1115 | if (!(((sap_lfreq > intf_lfreq && sap_lfreq < intf_hfreq) || |
| 1116 | (sap_hfreq > intf_lfreq && sap_hfreq < intf_hfreq)) || |
| 1117 | ((intf_lfreq > sap_lfreq && intf_lfreq < sap_hfreq) || |
| 1118 | (intf_hfreq > sap_lfreq && intf_hfreq < sap_hfreq)))) |
| 1119 | intf_ch = 0; |
| 1120 | } else if (intf_ch && sap_ch != intf_ch && |
Manishekar Chandrasekaran | f21b3b6 | 2016-05-02 16:33:55 +0530 | [diff] [blame] | 1121 | ((cc_switch_mode == QDF_MCC_TO_SCC_SWITCH_FORCE) || |
Bala Venkatesh | b816ce8 | 2018-06-28 17:00:54 +0530 | [diff] [blame] | 1122 | policy_mgr_is_force_scc(mac_ctx->psoc))) { |
Tushnim Bhattacharyya | 03103fd | 2017-06-23 10:48:52 -0700 | [diff] [blame] | 1123 | if (!((intf_ch <= 14 && sap_ch <= 14) || |
Ganesh Kondabattini | b2eabe3 | 2017-09-13 15:16:44 +0530 | [diff] [blame] | 1124 | (intf_ch > 14 && sap_ch > 14))) { |
Bala Venkatesh | b816ce8 | 2018-06-28 17:00:54 +0530 | [diff] [blame] | 1125 | if (policy_mgr_is_dbs_enable(mac_ctx->psoc) || |
| 1126 | cc_switch_mode == |
| 1127 | QDF_MCC_TO_SCC_WITH_PREFERRED_BAND) |
Ganesh Kondabattini | b2eabe3 | 2017-09-13 15:16:44 +0530 | [diff] [blame] | 1128 | intf_ch = 0; |
Jeff Johnson | 0daa944 | 2017-10-10 16:30:36 -0700 | [diff] [blame] | 1129 | } else if (cc_switch_mode == |
Manishekar Chandrasekaran | 1db3abe | 2016-06-24 03:27:07 +0530 | [diff] [blame] | 1130 | QDF_MCC_TO_SCC_SWITCH_WITH_FAVORITE_CHANNEL) { |
| 1131 | status = |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 1132 | policy_mgr_get_sap_mandatory_channel( |
| 1133 | mac_ctx->psoc, |
| 1134 | (uint32_t *)&intf_ch); |
Jeff Johnson | 0daa944 | 2017-10-10 16:30:36 -0700 | [diff] [blame] | 1135 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1136 | sme_err("no mandatory channel"); |
Manishekar Chandrasekaran | 1db3abe | 2016-06-24 03:27:07 +0530 | [diff] [blame] | 1137 | } |
| 1138 | } else if ((intf_ch == sap_ch) && (cc_switch_mode == |
| 1139 | QDF_MCC_TO_SCC_SWITCH_WITH_FAVORITE_CHANNEL)) { |
| 1140 | if (cds_chan_to_band(intf_ch) == CDS_BAND_2GHZ) { |
| 1141 | status = |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 1142 | policy_mgr_get_sap_mandatory_channel( |
| 1143 | mac_ctx->psoc, (uint32_t *)&intf_ch); |
Jeff Johnson | 0daa944 | 2017-10-10 16:30:36 -0700 | [diff] [blame] | 1144 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1145 | sme_err("no mandatory channel"); |
Manishekar Chandrasekaran | 1db3abe | 2016-06-24 03:27:07 +0530 | [diff] [blame] | 1146 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1147 | } |
| 1148 | |
Manishekar Chandrasekaran | 1db3abe | 2016-06-24 03:27:07 +0530 | [diff] [blame] | 1149 | if (intf_ch == sap_ch) |
| 1150 | intf_ch = 0; |
| 1151 | |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1152 | sme_err("##Concurrent Channels %s Interfering", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | intf_ch == 0 ? "Not" : "Are"); |
| 1154 | return intf_ch; |
| 1155 | } |
| 1156 | #endif |
| 1157 | |
| 1158 | bool csr_is_all_session_disconnected(tpAniSirGlobal pMac) |
| 1159 | { |
| 1160 | uint32_t i; |
| 1161 | bool fRc = true; |
| 1162 | |
| 1163 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1164 | if (CSR_IS_SESSION_VALID(pMac, i) |
| 1165 | && !csr_is_conn_state_disconnected(pMac, i)) { |
| 1166 | fRc = false; |
| 1167 | break; |
| 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | return fRc; |
| 1172 | } |
| 1173 | |
| 1174 | /** |
| 1175 | * csr_is_sta_session_connected() - to find if concurrent sta is active |
| 1176 | * @mac_ctx: pointer to mac context |
| 1177 | * |
| 1178 | * This function will iterate through each session and check if sta |
| 1179 | * session exist and active |
| 1180 | * |
| 1181 | * Return: true or false |
| 1182 | */ |
| 1183 | bool csr_is_sta_session_connected(tpAniSirGlobal mac_ctx) |
| 1184 | { |
| 1185 | uint32_t i; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1186 | struct csr_roam_session *pSession = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1187 | |
| 1188 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1189 | if (CSR_IS_SESSION_VALID(mac_ctx, i) && |
| 1190 | !csr_is_conn_state_disconnected(mac_ctx, i)) { |
| 1191 | pSession = CSR_GET_SESSION(mac_ctx, i); |
| 1192 | |
| 1193 | if ((NULL != pSession->pCurRoamProfile) && |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1194 | (QDF_STA_MODE == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1195 | pSession->pCurRoamProfile->csrPersona)) |
| 1196 | return true; |
| 1197 | } |
| 1198 | } |
| 1199 | |
| 1200 | return false; |
| 1201 | } |
| 1202 | |
| 1203 | /** |
| 1204 | * csr_is_p2p_session_connected() - to find if any p2p session is active |
| 1205 | * @mac_ctx: pointer to mac context |
| 1206 | * |
| 1207 | * This function will iterate through each session and check if any p2p |
| 1208 | * session exist and active |
| 1209 | * |
| 1210 | * Return: true or false |
| 1211 | */ |
| 1212 | bool csr_is_p2p_session_connected(tpAniSirGlobal pMac) |
| 1213 | { |
| 1214 | uint32_t i; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1215 | struct csr_roam_session *pSession = NULL; |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 1216 | enum QDF_OPMODE persona; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1217 | |
| 1218 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
Naveen Rawat | 9598f5e | 2016-06-27 15:33:40 -0700 | [diff] [blame] | 1219 | if (!CSR_IS_SESSION_VALID(pMac, i)) |
| 1220 | continue; |
| 1221 | |
| 1222 | if (csr_is_conn_state_disconnected(pMac, i)) |
| 1223 | continue; |
| 1224 | |
| 1225 | pSession = CSR_GET_SESSION(pMac, i); |
| 1226 | if (pSession->pCurRoamProfile == NULL) |
| 1227 | continue; |
| 1228 | |
| 1229 | persona = pSession->pCurRoamProfile->csrPersona; |
| 1230 | if (QDF_P2P_CLIENT_MODE == persona || |
| 1231 | QDF_P2P_GO_MODE == persona) |
| 1232 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1233 | } |
| 1234 | |
| 1235 | return false; |
| 1236 | } |
| 1237 | |
| 1238 | bool csr_is_any_session_connected(tpAniSirGlobal pMac) |
| 1239 | { |
| 1240 | uint32_t i, count; |
| 1241 | bool fRc = false; |
| 1242 | |
| 1243 | count = 0; |
| 1244 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1245 | if (CSR_IS_SESSION_VALID(pMac, i) |
| 1246 | && !csr_is_conn_state_disconnected(pMac, i)) |
| 1247 | count++; |
| 1248 | } |
| 1249 | |
| 1250 | if (count > 0) |
| 1251 | fRc = true; |
| 1252 | return fRc; |
| 1253 | } |
| 1254 | |
| 1255 | bool csr_is_infra_connected(tpAniSirGlobal pMac) |
| 1256 | { |
| 1257 | uint32_t i; |
| 1258 | bool fRc = false; |
| 1259 | |
| 1260 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1261 | if (CSR_IS_SESSION_VALID(pMac, i) |
| 1262 | && csr_is_conn_state_connected_infra(pMac, i)) { |
| 1263 | fRc = true; |
| 1264 | break; |
| 1265 | } |
| 1266 | } |
| 1267 | |
| 1268 | return fRc; |
| 1269 | } |
| 1270 | |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1271 | uint8_t csr_get_connected_infra(tpAniSirGlobal mac_ctx) |
| 1272 | { |
| 1273 | uint32_t i; |
| 1274 | uint8_t connected_session = CSR_SESSION_ID_INVALID; |
| 1275 | |
| 1276 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1277 | if (CSR_IS_SESSION_VALID(mac_ctx, i) |
| 1278 | && csr_is_conn_state_connected_infra(mac_ctx, i)) { |
| 1279 | connected_session = i; |
| 1280 | break; |
| 1281 | } |
| 1282 | } |
| 1283 | |
| 1284 | return connected_session; |
| 1285 | } |
| 1286 | |
| 1287 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1288 | bool csr_is_concurrent_infra_connected(tpAniSirGlobal pMac) |
| 1289 | { |
| 1290 | uint32_t i, noOfConnectedInfra = 0; |
| 1291 | |
| 1292 | bool fRc = false; |
| 1293 | |
| 1294 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1295 | if (CSR_IS_SESSION_VALID(pMac, i) |
| 1296 | && csr_is_conn_state_connected_infra(pMac, i)) { |
| 1297 | ++noOfConnectedInfra; |
| 1298 | } |
| 1299 | } |
| 1300 | |
| 1301 | /* More than one Infra Sta Connected */ |
| 1302 | if (noOfConnectedInfra > 1) |
| 1303 | fRc = true; |
| 1304 | return fRc; |
| 1305 | } |
| 1306 | |
| 1307 | bool csr_is_ibss_started(tpAniSirGlobal pMac) |
| 1308 | { |
| 1309 | uint32_t i; |
| 1310 | bool fRc = false; |
| 1311 | |
| 1312 | for (i = 0; i < CSR_ROAM_SESSION_MAX; i++) { |
| 1313 | if (CSR_IS_SESSION_VALID(pMac, i) |
| 1314 | && csr_is_conn_state_ibss(pMac, i)) { |
| 1315 | fRc = true; |
| 1316 | break; |
| 1317 | } |
| 1318 | } |
| 1319 | |
| 1320 | return fRc; |
| 1321 | } |
| 1322 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1323 | bool csr_is_concurrent_session_running(tpAniSirGlobal pMac) |
| 1324 | { |
| 1325 | uint32_t sessionId, noOfCocurrentSession = 0; |
| 1326 | eCsrConnectState connectState; |
| 1327 | |
| 1328 | bool fRc = false; |
| 1329 | |
| 1330 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) { |
| 1331 | if (CSR_IS_SESSION_VALID(pMac, sessionId)) { |
| 1332 | connectState = |
| 1333 | pMac->roam.roamSession[sessionId].connectState; |
| 1334 | if ((eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED == |
| 1335 | connectState) |
| 1336 | || (eCSR_ASSOC_STATE_TYPE_INFRA_CONNECTED == |
| 1337 | connectState) |
| 1338 | || (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTED == |
| 1339 | connectState)) { |
| 1340 | ++noOfCocurrentSession; |
| 1341 | } |
| 1342 | } |
| 1343 | } |
| 1344 | |
| 1345 | /* More than one session is Up and Running */ |
| 1346 | if (noOfCocurrentSession > 1) |
| 1347 | fRc = true; |
| 1348 | return fRc; |
| 1349 | } |
| 1350 | |
| 1351 | bool csr_is_infra_ap_started(tpAniSirGlobal pMac) |
| 1352 | { |
| 1353 | uint32_t sessionId; |
| 1354 | bool fRc = false; |
| 1355 | |
| 1356 | for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1357 | if (CSR_IS_SESSION_VALID(pMac, sessionId) && |
| 1358 | (csr_is_conn_state_connected_infra_ap(pMac, |
| 1359 | sessionId))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1360 | fRc = true; |
| 1361 | break; |
| 1362 | } |
| 1363 | } |
| 1364 | |
| 1365 | return fRc; |
| 1366 | |
| 1367 | } |
| 1368 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1369 | bool csr_is_conn_state_disconnected(tpAniSirGlobal pMac, uint32_t sessionId) |
| 1370 | { |
| 1371 | return eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED == |
| 1372 | pMac->roam.roamSession[sessionId].connectState; |
| 1373 | } |
| 1374 | |
| 1375 | /** |
| 1376 | * csr_is_valid_mc_concurrent_session() - To check concurren session is valid |
| 1377 | * @mac_ctx: pointer to mac context |
| 1378 | * @session_id: session id |
| 1379 | * @bss_descr: bss description |
| 1380 | * |
| 1381 | * This function validates the concurrent session |
| 1382 | * |
| 1383 | * Return: true or false |
| 1384 | */ |
| 1385 | bool csr_is_valid_mc_concurrent_session(tpAniSirGlobal mac_ctx, |
| 1386 | uint32_t session_id, |
| 1387 | tSirBssDescription *bss_descr) |
| 1388 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1389 | struct csr_roam_session *pSession = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1390 | |
| 1391 | /* Check for MCC support */ |
| 1392 | if (!mac_ctx->roam.configParam.fenableMCCMode) |
| 1393 | return false; |
| 1394 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) |
| 1395 | return false; |
| 1396 | /* Validate BeaconInterval */ |
| 1397 | pSession = CSR_GET_SESSION(mac_ctx, session_id); |
| 1398 | if (NULL == pSession->pCurRoamProfile) |
| 1399 | return false; |
Krunal Soni | cbda855 | 2016-07-14 19:39:02 -0700 | [diff] [blame] | 1400 | if (QDF_STATUS_SUCCESS == csr_validate_mcc_beacon_interval(mac_ctx, |
| 1401 | bss_descr->channelId, |
| 1402 | &bss_descr->beaconInterval, session_id, |
| 1403 | pSession->pCurRoamProfile->csrPersona)) |
| 1404 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1405 | return false; |
| 1406 | } |
| 1407 | |
| 1408 | static tSirMacCapabilityInfo csr_get_bss_capabilities(tSirBssDescription * |
| 1409 | pSirBssDesc) |
| 1410 | { |
| 1411 | tSirMacCapabilityInfo dot11Caps; |
| 1412 | |
| 1413 | /* tSirMacCapabilityInfo is 16-bit */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1414 | qdf_get_u16((uint8_t *) &pSirBssDesc->capabilityInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1415 | (uint16_t *) &dot11Caps); |
| 1416 | |
| 1417 | return dot11Caps; |
| 1418 | } |
| 1419 | |
| 1420 | bool csr_is_infra_bss_desc(tSirBssDescription *pSirBssDesc) |
| 1421 | { |
| 1422 | tSirMacCapabilityInfo dot11Caps = csr_get_bss_capabilities(pSirBssDesc); |
| 1423 | |
| 1424 | return (bool) dot11Caps.ess; |
| 1425 | } |
| 1426 | |
| 1427 | bool csr_is_ibss_bss_desc(tSirBssDescription *pSirBssDesc) |
| 1428 | { |
| 1429 | tSirMacCapabilityInfo dot11Caps = csr_get_bss_capabilities(pSirBssDesc); |
| 1430 | |
| 1431 | return (bool) dot11Caps.ibss; |
| 1432 | } |
| 1433 | |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 1434 | static bool csr_is_qos_bss_desc(tSirBssDescription *pSirBssDesc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1435 | { |
| 1436 | tSirMacCapabilityInfo dot11Caps = csr_get_bss_capabilities(pSirBssDesc); |
| 1437 | |
| 1438 | return (bool) dot11Caps.qos; |
| 1439 | } |
| 1440 | |
| 1441 | bool csr_is_privacy(tSirBssDescription *pSirBssDesc) |
| 1442 | { |
| 1443 | tSirMacCapabilityInfo dot11Caps = csr_get_bss_capabilities(pSirBssDesc); |
| 1444 | |
| 1445 | return (bool) dot11Caps.privacy; |
| 1446 | } |
| 1447 | |
| 1448 | bool csr_is11d_supported(tpAniSirGlobal pMac) |
| 1449 | { |
| 1450 | return pMac->roam.configParam.Is11dSupportEnabled; |
| 1451 | } |
| 1452 | |
| 1453 | bool csr_is11h_supported(tpAniSirGlobal pMac) |
| 1454 | { |
| 1455 | return pMac->roam.configParam.Is11hSupportEnabled; |
| 1456 | } |
| 1457 | |
| 1458 | bool csr_is11e_supported(tpAniSirGlobal pMac) |
| 1459 | { |
| 1460 | return pMac->roam.configParam.Is11eSupportEnabled; |
| 1461 | } |
| 1462 | |
| 1463 | bool csr_is_mcc_supported(tpAniSirGlobal pMac) |
| 1464 | { |
| 1465 | return pMac->roam.configParam.fenableMCCMode; |
| 1466 | |
| 1467 | } |
| 1468 | |
| 1469 | bool csr_is_wmm_supported(tpAniSirGlobal pMac) |
| 1470 | { |
| 1471 | if (eCsrRoamWmmNoQos == pMac->roam.configParam.WMMSupportMode) |
| 1472 | return false; |
| 1473 | else |
| 1474 | return true; |
| 1475 | } |
| 1476 | |
| 1477 | /* pIes is the IEs for pSirBssDesc2 */ |
Jeff Johnson | 515b3ec | 2018-06-03 20:11:05 -0700 | [diff] [blame] | 1478 | bool csr_is_ssid_equal(tpAniSirGlobal pMac, |
| 1479 | tSirBssDescription *pSirBssDesc1, |
| 1480 | tSirBssDescription *pSirBssDesc2, |
| 1481 | tDot11fBeaconIEs *pIes2) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1482 | { |
| 1483 | bool fEqual = false; |
| 1484 | tSirMacSSid Ssid1, Ssid2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1485 | tDot11fBeaconIEs *pIes1 = NULL; |
| 1486 | tDot11fBeaconIEs *pIesLocal = pIes2; |
| 1487 | |
| 1488 | do { |
| 1489 | if ((NULL == pSirBssDesc1) || (NULL == pSirBssDesc2)) |
| 1490 | break; |
| 1491 | if (!pIesLocal |
| 1492 | && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1493 | !QDF_IS_STATUS_SUCCESS(csr_get_parsed_bss_description_ies |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1494 | (pMac, pSirBssDesc2, |
| 1495 | &pIesLocal))) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1496 | sme_err("fail to parse IEs"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1497 | break; |
| 1498 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1499 | if (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1500 | (csr_get_parsed_bss_description_ies(pMac, |
| 1501 | pSirBssDesc1, &pIes1))) { |
| 1502 | break; |
| 1503 | } |
| 1504 | if ((!pIes1->SSID.present) || (!pIesLocal->SSID.present)) |
| 1505 | break; |
| 1506 | if (pIes1->SSID.num_ssid != pIesLocal->SSID.num_ssid) |
| 1507 | break; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1508 | qdf_mem_copy(Ssid1.ssId, pIes1->SSID.ssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1509 | pIes1->SSID.num_ssid); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1510 | qdf_mem_copy(Ssid2.ssId, pIesLocal->SSID.ssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1511 | pIesLocal->SSID.num_ssid); |
| 1512 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1513 | fEqual = (!qdf_mem_cmp(Ssid1.ssId, Ssid2.ssId, |
| 1514 | pIesLocal->SSID.num_ssid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1515 | |
| 1516 | } while (0); |
| 1517 | if (pIes1) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1518 | qdf_mem_free(pIes1); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1519 | if (pIesLocal && !pIes2) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1520 | qdf_mem_free(pIesLocal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1521 | |
| 1522 | return fEqual; |
| 1523 | } |
| 1524 | |
| 1525 | /* pIes can be passed in as NULL if the caller doesn't have one prepared */ |
Jeff Johnson | 3f9d9fb | 2018-06-09 23:53:16 -0700 | [diff] [blame] | 1526 | static bool csr_is_bss_description_wme(tpAniSirGlobal pMac, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 1527 | tSirBssDescription *pSirBssDesc, |
| 1528 | tDot11fBeaconIEs *pIes) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1529 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1530 | /* Assume that WME is found... */ |
| 1531 | bool fWme = true; |
| 1532 | tDot11fBeaconIEs *pIesTemp = pIes; |
| 1533 | |
| 1534 | do { |
| 1535 | if (pIesTemp == NULL) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1536 | if (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1537 | (csr_get_parsed_bss_description_ies |
| 1538 | (pMac, pSirBssDesc, &pIesTemp))) { |
| 1539 | fWme = false; |
| 1540 | break; |
| 1541 | } |
| 1542 | } |
| 1543 | /* if the Wme Info IE is found, then WME is supported... */ |
| 1544 | if (CSR_IS_QOS_BSS(pIesTemp)) |
| 1545 | break; |
| 1546 | /* if none of these are found, then WME is NOT supported... */ |
| 1547 | fWme = false; |
| 1548 | } while (0); |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1549 | if (!csr_is_wmm_supported(pMac) && fWme) |
| 1550 | if (!pIesTemp->HTCaps.present) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1551 | fWme = false; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1552 | |
| 1553 | if ((pIes == NULL) && (NULL != pIesTemp)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1554 | /* we allocate memory here so free it before returning */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1555 | qdf_mem_free(pIesTemp); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1556 | |
| 1557 | return fWme; |
| 1558 | } |
| 1559 | |
Jeff Johnson | 12ec010 | 2018-06-03 16:26:55 -0700 | [diff] [blame] | 1560 | eCsrMediaAccessType csr_get_qos_from_bss_desc(tpAniSirGlobal mac_ctx, |
| 1561 | tSirBssDescription *pSirBssDesc, |
| 1562 | tDot11fBeaconIEs *pIes) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1563 | { |
| 1564 | eCsrMediaAccessType qosType = eCSR_MEDIUM_ACCESS_DCF; |
| 1565 | |
| 1566 | if (NULL == pIes) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1567 | QDF_ASSERT(pIes != NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1568 | return qosType; |
| 1569 | } |
| 1570 | |
| 1571 | do { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1572 | /* If we find WMM in the Bss Description, then we let this |
| 1573 | * override and use WMM. |
| 1574 | */ |
Jeff Johnson | 12ec010 | 2018-06-03 16:26:55 -0700 | [diff] [blame] | 1575 | if (csr_is_bss_description_wme(mac_ctx, pSirBssDesc, pIes)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1576 | qosType = eCSR_MEDIUM_ACCESS_WMM_eDCF_DSCP; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1577 | else { |
| 1578 | /* If the QoS bit is on, then the AP is |
| 1579 | * advertising 11E QoS. |
| 1580 | */ |
| 1581 | if (csr_is_qos_bss_desc(pSirBssDesc)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1582 | qosType = eCSR_MEDIUM_ACCESS_11e_eDCF; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1583 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1584 | qosType = eCSR_MEDIUM_ACCESS_DCF; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1585 | |
| 1586 | /* Scale back based on the types turned on |
| 1587 | * for the adapter. |
| 1588 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1589 | if (eCSR_MEDIUM_ACCESS_11e_eDCF == qosType |
Jeff Johnson | 12ec010 | 2018-06-03 16:26:55 -0700 | [diff] [blame] | 1590 | && !csr_is11e_supported(mac_ctx)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1591 | qosType = eCSR_MEDIUM_ACCESS_DCF; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1592 | } |
| 1593 | |
| 1594 | } while (0); |
| 1595 | |
| 1596 | return qosType; |
| 1597 | } |
| 1598 | |
| 1599 | /* Caller allocates memory for pIEStruct */ |
Jeff Johnson | 57d8ee8 | 2018-06-04 06:25:32 -0700 | [diff] [blame] | 1600 | QDF_STATUS csr_parse_bss_description_ies(tpAniSirGlobal mac_ctx, |
| 1601 | tSirBssDescription *pBssDesc, |
| 1602 | tDot11fBeaconIEs *pIEStruct) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1603 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1604 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1605 | int ieLen = |
| 1606 | (int)(pBssDesc->length + sizeof(pBssDesc->length) - |
| 1607 | GET_FIELD_OFFSET(tSirBssDescription, ieFields)); |
| 1608 | |
| 1609 | if (ieLen > 0 && pIEStruct) { |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 1610 | if (!DOT11F_FAILED(dot11f_unpack_beacon_i_es |
Jeff Johnson | 57d8ee8 | 2018-06-04 06:25:32 -0700 | [diff] [blame] | 1611 | (mac_ctx, (uint8_t *) pBssDesc->ieFields, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1612 | ieLen, pIEStruct, false))) |
| 1613 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1614 | } |
| 1615 | |
| 1616 | return status; |
| 1617 | } |
| 1618 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1619 | /* This function will allocate memory for the parsed IEs to the caller. |
| 1620 | * Caller must free the memory after it is done with the data only if |
| 1621 | * this function succeeds |
| 1622 | */ |
Jeff Johnson | d4c61de | 2018-06-04 06:33:39 -0700 | [diff] [blame] | 1623 | QDF_STATUS csr_get_parsed_bss_description_ies(tpAniSirGlobal mac_ctx, |
| 1624 | tSirBssDescription *pBssDesc, |
| 1625 | tDot11fBeaconIEs **ppIEStruct) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1626 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1627 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1628 | |
| 1629 | if (pBssDesc && ppIEStruct) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1630 | *ppIEStruct = qdf_mem_malloc(sizeof(tDot11fBeaconIEs)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1631 | if ((*ppIEStruct) != NULL) { |
Jeff Johnson | d4c61de | 2018-06-04 06:33:39 -0700 | [diff] [blame] | 1632 | status = csr_parse_bss_description_ies(mac_ctx, |
| 1633 | pBssDesc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | *ppIEStruct); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1635 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1636 | qdf_mem_free(*ppIEStruct); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1637 | *ppIEStruct = NULL; |
| 1638 | } |
| 1639 | } else { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1640 | sme_err("failed to allocate memory"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 1641 | QDF_ASSERT(0); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1642 | return QDF_STATUS_E_NOMEM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1643 | } |
| 1644 | } |
| 1645 | |
| 1646 | return status; |
| 1647 | } |
| 1648 | |
| 1649 | bool csr_is_nullssid(uint8_t *pBssSsid, uint8_t len) |
| 1650 | { |
| 1651 | bool fNullSsid = false; |
| 1652 | |
| 1653 | uint32_t SsidLength; |
| 1654 | uint8_t *pSsidStr; |
| 1655 | |
| 1656 | do { |
| 1657 | if (0 == len) { |
| 1658 | fNullSsid = true; |
| 1659 | break; |
| 1660 | } |
| 1661 | /* Consider 0 or space for hidden SSID */ |
| 1662 | if (0 == pBssSsid[0]) { |
| 1663 | fNullSsid = true; |
| 1664 | break; |
| 1665 | } |
| 1666 | |
| 1667 | SsidLength = len; |
| 1668 | pSsidStr = pBssSsid; |
| 1669 | |
| 1670 | while (SsidLength) { |
| 1671 | if (*pSsidStr) |
| 1672 | break; |
| 1673 | |
| 1674 | pSsidStr++; |
| 1675 | SsidLength--; |
| 1676 | } |
| 1677 | |
| 1678 | if (0 == SsidLength) { |
| 1679 | fNullSsid = true; |
| 1680 | break; |
| 1681 | } |
| 1682 | } while (0); |
| 1683 | |
| 1684 | return fNullSsid; |
| 1685 | } |
| 1686 | |
Jeff Johnson | cb2193a | 2018-06-03 17:06:41 -0700 | [diff] [blame] | 1687 | uint32_t csr_get_frag_thresh(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | { |
Harprit Chhabada | bec6de4 | 2018-09-10 10:21:15 -0700 | [diff] [blame] | 1689 | return mac_ctx->mlme_cfg->threshold.frag_threshold; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1690 | } |
| 1691 | |
Jeff Johnson | 9fbc233 | 2018-06-03 17:11:31 -0700 | [diff] [blame] | 1692 | uint32_t csr_get_rts_thresh(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1693 | { |
Harprit Chhabada | bec6de4 | 2018-09-10 10:21:15 -0700 | [diff] [blame] | 1694 | return mac_ctx->mlme_cfg->threshold.rts_threshold; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1695 | } |
| 1696 | |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1697 | static eCsrPhyMode |
| 1698 | csr_translate_to_phy_mode_from_bss_desc(tpAniSirGlobal mac_ctx, |
| 1699 | tSirBssDescription *pSirBssDesc, |
| 1700 | tDot11fBeaconIEs *ies) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1701 | { |
| 1702 | eCsrPhyMode phyMode; |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1703 | uint8_t i; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1704 | |
| 1705 | switch (pSirBssDesc->nwType) { |
| 1706 | case eSIR_11A_NW_TYPE: |
| 1707 | phyMode = eCSR_DOT11_MODE_11a; |
| 1708 | break; |
| 1709 | |
| 1710 | case eSIR_11B_NW_TYPE: |
| 1711 | phyMode = eCSR_DOT11_MODE_11b; |
| 1712 | break; |
| 1713 | |
| 1714 | case eSIR_11G_NW_TYPE: |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1715 | phyMode = eCSR_DOT11_MODE_11g_ONLY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1716 | |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1717 | /* Check if the BSS is in b/g mixed mode or g_only mode */ |
| 1718 | if (!ies || !ies->SuppRates.present) { |
| 1719 | sme_debug("Unable to get rates, assume G only mode"); |
| 1720 | break; |
| 1721 | } |
| 1722 | |
| 1723 | for (i = 0; i < ies->SuppRates.num_rates; i++) { |
| 1724 | if (csr_rates_is_dot11_rate11b_supported_rate( |
| 1725 | ies->SuppRates.rates[i])) { |
| 1726 | sme_debug("One B rate is supported"); |
| 1727 | phyMode = eCSR_DOT11_MODE_11g; |
| 1728 | break; |
| 1729 | } |
| 1730 | } |
| 1731 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1732 | case eSIR_11N_NW_TYPE: |
| 1733 | phyMode = eCSR_DOT11_MODE_11n; |
| 1734 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1735 | case eSIR_11AX_NW_TYPE: |
| 1736 | phyMode = eCSR_DOT11_MODE_11ax; |
| 1737 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1738 | case eSIR_11AC_NW_TYPE: |
| 1739 | default: |
| 1740 | phyMode = eCSR_DOT11_MODE_11ac; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1741 | break; |
| 1742 | } |
| 1743 | return phyMode; |
| 1744 | } |
| 1745 | |
| 1746 | uint32_t csr_translate_to_wni_cfg_dot11_mode(tpAniSirGlobal pMac, |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1747 | enum csr_cfgdot11mode csrDot11Mode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | { |
| 1749 | uint32_t ret; |
| 1750 | |
| 1751 | switch (csrDot11Mode) { |
| 1752 | case eCSR_CFG_DOT11_MODE_AUTO: |
Sandeep Puligilla | 1f1e400 | 2018-08-18 12:15:01 -0700 | [diff] [blame] | 1753 | sme_debug("eCSR_CFG_DOT11_MODE_AUTO"); |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1754 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) |
| 1755 | ret = WNI_CFG_DOT11_MODE_11AX; |
| 1756 | else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1757 | ret = WNI_CFG_DOT11_MODE_11AC; |
| 1758 | else |
| 1759 | ret = WNI_CFG_DOT11_MODE_11N; |
| 1760 | break; |
| 1761 | case eCSR_CFG_DOT11_MODE_11A: |
| 1762 | ret = WNI_CFG_DOT11_MODE_11A; |
| 1763 | break; |
| 1764 | case eCSR_CFG_DOT11_MODE_11B: |
| 1765 | ret = WNI_CFG_DOT11_MODE_11B; |
| 1766 | break; |
| 1767 | case eCSR_CFG_DOT11_MODE_11G: |
| 1768 | ret = WNI_CFG_DOT11_MODE_11G; |
| 1769 | break; |
| 1770 | case eCSR_CFG_DOT11_MODE_11N: |
| 1771 | ret = WNI_CFG_DOT11_MODE_11N; |
| 1772 | break; |
| 1773 | case eCSR_CFG_DOT11_MODE_11G_ONLY: |
| 1774 | ret = WNI_CFG_DOT11_MODE_11G_ONLY; |
| 1775 | break; |
| 1776 | case eCSR_CFG_DOT11_MODE_11N_ONLY: |
| 1777 | ret = WNI_CFG_DOT11_MODE_11N_ONLY; |
| 1778 | break; |
| 1779 | case eCSR_CFG_DOT11_MODE_11AC_ONLY: |
| 1780 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 1781 | ret = WNI_CFG_DOT11_MODE_11AC_ONLY; |
| 1782 | else |
| 1783 | ret = WNI_CFG_DOT11_MODE_11N; |
| 1784 | break; |
| 1785 | case eCSR_CFG_DOT11_MODE_11AC: |
| 1786 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 1787 | ret = WNI_CFG_DOT11_MODE_11AC; |
| 1788 | else |
| 1789 | ret = WNI_CFG_DOT11_MODE_11N; |
| 1790 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1791 | case eCSR_CFG_DOT11_MODE_11AX_ONLY: |
| 1792 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) |
| 1793 | ret = WNI_CFG_DOT11_MODE_11AX_ONLY; |
| 1794 | else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 1795 | ret = WNI_CFG_DOT11_MODE_11AC; |
| 1796 | else |
| 1797 | ret = WNI_CFG_DOT11_MODE_11N; |
| 1798 | break; |
| 1799 | case eCSR_CFG_DOT11_MODE_11AX: |
| 1800 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) |
| 1801 | ret = WNI_CFG_DOT11_MODE_11AX; |
| 1802 | else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 1803 | ret = WNI_CFG_DOT11_MODE_11AC; |
| 1804 | else |
| 1805 | ret = WNI_CFG_DOT11_MODE_11N; |
| 1806 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1807 | default: |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 1808 | sme_warn("doesn't expect %d as csrDo11Mode", csrDot11Mode); |
Vignesh Viswanathan | f97cc11 | 2018-10-03 19:17:07 +0530 | [diff] [blame] | 1809 | if (BAND_2G == pMac->mlme_cfg->gen.band) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1810 | ret = WNI_CFG_DOT11_MODE_11G; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1811 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1812 | ret = WNI_CFG_DOT11_MODE_11A; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1813 | break; |
| 1814 | } |
| 1815 | |
| 1816 | return ret; |
| 1817 | } |
| 1818 | |
| 1819 | /** |
| 1820 | * csr_get_phy_mode_from_bss() - Get Phy Mode |
| 1821 | * @pMac: Global MAC context |
| 1822 | * @pBSSDescription: BSS Descriptor |
| 1823 | * @pPhyMode: Physical Mode |
| 1824 | * @pIes: Pointer to the IE fields |
| 1825 | * |
| 1826 | * This function should only return the super set of supported modes |
| 1827 | * 11n implies 11b/g/a/n. |
| 1828 | * |
| 1829 | * Return: success |
| 1830 | **/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1831 | QDF_STATUS csr_get_phy_mode_from_bss(tpAniSirGlobal pMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1832 | tSirBssDescription *pBSSDescription, |
| 1833 | eCsrPhyMode *pPhyMode, tDot11fBeaconIEs *pIes) |
| 1834 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1835 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1836 | eCsrPhyMode phyMode = |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1837 | csr_translate_to_phy_mode_from_bss_desc(pMac, pBSSDescription, |
| 1838 | pIes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1839 | |
| 1840 | if (pIes) { |
| 1841 | if (pIes->HTCaps.present) { |
| 1842 | phyMode = eCSR_DOT11_MODE_11n; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1843 | if (IS_BSS_VHT_CAPABLE(pIes->VHTCaps) || |
Kapil Gupta | 4b2efbb | 2016-10-03 13:07:20 +0530 | [diff] [blame] | 1844 | IS_BSS_VHT_CAPABLE(pIes->vendor_vht_ie.VHTCaps)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1845 | phyMode = eCSR_DOT11_MODE_11ac; |
Naveen Rawat | d8feac1 | 2017-09-08 15:08:39 -0700 | [diff] [blame] | 1846 | if (pIes->he_cap.present) |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1847 | phyMode = eCSR_DOT11_MODE_11ax; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1848 | } |
| 1849 | *pPhyMode = phyMode; |
| 1850 | } |
| 1851 | |
| 1852 | return status; |
| 1853 | } |
| 1854 | |
| 1855 | /** |
| 1856 | * csr_get_phy_mode_in_use() - to get phymode |
| 1857 | * @phyModeIn: physical mode |
| 1858 | * @bssPhyMode: physical mode in bss |
| 1859 | * @f5GhzBand: 5Ghz band |
| 1860 | * @pCfgDot11ModeToUse: dot11 mode in use |
| 1861 | * |
| 1862 | * This function returns the correct eCSR_CFG_DOT11_MODE is the two phyModes |
| 1863 | * matches. bssPhyMode is the mode derived from the BSS description |
| 1864 | * f5GhzBand is derived from the channel id of BSS description |
| 1865 | * |
| 1866 | * Return: true or false |
| 1867 | */ |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1868 | static bool csr_get_phy_mode_in_use(tpAniSirGlobal mac_ctx, |
| 1869 | eCsrPhyMode phyModeIn, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 1870 | eCsrPhyMode bssPhyMode, |
| 1871 | bool f5GhzBand, |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1872 | enum csr_cfgdot11mode *pCfgDot11ModeToUse) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1873 | { |
| 1874 | bool fMatch = false; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 1875 | enum csr_cfgdot11mode cfgDot11Mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1876 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1877 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1878 | switch (phyModeIn) { |
| 1879 | /* 11a or 11b or 11g */ |
| 1880 | case eCSR_DOT11_MODE_abg: |
| 1881 | fMatch = true; |
| 1882 | if (f5GhzBand) |
| 1883 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 1884 | else if (eCSR_DOT11_MODE_11b == bssPhyMode) |
| 1885 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 1886 | else |
| 1887 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 1888 | break; |
| 1889 | |
| 1890 | case eCSR_DOT11_MODE_11a: |
| 1891 | if (f5GhzBand) { |
| 1892 | fMatch = true; |
| 1893 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 1894 | } |
| 1895 | break; |
| 1896 | |
| 1897 | case eCSR_DOT11_MODE_11g: |
| 1898 | if (!f5GhzBand) { |
| 1899 | fMatch = true; |
| 1900 | if (eCSR_DOT11_MODE_11b == bssPhyMode) |
| 1901 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 1902 | else |
| 1903 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 1904 | } |
| 1905 | break; |
| 1906 | |
| 1907 | case eCSR_DOT11_MODE_11g_ONLY: |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1908 | if ((bssPhyMode == eCSR_DOT11_MODE_11g) || |
| 1909 | (bssPhyMode == eCSR_DOT11_MODE_11g_ONLY)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1910 | fMatch = true; |
| 1911 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 1912 | } |
| 1913 | break; |
| 1914 | |
| 1915 | case eCSR_DOT11_MODE_11b: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1916 | case eCSR_DOT11_MODE_11b_ONLY: |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1917 | if (!f5GhzBand && (bssPhyMode != eCSR_DOT11_MODE_11g_ONLY)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1918 | fMatch = true; |
| 1919 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 1920 | } |
| 1921 | break; |
| 1922 | |
| 1923 | case eCSR_DOT11_MODE_11n: |
| 1924 | fMatch = true; |
| 1925 | switch (bssPhyMode) { |
| 1926 | case eCSR_DOT11_MODE_11g: |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1927 | case eCSR_DOT11_MODE_11g_ONLY: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1928 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 1929 | break; |
| 1930 | case eCSR_DOT11_MODE_11b: |
| 1931 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 1932 | break; |
| 1933 | case eCSR_DOT11_MODE_11a: |
| 1934 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 1935 | break; |
| 1936 | case eCSR_DOT11_MODE_11n: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1937 | case eCSR_DOT11_MODE_11ac: |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1938 | case eCSR_DOT11_MODE_11ax: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1939 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 1940 | break; |
| 1941 | |
| 1942 | default: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1943 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | break; |
| 1945 | } |
| 1946 | break; |
| 1947 | |
| 1948 | case eCSR_DOT11_MODE_11n_ONLY: |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1949 | if (eCSR_DOT11_MODE_11n == bssPhyMode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1950 | fMatch = true; |
| 1951 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 1952 | |
| 1953 | } |
| 1954 | |
| 1955 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1956 | case eCSR_DOT11_MODE_11ac: |
| 1957 | fMatch = true; |
| 1958 | switch (bssPhyMode) { |
| 1959 | case eCSR_DOT11_MODE_11g: |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1960 | case eCSR_DOT11_MODE_11g_ONLY: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1961 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 1962 | break; |
| 1963 | case eCSR_DOT11_MODE_11b: |
| 1964 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 1965 | break; |
| 1966 | case eCSR_DOT11_MODE_11a: |
| 1967 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 1968 | break; |
| 1969 | case eCSR_DOT11_MODE_11n: |
| 1970 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 1971 | break; |
| 1972 | case eCSR_DOT11_MODE_11ac: |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1973 | case eCSR_DOT11_MODE_11ax: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1974 | default: |
| 1975 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 1976 | break; |
| 1977 | } |
| 1978 | break; |
| 1979 | |
| 1980 | case eCSR_DOT11_MODE_11ac_ONLY: |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 1981 | if (eCSR_DOT11_MODE_11ac == bssPhyMode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1982 | fMatch = true; |
| 1983 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 1984 | } |
| 1985 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1986 | case eCSR_DOT11_MODE_11ax: |
| 1987 | fMatch = true; |
| 1988 | switch (bssPhyMode) { |
| 1989 | case eCSR_DOT11_MODE_11g: |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 1990 | case eCSR_DOT11_MODE_11g_ONLY: |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 1991 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 1992 | break; |
| 1993 | case eCSR_DOT11_MODE_11b: |
| 1994 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 1995 | break; |
| 1996 | case eCSR_DOT11_MODE_11a: |
| 1997 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 1998 | break; |
| 1999 | case eCSR_DOT11_MODE_11n: |
| 2000 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 2001 | break; |
| 2002 | case eCSR_DOT11_MODE_11ac: |
| 2003 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 2004 | break; |
| 2005 | case eCSR_DOT11_MODE_11ax: |
| 2006 | default: |
| 2007 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX; |
| 2008 | break; |
| 2009 | } |
| 2010 | break; |
| 2011 | |
| 2012 | case eCSR_DOT11_MODE_11ax_ONLY: |
| 2013 | if (eCSR_DOT11_MODE_11ax == bssPhyMode) { |
| 2014 | fMatch = true; |
| 2015 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX; |
| 2016 | } |
| 2017 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2018 | |
| 2019 | default: |
| 2020 | fMatch = true; |
| 2021 | switch (bssPhyMode) { |
| 2022 | case eCSR_DOT11_MODE_11g: |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 2023 | case eCSR_DOT11_MODE_11g_ONLY: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 2025 | break; |
| 2026 | case eCSR_DOT11_MODE_11b: |
| 2027 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 2028 | break; |
| 2029 | case eCSR_DOT11_MODE_11a: |
| 2030 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 2031 | break; |
| 2032 | case eCSR_DOT11_MODE_11n: |
| 2033 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 2034 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2035 | case eCSR_DOT11_MODE_11ac: |
| 2036 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 2037 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 2038 | case eCSR_DOT11_MODE_11ax: |
| 2039 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX; |
| 2040 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2041 | default: |
| 2042 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO; |
| 2043 | break; |
| 2044 | } |
| 2045 | break; |
| 2046 | } |
| 2047 | |
| 2048 | if (fMatch && pCfgDot11ModeToUse) { |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 2049 | if (cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AX) { |
| 2050 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) |
| 2051 | *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AX; |
| 2052 | else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 2053 | *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC; |
| 2054 | else |
| 2055 | *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
| 2056 | } else { |
| 2057 | if (cfgDot11Mode == eCSR_CFG_DOT11_MODE_11AC |
| 2058 | && (!IS_FEATURE_SUPPORTED_BY_FW(DOT11AC))) |
| 2059 | *pCfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
| 2060 | else |
| 2061 | *pCfgDot11ModeToUse = cfgDot11Mode; |
| 2062 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2063 | } |
| 2064 | return fMatch; |
| 2065 | } |
| 2066 | |
| 2067 | /** |
| 2068 | * csr_is_phy_mode_match() - to find if phy mode matches |
| 2069 | * @pMac: pointer to mac context |
| 2070 | * @phyMode: physical mode |
| 2071 | * @pSirBssDesc: bss description |
| 2072 | * @pProfile: pointer to roam profile |
| 2073 | * @pReturnCfgDot11Mode: dot1 mode to return |
| 2074 | * @pIes: pointer to IEs |
| 2075 | * |
| 2076 | * This function decides whether the one of the bit of phyMode is matching the |
| 2077 | * mode in the BSS and allowed by the user setting |
| 2078 | * |
| 2079 | * Return: true or false based on mode that fits the criteria |
| 2080 | */ |
| 2081 | bool csr_is_phy_mode_match(tpAniSirGlobal pMac, uint32_t phyMode, |
| 2082 | tSirBssDescription *pSirBssDesc, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2083 | struct csr_roam_profile *pProfile, |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2084 | enum csr_cfgdot11mode *pReturnCfgDot11Mode, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2085 | tDot11fBeaconIEs *pIes) |
| 2086 | { |
| 2087 | bool fMatch = false; |
| 2088 | eCsrPhyMode phyModeInBssDesc = eCSR_DOT11_MODE_AUTO, phyMode2; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2089 | enum csr_cfgdot11mode cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_AUTO; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | uint32_t bitMask, loopCount; |
| 2091 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2092 | if (!QDF_IS_STATUS_SUCCESS(csr_get_phy_mode_from_bss(pMac, pSirBssDesc, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2093 | &phyModeInBssDesc, pIes))) |
| 2094 | return fMatch; |
| 2095 | |
| 2096 | if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode)) { |
| 2097 | if (eCSR_CFG_DOT11_MODE_ABG == |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 2098 | pMac->roam.configParam.uCfgDot11Mode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2099 | phyMode = eCSR_DOT11_MODE_abg; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 2100 | } else if (eCSR_CFG_DOT11_MODE_AUTO == |
| 2101 | pMac->roam.configParam.uCfgDot11Mode) { |
| 2102 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) |
| 2103 | phyMode = eCSR_DOT11_MODE_11ax; |
| 2104 | else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 2105 | phyMode = eCSR_DOT11_MODE_11ac; |
| 2106 | else |
| 2107 | phyMode = eCSR_DOT11_MODE_11n; |
| 2108 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2109 | /* user's pick */ |
| 2110 | phyMode = pMac->roam.configParam.phyMode; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 2111 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2112 | } |
| 2113 | |
| 2114 | if ((0 == phyMode) || (eCSR_DOT11_MODE_AUTO & phyMode)) { |
| 2115 | if (0 != phyMode) { |
| 2116 | if (eCSR_DOT11_MODE_AUTO & phyMode) { |
| 2117 | phyMode2 = |
| 2118 | eCSR_DOT11_MODE_AUTO & phyMode; |
| 2119 | } |
| 2120 | } else { |
| 2121 | phyMode2 = phyMode; |
| 2122 | } |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 2123 | fMatch = csr_get_phy_mode_in_use(pMac, phyMode2, |
| 2124 | phyModeInBssDesc, |
| 2125 | WLAN_REG_IS_5GHZ_CH( |
| 2126 | pSirBssDesc->channelId), |
| 2127 | &cfgDot11ModeToUse); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2128 | } else { |
| 2129 | bitMask = 1; |
| 2130 | loopCount = 0; |
| 2131 | while (loopCount < eCSR_NUM_PHY_MODE) { |
| 2132 | phyMode2 = (phyMode & (bitMask << loopCount++)); |
Vignesh Viswanathan | ad265f2 | 2018-10-09 14:40:45 +0530 | [diff] [blame] | 2133 | if (0 != phyMode2 && |
| 2134 | csr_get_phy_mode_in_use(pMac, phyMode2, |
| 2135 | phyModeInBssDesc, |
| 2136 | WLAN_REG_IS_5GHZ_CH(pSirBssDesc->channelId), |
| 2137 | &cfgDot11ModeToUse)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2138 | fMatch = true; |
| 2139 | break; |
| 2140 | } |
| 2141 | } |
| 2142 | } |
| 2143 | if (fMatch && pReturnCfgDot11Mode) { |
| 2144 | if (pProfile) { |
| 2145 | /* |
| 2146 | * IEEE 11n spec (8.4.3): HT STA shall |
| 2147 | * eliminate TKIP as a choice for the pairwise |
| 2148 | * cipher suite if CCMP is advertised by the AP |
| 2149 | * or if the AP included an HT capabilities |
| 2150 | * element in its Beacons and Probe Response. |
| 2151 | */ |
| 2152 | if ((!CSR_IS_11n_ALLOWED( |
| 2153 | pProfile->negotiatedUCEncryptionType)) |
| 2154 | && ((eCSR_CFG_DOT11_MODE_11N == |
| 2155 | cfgDot11ModeToUse) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2156 | (eCSR_CFG_DOT11_MODE_11AC == |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 2157 | cfgDot11ModeToUse) || |
| 2158 | (eCSR_CFG_DOT11_MODE_11AX == |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 2159 | cfgDot11ModeToUse))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2160 | /* We cannot do 11n here */ |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 2161 | if (!WLAN_REG_IS_5GHZ_CH |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2162 | (pSirBssDesc->channelId)) { |
| 2163 | cfgDot11ModeToUse = |
| 2164 | eCSR_CFG_DOT11_MODE_11G; |
| 2165 | } else { |
| 2166 | cfgDot11ModeToUse = |
| 2167 | eCSR_CFG_DOT11_MODE_11A; |
| 2168 | } |
| 2169 | } |
| 2170 | } |
| 2171 | *pReturnCfgDot11Mode = cfgDot11ModeToUse; |
| 2172 | } |
| 2173 | |
| 2174 | return fMatch; |
| 2175 | } |
| 2176 | |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2177 | enum csr_cfgdot11mode csr_find_best_phy_mode(tpAniSirGlobal pMac, |
| 2178 | uint32_t phyMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2179 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2180 | enum csr_cfgdot11mode cfgDot11ModeToUse; |
Vignesh Viswanathan | f97cc11 | 2018-10-03 19:17:07 +0530 | [diff] [blame] | 2181 | enum band_info eBand = pMac->mlme_cfg->gen.band; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2182 | |
| 2183 | if ((0 == phyMode) || |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 2184 | (eCSR_DOT11_MODE_AUTO & phyMode) || |
| 2185 | (eCSR_DOT11_MODE_11ax & phyMode)) { |
| 2186 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) { |
| 2187 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AX; |
| 2188 | } else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) { |
| 2189 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC; |
| 2190 | } else { |
| 2191 | /* Default to 11N mode if user has configured 11ac mode |
| 2192 | * and FW doesn't supports 11ac mode . |
| 2193 | */ |
| 2194 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
| 2195 | } |
| 2196 | } else if (eCSR_DOT11_MODE_11ac & phyMode) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2197 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) { |
| 2198 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11AC; |
Kiran Kumar Lokere | 9a733a7 | 2016-02-17 19:01:15 -0800 | [diff] [blame] | 2199 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2200 | /* Default to 11N mode if user has configured 11ac mode |
| 2201 | * and FW doesn't supports 11ac mode . |
| 2202 | */ |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2203 | } cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2204 | } else { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2205 | if ((eCSR_DOT11_MODE_11n | eCSR_DOT11_MODE_11n_ONLY) & phyMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2206 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11N; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2207 | else if (eCSR_DOT11_MODE_abg & phyMode) { |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 2208 | if (BAND_2G != eBand) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2209 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2210 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2211 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2212 | } else if (eCSR_DOT11_MODE_11a & phyMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2213 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11A; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2214 | else if ((eCSR_DOT11_MODE_11g | eCSR_DOT11_MODE_11g_ONLY) & |
| 2215 | phyMode) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2216 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11G; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2217 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2218 | cfgDot11ModeToUse = eCSR_CFG_DOT11_MODE_11B; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2219 | } |
| 2220 | |
| 2221 | return cfgDot11ModeToUse; |
| 2222 | } |
| 2223 | |
Jeff Johnson | b7de91b | 2018-06-03 18:15:02 -0700 | [diff] [blame] | 2224 | uint32_t csr_get11h_power_constraint(tpAniSirGlobal mac_ctx, |
| 2225 | tDot11fIEPowerConstraints *constraints) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2226 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2227 | uint32_t localPowerConstraint = 0; |
| 2228 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2229 | /* check if .11h support is enabled, if not, |
| 2230 | * the power constraint is 0. |
| 2231 | */ |
Jeff Johnson | b7de91b | 2018-06-03 18:15:02 -0700 | [diff] [blame] | 2232 | if (mac_ctx->roam.configParam.Is11hSupportEnabled && |
| 2233 | constraints->present) { |
| 2234 | localPowerConstraint = constraints->localPowerConstraints; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2235 | } |
| 2236 | |
| 2237 | return localPowerConstraint; |
| 2238 | } |
| 2239 | |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2240 | bool csr_is_profile_wpa(struct csr_roam_profile *pProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2241 | { |
| 2242 | bool fWpaProfile = false; |
| 2243 | |
| 2244 | switch (pProfile->negotiatedAuthType) { |
| 2245 | case eCSR_AUTH_TYPE_WPA: |
| 2246 | case eCSR_AUTH_TYPE_WPA_PSK: |
| 2247 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 2248 | #ifdef FEATURE_WLAN_ESE |
| 2249 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 2250 | #endif |
| 2251 | fWpaProfile = true; |
| 2252 | break; |
| 2253 | |
| 2254 | default: |
| 2255 | fWpaProfile = false; |
| 2256 | break; |
| 2257 | } |
| 2258 | |
| 2259 | if (fWpaProfile) { |
| 2260 | switch (pProfile->negotiatedUCEncryptionType) { |
| 2261 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 2262 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 2263 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 2264 | case eCSR_ENCRYPT_TYPE_AES: |
| 2265 | fWpaProfile = true; |
| 2266 | break; |
| 2267 | |
| 2268 | default: |
| 2269 | fWpaProfile = false; |
| 2270 | break; |
| 2271 | } |
| 2272 | } |
| 2273 | return fWpaProfile; |
| 2274 | } |
| 2275 | |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2276 | bool csr_is_profile_rsn(struct csr_roam_profile *pProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2277 | { |
| 2278 | bool fRSNProfile = false; |
| 2279 | |
| 2280 | switch (pProfile->negotiatedAuthType) { |
| 2281 | case eCSR_AUTH_TYPE_RSN: |
| 2282 | case eCSR_AUTH_TYPE_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2283 | case eCSR_AUTH_TYPE_FT_RSN: |
| 2284 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2285 | #ifdef FEATURE_WLAN_ESE |
| 2286 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 2287 | #endif |
| 2288 | #ifdef WLAN_FEATURE_11W |
| 2289 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 2290 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 2291 | #endif |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 2292 | /* fallthrough */ |
| 2293 | case eCSR_AUTH_TYPE_FILS_SHA256: |
| 2294 | case eCSR_AUTH_TYPE_FILS_SHA384: |
| 2295 | case eCSR_AUTH_TYPE_FT_FILS_SHA256: |
| 2296 | case eCSR_AUTH_TYPE_FT_FILS_SHA384: |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 2297 | case eCSR_AUTH_TYPE_DPP_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2298 | fRSNProfile = true; |
| 2299 | break; |
| 2300 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 2301 | case eCSR_AUTH_TYPE_OWE: |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 2302 | case eCSR_AUTH_TYPE_SUITEB_EAP_SHA256: |
| 2303 | case eCSR_AUTH_TYPE_SUITEB_EAP_SHA384: |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 2304 | fRSNProfile = true; |
| 2305 | break; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 2306 | case eCSR_AUTH_TYPE_SAE: |
| 2307 | fRSNProfile = true; |
| 2308 | break; |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 2309 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2310 | default: |
| 2311 | fRSNProfile = false; |
| 2312 | break; |
| 2313 | } |
| 2314 | |
| 2315 | if (fRSNProfile) { |
| 2316 | switch (pProfile->negotiatedUCEncryptionType) { |
| 2317 | /* !!REVIEW - For WPA2, use of RSN IE mandates */ |
| 2318 | /* use of AES as encryption. Here, we qualify */ |
| 2319 | /* even if encryption type is WEP or TKIP */ |
| 2320 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 2321 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 2322 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 2323 | case eCSR_ENCRYPT_TYPE_AES: |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2324 | case eCSR_ENCRYPT_TYPE_AES_GCMP: |
| 2325 | case eCSR_ENCRYPT_TYPE_AES_GCMP_256: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2326 | fRSNProfile = true; |
| 2327 | break; |
| 2328 | |
| 2329 | default: |
| 2330 | fRSNProfile = false; |
| 2331 | break; |
| 2332 | } |
| 2333 | } |
| 2334 | return fRSNProfile; |
| 2335 | } |
| 2336 | |
| 2337 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2338 | * csr_update_mcc_p2p_beacon_interval() - update p2p beacon interval |
| 2339 | * @mac_ctx: pointer to mac context |
| 2340 | * |
| 2341 | * This function is to update the mcc p2p beacon interval |
| 2342 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2343 | * Return: QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2344 | */ |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 2345 | static QDF_STATUS csr_update_mcc_p2p_beacon_interval(tpAniSirGlobal mac_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2346 | { |
| 2347 | uint32_t session_id = 0; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2348 | struct csr_roam_session *roam_session; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2349 | |
| 2350 | /* If MCC is not supported just break and return SUCCESS */ |
| 2351 | if (!mac_ctx->roam.configParam.fenableMCCMode) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2352 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2353 | |
| 2354 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 2355 | /* |
| 2356 | * If GO in MCC support different beacon interval, |
| 2357 | * change the BI of the P2P-GO |
| 2358 | */ |
| 2359 | roam_session = &mac_ctx->roam.roamSession[session_id]; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2360 | if (roam_session->bssParams.bssPersona != QDF_P2P_GO_MODE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2361 | continue; |
| 2362 | /* |
| 2363 | * Handle different BI scneario based on the |
| 2364 | * configuration set.If Config is set to 0x02 then |
| 2365 | * Disconnect all the P2P clients associated. If config |
| 2366 | * is set to 0x04 then update the BI without |
| 2367 | * disconnecting all the clients |
| 2368 | */ |
| 2369 | if ((mac_ctx->roam.configParam.fAllowMCCGODiffBI == 0x04) |
| 2370 | && (roam_session->bssParams. |
| 2371 | updatebeaconInterval)) { |
| 2372 | return csr_send_chng_mcc_beacon_interval(mac_ctx, |
| 2373 | session_id); |
| 2374 | } else if (roam_session->bssParams.updatebeaconInterval) { |
| 2375 | /* |
| 2376 | * If the configuration of fAllowMCCGODiffBI is set to |
| 2377 | * other than 0x04 |
| 2378 | */ |
| 2379 | return csr_roam_call_callback(mac_ctx, |
| 2380 | session_id, |
| 2381 | NULL, 0, |
| 2382 | eCSR_ROAM_DISCONNECT_ALL_P2P_CLIENTS, |
| 2383 | eCSR_ROAM_RESULT_NONE); |
| 2384 | } |
| 2385 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2386 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2387 | } |
| 2388 | |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 2389 | static uint16_t csr_calculate_mcc_beacon_interval(tpAniSirGlobal pMac, |
| 2390 | uint16_t sta_bi, |
| 2391 | uint16_t go_gbi) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2392 | { |
| 2393 | uint8_t num_beacons = 0; |
| 2394 | uint8_t is_multiple = 0; |
| 2395 | uint16_t go_cbi = 0; |
| 2396 | uint16_t go_fbi = 0; |
| 2397 | uint16_t sta_cbi = 0; |
| 2398 | |
| 2399 | /* If GO's given beacon Interval is less than 100 */ |
| 2400 | if (go_gbi < 100) |
| 2401 | go_cbi = 100; |
| 2402 | /* if GO's given beacon Interval is greater than or equal to 100 */ |
| 2403 | else |
| 2404 | go_cbi = 100 + (go_gbi % 100); |
| 2405 | |
| 2406 | if (sta_bi == 0) { |
| 2407 | /* There is possibility to receive zero as value. |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2408 | * Which will cause divide by zero. Hence initialise with 100 |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2409 | */ |
| 2410 | sta_bi = 100; |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2411 | sme_warn("sta_bi 2nd parameter is zero, initialize to %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2412 | sta_bi); |
| 2413 | } |
| 2414 | /* check, if either one is multiple of another */ |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2415 | if (sta_bi > go_cbi) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2416 | is_multiple = !(sta_bi % go_cbi); |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2417 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2418 | is_multiple = !(go_cbi % sta_bi); |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2419 | |
| 2420 | /* if it is multiple, then accept GO's beacon interval |
| 2421 | * range [100,199] as it is |
| 2422 | */ |
| 2423 | if (is_multiple) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2424 | return go_cbi; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2425 | |
| 2426 | /* else , if it is not multiple, then then check for number of beacons |
| 2427 | * to be inserted based on sta BI |
| 2428 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2429 | num_beacons = sta_bi / 100; |
| 2430 | if (num_beacons) { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2431 | /* GO's final beacon interval will be aligned to sta beacon |
| 2432 | * interval, but in the range of [100, 199]. |
| 2433 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2434 | sta_cbi = sta_bi / num_beacons; |
| 2435 | go_fbi = sta_cbi; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2436 | } else |
| 2437 | /* if STA beacon interval is less than 100, use GO's change |
| 2438 | * bacon interval instead of updating to STA's beacon interval. |
| 2439 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | go_fbi = go_cbi; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2441 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2442 | return go_fbi; |
| 2443 | } |
| 2444 | |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2445 | /** |
| 2446 | * csr_validate_p2pcli_bcn_intrvl() - to validate p2pcli beacon interval |
| 2447 | * @mac_ctx: pointer to mac context |
| 2448 | * @chnl_id: channel id variable |
| 2449 | * @bcn_interval: pointer to given beacon interval |
| 2450 | * @session_id: given session id |
| 2451 | * @status: fill the status in terms of QDF_STATUS to inform caller |
| 2452 | * |
| 2453 | * This API can provide the validation the beacon interval and re-calculate |
| 2454 | * in case concurrency |
| 2455 | * |
| 2456 | * Return: bool |
| 2457 | */ |
| 2458 | static bool csr_validate_p2pcli_bcn_intrvl(tpAniSirGlobal mac_ctx, |
| 2459 | uint8_t chnl_id, uint16_t *bcn_interval, uint32_t session_id, |
| 2460 | QDF_STATUS *status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2461 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2462 | struct csr_roam_session *roamsession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2463 | |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2464 | roamsession = &mac_ctx->roam.roamSession[session_id]; |
| 2465 | if (roamsession->pCurRoamProfile && |
| 2466 | (roamsession->pCurRoamProfile->csrPersona == |
| 2467 | QDF_STA_MODE)) { |
| 2468 | /* check for P2P client mode */ |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2469 | sme_debug("Ignore Beacon Interval Validation..."); |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2470 | } else if (roamsession->bssParams.bssPersona == QDF_P2P_GO_MODE) { |
| 2471 | /* Check for P2P go scenario */ |
| 2472 | if ((roamsession->bssParams.operationChn != chnl_id) |
| 2473 | && (roamsession->bssParams.beaconInterval != |
| 2474 | *bcn_interval)) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2475 | sme_err("BcnIntrvl is diff can't connect to P2P_GO network"); |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2476 | *status = QDF_STATUS_E_FAILURE; |
| 2477 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2478 | } |
| 2479 | } |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2480 | return false; |
| 2481 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2482 | |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2483 | /** |
| 2484 | * csr_validate_p2pgo_bcn_intrvl() - to validate p2pgo beacon interval |
| 2485 | * @mac_ctx: pointer to mac context |
| 2486 | * @chnl_id: channel id variable |
| 2487 | * @bcn_interval: pointer to given beacon interval |
| 2488 | * @session_id: given session id |
| 2489 | * @status: fill the status in terms of QDF_STATUS to inform caller |
| 2490 | * |
| 2491 | * This API can provide the validation the beacon interval and re-calculate |
| 2492 | * in case concurrency |
| 2493 | * |
| 2494 | * Return: bool |
| 2495 | */ |
| 2496 | static bool csr_validate_p2pgo_bcn_intrvl(tpAniSirGlobal mac_ctx, |
| 2497 | uint8_t chnl_id, uint16_t *bcn_interval, |
| 2498 | uint32_t session_id, QDF_STATUS *status) |
| 2499 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2500 | struct csr_roam_session *roamsession; |
| 2501 | struct csr_config *cfg_param; |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2502 | tCsrRoamConnectedProfile *conn_profile; |
| 2503 | uint16_t new_bcn_interval; |
| 2504 | |
| 2505 | roamsession = &mac_ctx->roam.roamSession[session_id]; |
| 2506 | cfg_param = &mac_ctx->roam.configParam; |
| 2507 | conn_profile = &roamsession->connectedProfile; |
| 2508 | if (roamsession->pCurRoamProfile && |
| 2509 | ((roamsession->pCurRoamProfile->csrPersona == |
| 2510 | QDF_P2P_CLIENT_MODE) || |
| 2511 | (roamsession->pCurRoamProfile->csrPersona == |
| 2512 | QDF_STA_MODE))) { |
| 2513 | /* check for P2P_client scenario */ |
| 2514 | if ((conn_profile->operationChannel == 0) && |
| 2515 | (conn_profile->beaconInterval == 0)) |
| 2516 | return false; |
| 2517 | |
| 2518 | if (csr_is_conn_state_connected_infra(mac_ctx, session_id) && |
| 2519 | (conn_profile->operationChannel != chnl_id) && |
| 2520 | (conn_profile->beaconInterval != *bcn_interval)) { |
| 2521 | /* |
| 2522 | * Updated beaconInterval should be used only when |
| 2523 | * we are starting a new BSS not incase of |
| 2524 | * client or STA case |
| 2525 | */ |
| 2526 | |
| 2527 | /* Calculate beacon Interval for P2P-GO incase of MCC */ |
| 2528 | if (cfg_param->conc_custom_rule1 || |
| 2529 | cfg_param->conc_custom_rule2) { |
| 2530 | new_bcn_interval = CSR_CUSTOM_CONC_GO_BI; |
| 2531 | } else { |
| 2532 | new_bcn_interval = |
| 2533 | csr_calculate_mcc_beacon_interval( |
| 2534 | mac_ctx, |
| 2535 | conn_profile->beaconInterval, |
| 2536 | *bcn_interval); |
| 2537 | } |
| 2538 | if (*bcn_interval != new_bcn_interval) |
| 2539 | *bcn_interval = new_bcn_interval; |
| 2540 | *status = QDF_STATUS_SUCCESS; |
| 2541 | return true; |
| 2542 | } |
| 2543 | } |
| 2544 | return false; |
| 2545 | } |
| 2546 | |
| 2547 | /** |
| 2548 | * csr_validate_sta_bcn_intrvl() - to validate sta beacon interval |
| 2549 | * @mac_ctx: pointer to mac context |
| 2550 | * @chnl_id: channel id variable |
| 2551 | * @bcn_interval: pointer to given beacon interval |
| 2552 | * @session_id: given session id |
| 2553 | * @status: fill the status in terms of QDF_STATUS to inform caller |
| 2554 | * |
| 2555 | * This API can provide the validation the beacon interval and re-calculate |
| 2556 | * in case concurrency |
| 2557 | * |
| 2558 | * Return: bool |
| 2559 | */ |
| 2560 | static bool csr_validate_sta_bcn_intrvl(tpAniSirGlobal mac_ctx, |
| 2561 | uint8_t chnl_id, uint16_t *bcn_interval, |
| 2562 | uint32_t session_id, QDF_STATUS *status) |
| 2563 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 2564 | struct csr_roam_session *roamsession; |
| 2565 | struct csr_config *cfg_param; |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2566 | uint16_t new_bcn_interval; |
| 2567 | |
| 2568 | roamsession = &mac_ctx->roam.roamSession[session_id]; |
| 2569 | cfg_param = &mac_ctx->roam.configParam; |
| 2570 | |
| 2571 | if (roamsession->pCurRoamProfile && |
| 2572 | (roamsession->pCurRoamProfile->csrPersona == |
| 2573 | QDF_P2P_CLIENT_MODE)) { |
| 2574 | /* check for P2P client mode */ |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2575 | sme_debug("Bcn Intrvl validation not require for STA/CLIENT"); |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2576 | return false; |
| 2577 | } |
| 2578 | if ((roamsession->bssParams.bssPersona == QDF_SAP_MODE) && |
| 2579 | (roamsession->bssParams.operationChn != chnl_id)) { |
| 2580 | /* |
| 2581 | * IF SAP has started and STA wants to connect |
| 2582 | * on different channel MCC should |
| 2583 | * MCC should not be enabled so making it |
| 2584 | * false to enforce on same channel |
| 2585 | */ |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2586 | sme_err("*** MCC with SAP+STA sessions ****"); |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2587 | *status = QDF_STATUS_SUCCESS; |
| 2588 | return true; |
| 2589 | } |
| 2590 | /* |
| 2591 | * Check for P2P go scenario |
| 2592 | * if GO in MCC support different |
| 2593 | * beacon interval, |
| 2594 | * change the BI of the P2P-GO |
| 2595 | */ |
| 2596 | if ((roamsession->bssParams.bssPersona == QDF_P2P_GO_MODE) && |
| 2597 | (roamsession->bssParams.operationChn != chnl_id) && |
| 2598 | (roamsession->bssParams.beaconInterval != *bcn_interval)) { |
| 2599 | /* if GO in MCC support diff beacon interval, return success */ |
| 2600 | if (cfg_param->fAllowMCCGODiffBI == 0x01) { |
| 2601 | *status = QDF_STATUS_SUCCESS; |
| 2602 | return true; |
| 2603 | } |
| 2604 | /* |
| 2605 | * Send only Broadcast disassoc and update bcn_interval |
| 2606 | * If configuration is set to 0x04 then dont |
| 2607 | * disconnect all the station |
| 2608 | */ |
| 2609 | if ((cfg_param->fAllowMCCGODiffBI == 0x02) |
| 2610 | || (cfg_param->fAllowMCCGODiffBI == 0x04)) { |
| 2611 | /* Check to pass the right beacon Interval */ |
| 2612 | if (cfg_param->conc_custom_rule1 || |
| 2613 | cfg_param->conc_custom_rule2) { |
| 2614 | new_bcn_interval = CSR_CUSTOM_CONC_GO_BI; |
| 2615 | } else { |
| 2616 | new_bcn_interval = |
| 2617 | csr_calculate_mcc_beacon_interval( |
| 2618 | mac_ctx, *bcn_interval, |
| 2619 | roamsession->bssParams.beaconInterval); |
| 2620 | } |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2621 | sme_debug("Peer AP BI : %d, new Beacon Interval: %d", |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2622 | *bcn_interval, new_bcn_interval); |
| 2623 | /* Update the becon Interval */ |
| 2624 | if (new_bcn_interval != |
| 2625 | roamsession->bssParams.beaconInterval) { |
| 2626 | /* Update the bcn_interval now */ |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2627 | sme_err("Beacon Interval got changed config used: %d", |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2628 | cfg_param->fAllowMCCGODiffBI); |
| 2629 | |
| 2630 | roamsession->bssParams.beaconInterval = |
| 2631 | new_bcn_interval; |
| 2632 | roamsession->bssParams.updatebeaconInterval = |
| 2633 | true; |
| 2634 | *status = csr_update_mcc_p2p_beacon_interval( |
| 2635 | mac_ctx); |
| 2636 | return true; |
| 2637 | } |
| 2638 | *status = QDF_STATUS_SUCCESS; |
| 2639 | return true; |
| 2640 | } |
| 2641 | if (cfg_param->fAllowMCCGODiffBI |
| 2642 | == 0x03) { |
| 2643 | /* Disconnect the P2P session */ |
| 2644 | roamsession->bssParams.updatebeaconInterval = false; |
| 2645 | *status = csr_roam_call_callback(mac_ctx, |
| 2646 | session_id, NULL, 0, |
| 2647 | eCSR_ROAM_SEND_P2P_STOP_BSS, |
| 2648 | eCSR_ROAM_RESULT_NONE); |
| 2649 | return true; |
| 2650 | } |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2651 | sme_err("BcnIntrvl is diff can't connect to preferred AP"); |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2652 | *status = QDF_STATUS_E_FAILURE; |
| 2653 | return true; |
| 2654 | } |
| 2655 | return false; |
| 2656 | } |
| 2657 | |
| 2658 | /** |
| 2659 | * csr_validate_mcc_beacon_interval() - to validate the mcc beacon interval |
| 2660 | * @mac_ctx: pointer to mac context |
| 2661 | * @chnl_id: channel number |
| 2662 | * @bcn_interval: provided beacon interval |
| 2663 | * @cur_session_id: current session id |
| 2664 | * @cur_bss_persona: Current BSS persona |
| 2665 | * |
| 2666 | * This API will validate the mcc beacon interval |
| 2667 | * |
| 2668 | * Return: QDF_STATUS |
| 2669 | */ |
| 2670 | QDF_STATUS csr_validate_mcc_beacon_interval(tpAniSirGlobal mac_ctx, |
| 2671 | uint8_t chnl_id, |
| 2672 | uint16_t *bcn_interval, |
| 2673 | uint32_t cur_session_id, |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 2674 | enum QDF_OPMODE cur_bss_persona) |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2675 | { |
| 2676 | uint32_t session_id = 0; |
| 2677 | QDF_STATUS status; |
| 2678 | bool is_done; |
| 2679 | |
| 2680 | /* If MCC is not supported just break */ |
| 2681 | if (!mac_ctx->roam.configParam.fenableMCCMode) |
| 2682 | return QDF_STATUS_E_FAILURE; |
| 2683 | |
| 2684 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 2685 | if (cur_session_id == session_id) |
| 2686 | continue; |
| 2687 | |
| 2688 | if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) |
| 2689 | continue; |
| 2690 | |
| 2691 | switch (cur_bss_persona) { |
| 2692 | case QDF_STA_MODE: |
| 2693 | is_done = csr_validate_sta_bcn_intrvl(mac_ctx, chnl_id, |
| 2694 | bcn_interval, session_id, &status); |
| 2695 | if (true == is_done) |
| 2696 | return status; |
| 2697 | break; |
| 2698 | |
| 2699 | case QDF_P2P_CLIENT_MODE: |
| 2700 | is_done = csr_validate_p2pcli_bcn_intrvl(mac_ctx, |
| 2701 | chnl_id, bcn_interval, session_id, |
| 2702 | &status); |
| 2703 | if (true == is_done) |
| 2704 | return status; |
| 2705 | break; |
| 2706 | |
| 2707 | case QDF_SAP_MODE: |
| 2708 | case QDF_IBSS_MODE: |
| 2709 | break; |
| 2710 | |
| 2711 | case QDF_P2P_GO_MODE: |
| 2712 | is_done = csr_validate_p2pgo_bcn_intrvl(mac_ctx, |
| 2713 | chnl_id, bcn_interval, |
| 2714 | session_id, &status); |
| 2715 | if (true == is_done) |
| 2716 | return status; |
| 2717 | break; |
| 2718 | |
| 2719 | default: |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 2720 | sme_err("Persona not supported: %d", cur_bss_persona); |
Naveen Rawat | 206e2ac | 2016-04-14 18:01:38 -0700 | [diff] [blame] | 2721 | return QDF_STATUS_E_FAILURE; |
| 2722 | } |
| 2723 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2724 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2725 | } |
| 2726 | |
Deepak Dhamdhere | add334b | 2016-01-09 23:40:33 -0800 | [diff] [blame] | 2727 | /** |
| 2728 | * csr_is_auth_type11r() - Check if Authentication type is 11R |
Abhinav Kumar | 271f063 | 2018-03-29 16:01:30 +0530 | [diff] [blame] | 2729 | * @mac: pointer to mac context |
Deepak Dhamdhere | add334b | 2016-01-09 23:40:33 -0800 | [diff] [blame] | 2730 | * @auth_type: The authentication type that is used to make the connection |
| 2731 | * @mdie_present: Is MDIE IE present |
| 2732 | * |
| 2733 | * Return: true if is 11R auth type, false otherwise |
| 2734 | */ |
Abhinav Kumar | 271f063 | 2018-03-29 16:01:30 +0530 | [diff] [blame] | 2735 | bool csr_is_auth_type11r(tpAniSirGlobal mac, eCsrAuthType auth_type, |
| 2736 | uint8_t mdie_present) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2737 | { |
Deepak Dhamdhere | add334b | 2016-01-09 23:40:33 -0800 | [diff] [blame] | 2738 | switch (auth_type) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2739 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Abhinav Kumar | 271f063 | 2018-03-29 16:01:30 +0530 | [diff] [blame] | 2740 | if (mdie_present && |
| 2741 | mac->roam.configParam.enable_ftopen) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2742 | return true; |
Naveen Rawat | 23be88d | 2017-04-18 17:34:43 -0700 | [diff] [blame] | 2743 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
| 2745 | case eCSR_AUTH_TYPE_FT_RSN: |
| 2746 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2747 | default: |
| 2748 | break; |
| 2749 | } |
| 2750 | return false; |
| 2751 | } |
| 2752 | |
| 2753 | /* Function to return true if the profile is 11r */ |
Abhinav Kumar | 271f063 | 2018-03-29 16:01:30 +0530 | [diff] [blame] | 2754 | bool csr_is_profile11r(tpAniSirGlobal mac, |
| 2755 | struct csr_roam_profile *pProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2756 | { |
Abhinav Kumar | 271f063 | 2018-03-29 16:01:30 +0530 | [diff] [blame] | 2757 | return csr_is_auth_type11r(mac, pProfile->negotiatedAuthType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2758 | pProfile->MDID.mdiePresent); |
| 2759 | } |
| 2760 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2761 | bool csr_is_auth_type_ese(eCsrAuthType AuthType) |
| 2762 | { |
| 2763 | switch (AuthType) { |
| 2764 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 2765 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 2766 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2767 | default: |
| 2768 | break; |
| 2769 | } |
| 2770 | return false; |
| 2771 | } |
| 2772 | |
Padma, Santhosh Kumar | 2d1f77c | 2017-11-22 16:20:28 +0530 | [diff] [blame] | 2773 | #ifdef FEATURE_WLAN_ESE |
| 2774 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2775 | /* Function to return true if the profile is ESE */ |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2776 | bool csr_is_profile_ese(struct csr_roam_profile *pProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2777 | { |
| 2778 | return csr_is_auth_type_ese(pProfile->negotiatedAuthType); |
| 2779 | } |
| 2780 | |
| 2781 | #endif |
| 2782 | |
| 2783 | #ifdef FEATURE_WLAN_WAPI |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 2784 | bool csr_is_profile_wapi(struct csr_roam_profile *pProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2785 | { |
| 2786 | bool fWapiProfile = false; |
| 2787 | |
| 2788 | switch (pProfile->negotiatedAuthType) { |
| 2789 | case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE: |
| 2790 | case eCSR_AUTH_TYPE_WAPI_WAI_PSK: |
| 2791 | fWapiProfile = true; |
| 2792 | break; |
| 2793 | |
| 2794 | default: |
| 2795 | fWapiProfile = false; |
| 2796 | break; |
| 2797 | } |
| 2798 | |
| 2799 | if (fWapiProfile) { |
| 2800 | switch (pProfile->negotiatedUCEncryptionType) { |
| 2801 | case eCSR_ENCRYPT_TYPE_WPI: |
| 2802 | fWapiProfile = true; |
| 2803 | break; |
| 2804 | |
| 2805 | default: |
| 2806 | fWapiProfile = false; |
| 2807 | break; |
| 2808 | } |
| 2809 | } |
| 2810 | return fWapiProfile; |
| 2811 | } |
| 2812 | |
| 2813 | static bool csr_is_wapi_oui_equal(tpAniSirGlobal pMac, uint8_t *Oui1, |
| 2814 | uint8_t *Oui2) |
| 2815 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2816 | return !qdf_mem_cmp(Oui1, Oui2, CSR_WAPI_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2817 | } |
| 2818 | |
| 2819 | static bool csr_is_wapi_oui_match(tpAniSirGlobal pMac, |
| 2820 | uint8_t AllCyphers[][CSR_WAPI_OUI_SIZE], |
| 2821 | uint8_t cAllCyphers, uint8_t Cypher[], |
| 2822 | uint8_t Oui[]) |
| 2823 | { |
| 2824 | bool fYes = false; |
| 2825 | uint8_t idx; |
| 2826 | |
| 2827 | for (idx = 0; idx < cAllCyphers; idx++) { |
| 2828 | if (csr_is_wapi_oui_equal(pMac, AllCyphers[idx], Cypher)) { |
| 2829 | fYes = true; |
| 2830 | break; |
| 2831 | } |
| 2832 | } |
| 2833 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2834 | if (fYes && Oui) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2835 | qdf_mem_copy(Oui, AllCyphers[idx], CSR_WAPI_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2836 | |
| 2837 | return fYes; |
| 2838 | } |
| 2839 | #endif /* FEATURE_WLAN_WAPI */ |
| 2840 | |
| 2841 | static bool csr_is_wpa_oui_equal(tpAniSirGlobal pMac, uint8_t *Oui1, |
| 2842 | uint8_t *Oui2) |
| 2843 | { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2844 | return !qdf_mem_cmp(Oui1, Oui2, CSR_WPA_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2845 | } |
| 2846 | |
| 2847 | static bool csr_is_oui_match(tpAniSirGlobal pMac, |
| 2848 | uint8_t AllCyphers[][CSR_WPA_OUI_SIZE], |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2849 | uint8_t cAllCyphers, uint8_t Cypher[], uint8_t Oui[]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2850 | { |
| 2851 | bool fYes = false; |
| 2852 | uint8_t idx; |
| 2853 | |
| 2854 | for (idx = 0; idx < cAllCyphers; idx++) { |
| 2855 | if (csr_is_wpa_oui_equal(pMac, AllCyphers[idx], Cypher)) { |
| 2856 | fYes = true; |
| 2857 | break; |
| 2858 | } |
| 2859 | } |
| 2860 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 2861 | if (fYes && Oui) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2862 | qdf_mem_copy(Oui, AllCyphers[idx], CSR_WPA_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2863 | |
| 2864 | return fYes; |
| 2865 | } |
| 2866 | |
| 2867 | static bool csr_match_rsnoui_index(tpAniSirGlobal pMac, |
| 2868 | uint8_t AllCyphers[][CSR_RSN_OUI_SIZE], |
| 2869 | uint8_t cAllCyphers, uint8_t ouiIndex, |
| 2870 | uint8_t Oui[]) |
| 2871 | { |
| 2872 | return csr_is_oui_match |
| 2873 | (pMac, AllCyphers, cAllCyphers, csr_rsn_oui[ouiIndex], Oui); |
| 2874 | |
| 2875 | } |
| 2876 | |
| 2877 | #ifdef FEATURE_WLAN_WAPI |
| 2878 | static bool csr_match_wapi_oui_index(tpAniSirGlobal pMac, |
| 2879 | uint8_t AllCyphers[][CSR_WAPI_OUI_SIZE], |
| 2880 | uint8_t cAllCyphers, uint8_t ouiIndex, |
| 2881 | uint8_t Oui[]) |
| 2882 | { |
| 2883 | return csr_is_wapi_oui_match |
| 2884 | (pMac, AllCyphers, cAllCyphers, csr_wapi_oui[ouiIndex], Oui); |
| 2885 | |
| 2886 | } |
| 2887 | #endif /* FEATURE_WLAN_WAPI */ |
| 2888 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 2889 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2890 | static bool csr_match_wpaoui_index(tpAniSirGlobal pMac, |
| 2891 | uint8_t AllCyphers[][CSR_RSN_OUI_SIZE], |
| 2892 | uint8_t cAllCyphers, uint8_t ouiIndex, |
| 2893 | uint8_t Oui[]) |
| 2894 | { |
Padma, Santhosh Kumar | 5f42892 | 2017-07-24 12:48:00 +0530 | [diff] [blame] | 2895 | if (ouiIndex < QDF_ARRAY_SIZE(csr_wpa_oui)) |
| 2896 | return csr_is_oui_match |
| 2897 | (pMac, AllCyphers, cAllCyphers, |
| 2898 | csr_wpa_oui[ouiIndex], Oui); |
| 2899 | else |
| 2900 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2901 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 2902 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2903 | |
| 2904 | #ifdef FEATURE_WLAN_WAPI |
| 2905 | static bool csr_is_auth_wapi_cert(tpAniSirGlobal pMac, |
| 2906 | uint8_t AllSuites[][CSR_WAPI_OUI_SIZE], |
| 2907 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2908 | { |
| 2909 | return csr_is_wapi_oui_match |
| 2910 | (pMac, AllSuites, cAllSuites, csr_wapi_oui[1], Oui); |
| 2911 | } |
| 2912 | |
| 2913 | static bool csr_is_auth_wapi_psk(tpAniSirGlobal pMac, |
| 2914 | uint8_t AllSuites[][CSR_WAPI_OUI_SIZE], |
| 2915 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2916 | { |
| 2917 | return csr_is_wapi_oui_match |
| 2918 | (pMac, AllSuites, cAllSuites, csr_wapi_oui[2], Oui); |
| 2919 | } |
| 2920 | #endif /* FEATURE_WLAN_WAPI */ |
| 2921 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2922 | |
| 2923 | /* |
| 2924 | * Function for 11R FT Authentication. We match the FT Authentication Cipher |
| 2925 | * suite here. This matches for FT Auth with the 802.1X exchange. |
| 2926 | */ |
| 2927 | static bool csr_is_ft_auth_rsn(tpAniSirGlobal pMac, |
| 2928 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 2929 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2930 | { |
| 2931 | return csr_is_oui_match |
| 2932 | (pMac, AllSuites, cAllSuites, csr_rsn_oui[03], Oui); |
| 2933 | } |
| 2934 | |
| 2935 | /* |
| 2936 | * Function for 11R FT Authentication. We match the FT Authentication Cipher |
| 2937 | * suite here. This matches for FT Auth with the PSK. |
| 2938 | */ |
| 2939 | static bool csr_is_ft_auth_rsn_psk(tpAniSirGlobal pMac, |
| 2940 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 2941 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2942 | { |
| 2943 | return csr_is_oui_match |
| 2944 | (pMac, AllSuites, cAllSuites, csr_rsn_oui[04], Oui); |
| 2945 | } |
| 2946 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2947 | |
| 2948 | #ifdef FEATURE_WLAN_ESE |
| 2949 | |
| 2950 | /* |
| 2951 | * Function for ESE CCKM AKM Authentication. We match the CCKM AKM |
| 2952 | * Authentication Key Management suite here. This matches for CCKM AKM Auth |
| 2953 | * with the 802.1X exchange. |
| 2954 | */ |
| 2955 | static bool csr_is_ese_cckm_auth_rsn(tpAniSirGlobal pMac, |
| 2956 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 2957 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2958 | { |
| 2959 | return csr_is_oui_match |
| 2960 | (pMac, AllSuites, cAllSuites, csr_rsn_oui[06], Oui); |
| 2961 | } |
| 2962 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 2963 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2964 | static bool csr_is_ese_cckm_auth_wpa(tpAniSirGlobal pMac, |
| 2965 | uint8_t AllSuites[][CSR_WPA_OUI_SIZE], |
| 2966 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2967 | { |
| 2968 | return csr_is_oui_match |
| 2969 | (pMac, AllSuites, cAllSuites, csr_wpa_oui[06], Oui); |
| 2970 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 2971 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2972 | |
| 2973 | #endif |
| 2974 | |
| 2975 | static bool csr_is_auth_rsn(tpAniSirGlobal pMac, |
| 2976 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 2977 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2978 | { |
| 2979 | return csr_is_oui_match |
| 2980 | (pMac, AllSuites, cAllSuites, csr_rsn_oui[01], Oui); |
| 2981 | } |
| 2982 | |
| 2983 | static bool csr_is_auth_rsn_psk(tpAniSirGlobal pMac, |
| 2984 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 2985 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2986 | { |
| 2987 | return csr_is_oui_match |
| 2988 | (pMac, AllSuites, cAllSuites, csr_rsn_oui[02], Oui); |
| 2989 | } |
| 2990 | |
| 2991 | #ifdef WLAN_FEATURE_11W |
| 2992 | static bool csr_is_auth_rsn_psk_sha256(tpAniSirGlobal pMac, |
| 2993 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 2994 | uint8_t cAllSuites, uint8_t Oui[]) |
| 2995 | { |
| 2996 | return csr_is_oui_match |
| 2997 | (pMac, AllSuites, cAllSuites, csr_rsn_oui[07], Oui); |
| 2998 | } |
| 2999 | static bool csr_is_auth_rsn8021x_sha256(tpAniSirGlobal pMac, |
| 3000 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 3001 | uint8_t cAllSuites, uint8_t Oui[]) |
| 3002 | { |
| 3003 | return csr_is_oui_match |
| 3004 | (pMac, AllSuites, cAllSuites, csr_rsn_oui[8], Oui); |
| 3005 | } |
| 3006 | #endif |
| 3007 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 3008 | #ifdef WLAN_FEATURE_FILS_SK |
| 3009 | /* |
| 3010 | * csr_is_auth_fils_sha256() - check whether oui is fils sha256 |
| 3011 | * @mac: Global MAC context |
| 3012 | * @all_suites: pointer to all supported akm suites |
| 3013 | * @suite_count: all supported akm suites count |
| 3014 | * @oui: Oui needs to be matched |
| 3015 | * |
| 3016 | * Return: True if OUI is FILS SHA256, false otherwise |
| 3017 | */ |
| 3018 | static bool csr_is_auth_fils_sha256(tpAniSirGlobal mac, |
| 3019 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3020 | uint8_t suite_count, uint8_t oui[]) |
| 3021 | { |
| 3022 | return csr_is_oui_match(mac, all_suites, suite_count, |
| 3023 | csr_rsn_oui[ENUM_FILS_SHA256], oui); |
| 3024 | } |
| 3025 | |
| 3026 | /* |
| 3027 | * csr_is_auth_fils_sha384() - check whether oui is fils sha384 |
| 3028 | * @mac: Global MAC context |
| 3029 | * @all_suites: pointer to all supported akm suites |
| 3030 | * @suite_count: all supported akm suites count |
| 3031 | * @oui: Oui needs to be matched |
| 3032 | * |
| 3033 | * Return: True if OUI is FILS SHA384, false otherwise |
| 3034 | */ |
| 3035 | static bool csr_is_auth_fils_sha384(tpAniSirGlobal mac, |
| 3036 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3037 | uint8_t suite_count, uint8_t oui[]) |
| 3038 | { |
| 3039 | return csr_is_oui_match(mac, all_suites, suite_count, |
| 3040 | csr_rsn_oui[ENUM_FILS_SHA384], oui); |
| 3041 | } |
| 3042 | |
| 3043 | /* |
| 3044 | * csr_is_auth_fils_ft_sha256() - check whether oui is fils ft sha256 |
| 3045 | * @mac: Global MAC context |
| 3046 | * @all_suites: pointer to all supported akm suites |
| 3047 | * @suite_count: all supported akm suites count |
| 3048 | * @oui: Oui needs to be matched |
| 3049 | * |
| 3050 | * Return: True if OUI is FT FILS SHA256, false otherwise |
| 3051 | */ |
| 3052 | static bool csr_is_auth_fils_ft_sha256(tpAniSirGlobal mac, |
| 3053 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3054 | uint8_t suite_count, uint8_t oui[]) |
| 3055 | { |
| 3056 | return csr_is_oui_match(mac, all_suites, suite_count, |
| 3057 | csr_rsn_oui[ENUM_FT_FILS_SHA256], oui); |
| 3058 | } |
| 3059 | |
| 3060 | /* |
| 3061 | * csr_is_auth_fils_ft_sha384() - check whether oui is fils ft sha384 |
| 3062 | * @mac: Global MAC context |
| 3063 | * @all_suites: pointer to all supported akm suites |
| 3064 | * @suite_count: all supported akm suites count |
| 3065 | * @oui: Oui needs to be matched |
| 3066 | * |
| 3067 | * Return: True if OUI is FT FILS SHA384, false otherwise |
| 3068 | */ |
| 3069 | static bool csr_is_auth_fils_ft_sha384(tpAniSirGlobal mac, |
| 3070 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3071 | uint8_t suite_count, uint8_t oui[]) |
| 3072 | { |
| 3073 | return csr_is_oui_match(mac, all_suites, suite_count, |
| 3074 | csr_rsn_oui[ENUM_FT_FILS_SHA384], oui); |
| 3075 | } |
| 3076 | #endif |
| 3077 | |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 3078 | /* |
| 3079 | * csr_is_auth_dpp_rsn() - check whether oui is dpp rsn |
| 3080 | * @mac: Global MAC context |
| 3081 | * @all_suites: pointer to all supported akm suites |
| 3082 | * @suite_count: all supported akm suites count |
| 3083 | * @oui: Oui needs to be matched |
| 3084 | * |
| 3085 | * Return: True if OUI is dpp rsn, false otherwise |
| 3086 | */ |
| 3087 | static bool csr_is_auth_dpp_rsn(tpAniSirGlobal mac, |
| 3088 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3089 | uint8_t suite_count, uint8_t oui[]) |
| 3090 | { |
| 3091 | return csr_is_oui_match(mac, all_suites, suite_count, |
| 3092 | csr_rsn_oui[ENUM_DPP_RSN], oui); |
| 3093 | } |
| 3094 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 3095 | /* |
| 3096 | * csr_is_auth_wpa_owe() - check whether oui is OWE |
| 3097 | * @mac: Global MAC context |
| 3098 | * @all_suites: pointer to all supported akm suites |
| 3099 | * @suite_count: all supported akm suites count |
| 3100 | * @oui: Oui needs to be matched |
| 3101 | * |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3102 | * Return: True if OUI is OWE, false otherwise |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 3103 | */ |
| 3104 | static bool csr_is_auth_wpa_owe(tpAniSirGlobal mac, |
| 3105 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3106 | uint8_t suite_count, uint8_t oui[]) |
| 3107 | { |
| 3108 | return csr_is_oui_match |
| 3109 | (mac, all_suites, suite_count, csr_rsn_oui[ENUM_OWE], oui); |
| 3110 | } |
| 3111 | |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 3112 | /* |
| 3113 | * csr_is_auth_suiteb_eap_256() - check whether oui is SuiteB EAP256 |
| 3114 | * @mac: Global MAC context |
| 3115 | * @all_suites: pointer to all supported akm suites |
| 3116 | * @suite_count: all supported akm suites count |
| 3117 | * @oui: Oui needs to be matched |
| 3118 | * |
| 3119 | * Return: True if OUI is SuiteB EAP256, false otherwise |
| 3120 | */ |
| 3121 | static bool csr_is_auth_suiteb_eap_256(tpAniSirGlobal mac, |
| 3122 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3123 | uint8_t suite_count, uint8_t oui[]) |
| 3124 | { |
| 3125 | return csr_is_oui_match(mac, all_suites, suite_count, |
| 3126 | csr_rsn_oui[ENUM_SUITEB_EAP256], oui); |
| 3127 | } |
| 3128 | |
| 3129 | /* |
| 3130 | * csr_is_auth_suiteb_eap_384() - check whether oui is SuiteB EAP384 |
| 3131 | * @mac: Global MAC context |
| 3132 | * @all_suites: pointer to all supported akm suites |
| 3133 | * @suite_count: all supported akm suites count |
| 3134 | * @oui: Oui needs to be matched |
| 3135 | * |
| 3136 | * Return: True if OUI is SuiteB EAP384, false otherwise |
| 3137 | */ |
| 3138 | static bool csr_is_auth_suiteb_eap_384(tpAniSirGlobal mac, |
| 3139 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3140 | uint8_t suite_count, uint8_t oui[]) |
| 3141 | { |
| 3142 | return csr_is_oui_match(mac, all_suites, suite_count, |
| 3143 | csr_rsn_oui[ENUM_SUITEB_EAP384], oui); |
| 3144 | } |
| 3145 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 3146 | #ifdef WLAN_FEATURE_SAE |
| 3147 | /* |
| 3148 | * csr_is_auth_wpa_sae() - check whether oui is SAE |
| 3149 | * @mac: Global MAC context |
| 3150 | * @all_suites: pointer to all supported akm suites |
| 3151 | * @suite_count: all supported akm suites count |
| 3152 | * @oui: Oui needs to be matched |
| 3153 | * |
| 3154 | * Return: True if OUI is SAE, false otherwise |
| 3155 | */ |
| 3156 | static bool csr_is_auth_wpa_sae(tpAniSirGlobal mac, |
| 3157 | uint8_t all_suites[][CSR_RSN_OUI_SIZE], |
| 3158 | uint8_t suite_count, uint8_t oui[]) |
| 3159 | { |
| 3160 | return csr_is_oui_match |
| 3161 | (mac, all_suites, suite_count, csr_rsn_oui[ENUM_SAE], oui); |
| 3162 | } |
| 3163 | #endif |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 3164 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3165 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3166 | static bool csr_is_auth_wpa(tpAniSirGlobal pMac, |
| 3167 | uint8_t AllSuites[][CSR_WPA_OUI_SIZE], |
| 3168 | uint8_t cAllSuites, uint8_t Oui[]) |
| 3169 | { |
| 3170 | return csr_is_oui_match |
| 3171 | (pMac, AllSuites, cAllSuites, csr_wpa_oui[01], Oui); |
| 3172 | } |
| 3173 | |
| 3174 | static bool csr_is_auth_wpa_psk(tpAniSirGlobal pMac, |
| 3175 | uint8_t AllSuites[][CSR_WPA_OUI_SIZE], |
| 3176 | uint8_t cAllSuites, uint8_t Oui[]) |
| 3177 | { |
| 3178 | return csr_is_oui_match |
| 3179 | (pMac, AllSuites, cAllSuites, csr_wpa_oui[02], Oui); |
| 3180 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3181 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3182 | |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3183 | /* |
| 3184 | * csr_is_group_mgmt_gmac_128() - check whether oui is GMAC_128 |
| 3185 | * @mac: Global MAC context |
| 3186 | * @all_suites: pointer to all supported akm suites |
| 3187 | * @suite_count: all supported akm suites count |
| 3188 | * @oui: Oui needs to be matched |
| 3189 | * |
| 3190 | * Return: True if OUI is GMAC_128, false otherwise |
| 3191 | */ |
| 3192 | static bool csr_is_group_mgmt_gmac_128(tpAniSirGlobal pMac, |
| 3193 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 3194 | uint8_t cAllSuites, uint8_t Oui[]) |
| 3195 | { |
| 3196 | return csr_is_oui_match(pMac, AllSuites, cAllSuites, |
| 3197 | csr_group_mgmt_oui[ENUM_GMAC_128], Oui); |
| 3198 | } |
| 3199 | |
| 3200 | /* |
| 3201 | * csr_is_group_mgmt_gmac_256() - check whether oui is GMAC_256 |
| 3202 | * @mac: Global MAC context |
| 3203 | * @all_suites: pointer to all supported akm suites |
| 3204 | * @suite_count: all supported akm suites count |
| 3205 | * @oui: Oui needs to be matched |
| 3206 | * |
| 3207 | * Return: True if OUI is GMAC_256, false otherwise |
| 3208 | */ |
| 3209 | static bool csr_is_group_mgmt_gmac_256(tpAniSirGlobal pMac, |
| 3210 | uint8_t AllSuites[][CSR_RSN_OUI_SIZE], |
| 3211 | uint8_t cAllSuites, uint8_t Oui[]) |
| 3212 | { |
| 3213 | return csr_is_oui_match(pMac, AllSuites, cAllSuites, |
| 3214 | csr_group_mgmt_oui[ENUM_GMAC_256], Oui); |
| 3215 | } |
| 3216 | |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 3217 | static uint8_t csr_get_oui_index_from_cipher(eCsrEncryptionType enType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3218 | { |
| 3219 | uint8_t OUIIndex; |
| 3220 | |
| 3221 | switch (enType) { |
| 3222 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 3223 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 3224 | OUIIndex = CSR_OUI_WEP40_OR_1X_INDEX; |
| 3225 | break; |
| 3226 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 3227 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 3228 | OUIIndex = CSR_OUI_WEP104_INDEX; |
| 3229 | break; |
| 3230 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 3231 | OUIIndex = CSR_OUI_TKIP_OR_PSK_INDEX; |
| 3232 | break; |
| 3233 | case eCSR_ENCRYPT_TYPE_AES: |
| 3234 | OUIIndex = CSR_OUI_AES_INDEX; |
| 3235 | break; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 3236 | case eCSR_ENCRYPT_TYPE_AES_GCMP: |
| 3237 | OUIIndex = CSR_OUI_AES_GCMP_INDEX; |
| 3238 | break; |
| 3239 | case eCSR_ENCRYPT_TYPE_AES_GCMP_256: |
| 3240 | OUIIndex = CSR_OUI_AES_GCMP_256_INDEX; |
| 3241 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3242 | case eCSR_ENCRYPT_TYPE_NONE: |
| 3243 | OUIIndex = CSR_OUI_USE_GROUP_CIPHER_INDEX; |
| 3244 | break; |
| 3245 | #ifdef FEATURE_WLAN_WAPI |
| 3246 | case eCSR_ENCRYPT_TYPE_WPI: |
| 3247 | OUIIndex = CSR_OUI_WAPI_WAI_CERT_OR_SMS4_INDEX; |
| 3248 | break; |
| 3249 | #endif /* FEATURE_WLAN_WAPI */ |
| 3250 | default: /* HOWTO handle this? */ |
| 3251 | OUIIndex = CSR_OUI_RESERVED_INDEX; |
| 3252 | break; |
| 3253 | } /* switch */ |
| 3254 | |
| 3255 | return OUIIndex; |
| 3256 | } |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 3257 | |
| 3258 | #ifdef WLAN_FEATURE_FILS_SK |
| 3259 | /** |
| 3260 | * csr_is_fils_auth() - update negotiated auth if matches to FILS auth type |
| 3261 | * @mac_ctx: pointer to mac context |
| 3262 | * @authsuites: auth suites |
| 3263 | * @c_auth_suites: auth suites count |
| 3264 | * @authentication: authentication |
| 3265 | * @auth_type: authentication type list |
| 3266 | * @index: current counter |
| 3267 | * @neg_authtype: pointer to negotiated auth |
| 3268 | * |
| 3269 | * Return: None |
| 3270 | */ |
| 3271 | static void csr_is_fils_auth(tpAniSirGlobal mac_ctx, |
| 3272 | uint8_t authsuites[][CSR_RSN_OUI_SIZE], uint8_t c_auth_suites, |
| 3273 | uint8_t authentication[], tCsrAuthList *auth_type, |
| 3274 | uint8_t index, eCsrAuthType *neg_authtype) |
| 3275 | { |
| 3276 | /* |
| 3277 | * TODO Always try with highest security |
| 3278 | * move this down once sha384 is validated |
| 3279 | */ |
| 3280 | if (csr_is_auth_fils_sha256(mac_ctx, authsuites, |
| 3281 | c_auth_suites, authentication)) { |
| 3282 | if (eCSR_AUTH_TYPE_FILS_SHA256 == |
| 3283 | auth_type->authType[index]) |
| 3284 | *neg_authtype = eCSR_AUTH_TYPE_FILS_SHA256; |
| 3285 | } |
| 3286 | if ((*neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3287 | csr_is_auth_fils_sha384(mac_ctx, authsuites, |
| 3288 | c_auth_suites, authentication)) { |
| 3289 | if (eCSR_AUTH_TYPE_FILS_SHA384 == |
| 3290 | auth_type->authType[index]) |
| 3291 | *neg_authtype = eCSR_AUTH_TYPE_FILS_SHA384; |
| 3292 | } |
| 3293 | if ((*neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3294 | csr_is_auth_fils_ft_sha256(mac_ctx, authsuites, |
| 3295 | c_auth_suites, authentication)) { |
| 3296 | if (eCSR_AUTH_TYPE_FT_FILS_SHA256 == |
| 3297 | auth_type->authType[index]) |
| 3298 | *neg_authtype = eCSR_AUTH_TYPE_FT_FILS_SHA256; |
| 3299 | } |
| 3300 | if ((*neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3301 | csr_is_auth_fils_ft_sha384(mac_ctx, authsuites, |
| 3302 | c_auth_suites, authentication)) { |
| 3303 | if (eCSR_AUTH_TYPE_FT_FILS_SHA384 == |
| 3304 | auth_type->authType[index]) |
| 3305 | *neg_authtype = eCSR_AUTH_TYPE_FT_FILS_SHA384; |
| 3306 | } |
| 3307 | sme_debug("negotiated auth type is %d", *neg_authtype); |
| 3308 | } |
| 3309 | #else |
| 3310 | static void csr_is_fils_auth(tpAniSirGlobal mac_ctx, |
| 3311 | uint8_t authsuites[][CSR_RSN_OUI_SIZE], uint8_t c_auth_suites, |
| 3312 | uint8_t authentication[], tCsrAuthList *auth_type, |
| 3313 | uint8_t index, eCsrAuthType *neg_authtype) |
| 3314 | { |
| 3315 | } |
| 3316 | #endif |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 3317 | |
| 3318 | #ifdef WLAN_FEATURE_SAE |
| 3319 | /** |
| 3320 | * csr_check_sae_auth() - update negotiated auth if matches to SAE auth type |
| 3321 | * @mac_ctx: pointer to mac context |
| 3322 | * @authsuites: auth suites |
| 3323 | * @c_auth_suites: auth suites count |
| 3324 | * @authentication: authentication |
| 3325 | * @auth_type: authentication type list |
| 3326 | * @index: current counter |
| 3327 | * @neg_authtype: pointer to negotiated auth |
| 3328 | * |
| 3329 | * Return: None |
| 3330 | */ |
| 3331 | static void csr_check_sae_auth(tpAniSirGlobal mac_ctx, |
| 3332 | uint8_t authsuites[][CSR_RSN_OUI_SIZE], uint8_t c_auth_suites, |
| 3333 | uint8_t authentication[], tCsrAuthList *auth_type, |
| 3334 | uint8_t index, eCsrAuthType *neg_authtype) |
| 3335 | { |
| 3336 | if ((*neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3337 | csr_is_auth_wpa_sae(mac_ctx, authsuites, |
| 3338 | c_auth_suites, authentication)) { |
| 3339 | if (eCSR_AUTH_TYPE_SAE == auth_type->authType[index]) |
| 3340 | *neg_authtype = eCSR_AUTH_TYPE_SAE; |
| 3341 | } |
| 3342 | sme_debug("negotiated auth type is %d", *neg_authtype); |
| 3343 | } |
| 3344 | #else |
| 3345 | static void csr_check_sae_auth(tpAniSirGlobal mac_ctx, |
| 3346 | uint8_t authsuites[][CSR_RSN_OUI_SIZE], uint8_t c_auth_suites, |
| 3347 | uint8_t authentication[], tCsrAuthList *auth_type, |
| 3348 | uint8_t index, eCsrAuthType *neg_authtype) |
| 3349 | { |
| 3350 | } |
| 3351 | #endif |
| 3352 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3353 | /** |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 3354 | * csr_get_rsn_information() - to get RSN information |
Jeff Johnson | 353650e | 2018-06-10 16:29:42 -0700 | [diff] [blame] | 3355 | * @mac_ctx: pointer to global MAC context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3356 | * @auth_type: auth type |
| 3357 | * @encr_type: encryption type |
| 3358 | * @mc_encryption: multicast encryption type |
| 3359 | * @rsn_ie: pointer to RSN IE |
| 3360 | * @ucast_cipher: Unicast cipher |
| 3361 | * @mcast_cipher: Multicast cipher |
| 3362 | * @auth_suite: Authentication suite |
| 3363 | * @capabilities: RSN capabilities |
| 3364 | * @negotiated_authtype: Negotiated auth type |
| 3365 | * @negotiated_mccipher: negotiated multicast cipher |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3366 | * @gp_mgmt_cipher: group management cipher |
| 3367 | * @mgmt_encryption_type: group management encryption type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3368 | * |
| 3369 | * This routine will get all RSN information |
| 3370 | * |
| 3371 | * Return: bool |
| 3372 | */ |
Jeff Johnson | 353650e | 2018-06-10 16:29:42 -0700 | [diff] [blame] | 3373 | static bool csr_get_rsn_information(tpAniSirGlobal mac_ctx, |
| 3374 | tCsrAuthList *auth_type, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 3375 | eCsrEncryptionType encr_type, |
| 3376 | tCsrEncryptionList *mc_encryption, |
| 3377 | tDot11fIERSN *rsn_ie, uint8_t *ucast_cipher, |
| 3378 | uint8_t *mcast_cipher, uint8_t *auth_suite, |
gaurank kathpalia | c63859d | 2018-05-03 18:48:41 +0530 | [diff] [blame] | 3379 | struct rsn_caps *capabilities, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 3380 | eCsrAuthType *negotiated_authtype, |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3381 | eCsrEncryptionType *negotiated_mccipher, |
| 3382 | uint8_t *gp_mgmt_cipher, |
| 3383 | tAniEdType *mgmt_encryption_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3385 | bool acceptable_cipher = false; |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3386 | bool group_mgmt_acceptable_cipher = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3387 | uint8_t c_ucast_cipher = 0; |
| 3388 | uint8_t c_mcast_cipher = 0; |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3389 | uint8_t c_group_mgmt_cipher = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3390 | uint8_t c_auth_suites = 0, i; |
| 3391 | uint8_t unicast[CSR_RSN_OUI_SIZE]; |
| 3392 | uint8_t multicast[CSR_RSN_OUI_SIZE]; |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3393 | uint8_t group_mgmt[CSR_RSN_OUI_SIZE]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3394 | uint8_t authsuites[CSR_RSN_MAX_AUTH_SUITES][CSR_RSN_OUI_SIZE]; |
| 3395 | uint8_t authentication[CSR_RSN_OUI_SIZE]; |
| 3396 | uint8_t mccipher_arr[CSR_RSN_MAX_MULTICAST_CYPHERS][CSR_RSN_OUI_SIZE]; |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3397 | uint8_t group_mgmt_arr[CSR_RSN_MAX_MULTICAST_CYPHERS][CSR_RSN_OUI_SIZE]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3398 | eCsrAuthType neg_authtype = eCSR_AUTH_TYPE_UNKNOWN; |
| 3399 | |
| 3400 | if (!rsn_ie->present) |
| 3401 | goto end; |
| 3402 | c_mcast_cipher++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3403 | qdf_mem_copy(mccipher_arr, rsn_ie->gp_cipher_suite, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3404 | CSR_RSN_OUI_SIZE); |
| 3405 | c_ucast_cipher = |
| 3406 | (uint8_t) (rsn_ie->pwise_cipher_suite_count); |
Abhishek Singh | 7dcb85b | 2017-12-27 15:15:01 +0530 | [diff] [blame] | 3407 | |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 3408 | c_auth_suites = (uint8_t) (rsn_ie->akm_suite_cnt); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | for (i = 0; i < c_auth_suites && i < CSR_RSN_MAX_AUTH_SUITES; i++) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3410 | qdf_mem_copy((void *)&authsuites[i], |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 3411 | (void *)&rsn_ie->akm_suite[i], CSR_RSN_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3412 | } |
| 3413 | |
| 3414 | /* Check - Is requested unicast Cipher supported by the BSS. */ |
| 3415 | acceptable_cipher = csr_match_rsnoui_index(mac_ctx, |
| 3416 | rsn_ie->pwise_cipher_suites, c_ucast_cipher, |
| 3417 | csr_get_oui_index_from_cipher(encr_type), |
| 3418 | unicast); |
| 3419 | |
| 3420 | if (!acceptable_cipher) |
| 3421 | goto end; |
| 3422 | |
| 3423 | /* unicast is supported. Pick the first matching Group cipher, if any */ |
| 3424 | for (i = 0; i < mc_encryption->numEntries; i++) { |
| 3425 | acceptable_cipher = csr_match_rsnoui_index(mac_ctx, |
| 3426 | mccipher_arr, c_mcast_cipher, |
| 3427 | csr_get_oui_index_from_cipher( |
| 3428 | mc_encryption->encryptionType[i]), |
| 3429 | multicast); |
| 3430 | if (acceptable_cipher) |
| 3431 | break; |
| 3432 | } |
| 3433 | if (!acceptable_cipher) |
| 3434 | goto end; |
| 3435 | |
| 3436 | if (negotiated_mccipher) |
| 3437 | *negotiated_mccipher = mc_encryption->encryptionType[i]; |
| 3438 | |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3439 | /* Group Management Cipher only for 11w */ |
| 3440 | if (mgmt_encryption_type) { |
| 3441 | c_group_mgmt_cipher++; |
| 3442 | qdf_mem_copy(group_mgmt_arr, rsn_ie->gp_mgmt_cipher_suite, |
| 3443 | CSR_RSN_OUI_SIZE); |
| 3444 | if (csr_is_group_mgmt_gmac_128(mac_ctx, group_mgmt_arr, |
| 3445 | c_group_mgmt_cipher, group_mgmt)) { |
| 3446 | group_mgmt_acceptable_cipher = true; |
| 3447 | *mgmt_encryption_type = eSIR_ED_AES_GMAC_128; |
| 3448 | } else if (csr_is_group_mgmt_gmac_256(mac_ctx, group_mgmt_arr, |
| 3449 | c_group_mgmt_cipher, group_mgmt)) { |
| 3450 | group_mgmt_acceptable_cipher = true; |
| 3451 | *mgmt_encryption_type = eSIR_ED_AES_GMAC_256; |
| 3452 | } else { |
| 3453 | /* Default is CMAC */ |
| 3454 | group_mgmt_acceptable_cipher = true; |
| 3455 | *mgmt_encryption_type = eSIR_ED_AES_128_CMAC; |
| 3456 | qdf_mem_copy(group_mgmt, csr_group_mgmt_oui[ENUM_CMAC], |
| 3457 | CSR_RSN_OUI_SIZE); |
| 3458 | } |
| 3459 | } |
| 3460 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3461 | /* Initializing with false as it has true value already */ |
| 3462 | acceptable_cipher = false; |
| 3463 | for (i = 0; i < auth_type->numEntries; i++) { |
| 3464 | /* |
| 3465 | * Ciphers are supported, Match authentication algorithm and |
| 3466 | * pick first matching authtype. |
| 3467 | */ |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 3468 | /* Set FILS as first preference */ |
| 3469 | csr_is_fils_auth(mac_ctx, authsuites, c_auth_suites, |
| 3470 | authentication, auth_type, i, &neg_authtype); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3471 | /* Changed the AKM suites according to order of preference */ |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 3472 | csr_check_sae_auth(mac_ctx, authsuites, c_auth_suites, |
| 3473 | authentication, auth_type, i, &neg_authtype); |
| 3474 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 3475 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 3476 | csr_is_auth_dpp_rsn(mac_ctx, authsuites, |
| 3477 | c_auth_suites, authentication)) { |
| 3478 | if (eCSR_AUTH_TYPE_DPP_RSN == auth_type->authType[i]) |
| 3479 | neg_authtype = eCSR_AUTH_TYPE_DPP_RSN; |
| 3480 | } |
| 3481 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 3482 | csr_is_ft_auth_rsn(mac_ctx, authsuites, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3483 | c_auth_suites, authentication)) { |
| 3484 | if (eCSR_AUTH_TYPE_FT_RSN == auth_type->authType[i]) |
| 3485 | neg_authtype = eCSR_AUTH_TYPE_FT_RSN; |
| 3486 | } |
| 3487 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) |
| 3488 | && csr_is_ft_auth_rsn_psk(mac_ctx, authsuites, |
| 3489 | c_auth_suites, authentication)) { |
| 3490 | if (eCSR_AUTH_TYPE_FT_RSN_PSK == |
| 3491 | auth_type->authType[i]) |
| 3492 | neg_authtype = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 3493 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3494 | #ifdef FEATURE_WLAN_ESE |
| 3495 | /* ESE only supports 802.1X. No PSK. */ |
| 3496 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3497 | csr_is_ese_cckm_auth_rsn(mac_ctx, authsuites, |
| 3498 | c_auth_suites, authentication)) { |
| 3499 | if (eCSR_AUTH_TYPE_CCKM_RSN == auth_type->authType[i]) |
| 3500 | neg_authtype = eCSR_AUTH_TYPE_CCKM_RSN; |
| 3501 | } |
| 3502 | #endif |
| 3503 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) |
| 3504 | && csr_is_auth_rsn(mac_ctx, authsuites, |
| 3505 | c_auth_suites, authentication)) { |
| 3506 | if (eCSR_AUTH_TYPE_RSN == auth_type->authType[i]) |
| 3507 | neg_authtype = eCSR_AUTH_TYPE_RSN; |
| 3508 | } |
| 3509 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) |
| 3510 | && csr_is_auth_rsn_psk(mac_ctx, authsuites, |
| 3511 | c_auth_suites, authentication)) { |
| 3512 | if (eCSR_AUTH_TYPE_RSN_PSK == auth_type->authType[i]) |
| 3513 | neg_authtype = eCSR_AUTH_TYPE_RSN_PSK; |
| 3514 | } |
| 3515 | #ifdef WLAN_FEATURE_11W |
| 3516 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) |
| 3517 | && csr_is_auth_rsn_psk_sha256(mac_ctx, authsuites, |
| 3518 | c_auth_suites, authentication)) { |
| 3519 | if (eCSR_AUTH_TYPE_RSN_PSK_SHA256 == |
| 3520 | auth_type->authType[i]) |
| 3521 | neg_authtype = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 3522 | } |
| 3523 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3524 | csr_is_auth_rsn8021x_sha256(mac_ctx, authsuites, |
| 3525 | c_auth_suites, authentication)) { |
| 3526 | if (eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 3527 | auth_type->authType[i]) |
| 3528 | neg_authtype = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 3529 | } |
| 3530 | #endif |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 3531 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3532 | csr_is_auth_wpa_owe(mac_ctx, authsuites, |
| 3533 | c_auth_suites, authentication)) { |
| 3534 | if (eCSR_AUTH_TYPE_OWE == auth_type->authType[i]) |
| 3535 | neg_authtype = eCSR_AUTH_TYPE_OWE; |
| 3536 | } |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 3537 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3538 | csr_is_auth_suiteb_eap_256(mac_ctx, authsuites, |
| 3539 | c_auth_suites, authentication)) { |
| 3540 | if (eCSR_AUTH_TYPE_SUITEB_EAP_SHA256 == |
| 3541 | auth_type->authType[i]) |
| 3542 | neg_authtype = eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
| 3543 | } |
| 3544 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 3545 | csr_is_auth_suiteb_eap_384(mac_ctx, authsuites, |
| 3546 | c_auth_suites, authentication)) { |
| 3547 | if (eCSR_AUTH_TYPE_SUITEB_EAP_SHA384 == |
| 3548 | auth_type->authType[i]) |
| 3549 | neg_authtype = eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
| 3550 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3551 | |
| 3552 | /* |
| 3553 | * The 1st auth type in the APs RSN IE, to match stations |
| 3554 | * connecting profiles auth type will cause us to exit this |
| 3555 | * loop. This is added as some APs advertise multiple akms in |
| 3556 | * the RSN IE |
| 3557 | */ |
| 3558 | if (eCSR_AUTH_TYPE_UNKNOWN != neg_authtype) { |
| 3559 | acceptable_cipher = true; |
| 3560 | break; |
| 3561 | } |
| 3562 | } /* for */ |
| 3563 | end: |
| 3564 | if (acceptable_cipher) { |
| 3565 | if (mcast_cipher) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3566 | qdf_mem_copy(mcast_cipher, multicast, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3567 | CSR_RSN_OUI_SIZE); |
| 3568 | |
| 3569 | if (ucast_cipher) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3570 | qdf_mem_copy(ucast_cipher, unicast, CSR_RSN_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3571 | |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3572 | if (gp_mgmt_cipher && group_mgmt_acceptable_cipher) |
| 3573 | qdf_mem_copy(gp_mgmt_cipher, group_mgmt, |
| 3574 | CSR_RSN_OUI_SIZE); |
| 3575 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3576 | if (auth_suite) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3577 | qdf_mem_copy(auth_suite, authentication, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3578 | CSR_RSN_OUI_SIZE); |
| 3579 | |
| 3580 | if (negotiated_authtype) |
| 3581 | *negotiated_authtype = neg_authtype; |
| 3582 | |
| 3583 | if (capabilities) { |
| 3584 | /* Bit 0 Preauthentication */ |
| 3585 | capabilities->PreAuthSupported = |
| 3586 | (rsn_ie->RSN_Cap[0] >> 0) & 0x1; |
| 3587 | /* Bit 1 No Pairwise */ |
| 3588 | capabilities->NoPairwise = |
| 3589 | (rsn_ie->RSN_Cap[0] >> 1) & 0x1; |
| 3590 | /* Bit 2, 3 PTKSA Replay Counter */ |
| 3591 | capabilities->PTKSAReplayCounter = |
| 3592 | (rsn_ie->RSN_Cap[0] >> 2) & 0x3; |
| 3593 | /* Bit 4, 5 GTKSA Replay Counter */ |
| 3594 | capabilities->GTKSAReplayCounter = |
| 3595 | (rsn_ie->RSN_Cap[0] >> 4) & 0x3; |
| 3596 | #ifdef WLAN_FEATURE_11W |
| 3597 | /* Bit 6 MFPR */ |
| 3598 | capabilities->MFPRequired = |
| 3599 | (rsn_ie->RSN_Cap[0] >> 6) & 0x1; |
| 3600 | /* Bit 7 MFPC */ |
| 3601 | capabilities->MFPCapable = |
| 3602 | (rsn_ie->RSN_Cap[0] >> 7) & 0x1; |
| 3603 | #else |
| 3604 | /* Bit 6 MFPR */ |
| 3605 | capabilities->MFPRequired = 0; |
| 3606 | /* Bit 7 MFPC */ |
| 3607 | capabilities->MFPCapable = 0; |
| 3608 | #endif |
| 3609 | /* remaining reserved */ |
| 3610 | capabilities->Reserved = rsn_ie->RSN_Cap[1] & 0xff; |
| 3611 | } |
| 3612 | } |
| 3613 | return acceptable_cipher; |
| 3614 | } |
| 3615 | |
| 3616 | #ifdef WLAN_FEATURE_11W |
| 3617 | /** |
| 3618 | * csr_is_pmf_capabilities_in_rsn_match() - check for PMF capability |
Jeff Johnson | 13386da | 2018-06-09 23:55:41 -0700 | [diff] [blame] | 3619 | * @mac: Global MAC Context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3620 | * @pFilterMFPEnabled: given by supplicant to us to specify what kind |
| 3621 | * of connection supplicant is expecting to make |
| 3622 | * if it is enabled then make PMF connection. |
| 3623 | * if it is disabled then make normal connection. |
| 3624 | * @pFilterMFPRequired: given by supplicant based on our configuration |
| 3625 | * if it is 1 then we will require mandatory |
| 3626 | * PMF connection and if it is 0 then we PMF |
| 3627 | * connection is optional. |
| 3628 | * @pFilterMFPCapable: given by supplicant based on our configuration |
| 3629 | * if it 1 then we are PMF capable and if it 0 |
| 3630 | * then we are not PMF capable. |
| 3631 | * @pRSNIe: RSNIe from Beacon/probe response of |
| 3632 | * neighbor AP against which we will compare |
| 3633 | * our capabilities. |
| 3634 | * |
| 3635 | * This function is to match our current capabilities with the AP |
| 3636 | * to which we are expecting make the connection. |
| 3637 | * |
| 3638 | * Return: if our PMF capabilities matches with AP then we |
| 3639 | * will return true to indicate that we are good |
| 3640 | * to make connection with it. Else we will return false |
| 3641 | **/ |
| 3642 | static bool |
Jeff Johnson | 13386da | 2018-06-09 23:55:41 -0700 | [diff] [blame] | 3643 | csr_is_pmf_capabilities_in_rsn_match(tpAniSirGlobal mac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3644 | bool *pFilterMFPEnabled, |
| 3645 | uint8_t *pFilterMFPRequired, |
| 3646 | uint8_t *pFilterMFPCapable, |
| 3647 | tDot11fIERSN *pRSNIe) |
| 3648 | { |
| 3649 | uint8_t apProfileMFPCapable = 0; |
| 3650 | uint8_t apProfileMFPRequired = 0; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 3651 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3652 | if (pRSNIe && pFilterMFPEnabled && pFilterMFPCapable |
| 3653 | && pFilterMFPRequired) { |
| 3654 | /* Extracting MFPCapable bit from RSN Ie */ |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 3655 | apProfileMFPCapable = csr_is_mfpc_capable(pRSNIe); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3656 | apProfileMFPRequired = (pRSNIe->RSN_Cap[0] >> 6) & 0x1; |
Deepthi Gowri | 9f2fc78 | 2016-09-01 12:31:18 +0530 | [diff] [blame] | 3657 | |
Srinivas Girigowda | 2db365c | 2017-03-10 14:03:55 -0800 | [diff] [blame] | 3658 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 3659 | "pFilterMFPEnabled: %d pFilterMFPRequired: %d pFilterMFPCapable: %d apProfileMFPCapable: %d apProfileMFPRequired: %d", |
Deepthi Gowri | 9f2fc78 | 2016-09-01 12:31:18 +0530 | [diff] [blame] | 3660 | *pFilterMFPEnabled, *pFilterMFPRequired, |
| 3661 | *pFilterMFPCapable, apProfileMFPCapable, |
| 3662 | apProfileMFPRequired); |
| 3663 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3664 | if (*pFilterMFPEnabled && *pFilterMFPCapable |
| 3665 | && *pFilterMFPRequired && (apProfileMFPCapable == 0)) { |
Srinivas Girigowda | 2db365c | 2017-03-10 14:03:55 -0800 | [diff] [blame] | 3666 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3667 | "AP is not capable to make PMF connection"); |
| 3668 | return false; |
Deepthi Gowri | 9f2fc78 | 2016-09-01 12:31:18 +0530 | [diff] [blame] | 3669 | } else if (!(*pFilterMFPCapable) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3670 | apProfileMFPCapable && apProfileMFPRequired) { |
| 3671 | |
| 3672 | /* |
| 3673 | * In this case, AP with whom we trying to connect |
| 3674 | * requires mandatory PMF connections and we are not |
| 3675 | * capable so this AP is not good choice to connect |
| 3676 | */ |
Srinivas Girigowda | 2db365c | 2017-03-10 14:03:55 -0800 | [diff] [blame] | 3677 | QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3678 | "AP needs PMF connection and we are not capable of pmf connection"); |
| 3679 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3680 | } |
| 3681 | } |
| 3682 | return true; |
| 3683 | } |
| 3684 | #endif |
| 3685 | |
Jeff Johnson | 44d0c09 | 2018-06-10 16:02:47 -0700 | [diff] [blame] | 3686 | static bool csr_is_rsn_match(tpAniSirGlobal mac_ctx, tCsrAuthList *pAuthType, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 3687 | eCsrEncryptionType enType, |
| 3688 | tCsrEncryptionList *pEnMcType, |
| 3689 | bool *pMFPEnabled, uint8_t *pMFPRequired, |
| 3690 | uint8_t *pMFPCapable, |
| 3691 | tDot11fBeaconIEs *pIes, |
| 3692 | eCsrAuthType *pNegotiatedAuthType, |
| 3693 | eCsrEncryptionType *pNegotiatedMCCipher) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3694 | { |
| 3695 | bool fRSNMatch = false; |
| 3696 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 3697 | /* See if the cyphers in the Bss description match with the |
| 3698 | * settings in the profile. |
| 3699 | */ |
Jeff Johnson | 44d0c09 | 2018-06-10 16:02:47 -0700 | [diff] [blame] | 3700 | fRSNMatch = csr_get_rsn_information(mac_ctx, pAuthType, enType, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 3701 | pEnMcType, &pIes->RSN, |
| 3702 | NULL, NULL, NULL, NULL, |
| 3703 | pNegotiatedAuthType, |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3704 | pNegotiatedMCCipher, NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3705 | #ifdef WLAN_FEATURE_11W |
| 3706 | /* If all the filter matches then finally checks for PMF capabilities */ |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 3707 | if (fRSNMatch) |
Jeff Johnson | 44d0c09 | 2018-06-10 16:02:47 -0700 | [diff] [blame] | 3708 | fRSNMatch = csr_is_pmf_capabilities_in_rsn_match(mac_ctx, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 3709 | pMFPEnabled, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3710 | pMFPRequired, |
| 3711 | pMFPCapable, |
| 3712 | &pIes->RSN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3713 | #endif |
| 3714 | return fRSNMatch; |
| 3715 | } |
| 3716 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3717 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3718 | /** |
| 3719 | * csr_lookup_pmkid_using_ssid() - lookup pmkid using ssid and cache_id |
| 3720 | * @mac: pointer to mac |
| 3721 | * @session: sme session pointer |
| 3722 | * @pmk_cache: pointer to pmk cache |
| 3723 | * @index: index value needs to be seached |
| 3724 | * |
| 3725 | * Return: true if pmkid is found else false |
| 3726 | */ |
| 3727 | static bool csr_lookup_pmkid_using_ssid(tpAniSirGlobal mac, |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 3728 | struct csr_roam_session *session, |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3729 | tPmkidCacheInfo *pmk_cache, |
| 3730 | uint32_t *index) |
| 3731 | { |
| 3732 | uint32_t i; |
| 3733 | tPmkidCacheInfo *session_pmk; |
| 3734 | |
| 3735 | for (i = 0; i < session->NumPmkidCache; i++) { |
| 3736 | session_pmk = &session->PmkidCacheInfo[i]; |
| 3737 | sme_debug("match PMKID ssid %*.*s cache id %x %x ssid_len %d to ssid %s cache_id %x %x", |
| 3738 | pmk_cache->ssid_len, pmk_cache->ssid_len, |
| 3739 | pmk_cache->ssid, pmk_cache->cache_id[0], |
| 3740 | pmk_cache->cache_id[1], pmk_cache->ssid_len, |
| 3741 | session_pmk->ssid, |
| 3742 | session_pmk->cache_id[0], session_pmk->cache_id[1]); |
| 3743 | |
| 3744 | if ((!qdf_mem_cmp(pmk_cache->ssid, session_pmk->ssid, |
| 3745 | pmk_cache->ssid_len)) && |
| 3746 | (!qdf_mem_cmp(session_pmk->cache_id, |
| 3747 | pmk_cache->cache_id, CACHE_ID_LEN))) { |
| 3748 | /* match found */ |
| 3749 | *index = i; |
| 3750 | sme_debug("PMKID found at index %d", i); |
| 3751 | return true; |
| 3752 | } |
| 3753 | } |
| 3754 | |
| 3755 | return false; |
| 3756 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3757 | #endif |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3758 | |
Padma, Santhosh Kumar | b8f65d9 | 2017-09-14 13:05:42 +0530 | [diff] [blame] | 3759 | bool csr_lookup_pmkid_using_bssid(tpAniSirGlobal mac, |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 3760 | struct csr_roam_session *session, |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3761 | tPmkidCacheInfo *pmk_cache, |
| 3762 | uint32_t *index) |
| 3763 | { |
| 3764 | uint32_t i; |
| 3765 | tPmkidCacheInfo *session_pmk; |
| 3766 | |
| 3767 | for (i = 0; i < session->NumPmkidCache; i++) { |
| 3768 | session_pmk = &session->PmkidCacheInfo[i]; |
| 3769 | sme_debug("Matching BSSID: " MAC_ADDRESS_STR " to cached BSSID:" |
| 3770 | MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pmk_cache->BSSID.bytes), |
| 3771 | MAC_ADDR_ARRAY(session_pmk->BSSID.bytes)); |
| 3772 | if (qdf_is_macaddr_equal(&pmk_cache->BSSID, |
| 3773 | &session_pmk->BSSID)) { |
| 3774 | /* match found */ |
| 3775 | *index = i; |
| 3776 | sme_debug("PMKID found at index %d", i); |
| 3777 | return true; |
| 3778 | } |
| 3779 | } |
| 3780 | |
| 3781 | return false; |
| 3782 | } |
| 3783 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3784 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3785 | /** |
| 3786 | * csr_lookup_pmkid() - lookup pmkid using bssid or ssid + cache_id |
| 3787 | * @mac: pointer to mac |
| 3788 | * @session: sme session pointer |
| 3789 | * @pmk_cache: pointer to pmk cache |
| 3790 | * @index: index value needs to be seached |
| 3791 | * |
| 3792 | * Return: true if pmkid is found else false |
| 3793 | */ |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 3794 | static bool csr_lookup_pmkid(tpAniSirGlobal pMac, uint32_t sessionId, |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3795 | tPmkidCacheInfo *pmk_cache) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3796 | { |
| 3797 | bool fRC = false, fMatchFound = false; |
| 3798 | uint32_t Index; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 3799 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | |
| 3801 | if (!pSession) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 3802 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3803 | return false; |
| 3804 | } |
| 3805 | |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3806 | if (pmk_cache->ssid_len) { |
| 3807 | /* Try to find based on cache_id and ssid first */ |
| 3808 | fMatchFound = csr_lookup_pmkid_using_ssid(pMac, pSession, |
| 3809 | pmk_cache, &Index); |
| 3810 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3811 | |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3812 | /* If not able to find using cache id or ssid_len is not present */ |
| 3813 | if (!fMatchFound) |
| 3814 | fMatchFound = csr_lookup_pmkid_using_bssid(pMac, |
| 3815 | pSession, pmk_cache, &Index); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3816 | |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3817 | if (!fMatchFound) { |
| 3818 | sme_debug("no pmkid match found NumPmkidCache = %d", |
| 3819 | pSession->NumPmkidCache); |
| 3820 | return false; |
| 3821 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3822 | |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3823 | qdf_mem_copy(pmk_cache->PMKID, |
| 3824 | pSession->PmkidCacheInfo[Index].PMKID, |
| 3825 | CSR_RSN_PMKID_SIZE); |
| 3826 | |
| 3827 | qdf_mem_copy(pmk_cache->pmk, |
| 3828 | pSession->PmkidCacheInfo[Index].pmk, |
| 3829 | pSession->PmkidCacheInfo[Index].pmk_len); |
| 3830 | pmk_cache->pmk_len = pSession->PmkidCacheInfo[Index].pmk_len; |
| 3831 | |
| 3832 | fRC = true; |
| 3833 | sme_debug("match = %d NumPmkidCache = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3834 | fRC, pSession->NumPmkidCache); |
| 3835 | |
| 3836 | return fRC; |
| 3837 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3838 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3839 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 3840 | #ifdef WLAN_FEATURE_FILS_SK |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3841 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 3842 | /* |
| 3843 | * csr_update_pmksa_for_cache_id: update tPmkidCacheInfo to lookup using |
| 3844 | * ssid and cache id |
| 3845 | * @bss_desc: bss description |
| 3846 | * @profile: csr roam profile |
| 3847 | * @pmkid_cache: pmksa cache |
| 3848 | * |
| 3849 | * Return: true if cache identifier present else false |
| 3850 | */ |
| 3851 | static bool csr_update_pmksa_for_cache_id(tSirBssDescription *bss_desc, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 3852 | struct csr_roam_profile *profile, |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 3853 | tPmkidCacheInfo *pmkid_cache) |
| 3854 | { |
| 3855 | if (!bss_desc->fils_info_element.is_cache_id_present) |
| 3856 | return false; |
| 3857 | |
| 3858 | pmkid_cache->ssid_len = |
| 3859 | profile->SSIDs.SSIDList[0].SSID.length; |
| 3860 | qdf_mem_copy(pmkid_cache->ssid, |
| 3861 | profile->SSIDs.SSIDList[0].SSID.ssId, |
| 3862 | profile->SSIDs.SSIDList[0].SSID.length); |
| 3863 | qdf_mem_copy(pmkid_cache->cache_id, |
| 3864 | bss_desc->fils_info_element.cache_id, |
| 3865 | CACHE_ID_LEN); |
| 3866 | qdf_mem_copy(pmkid_cache->BSSID.bytes, |
| 3867 | bss_desc->bssId, QDF_MAC_ADDR_SIZE); |
| 3868 | |
| 3869 | return true; |
| 3870 | |
| 3871 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3872 | #endif |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 3873 | /* |
| 3874 | * csr_update_pmksa_to_profile: update pmk and pmkid to profile which will be |
| 3875 | * used in case of fils session |
| 3876 | * @profile: profile |
| 3877 | * @pmkid_cache: pmksa cache |
| 3878 | * |
| 3879 | * Return: None |
| 3880 | */ |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 3881 | static inline void csr_update_pmksa_to_profile(struct csr_roam_profile *profile, |
| 3882 | tPmkidCacheInfo *pmkid_cache) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 3883 | { |
| 3884 | if (!profile->fils_con_info) |
| 3885 | return; |
| 3886 | |
| 3887 | profile->fils_con_info->pmk_len = pmkid_cache->pmk_len; |
| 3888 | qdf_mem_copy(profile->fils_con_info->pmk, |
| 3889 | pmkid_cache->pmk, pmkid_cache->pmk_len); |
| 3890 | qdf_mem_copy(profile->fils_con_info->pmkid, |
| 3891 | pmkid_cache->PMKID, CSR_RSN_PMKID_SIZE); |
| 3892 | |
| 3893 | } |
| 3894 | #else |
| 3895 | static inline bool csr_update_pmksa_for_cache_id(tSirBssDescription *bss_desc, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 3896 | struct csr_roam_profile *profile, |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 3897 | tPmkidCacheInfo *pmkid_cache) |
| 3898 | { |
| 3899 | return false; |
| 3900 | } |
| 3901 | |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 3902 | static inline void csr_update_pmksa_to_profile(struct csr_roam_profile *profile, |
| 3903 | tPmkidCacheInfo *pmkid_cache) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 3904 | { |
| 3905 | } |
| 3906 | #endif |
| 3907 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 3908 | #ifdef WLAN_CONV_CRYPTO_IE_SUPPORT |
| 3909 | uint8_t csr_construct_rsn_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
| 3910 | struct csr_roam_profile *pProfile, |
| 3911 | tSirBssDescription *pSirBssDesc, |
| 3912 | tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe) |
| 3913 | { |
| 3914 | struct wlan_objmgr_vdev *vdev; |
| 3915 | uint8_t *rsn_ie_end = NULL; |
| 3916 | uint8_t *rsn_ie = (uint8_t *)pRSNIe; |
| 3917 | uint8_t ie_len = 0; |
| 3918 | |
| 3919 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(pMac->psoc, sessionId, |
| 3920 | WLAN_LEGACY_SME_ID); |
| 3921 | if (!vdev) { |
| 3922 | sme_err("Invalid vdev"); |
| 3923 | return ie_len; |
| 3924 | } |
| 3925 | rsn_ie_end = wlan_crypto_build_rsnie(vdev, rsn_ie); |
| 3926 | if (rsn_ie_end) |
| 3927 | ie_len = rsn_ie_end - rsn_ie; |
| 3928 | |
| 3929 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID); |
| 3930 | |
| 3931 | return ie_len; |
| 3932 | } |
| 3933 | #else |
Vignesh Viswanathan | 32f21c8 | 2018-09-11 17:36:30 +0530 | [diff] [blame] | 3934 | /** |
| 3935 | * csr_update_session_pmk() - Update the pmk len and pmk in the roam session |
| 3936 | * @session: pointer to the CSR Roam session |
| 3937 | * @pmkid_cache: pointer to the pmkid cache |
| 3938 | * |
| 3939 | * Return: None |
| 3940 | */ |
| 3941 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3942 | static void csr_update_session_pmk(struct csr_roam_session *session, |
| 3943 | tPmkidCacheInfo *pmkid_cache) |
| 3944 | { |
| 3945 | session->pmk_len = pmkid_cache->pmk_len; |
| 3946 | qdf_mem_zero(session->psk_pmk, sizeof(session->psk_pmk)); |
| 3947 | qdf_mem_copy(session->psk_pmk, pmkid_cache->pmk, session->pmk_len); |
| 3948 | } |
| 3949 | #else |
| 3950 | static inline void csr_update_session_pmk(struct csr_roam_session *session, |
| 3951 | tPmkidCacheInfo *pmkid_cache) |
| 3952 | { |
| 3953 | } |
| 3954 | #endif |
| 3955 | |
Jeff Johnson | 079c002 | 2018-06-03 18:43:36 -0700 | [diff] [blame] | 3956 | uint8_t csr_construct_rsn_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 3957 | struct csr_roam_profile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3958 | tSirBssDescription *pSirBssDesc, |
| 3959 | tDot11fBeaconIEs *pIes, tCsrRSNIe *pRSNIe) |
| 3960 | { |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 3961 | uint32_t ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3962 | bool fRSNMatch; |
| 3963 | uint8_t cbRSNIe = 0; |
| 3964 | uint8_t UnicastCypher[CSR_RSN_OUI_SIZE]; |
| 3965 | uint8_t MulticastCypher[CSR_RSN_OUI_SIZE]; |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 3966 | uint8_t gp_mgmt_cipher_suite[CSR_RSN_OUI_SIZE]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3967 | uint8_t AuthSuite[CSR_RSN_OUI_SIZE]; |
| 3968 | tCsrRSNAuthIe *pAuthSuite; |
gaurank kathpalia | c63859d | 2018-05-03 18:48:41 +0530 | [diff] [blame] | 3969 | struct rsn_caps RSNCapabilities; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3970 | tCsrRSNPMKIe *pPMK; |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 3971 | tPmkidCacheInfo pmkid_cache; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3972 | #ifdef WLAN_FEATURE_11W |
| 3973 | uint8_t *pGroupMgmtCipherSuite; |
| 3974 | #endif |
| 3975 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 3976 | eCsrAuthType negAuthType = eCSR_AUTH_TYPE_UNKNOWN; |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 3977 | tDot11fIERSN rsn_ie = {0}; |
gaurank kathpalia | c63859d | 2018-05-03 18:48:41 +0530 | [diff] [blame] | 3978 | struct csr_roam_session *session = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3979 | |
gaurank kathpalia | c63859d | 2018-05-03 18:48:41 +0530 | [diff] [blame] | 3980 | if (!CSR_IS_SESSION_VALID(pMac, sessionId) || !session) |
| 3981 | return 0; |
Sandeep Puligilla | a3cac40 | 2017-10-03 12:42:43 -0700 | [diff] [blame] | 3982 | qdf_mem_zero(&pmkid_cache, sizeof(pmkid_cache)); |
Jiachao Wu | 17d37b3 | 2018-01-24 14:24:02 +0800 | [diff] [blame] | 3983 | qdf_mem_zero(&rsn_ie, sizeof(rsn_ie)); |
| 3984 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | do { |
| 3986 | if (!csr_is_profile_rsn(pProfile)) |
| 3987 | break; |
| 3988 | |
| 3989 | if (!pIesLocal |
| 3990 | && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3991 | (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3992 | (csr_get_parsed_bss_description_ies |
| 3993 | (pMac, pSirBssDesc, &pIesLocal)))) { |
| 3994 | break; |
| 3995 | } |
Abhishek Singh | ed55b24 | 2017-12-20 11:02:34 +0530 | [diff] [blame] | 3996 | |
| 3997 | /* |
| 3998 | * Use intersection of the RSN cap sent by user space and |
| 3999 | * the AP, so that only common capability are enabled. |
| 4000 | */ |
| 4001 | if (pProfile->pRSNReqIE && pProfile->nRSNReqIELength) { |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 4002 | ret = dot11f_unpack_ie_rsn(pMac, |
| 4003 | pProfile->pRSNReqIE + 2, |
Abhishek Singh | ed55b24 | 2017-12-20 11:02:34 +0530 | [diff] [blame] | 4004 | pProfile->nRSNReqIELength -2, &rsn_ie, false); |
Naveen Rawat | 72475db | 2017-12-13 18:07:35 -0800 | [diff] [blame] | 4005 | if (!DOT11F_FAILED(ret)) { |
| 4006 | pIesLocal->RSN.RSN_Cap[0] = |
| 4007 | pIesLocal->RSN.RSN_Cap[0] & |
| 4008 | rsn_ie.RSN_Cap[0]; |
| 4009 | pIesLocal->RSN.RSN_Cap[1] = |
| 4010 | pIesLocal->RSN.RSN_Cap[1] & |
| 4011 | rsn_ie.RSN_Cap[1]; |
| 4012 | } |
Abhishek Singh | ed55b24 | 2017-12-20 11:02:34 +0530 | [diff] [blame] | 4013 | } |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4014 | /* See if the cyphers in the Bss description match with the |
| 4015 | * settings in the profile. |
| 4016 | */ |
Jeff Johnson | 079c002 | 2018-06-03 18:43:36 -0700 | [diff] [blame] | 4017 | fRSNMatch = csr_get_rsn_information(pMac, &pProfile->AuthType, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4018 | pProfile->negotiatedUCEncryptionType, |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 4019 | &pProfile->mcEncryptionType, |
| 4020 | &pIesLocal->RSN, UnicastCypher, |
| 4021 | MulticastCypher, AuthSuite, |
| 4022 | &RSNCapabilities, &negAuthType, NULL, |
| 4023 | gp_mgmt_cipher_suite, |
| 4024 | &pProfile->mgmt_encryption_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4025 | if (!fRSNMatch) |
| 4026 | break; |
| 4027 | |
| 4028 | pRSNIe->IeHeader.ElementID = SIR_MAC_RSN_EID; |
| 4029 | |
| 4030 | pRSNIe->Version = CSR_RSN_VERSION_SUPPORTED; |
| 4031 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4032 | qdf_mem_copy(pRSNIe->MulticastOui, MulticastCypher, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4033 | sizeof(MulticastCypher)); |
| 4034 | |
| 4035 | pRSNIe->cUnicastCyphers = 1; |
| 4036 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4037 | qdf_mem_copy(&pRSNIe->UnicastOui[0], UnicastCypher, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | sizeof(UnicastCypher)); |
| 4039 | |
| 4040 | pAuthSuite = |
| 4041 | (tCsrRSNAuthIe *) (&pRSNIe-> |
| 4042 | UnicastOui[pRSNIe->cUnicastCyphers]); |
| 4043 | |
| 4044 | pAuthSuite->cAuthenticationSuites = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4045 | qdf_mem_copy(&pAuthSuite->AuthOui[0], AuthSuite, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4046 | sizeof(AuthSuite)); |
| 4047 | |
Abhishek Singh | ed55b24 | 2017-12-20 11:02:34 +0530 | [diff] [blame] | 4048 | /* PreAuthSupported is an AP only capability */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4049 | RSNCapabilities.PreAuthSupported = 0; |
Abhishek Singh | ed55b24 | 2017-12-20 11:02:34 +0530 | [diff] [blame] | 4050 | /* |
| 4051 | * Use the Management Frame Protection values given by the |
| 4052 | * supplicant, if AP and STA both are MFP capable. |
| 4053 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4054 | #ifdef WLAN_FEATURE_11W |
| 4055 | if (RSNCapabilities.MFPCapable && pProfile->MFPCapable) { |
| 4056 | RSNCapabilities.MFPCapable = pProfile->MFPCapable; |
| 4057 | RSNCapabilities.MFPRequired = pProfile->MFPRequired; |
| 4058 | } else { |
| 4059 | RSNCapabilities.MFPCapable = 0; |
| 4060 | RSNCapabilities.MFPRequired = 0; |
| 4061 | } |
| 4062 | #endif |
| 4063 | *(uint16_t *) (&pAuthSuite->AuthOui[1]) = |
| 4064 | *((uint16_t *) (&RSNCapabilities)); |
| 4065 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4066 | pPMK = (tCsrRSNPMKIe *) (((uint8_t *) (&pAuthSuite->AuthOui[1])) |
| 4067 | + sizeof(uint16_t)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4068 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4069 | if (!csr_update_pmksa_for_cache_id(pSirBssDesc, |
| 4070 | pProfile, &pmkid_cache)) |
| 4071 | qdf_mem_copy(pmkid_cache.BSSID.bytes, |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 4072 | pSirBssDesc->bssId, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4073 | /* Don't include the PMK SA IDs for CCKM associations. */ |
| 4074 | if ( |
| 4075 | #ifdef FEATURE_WLAN_ESE |
| 4076 | (eCSR_AUTH_TYPE_CCKM_RSN != negAuthType) && |
| 4077 | #endif |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 4078 | csr_lookup_pmkid(pMac, sessionId, &pmkid_cache)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4079 | pPMK->cPMKIDs = 1; |
| 4080 | |
Sridhar Selvaraj | c3684c7 | 2017-08-21 14:32:47 +0530 | [diff] [blame] | 4081 | qdf_trace_hex_dump(QDF_MODULE_ID_PE, |
| 4082 | QDF_TRACE_LEVEL_INFO, |
| 4083 | pmkid_cache.pmk, pmkid_cache.pmk_len); |
| 4084 | qdf_mem_copy(pPMK->PMKIDList[0].PMKID, |
| 4085 | pmkid_cache.PMKID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4086 | CSR_RSN_PMKID_SIZE); |
Vignesh Viswanathan | 32f21c8 | 2018-09-11 17:36:30 +0530 | [diff] [blame] | 4087 | |
| 4088 | /* |
| 4089 | * If a PMK cache is found for the BSSID, then |
| 4090 | * update the PMK in CSR session also as this |
| 4091 | * will be sent to the FW during RSO. |
| 4092 | */ |
| 4093 | csr_update_session_pmk(session, &pmkid_cache); |
| 4094 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4095 | csr_update_pmksa_to_profile(pProfile, &pmkid_cache); |
| 4096 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4097 | pPMK->cPMKIDs = 0; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4098 | } |
gaurank kathpalia | c63859d | 2018-05-03 18:48:41 +0530 | [diff] [blame] | 4099 | session->rsn_caps = RSNCapabilities; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4100 | |
| 4101 | #ifdef WLAN_FEATURE_11W |
Deepthi Gowri | 9f2fc78 | 2016-09-01 12:31:18 +0530 | [diff] [blame] | 4102 | /* Advertise BIP in group cipher key management only if PMF is |
| 4103 | * enabled and AP is capable. |
| 4104 | */ |
| 4105 | if (pProfile->MFPEnabled && |
| 4106 | (RSNCapabilities.MFPCapable && pProfile->MFPCapable)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4107 | pGroupMgmtCipherSuite = |
| 4108 | (uint8_t *) pPMK + sizeof(uint16_t) + |
| 4109 | (pPMK->cPMKIDs * CSR_RSN_PMKID_SIZE); |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 4110 | qdf_mem_copy(pGroupMgmtCipherSuite, |
| 4111 | gp_mgmt_cipher_suite, CSR_RSN_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4112 | } |
| 4113 | #endif |
Abhinav Kumar | 8556167 | 2018-04-17 12:48:51 +0530 | [diff] [blame] | 4114 | host_log_rsn_info(UnicastCypher, MulticastCypher, |
| 4115 | AuthSuite, gp_mgmt_cipher_suite); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4116 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4117 | /* Add in the fixed fields plus 1 Unicast cypher, less the |
| 4118 | * IE Header length Add in the size of the Auth suite (count |
| 4119 | * plus a single OUI) Add in the RSN caps field. |
| 4120 | * Add PMKID count and PMKID (if any) |
| 4121 | * Add group management cipher suite |
| 4122 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4123 | pRSNIe->IeHeader.Length = |
| 4124 | (uint8_t) (sizeof(*pRSNIe) - sizeof(pRSNIe->IeHeader) + |
| 4125 | sizeof(*pAuthSuite) + |
gaurank kathpalia | c63859d | 2018-05-03 18:48:41 +0530 | [diff] [blame] | 4126 | sizeof(struct rsn_caps)); |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4127 | if (pPMK->cPMKIDs) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4128 | pRSNIe->IeHeader.Length += (uint8_t) (sizeof(uint16_t) + |
| 4129 | (pPMK->cPMKIDs * |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4130 | CSR_RSN_PMKID_SIZE)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4131 | #ifdef WLAN_FEATURE_11W |
Deepthi Gowri | 9f2fc78 | 2016-09-01 12:31:18 +0530 | [diff] [blame] | 4132 | if (pProfile->MFPEnabled && |
| 4133 | (RSNCapabilities.MFPCapable && pProfile->MFPCapable)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4134 | if (0 == pPMK->cPMKIDs) |
| 4135 | pRSNIe->IeHeader.Length += sizeof(uint16_t); |
| 4136 | pRSNIe->IeHeader.Length += CSR_WPA_OUI_SIZE; |
| 4137 | } |
| 4138 | #endif |
| 4139 | |
| 4140 | /* return the size of the IE header (total) constructed... */ |
| 4141 | cbRSNIe = pRSNIe->IeHeader.Length + sizeof(pRSNIe->IeHeader); |
| 4142 | |
| 4143 | } while (0); |
| 4144 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4145 | if (!pIes && pIesLocal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4146 | /* locally allocated */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4147 | qdf_mem_free(pIesLocal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4148 | |
| 4149 | return cbRSNIe; |
| 4150 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4151 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4152 | |
| 4153 | #ifdef FEATURE_WLAN_WAPI |
| 4154 | /** |
Jeff Johnson | 698eacd | 2018-05-12 17:00:03 -0700 | [diff] [blame] | 4155 | * csr_get_wapi_information() - to get WAPI information |
Jeff Johnson | d80e915 | 2018-06-10 16:35:43 -0700 | [diff] [blame] | 4156 | * @mac_ctx: pointer to global MAC context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4157 | * @auth_type: auth type |
| 4158 | * @encr_type: encryption type |
| 4159 | * @mc_encryption: multicast encryption type |
| 4160 | * @wapi_ie: pointer to WAPI IE |
| 4161 | * @ucast_cipher: Unicast cipher |
| 4162 | * @mcast_cipher: Multicast cipher |
| 4163 | * @auth_suite: Authentication suite |
| 4164 | * @negotiated_authtype: Negotiated auth type |
| 4165 | * @negotiated_mccipher: negotiated multicast cipher |
| 4166 | * |
| 4167 | * This routine will get all WAPI information |
| 4168 | * |
| 4169 | * Return: bool |
| 4170 | */ |
Jeff Johnson | d80e915 | 2018-06-10 16:35:43 -0700 | [diff] [blame] | 4171 | static bool csr_get_wapi_information(tpAniSirGlobal mac_ctx, |
| 4172 | tCsrAuthList *auth_type, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4173 | eCsrEncryptionType encr_type, |
| 4174 | tCsrEncryptionList *mc_encryption, |
| 4175 | tDot11fIEWAPI *wapi_ie, |
| 4176 | uint8_t *ucast_cipher, |
| 4177 | uint8_t *mcast_cipher, uint8_t *auth_suite, |
| 4178 | eCsrAuthType *negotiated_authtype, |
| 4179 | eCsrEncryptionType *negotiated_mccipher) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4181 | bool acceptable_cipher = false; |
| 4182 | uint8_t c_ucast_cipher = 0; |
| 4183 | uint8_t c_mcast_cipher = 0; |
| 4184 | uint8_t c_auth_suites = 0, i; |
| 4185 | uint8_t unicast[CSR_WAPI_OUI_SIZE]; |
| 4186 | uint8_t multicast[CSR_WAPI_OUI_SIZE]; |
| 4187 | uint8_t authsuites[CSR_WAPI_MAX_AUTH_SUITES][CSR_WAPI_OUI_SIZE]; |
| 4188 | uint8_t authentication[CSR_WAPI_OUI_SIZE]; |
| 4189 | uint8_t mccipher_arr[CSR_WAPI_MAX_MULTICAST_CYPHERS][CSR_WAPI_OUI_SIZE]; |
| 4190 | eCsrAuthType neg_authtype = eCSR_AUTH_TYPE_UNKNOWN; |
| 4191 | uint8_t wapioui_idx = 0; |
| 4192 | |
| 4193 | if (!wapi_ie->present) |
| 4194 | goto end; |
| 4195 | |
| 4196 | c_mcast_cipher++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4197 | qdf_mem_copy(mccipher_arr, wapi_ie->multicast_cipher_suite, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4198 | CSR_WAPI_OUI_SIZE); |
| 4199 | c_ucast_cipher = (uint8_t) (wapi_ie->unicast_cipher_suite_count); |
| 4200 | c_auth_suites = (uint8_t) (wapi_ie->akm_suite_count); |
| 4201 | for (i = 0; i < c_auth_suites && i < CSR_WAPI_MAX_AUTH_SUITES; i++) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4202 | qdf_mem_copy((void *)&authsuites[i], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4203 | (void *)&wapi_ie->akm_suites[i], CSR_WAPI_OUI_SIZE); |
| 4204 | |
| 4205 | wapioui_idx = csr_get_oui_index_from_cipher(encr_type); |
| 4206 | if (wapioui_idx >= CSR_OUI_WAPI_WAI_MAX_INDEX) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 4207 | sme_err("Wapi OUI index = %d out of limit", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4208 | wapioui_idx); |
| 4209 | acceptable_cipher = false; |
| 4210 | goto end; |
| 4211 | } |
| 4212 | /* Check - Is requested unicast Cipher supported by the BSS. */ |
| 4213 | acceptable_cipher = csr_match_wapi_oui_index(mac_ctx, |
| 4214 | wapi_ie->unicast_cipher_suites, |
| 4215 | c_ucast_cipher, wapioui_idx, unicast); |
| 4216 | if (!acceptable_cipher) |
| 4217 | goto end; |
| 4218 | |
| 4219 | /* unicast is supported. Pick the first matching Group cipher, if any */ |
| 4220 | for (i = 0; i < mc_encryption->numEntries; i++) { |
| 4221 | wapioui_idx = csr_get_oui_index_from_cipher( |
| 4222 | mc_encryption->encryptionType[i]); |
| 4223 | if (wapioui_idx >= CSR_OUI_WAPI_WAI_MAX_INDEX) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 4224 | sme_err("Wapi OUI index = %d out of limit", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4225 | wapioui_idx); |
| 4226 | acceptable_cipher = false; |
| 4227 | break; |
| 4228 | } |
| 4229 | acceptable_cipher = csr_match_wapi_oui_index(mac_ctx, |
| 4230 | mccipher_arr, c_mcast_cipher, |
| 4231 | wapioui_idx, multicast); |
| 4232 | if (acceptable_cipher) |
| 4233 | break; |
| 4234 | } |
| 4235 | if (!acceptable_cipher) |
| 4236 | goto end; |
| 4237 | |
| 4238 | if (negotiated_mccipher) |
| 4239 | *negotiated_mccipher = |
| 4240 | mc_encryption->encryptionType[i]; |
| 4241 | |
| 4242 | /* |
| 4243 | * Ciphers are supported, Match authentication algorithm and |
| 4244 | * pick first matching authtype |
| 4245 | */ |
| 4246 | if (csr_is_auth_wapi_cert |
| 4247 | (mac_ctx, authsuites, c_auth_suites, authentication)) { |
| 4248 | neg_authtype = |
| 4249 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 4250 | } else if (csr_is_auth_wapi_psk(mac_ctx, authsuites, |
| 4251 | c_auth_suites, authentication)) { |
| 4252 | neg_authtype = eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 4253 | } else { |
| 4254 | acceptable_cipher = false; |
| 4255 | neg_authtype = eCSR_AUTH_TYPE_UNKNOWN; |
| 4256 | } |
| 4257 | |
| 4258 | /* Caller doesn't care about auth type, or BSS doesn't match */ |
| 4259 | if ((0 == auth_type->numEntries) || (false == acceptable_cipher)) |
| 4260 | goto end; |
| 4261 | |
| 4262 | acceptable_cipher = false; |
| 4263 | for (i = 0; i < auth_type->numEntries; i++) { |
| 4264 | if (auth_type->authType[i] == neg_authtype) { |
| 4265 | acceptable_cipher = true; |
| 4266 | break; |
| 4267 | } |
| 4268 | } |
| 4269 | |
| 4270 | end: |
| 4271 | if (acceptable_cipher) { |
| 4272 | if (mcast_cipher) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4273 | qdf_mem_copy(mcast_cipher, multicast, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4274 | CSR_WAPI_OUI_SIZE); |
| 4275 | if (ucast_cipher) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4276 | qdf_mem_copy(ucast_cipher, unicast, CSR_WAPI_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4277 | if (auth_suite) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4278 | qdf_mem_copy(auth_suite, authentication, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4279 | CSR_WAPI_OUI_SIZE); |
| 4280 | if (negotiated_authtype) |
| 4281 | *negotiated_authtype = neg_authtype; |
| 4282 | } |
| 4283 | return acceptable_cipher; |
| 4284 | } |
| 4285 | |
Jeff Johnson | 0589eec | 2018-06-10 16:40:10 -0700 | [diff] [blame] | 4286 | static bool csr_is_wapi_match(tpAniSirGlobal mac_ctx, tCsrAuthList *pAuthType, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4287 | eCsrEncryptionType enType, |
| 4288 | tCsrEncryptionList *pEnMcType, |
| 4289 | tDot11fBeaconIEs *pIes, |
| 4290 | eCsrAuthType *pNegotiatedAuthType, |
| 4291 | eCsrEncryptionType *pNegotiatedMCCipher) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | { |
| 4293 | bool fWapiMatch = false; |
| 4294 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4295 | /* See if the cyphers in the Bss description match with the |
| 4296 | * settings in the profile. |
| 4297 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4298 | fWapiMatch = |
Jeff Johnson | 0589eec | 2018-06-10 16:40:10 -0700 | [diff] [blame] | 4299 | csr_get_wapi_information(mac_ctx, pAuthType, enType, pEnMcType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4300 | &pIes->WAPI, NULL, NULL, NULL, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4301 | pNegotiatedAuthType, |
| 4302 | pNegotiatedMCCipher); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4303 | |
| 4304 | return fWapiMatch; |
| 4305 | } |
| 4306 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4307 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4308 | static bool csr_lookup_bkid(tpAniSirGlobal pMac, uint32_t sessionId, |
| 4309 | uint8_t *pBSSId, uint8_t *pBKId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4310 | { |
| 4311 | bool fRC = false, fMatchFound = false; |
| 4312 | uint32_t Index; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 4313 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4314 | |
| 4315 | if (!pSession) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 4316 | sme_err("session %d not found", sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4317 | return false; |
| 4318 | } |
| 4319 | |
| 4320 | do { |
| 4321 | for (Index = 0; Index < pSession->NumBkidCache; Index++) { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 4322 | sme_debug("match BKID " MAC_ADDRESS_STR " to ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4323 | MAC_ADDR_ARRAY(pBSSId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4324 | if (!qdf_mem_cmp |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4325 | (pBSSId, pSession->BkidCacheInfo[Index].BSSID.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4326 | sizeof(struct qdf_mac_addr))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4327 | /* match found */ |
| 4328 | fMatchFound = true; |
| 4329 | break; |
| 4330 | } |
| 4331 | } |
| 4332 | |
| 4333 | if (!fMatchFound) |
| 4334 | break; |
| 4335 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4336 | qdf_mem_copy(pBKId, pSession->BkidCacheInfo[Index].BKID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4337 | CSR_WAPI_BKID_SIZE); |
| 4338 | |
| 4339 | fRC = true; |
| 4340 | } while (0); |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 4341 | sme_debug( |
Srinivas Girigowda | 09625b0 | 2018-09-10 15:28:09 -0700 | [diff] [blame] | 4342 | "return match = %d pMac->roam.NumBkidCache = %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4343 | fRC, pSession->NumBkidCache); |
| 4344 | |
| 4345 | return fRC; |
| 4346 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4347 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4348 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4349 | #ifdef WLAN_CONV_CRYPTO_IE_SUPPORT |
| 4350 | uint8_t csr_construct_wapi_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
| 4351 | struct csr_roam_profile *pProfile, |
| 4352 | tSirBssDescription *pSirBssDesc, |
| 4353 | tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe) |
| 4354 | { |
| 4355 | struct wlan_objmgr_vdev *vdev; |
| 4356 | uint8_t *wapi_ie_end = NULL; |
| 4357 | uint8_t *wapi_ie = (uint8_t *)pWapiIe; |
| 4358 | uint8_t ie_len = 0; |
| 4359 | |
| 4360 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(pMac->psoc, sessionId, |
| 4361 | WLAN_LEGACY_SME_ID); |
| 4362 | if (!vdev) { |
| 4363 | sme_err("Invalid vdev"); |
| 4364 | return ie_len; |
| 4365 | } |
| 4366 | wapi_ie_end = wlan_crypto_build_wapiie(vdev, wapi_ie); |
| 4367 | if (wapi_ie_end) |
| 4368 | ie_len = wapi_ie_end - wapi_ie; |
| 4369 | |
| 4370 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID); |
| 4371 | |
| 4372 | return ie_len; |
| 4373 | } |
| 4374 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4375 | uint8_t csr_construct_wapi_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 4376 | struct csr_roam_profile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4377 | tSirBssDescription *pSirBssDesc, |
| 4378 | tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe) |
| 4379 | { |
| 4380 | bool fWapiMatch = false; |
| 4381 | uint8_t cbWapiIe = 0; |
| 4382 | uint8_t UnicastCypher[CSR_WAPI_OUI_SIZE]; |
| 4383 | uint8_t MulticastCypher[CSR_WAPI_OUI_SIZE]; |
| 4384 | uint8_t AuthSuite[CSR_WAPI_OUI_SIZE]; |
| 4385 | uint8_t BKId[CSR_WAPI_BKID_SIZE]; |
| 4386 | uint8_t *pWapi = NULL; |
| 4387 | bool fBKIDFound = false; |
| 4388 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 4389 | |
| 4390 | do { |
| 4391 | if (!csr_is_profile_wapi(pProfile)) |
| 4392 | break; |
| 4393 | |
| 4394 | if (!pIesLocal |
| 4395 | && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4396 | (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4397 | (csr_get_parsed_bss_description_ies |
| 4398 | (pMac, pSirBssDesc, &pIesLocal)))) { |
| 4399 | break; |
| 4400 | } |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4401 | /* See if the cyphers in the Bss description match with the |
| 4402 | * settings in the profile. |
| 4403 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4404 | fWapiMatch = |
| 4405 | csr_get_wapi_information(pMac, &pProfile->AuthType, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4406 | pProfile->negotiatedUCEncryptionType, |
| 4407 | &pProfile->mcEncryptionType, |
| 4408 | &pIesLocal->WAPI, UnicastCypher, |
| 4409 | MulticastCypher, AuthSuite, NULL, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4410 | NULL); |
| 4411 | if (!fWapiMatch) |
| 4412 | break; |
| 4413 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4414 | qdf_mem_set(pWapiIe, sizeof(tCsrWapiIe), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4415 | |
| 4416 | pWapiIe->IeHeader.ElementID = DOT11F_EID_WAPI; |
| 4417 | |
| 4418 | pWapiIe->Version = CSR_WAPI_VERSION_SUPPORTED; |
| 4419 | |
| 4420 | pWapiIe->cAuthenticationSuites = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4421 | qdf_mem_copy(&pWapiIe->AuthOui[0], AuthSuite, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4422 | sizeof(AuthSuite)); |
| 4423 | |
| 4424 | pWapi = (uint8_t *) (&pWapiIe->AuthOui[1]); |
| 4425 | |
| 4426 | *pWapi = (uint16_t) 1; /* cUnicastCyphers */ |
| 4427 | pWapi += 2; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4428 | qdf_mem_copy(pWapi, UnicastCypher, sizeof(UnicastCypher)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4429 | pWapi += sizeof(UnicastCypher); |
| 4430 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4431 | qdf_mem_copy(pWapi, MulticastCypher, sizeof(MulticastCypher)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4432 | pWapi += sizeof(MulticastCypher); |
| 4433 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4434 | /* WAPI capabilities follows the Auth Suite (two octects) |
| 4435 | * we shouldn't EVER be sending out "pre-auth supported". |
| 4436 | * It is an AP only capability & since we already did a memset |
| 4437 | * pWapiIe to 0, skip these fields |
| 4438 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4439 | pWapi += 2; |
| 4440 | |
| 4441 | fBKIDFound = |
| 4442 | csr_lookup_bkid(pMac, sessionId, pSirBssDesc->bssId, |
| 4443 | &(BKId[0])); |
| 4444 | |
| 4445 | if (fBKIDFound) { |
| 4446 | /* Do we need to change the endianness here */ |
| 4447 | *pWapi = (uint16_t) 1; /* cBKIDs */ |
| 4448 | pWapi += 2; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4449 | qdf_mem_copy(pWapi, BKId, CSR_WAPI_BKID_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4450 | } else { |
| 4451 | *pWapi = 0; |
| 4452 | pWapi += 1; |
| 4453 | *pWapi = 0; |
| 4454 | pWapi += 1; |
| 4455 | } |
| 4456 | |
| 4457 | /* Add in the IE fields except the IE header */ |
| 4458 | /* Add BKID count and BKID (if any) */ |
| 4459 | pWapiIe->IeHeader.Length = |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4460 | (uint8_t) (sizeof(*pWapiIe) - |
| 4461 | sizeof(pWapiIe->IeHeader)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4462 | |
| 4463 | /*2 bytes for BKID Count field */ |
| 4464 | pWapiIe->IeHeader.Length += sizeof(uint16_t); |
| 4465 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4466 | if (fBKIDFound) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4467 | pWapiIe->IeHeader.Length += CSR_WAPI_BKID_SIZE; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4468 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4469 | /* return the size of the IE header (total) constructed... */ |
| 4470 | cbWapiIe = pWapiIe->IeHeader.Length + sizeof(pWapiIe->IeHeader); |
| 4471 | |
| 4472 | } while (0); |
| 4473 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4474 | if (!pIes && pIesLocal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | /* locally allocated */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4476 | qdf_mem_free(pIesLocal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4477 | |
| 4478 | return cbWapiIe; |
| 4479 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4480 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | #endif /* FEATURE_WLAN_WAPI */ |
| 4482 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4483 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4484 | /** |
| 4485 | * csr_get_wpa_cyphers() - to get WPA cipher info |
| 4486 | * @mac_ctx: pointer to mac context |
| 4487 | * @auth_type: auth type |
| 4488 | * @encr_type: encryption type |
| 4489 | * @mc_encryption: multicast encryption type |
| 4490 | * @wpa_ie: pointer to WPA IE |
| 4491 | * @ucast_cipher: Unicast cipher |
| 4492 | * @mcast_cipher: Multicast cipher |
| 4493 | * @auth_suite: Authentication suite |
| 4494 | * @negotiated_authtype: Negotiated auth type |
| 4495 | * @negotiated_mccipher: negotiated multicast cipher |
| 4496 | * |
| 4497 | * This routine will get all WPA information |
| 4498 | * |
| 4499 | * Return: bool |
| 4500 | */ |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4501 | static bool csr_get_wpa_cyphers(tpAniSirGlobal mac_ctx, tCsrAuthList *auth_type, |
| 4502 | eCsrEncryptionType encr_type, |
| 4503 | tCsrEncryptionList *mc_encryption, |
| 4504 | tDot11fIEWPA *wpa_ie, uint8_t *ucast_cipher, |
| 4505 | uint8_t *mcast_cipher, uint8_t *auth_suite, |
| 4506 | eCsrAuthType *negotiated_authtype, |
| 4507 | eCsrEncryptionType *negotiated_mccipher) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4508 | { |
| 4509 | bool acceptable_cipher = false; |
| 4510 | uint8_t c_ucast_cipher = 0; |
| 4511 | uint8_t c_mcast_cipher = 0; |
| 4512 | uint8_t c_auth_suites = 0; |
| 4513 | uint8_t unicast[CSR_WPA_OUI_SIZE]; |
| 4514 | uint8_t multicast[CSR_WPA_OUI_SIZE]; |
| 4515 | uint8_t authentication[CSR_WPA_OUI_SIZE]; |
| 4516 | uint8_t mccipher_arr[1][CSR_WPA_OUI_SIZE]; |
| 4517 | uint8_t i; |
Varun Reddy Yeturu | a863ec2 | 2017-08-02 16:47:51 -0700 | [diff] [blame] | 4518 | uint8_t index; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4519 | eCsrAuthType neg_authtype = eCSR_AUTH_TYPE_UNKNOWN; |
| 4520 | |
| 4521 | if (!wpa_ie->present) |
| 4522 | goto end; |
| 4523 | c_mcast_cipher = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4524 | qdf_mem_copy(mccipher_arr, wpa_ie->multicast_cipher, CSR_WPA_OUI_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4525 | c_ucast_cipher = (uint8_t) (wpa_ie->unicast_cipher_count); |
| 4526 | c_auth_suites = (uint8_t) (wpa_ie->auth_suite_count); |
| 4527 | |
Varun Reddy Yeturu | a863ec2 | 2017-08-02 16:47:51 -0700 | [diff] [blame] | 4528 | /* |
| 4529 | * csr_match_wpaoui_index will provide the index of the |
| 4530 | * array csr_wpa_oui to be read and determine if it is |
| 4531 | * accepatable cipher or not. Below check ensures that |
| 4532 | * the index will not be out of range of the array size. |
| 4533 | */ |
| 4534 | index = csr_get_oui_index_from_cipher(encr_type); |
| 4535 | if (!(index < (sizeof(csr_wpa_oui)/CSR_WPA_OUI_SIZE))) { |
| 4536 | sme_debug("Unacceptable index: %d", index); |
| 4537 | goto end; |
| 4538 | } |
| 4539 | |
| 4540 | sme_debug("kw_dbg: index: %d", index); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4541 | /* Check - Is requested unicast Cipher supported by the BSS. */ |
| 4542 | acceptable_cipher = csr_match_wpaoui_index(mac_ctx, |
| 4543 | wpa_ie->unicast_ciphers, c_ucast_cipher, |
Varun Reddy Yeturu | a863ec2 | 2017-08-02 16:47:51 -0700 | [diff] [blame] | 4544 | index, unicast); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4545 | if (!acceptable_cipher) |
| 4546 | goto end; |
| 4547 | /* unicast is supported. Pick the first matching Group cipher, if any */ |
| 4548 | for (i = 0; i < mc_encryption->numEntries; i++) { |
Varun Reddy Yeturu | a863ec2 | 2017-08-02 16:47:51 -0700 | [diff] [blame] | 4549 | index = csr_get_oui_index_from_cipher( |
| 4550 | mc_encryption->encryptionType[i]); |
| 4551 | sme_debug("kw_dbg: index: %d", index); |
| 4552 | if (!(index < (sizeof(csr_wpa_oui)/CSR_WPA_OUI_SIZE))) { |
| 4553 | sme_debug("Unacceptable MC index: %d", index); |
| 4554 | acceptable_cipher = false; |
| 4555 | continue; |
| 4556 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4557 | acceptable_cipher = csr_match_wpaoui_index(mac_ctx, |
| 4558 | mccipher_arr, c_mcast_cipher, |
Varun Reddy Yeturu | a863ec2 | 2017-08-02 16:47:51 -0700 | [diff] [blame] | 4559 | index, multicast); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4560 | if (acceptable_cipher) |
| 4561 | break; |
| 4562 | } |
| 4563 | if (!acceptable_cipher) |
| 4564 | goto end; |
| 4565 | |
| 4566 | if (negotiated_mccipher) |
| 4567 | *negotiated_mccipher = mc_encryption->encryptionType[i]; |
| 4568 | |
| 4569 | /* Initializing with false as it has true value already */ |
| 4570 | acceptable_cipher = false; |
| 4571 | for (i = 0; i < auth_type->numEntries; i++) { |
| 4572 | /* |
| 4573 | * Ciphers are supported, Match authentication algorithm and |
| 4574 | * pick first matching authtype |
| 4575 | */ |
| 4576 | if (csr_is_auth_wpa(mac_ctx, wpa_ie->auth_suites, c_auth_suites, |
| 4577 | authentication)) { |
| 4578 | if (eCSR_AUTH_TYPE_WPA == auth_type->authType[i]) |
| 4579 | neg_authtype = eCSR_AUTH_TYPE_WPA; |
| 4580 | } |
| 4581 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) && |
| 4582 | csr_is_auth_wpa_psk(mac_ctx, |
| 4583 | wpa_ie->auth_suites, c_auth_suites, |
| 4584 | authentication)) { |
| 4585 | if (eCSR_AUTH_TYPE_WPA_PSK == auth_type->authType[i]) |
| 4586 | neg_authtype = eCSR_AUTH_TYPE_WPA_PSK; |
| 4587 | } |
| 4588 | #ifdef FEATURE_WLAN_ESE |
| 4589 | if ((neg_authtype == eCSR_AUTH_TYPE_UNKNOWN) |
| 4590 | && csr_is_ese_cckm_auth_wpa(mac_ctx, |
| 4591 | wpa_ie->auth_suites, c_auth_suites, |
| 4592 | authentication)) { |
| 4593 | if (eCSR_AUTH_TYPE_CCKM_WPA == auth_type->authType[i]) |
| 4594 | neg_authtype = eCSR_AUTH_TYPE_CCKM_WPA; |
| 4595 | } |
| 4596 | #endif /* FEATURE_WLAN_ESE */ |
| 4597 | |
| 4598 | /* |
| 4599 | * The 1st auth type in the APs WPA IE, to match stations |
| 4600 | * connecting profiles auth type will cause us to exit this |
| 4601 | * loop. This is added as some APs advertise multiple akms in |
| 4602 | * the WPA IE |
| 4603 | */ |
| 4604 | if (eCSR_AUTH_TYPE_UNKNOWN != neg_authtype) { |
| 4605 | acceptable_cipher = true; |
| 4606 | break; |
| 4607 | } |
| 4608 | } |
| 4609 | |
| 4610 | end: |
| 4611 | if (acceptable_cipher) { |
| 4612 | if (mcast_cipher) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4613 | qdf_mem_copy((uint8_t **) mcast_cipher, multicast, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4614 | CSR_WPA_OUI_SIZE); |
| 4615 | |
| 4616 | if (ucast_cipher) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4617 | qdf_mem_copy((uint8_t **) ucast_cipher, unicast, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | CSR_WPA_OUI_SIZE); |
| 4619 | |
| 4620 | if (auth_suite) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4621 | qdf_mem_copy((uint8_t **) auth_suite, authentication, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4622 | CSR_WPA_OUI_SIZE); |
| 4623 | |
| 4624 | if (negotiated_authtype) |
| 4625 | *negotiated_authtype = neg_authtype; |
| 4626 | } |
| 4627 | |
| 4628 | return acceptable_cipher; |
| 4629 | } |
| 4630 | |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4631 | static bool csr_is_wpa_encryption_match(tpAniSirGlobal pMac, |
| 4632 | tCsrAuthList *pAuthType, |
| 4633 | eCsrEncryptionType enType, |
| 4634 | tCsrEncryptionList *pEnMcType, |
| 4635 | tDot11fBeaconIEs *pIes, |
| 4636 | eCsrAuthType *pNegotiatedAuthtype, |
| 4637 | eCsrEncryptionType *pNegotiatedMCCipher) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4638 | { |
| 4639 | bool fWpaMatch = false; |
| 4640 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4641 | /* See if the cyphers in the Bss description match with the |
| 4642 | * settings in the profile. |
| 4643 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4644 | fWpaMatch = |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4645 | csr_get_wpa_cyphers(pMac, pAuthType, enType, pEnMcType, |
| 4646 | &pIes->WPA, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4647 | NULL, NULL, NULL, pNegotiatedAuthtype, |
| 4648 | pNegotiatedMCCipher); |
| 4649 | |
| 4650 | return fWpaMatch; |
| 4651 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4652 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4653 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4654 | #ifdef WLAN_CONV_CRYPTO_IE_SUPPORT |
| 4655 | uint8_t csr_construct_wpa_ie(tpAniSirGlobal pMac, uint8_t session_id, |
| 4656 | struct csr_roam_profile *pProfile, |
| 4657 | tSirBssDescription *pSirBssDesc, |
| 4658 | tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe) |
| 4659 | { |
| 4660 | struct wlan_objmgr_vdev *vdev; |
| 4661 | uint8_t *wpa_ie_end = NULL; |
| 4662 | uint8_t *wpa_ie = (uint8_t *)pWpaIe; |
| 4663 | uint8_t ie_len = 0; |
| 4664 | |
| 4665 | vdev = wlan_objmgr_get_vdev_by_id_from_psoc(pMac->psoc, session_id, |
| 4666 | WLAN_LEGACY_SME_ID); |
| 4667 | if (!vdev) { |
| 4668 | sme_err("Invalid vdev"); |
| 4669 | return ie_len; |
| 4670 | } |
| 4671 | wpa_ie_end = wlan_crypto_build_wpaie(vdev, wpa_ie); |
| 4672 | if (wpa_ie_end) |
| 4673 | ie_len = wpa_ie_end - wpa_ie; |
| 4674 | |
| 4675 | wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID); |
| 4676 | |
| 4677 | return ie_len; |
| 4678 | } |
| 4679 | #else |
| 4680 | uint8_t csr_construct_wpa_ie(tpAniSirGlobal pMac, uint8_t session_id, |
Jeff Johnson | a6a191a | 2018-06-03 19:25:33 -0700 | [diff] [blame] | 4681 | struct csr_roam_profile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4682 | tSirBssDescription *pSirBssDesc, |
| 4683 | tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe) |
| 4684 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4685 | bool fWpaMatch; |
| 4686 | uint8_t cbWpaIe = 0; |
| 4687 | uint8_t UnicastCypher[CSR_WPA_OUI_SIZE]; |
| 4688 | uint8_t MulticastCypher[CSR_WPA_OUI_SIZE]; |
| 4689 | uint8_t AuthSuite[CSR_WPA_OUI_SIZE]; |
| 4690 | tCsrWpaAuthIe *pAuthSuite; |
| 4691 | tDot11fBeaconIEs *pIesLocal = pIes; |
| 4692 | |
| 4693 | do { |
| 4694 | if (!csr_is_profile_wpa(pProfile)) |
| 4695 | break; |
| 4696 | |
| 4697 | if (!pIesLocal |
| 4698 | && |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4699 | (!QDF_IS_STATUS_SUCCESS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4700 | (csr_get_parsed_bss_description_ies |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4701 | (pMac, pSirBssDesc, &pIesLocal)))) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4702 | break; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4703 | /* See if the cyphers in the Bss description match with the |
| 4704 | * settings in the profile. |
| 4705 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4706 | fWpaMatch = |
Jeff Johnson | a6a191a | 2018-06-03 19:25:33 -0700 | [diff] [blame] | 4707 | csr_get_wpa_cyphers(pMac, &pProfile->AuthType, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4708 | pProfile->negotiatedUCEncryptionType, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4709 | &pProfile->mcEncryptionType, |
| 4710 | &pIesLocal->WPA, UnicastCypher, |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4711 | MulticastCypher, AuthSuite, NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4712 | if (!fWpaMatch) |
| 4713 | break; |
| 4714 | |
| 4715 | pWpaIe->IeHeader.ElementID = SIR_MAC_WPA_EID; |
| 4716 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4717 | qdf_mem_copy(pWpaIe->Oui, csr_wpa_oui[01], sizeof(pWpaIe->Oui)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4718 | |
| 4719 | pWpaIe->Version = CSR_WPA_VERSION_SUPPORTED; |
| 4720 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4721 | qdf_mem_copy(pWpaIe->MulticastOui, MulticastCypher, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4722 | sizeof(MulticastCypher)); |
| 4723 | |
| 4724 | pWpaIe->cUnicastCyphers = 1; |
| 4725 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4726 | qdf_mem_copy(&pWpaIe->UnicastOui[0], UnicastCypher, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4727 | sizeof(UnicastCypher)); |
| 4728 | |
| 4729 | pAuthSuite = |
| 4730 | (tCsrWpaAuthIe *) (&pWpaIe-> |
| 4731 | UnicastOui[pWpaIe->cUnicastCyphers]); |
| 4732 | |
| 4733 | pAuthSuite->cAuthenticationSuites = 1; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4734 | qdf_mem_copy(&pAuthSuite->AuthOui[0], AuthSuite, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4735 | sizeof(AuthSuite)); |
| 4736 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4737 | /* The WPA capabilities follows the Auth Suite (two octects)- |
| 4738 | * this field is optional, and we always "send" zero, so just |
| 4739 | * remove it. This is consistent with our assumptions in the |
| 4740 | * frames compiler; c.f. bug 15234: |
| 4741 | * http://gold.woodsidenet.com/bugzilla/show_bug.cgi?id=15234 |
| 4742 | * Add in the fixed fields plus 1 Unicast cypher, less the IE |
| 4743 | * Header length Add in the size of the Auth suite (count plus |
| 4744 | * a single OUI) |
| 4745 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4746 | pWpaIe->IeHeader.Length = |
| 4747 | sizeof(*pWpaIe) - sizeof(pWpaIe->IeHeader) + |
| 4748 | sizeof(*pAuthSuite); |
| 4749 | |
| 4750 | /* return the size of the IE header (total) constructed... */ |
| 4751 | cbWpaIe = pWpaIe->IeHeader.Length + sizeof(pWpaIe->IeHeader); |
| 4752 | |
| 4753 | } while (0); |
| 4754 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4755 | if (!pIes && pIesLocal) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4756 | /* locally allocated */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4757 | qdf_mem_free(pIesLocal); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4758 | |
| 4759 | return cbWpaIe; |
| 4760 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4761 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4762 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4763 | /* If a WPAIE exists in the profile, just use it. Or else construct |
| 4764 | * one from the BSS Caller allocated memory for pWpaIe and guarrantee |
| 4765 | * it can contain a max length WPA IE |
| 4766 | */ |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4767 | uint8_t csr_retrieve_wpa_ie(tpAniSirGlobal pMac, uint8_t session_id, |
Jeff Johnson | 17c7fbf | 2018-06-03 19:33:51 -0700 | [diff] [blame] | 4768 | struct csr_roam_profile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4769 | tSirBssDescription *pSirBssDesc, |
| 4770 | tDot11fBeaconIEs *pIes, tCsrWpaIe *pWpaIe) |
| 4771 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4772 | uint8_t cbWpaIe = 0; |
| 4773 | |
| 4774 | do { |
| 4775 | if (!csr_is_profile_wpa(pProfile)) |
| 4776 | break; |
| 4777 | if (pProfile->nWPAReqIELength && pProfile->pWPAReqIE) { |
Naveen Rawat | b88d73e | 2016-11-17 11:43:11 -0800 | [diff] [blame] | 4778 | if (pProfile->nWPAReqIELength <= |
| 4779 | DOT11F_IE_RSN_MAX_LEN) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4780 | cbWpaIe = (uint8_t) pProfile->nWPAReqIELength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4781 | qdf_mem_copy(pWpaIe, pProfile->pWPAReqIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4782 | cbWpaIe); |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4783 | } else { |
| 4784 | sme_warn("Invalid WPA IE length %d", |
| 4785 | pProfile->nWPAReqIELength); |
| 4786 | } |
| 4787 | break; |
| 4788 | } |
| 4789 | cbWpaIe = csr_construct_wpa_ie(pMac, session_id, pProfile, |
| 4790 | pSirBssDesc, pIes, pWpaIe); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4791 | } while (0); |
| 4792 | |
| 4793 | return cbWpaIe; |
| 4794 | } |
| 4795 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4796 | /* If a RSNIE exists in the profile, just use it. Or else construct |
| 4797 | * one from the BSS Caller allocated memory for pWpaIe and guarrantee |
| 4798 | * it can contain a max length WPA IE |
| 4799 | */ |
Jeff Johnson | c8f9b67 | 2018-06-03 20:56:41 -0700 | [diff] [blame] | 4800 | uint8_t csr_retrieve_rsn_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 4801 | struct csr_roam_profile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4802 | tSirBssDescription *pSirBssDesc, |
| 4803 | tDot11fBeaconIEs *pIes, tCsrRSNIe *pRsnIe) |
| 4804 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4805 | uint8_t cbRsnIe = 0; |
| 4806 | |
| 4807 | do { |
| 4808 | if (!csr_is_profile_rsn(pProfile)) |
| 4809 | break; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 4810 | /* copy RSNIE from user as it is if test mode is enabled */ |
| 4811 | if (pProfile->force_rsne_override && |
| 4812 | pProfile->nRSNReqIELength && pProfile->pRSNReqIE) { |
| 4813 | sme_debug("force_rsne_override, copy RSN IE provided by user"); |
| 4814 | if (pProfile->nRSNReqIELength <= |
| 4815 | DOT11F_IE_RSN_MAX_LEN) { |
| 4816 | cbRsnIe = (uint8_t) pProfile->nRSNReqIELength; |
| 4817 | qdf_mem_copy(pRsnIe, pProfile->pRSNReqIE, |
| 4818 | cbRsnIe); |
| 4819 | } else { |
Srinivas Girigowda | 09625b0 | 2018-09-10 15:28:09 -0700 | [diff] [blame] | 4820 | sme_warn("Invalid RSN IE length: %d", |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4821 | pProfile->nRSNReqIELength); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 4822 | } |
| 4823 | break; |
| 4824 | } |
bings | 13f45e6 | 2018-08-22 11:24:56 +0800 | [diff] [blame] | 4825 | cbRsnIe = csr_construct_rsn_ie(pMac, sessionId, pProfile, |
| 4826 | pSirBssDesc, pIes, pRsnIe); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4827 | } while (0); |
| 4828 | |
| 4829 | return cbRsnIe; |
| 4830 | } |
| 4831 | |
| 4832 | #ifdef FEATURE_WLAN_WAPI |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 4833 | /* If a WAPI IE exists in the profile, just use it. Or else construct |
| 4834 | * one from the BSS Caller allocated memory for pWapiIe and guarrantee |
| 4835 | * it can contain a max length WAPI IE |
| 4836 | */ |
Jeff Johnson | c276962 | 2018-06-03 21:14:25 -0700 | [diff] [blame] | 4837 | uint8_t csr_retrieve_wapi_ie(tpAniSirGlobal pMac, uint32_t sessionId, |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 4838 | struct csr_roam_profile *pProfile, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | tSirBssDescription *pSirBssDesc, |
| 4840 | tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe) |
| 4841 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | uint8_t cbWapiIe = 0; |
| 4843 | |
| 4844 | do { |
| 4845 | if (!csr_is_profile_wapi(pProfile)) |
| 4846 | break; |
| 4847 | if (pProfile->nWAPIReqIELength && pProfile->pWAPIReqIE) { |
| 4848 | if (DOT11F_IE_WAPI_MAX_LEN >= |
| 4849 | pProfile->nWAPIReqIELength) { |
| 4850 | cbWapiIe = (uint8_t) pProfile->nWAPIReqIELength; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4851 | qdf_mem_copy(pWapiIe, pProfile->pWAPIReqIE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4852 | cbWapiIe); |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4853 | } else { |
| 4854 | sme_warn("Invalid WAPI IE length %d", |
| 4855 | pProfile->nWAPIReqIELength); |
| 4856 | } |
| 4857 | break; |
| 4858 | } |
| 4859 | cbWapiIe = csr_construct_wapi_ie(pMac, sessionId, |
| 4860 | pProfile, pSirBssDesc, |
| 4861 | pIes, pWapiIe); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4862 | } while (0); |
| 4863 | |
| 4864 | return cbWapiIe; |
| 4865 | } |
| 4866 | #endif /* FEATURE_WLAN_WAPI */ |
| 4867 | |
| 4868 | bool csr_rates_is_dot11_rate11b_supported_rate(uint8_t dot11Rate) |
| 4869 | { |
| 4870 | bool fSupported = false; |
| 4871 | uint16_t nonBasicRate = |
| 4872 | (uint16_t) (BITS_OFF(dot11Rate, CSR_DOT11_BASIC_RATE_MASK)); |
| 4873 | |
| 4874 | switch (nonBasicRate) { |
| 4875 | case eCsrSuppRate_1Mbps: |
| 4876 | case eCsrSuppRate_2Mbps: |
| 4877 | case eCsrSuppRate_5_5Mbps: |
| 4878 | case eCsrSuppRate_11Mbps: |
| 4879 | fSupported = true; |
| 4880 | break; |
| 4881 | |
| 4882 | default: |
| 4883 | break; |
| 4884 | } |
| 4885 | |
| 4886 | return fSupported; |
| 4887 | } |
| 4888 | |
| 4889 | bool csr_rates_is_dot11_rate11a_supported_rate(uint8_t dot11Rate) |
| 4890 | { |
| 4891 | bool fSupported = false; |
| 4892 | uint16_t nonBasicRate = |
| 4893 | (uint16_t) (BITS_OFF(dot11Rate, CSR_DOT11_BASIC_RATE_MASK)); |
| 4894 | |
| 4895 | switch (nonBasicRate) { |
| 4896 | case eCsrSuppRate_6Mbps: |
| 4897 | case eCsrSuppRate_9Mbps: |
| 4898 | case eCsrSuppRate_12Mbps: |
| 4899 | case eCsrSuppRate_18Mbps: |
| 4900 | case eCsrSuppRate_24Mbps: |
| 4901 | case eCsrSuppRate_36Mbps: |
| 4902 | case eCsrSuppRate_48Mbps: |
| 4903 | case eCsrSuppRate_54Mbps: |
| 4904 | fSupported = true; |
| 4905 | break; |
| 4906 | |
| 4907 | default: |
| 4908 | break; |
| 4909 | } |
| 4910 | |
| 4911 | return fSupported; |
| 4912 | } |
| 4913 | |
| 4914 | tAniEdType csr_translate_encrypt_type_to_ed_type(eCsrEncryptionType EncryptType) |
| 4915 | { |
| 4916 | tAniEdType edType; |
| 4917 | |
| 4918 | switch (EncryptType) { |
| 4919 | default: |
| 4920 | case eCSR_ENCRYPT_TYPE_NONE: |
| 4921 | edType = eSIR_ED_NONE; |
| 4922 | break; |
| 4923 | |
| 4924 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 4925 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 4926 | edType = eSIR_ED_WEP40; |
| 4927 | break; |
| 4928 | |
| 4929 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 4930 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 4931 | edType = eSIR_ED_WEP104; |
| 4932 | break; |
| 4933 | |
| 4934 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 4935 | edType = eSIR_ED_TKIP; |
| 4936 | break; |
| 4937 | |
| 4938 | case eCSR_ENCRYPT_TYPE_AES: |
| 4939 | edType = eSIR_ED_CCMP; |
| 4940 | break; |
| 4941 | #ifdef FEATURE_WLAN_WAPI |
| 4942 | case eCSR_ENCRYPT_TYPE_WPI: |
| 4943 | edType = eSIR_ED_WPI; |
| 4944 | break; |
| 4945 | #endif |
| 4946 | #ifdef WLAN_FEATURE_11W |
| 4947 | /* 11w BIP */ |
| 4948 | case eCSR_ENCRYPT_TYPE_AES_CMAC: |
| 4949 | edType = eSIR_ED_AES_128_CMAC; |
| 4950 | break; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 4951 | case eCSR_ENCRYPT_TYPE_AES_GCMP: |
| 4952 | edType = eSIR_ED_GCMP; |
| 4953 | break; |
| 4954 | case eCSR_ENCRYPT_TYPE_AES_GCMP_256: |
| 4955 | edType = eSIR_ED_GCMP_256; |
| 4956 | break; |
Padma, Santhosh Kumar | 4117d7a | 2017-12-20 17:39:33 +0530 | [diff] [blame] | 4957 | case eCSR_ENCRYPT_TYPE_AES_GMAC_128: |
| 4958 | edType = eSIR_ED_AES_GMAC_128; |
| 4959 | break; |
| 4960 | case eCSR_ENCRYPT_TYPE_AES_GMAC_256: |
| 4961 | edType = eSIR_ED_AES_GMAC_256; |
| 4962 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4963 | #endif |
| 4964 | } |
| 4965 | |
| 4966 | return edType; |
| 4967 | } |
| 4968 | |
| 4969 | /** |
| 4970 | * csr_validate_wep() - to validate wep |
| 4971 | * @uc_encry_type: unicast encryption type |
| 4972 | * @auth_list: Auth list |
| 4973 | * @mc_encryption_list: multicast encryption type |
| 4974 | * @negotiated_authtype: negotiated auth type |
| 4975 | * @negotiated_mc_encry: negotiated mc encry type |
| 4976 | * @bss_descr: BSS description |
| 4977 | * @ie_ptr: IE pointer |
| 4978 | * |
| 4979 | * This function just checks whether HDD is giving correct values for |
| 4980 | * Multicast cipher and Auth |
| 4981 | * |
| 4982 | * Return: bool |
| 4983 | */ |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4984 | static bool csr_validate_wep(tpAniSirGlobal mac_ctx, |
| 4985 | eCsrEncryptionType uc_encry_type, |
| 4986 | tCsrAuthList *auth_list, |
| 4987 | tCsrEncryptionList *mc_encryption_list, |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 4988 | tSirBssDescription *bss_descr, |
| 4989 | tDot11fBeaconIEs *ie_ptr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4990 | { |
| 4991 | uint32_t idx; |
| 4992 | bool match = false; |
Padma, Santhosh Kumar | 5f42892 | 2017-07-24 12:48:00 +0530 | [diff] [blame] | 4993 | uint8_t oui_index; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4994 | |
| 4995 | /* If privacy bit is not set, consider no match */ |
| 4996 | if (!csr_is_privacy(bss_descr)) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 4997 | return match; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4998 | |
| 4999 | for (idx = 0; idx < mc_encryption_list->numEntries; idx++) { |
| 5000 | switch (mc_encryption_list->encryptionType[idx]) { |
| 5001 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5002 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 5003 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5004 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 5005 | /* |
| 5006 | * Multicast list may contain WEP40/WEP104. |
| 5007 | * Check whether it matches UC. |
| 5008 | */ |
| 5009 | if (uc_encry_type == |
| 5010 | mc_encryption_list->encryptionType[idx]) { |
| 5011 | match = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5012 | } |
| 5013 | break; |
| 5014 | default: |
| 5015 | match = false; |
| 5016 | break; |
| 5017 | } |
| 5018 | if (match) |
| 5019 | break; |
| 5020 | } |
| 5021 | |
| 5022 | if (!match) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5023 | return match; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5024 | |
| 5025 | for (idx = 0; idx < auth_list->numEntries; idx++) { |
| 5026 | switch (auth_list->authType[idx]) { |
| 5027 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5028 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5029 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 5030 | match = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5031 | break; |
| 5032 | default: |
| 5033 | match = false; |
| 5034 | } |
| 5035 | if (match) |
| 5036 | break; |
| 5037 | } |
| 5038 | |
| 5039 | if (!match) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5040 | return match; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5041 | |
| 5042 | if (!ie_ptr) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5043 | return match; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5044 | |
| 5045 | /* |
| 5046 | * In case of WPA / WPA2, check whether it supports WEP as well. |
| 5047 | * Prepare the encryption type for WPA/WPA2 functions |
| 5048 | */ |
| 5049 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == uc_encry_type) |
| 5050 | uc_encry_type = eCSR_ENCRYPT_TYPE_WEP40; |
| 5051 | else if (eCSR_ENCRYPT_TYPE_WEP104 == uc_encry_type) |
| 5052 | uc_encry_type = eCSR_ENCRYPT_TYPE_WEP104; |
| 5053 | |
| 5054 | /* else we can use the encryption type directly */ |
| 5055 | if (ie_ptr->WPA.present) { |
Padma, Santhosh Kumar | 5f42892 | 2017-07-24 12:48:00 +0530 | [diff] [blame] | 5056 | oui_index = csr_get_oui_index_from_cipher(uc_encry_type); |
| 5057 | if (oui_index < QDF_ARRAY_SIZE(csr_wpa_oui)) |
| 5058 | match = (!qdf_mem_cmp(ie_ptr->WPA.multicast_cipher, |
| 5059 | csr_wpa_oui[oui_index], |
| 5060 | CSR_WPA_OUI_SIZE)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5061 | if (match) |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5062 | return match; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5063 | } |
| 5064 | if (ie_ptr->RSN.present) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5065 | match = (!qdf_mem_cmp(ie_ptr->RSN.gp_cipher_suite, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5066 | csr_rsn_oui[csr_get_oui_index_from_cipher( |
| 5067 | uc_encry_type)], |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5068 | CSR_RSN_OUI_SIZE)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5069 | } |
| 5070 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5071 | return match; |
| 5072 | } |
| 5073 | |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5074 | #ifndef WLAN_CONV_CRYPTO_IE_SUPPORT |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5075 | /** |
| 5076 | * csr_validate_open_none() - Check if the security is matching |
| 5077 | * @bss_desc: BSS Descriptor on which the check is done |
| 5078 | * @mc_enc_type: Multicast encryption type |
| 5079 | * @mc_cipher: Multicast Cipher |
| 5080 | * @auth_type: Authentication type |
| 5081 | * @neg_auth_type: Negotiated Auth type with the AP |
| 5082 | * |
| 5083 | * Return: Boolean value to tell if matched or not. |
| 5084 | */ |
| 5085 | static bool csr_validate_open_none(tSirBssDescription *bss_desc, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5086 | tCsrEncryptionList *mc_enc_type, |
| 5087 | tCsrAuthList *auth_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5088 | { |
| 5089 | bool match; |
| 5090 | uint8_t idx; |
| 5091 | |
| 5092 | /* |
| 5093 | * for NO encryption, if the Bss description has the |
| 5094 | * Privacy bit turned on, then encryption is required |
| 5095 | * so we have to reject this Bss. |
| 5096 | */ |
| 5097 | if (csr_is_privacy(bss_desc)) |
| 5098 | match = false; |
| 5099 | else |
| 5100 | match = true; |
| 5101 | if (match) { |
| 5102 | match = false; |
| 5103 | /* Check MC cipher and Auth type requested. */ |
| 5104 | for (idx = 0; idx < mc_enc_type->numEntries; idx++) { |
| 5105 | if (eCSR_ENCRYPT_TYPE_NONE == |
| 5106 | mc_enc_type->encryptionType[idx]) { |
| 5107 | match = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5108 | break; |
| 5109 | } |
| 5110 | } |
| 5111 | if (!match) |
| 5112 | return match; |
| 5113 | |
| 5114 | match = false; |
| 5115 | /* Check Auth list. It should contain AuthOpen. */ |
| 5116 | for (idx = 0; idx < auth_type->numEntries; idx++) { |
| 5117 | if ((eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 5118 | auth_type->authType[idx]) || |
| 5119 | (eCSR_AUTH_TYPE_AUTOSWITCH == |
| 5120 | auth_type->authType[idx])) { |
| 5121 | match = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5122 | break; |
| 5123 | } |
| 5124 | } |
| 5125 | if (!match) |
| 5126 | return match; |
| 5127 | |
| 5128 | } |
| 5129 | return match; |
| 5130 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5131 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5132 | /** |
| 5133 | * csr_validate_any_default() - Check if the security is matching |
Jeff Johnson | c6ab08f | 2018-06-10 16:47:32 -0700 | [diff] [blame] | 5134 | * @mac_ctx: Global MAC context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5135 | * @auth_type: Authentication type |
| 5136 | * @mc_enc_type: Multicast encryption type |
| 5137 | * @mfp_enabled: Management frame protection feature |
Jeff Johnson | 9020f0c | 2018-05-06 08:08:25 -0700 | [diff] [blame] | 5138 | * @mfp_required: Management frame protection mandatory |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5139 | * @mfp_capable: Device capable of MFP |
| 5140 | * @ies_ptr: Pointer to the IE fields |
| 5141 | * @neg_auth_type: Negotiated Auth type with the AP |
| 5142 | * @bss_desc: BSS Descriptor |
| 5143 | * @neg_uc_cipher: Negotiated unicast cipher suite |
| 5144 | * @neg_mc_cipher: Negotiated multicast cipher |
| 5145 | * |
| 5146 | * Return: Boolean value to tell if matched or not. |
| 5147 | */ |
Jeff Johnson | c6ab08f | 2018-06-10 16:47:32 -0700 | [diff] [blame] | 5148 | static bool csr_validate_any_default(tpAniSirGlobal mac_ctx, |
| 5149 | tCsrAuthList *auth_type, |
| 5150 | tCsrEncryptionList *mc_enc_type, |
| 5151 | bool *mfp_enabled, |
| 5152 | uint8_t *mfp_required, |
| 5153 | uint8_t *mfp_capable, |
| 5154 | tDot11fBeaconIEs *ies_ptr, |
| 5155 | eCsrAuthType *neg_auth_type, |
| 5156 | tSirBssDescription *bss_desc, |
| 5157 | eCsrEncryptionType *uc_cipher, |
| 5158 | eCsrEncryptionType *mc_cipher) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5159 | { |
| 5160 | bool match_any = false; |
| 5161 | bool match = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5162 | /* It is allowed to match anything. Try the more secured ones first. */ |
| 5163 | if (ies_ptr) { |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5164 | /* Check GCMP-256 first */ |
| 5165 | *uc_cipher = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Jeff Johnson | 44d0c09 | 2018-06-10 16:02:47 -0700 | [diff] [blame] | 5166 | match_any = csr_is_rsn_match(mac_ctx, auth_type, |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5167 | *uc_cipher, mc_enc_type, mfp_enabled, |
| 5168 | mfp_required, mfp_capable, ies_ptr, |
| 5169 | neg_auth_type, mc_cipher); |
| 5170 | /* Check GCMP second */ |
| 5171 | *uc_cipher = eCSR_ENCRYPT_TYPE_AES_GCMP; |
Jeff Johnson | 44d0c09 | 2018-06-10 16:02:47 -0700 | [diff] [blame] | 5172 | match_any = csr_is_rsn_match(mac_ctx, auth_type, |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5173 | *uc_cipher, mc_enc_type, mfp_enabled, |
| 5174 | mfp_required, mfp_capable, ies_ptr, |
| 5175 | neg_auth_type, mc_cipher); |
| 5176 | /* Check AES third */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5177 | *uc_cipher = eCSR_ENCRYPT_TYPE_AES; |
Jeff Johnson | 44d0c09 | 2018-06-10 16:02:47 -0700 | [diff] [blame] | 5178 | match_any = csr_is_rsn_match(mac_ctx, auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5179 | *uc_cipher, mc_enc_type, mfp_enabled, |
| 5180 | mfp_required, mfp_capable, ies_ptr, |
| 5181 | neg_auth_type, mc_cipher); |
| 5182 | if (!match_any) { |
| 5183 | /* Check TKIP */ |
| 5184 | *uc_cipher = eCSR_ENCRYPT_TYPE_TKIP; |
Jeff Johnson | 44d0c09 | 2018-06-10 16:02:47 -0700 | [diff] [blame] | 5185 | match_any = csr_is_rsn_match(mac_ctx, auth_type, |
| 5186 | *uc_cipher, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5187 | mc_enc_type, mfp_enabled, mfp_required, |
| 5188 | mfp_capable, ies_ptr, neg_auth_type, |
| 5189 | mc_cipher); |
| 5190 | } |
| 5191 | #ifdef FEATURE_WLAN_WAPI |
| 5192 | if (!match_any) { |
| 5193 | /* Check WAPI */ |
| 5194 | *uc_cipher = eCSR_ENCRYPT_TYPE_WPI; |
Jeff Johnson | 0589eec | 2018-06-10 16:40:10 -0700 | [diff] [blame] | 5195 | match_any = csr_is_wapi_match(mac_ctx, auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5196 | *uc_cipher, mc_enc_type, ies_ptr, |
| 5197 | neg_auth_type, mc_cipher); |
| 5198 | } |
| 5199 | #endif |
| 5200 | } |
| 5201 | if (match_any) |
| 5202 | return match; |
| 5203 | *uc_cipher = eCSR_ENCRYPT_TYPE_WEP104; |
| 5204 | if (csr_validate_wep(mac_ctx, *uc_cipher, auth_type, mc_enc_type, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5205 | bss_desc, ies_ptr)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5206 | return match; |
| 5207 | *uc_cipher = eCSR_ENCRYPT_TYPE_WEP40; |
| 5208 | if (csr_validate_wep(mac_ctx, *uc_cipher, auth_type, mc_enc_type, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5209 | bss_desc, ies_ptr)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5210 | return match; |
| 5211 | *uc_cipher = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5212 | if (csr_validate_wep(mac_ctx, *uc_cipher, auth_type, mc_enc_type, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5213 | bss_desc, ies_ptr)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5214 | return match; |
| 5215 | *uc_cipher = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5216 | if (csr_validate_wep(mac_ctx, *uc_cipher, auth_type, mc_enc_type, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5217 | bss_desc, ies_ptr)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5218 | return match; |
| 5219 | /* It must be open and no enc */ |
| 5220 | if (csr_is_privacy(bss_desc)) { |
| 5221 | match = false; |
| 5222 | return match; |
| 5223 | } |
| 5224 | |
| 5225 | *neg_auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5226 | *mc_cipher = eCSR_ENCRYPT_TYPE_NONE; |
| 5227 | *uc_cipher = eCSR_ENCRYPT_TYPE_NONE; |
| 5228 | return match; |
| 5229 | |
| 5230 | } |
| 5231 | |
| 5232 | /** |
| 5233 | * csr_is_security_match() - Check if the security is matching |
Jeff Johnson | ad4e805 | 2018-06-03 21:24:49 -0700 | [diff] [blame] | 5234 | * @mac_ctx: Global MAC context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5235 | * @auth_type: Authentication type |
| 5236 | * @uc_enc_type: Unicast Encryption type |
| 5237 | * @mc_enc_type: Multicast encryption type |
| 5238 | * @mfp_enabled: Management frame protection feature |
Jeff Johnson | 9020f0c | 2018-05-06 08:08:25 -0700 | [diff] [blame] | 5239 | * @mfp_required: Management frame protection mandatory |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5240 | * @mfp_capable: Device capable of MFP |
| 5241 | * @bss_desc: BSS Descriptor |
| 5242 | * @ies_ptr: Pointer to the IE fields |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5243 | * @session_id: Session Id |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5244 | * |
| 5245 | * Return: Boolean value to tell if matched or not. |
| 5246 | */ |
Jeff Johnson | ad4e805 | 2018-06-03 21:24:49 -0700 | [diff] [blame] | 5247 | bool csr_is_security_match(tpAniSirGlobal mac_ctx, tCsrAuthList *auth_type, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5248 | tCsrEncryptionList *uc_enc_type, |
| 5249 | tCsrEncryptionList *mc_enc_type, bool *mfp_enabled, |
| 5250 | uint8_t *mfp_required, uint8_t *mfp_capable, |
| 5251 | tSirBssDescription *bss_desc, |
| 5252 | tDot11fBeaconIEs *ies_ptr, uint8_t session_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5253 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5254 | bool match = false; |
| 5255 | uint8_t i; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5256 | eCsrEncryptionType uc_cipher = eCSR_ENCRYPT_TYPE_UNKNOWN; |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5257 | uint16_t ie_len; |
| 5258 | |
| 5259 | ie_len = (bss_desc->length + sizeof(bss_desc->length) - |
| 5260 | GET_FIELD_OFFSET(tSirBssDescription, ieFields)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5261 | |
| 5262 | for (i = 0; ((i < uc_enc_type->numEntries) && (!match)); i++) { |
| 5263 | uc_cipher = uc_enc_type->encryptionType[i]; |
| 5264 | /* |
| 5265 | * If the Bss description shows the Privacy bit is on, then we |
| 5266 | * must have some sort of encryption configured for the profile |
| 5267 | * to work. Don't attempt to join networks with Privacy bit |
| 5268 | * set when profiles say NONE for encryption type. |
| 5269 | */ |
| 5270 | switch (uc_cipher) { |
| 5271 | case eCSR_ENCRYPT_TYPE_NONE: |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5272 | #ifdef WLAN_CONV_CRYPTO_IE_SUPPORT |
| 5273 | if (csr_is_privacy(bss_desc)) |
| 5274 | return false; |
| 5275 | |
| 5276 | match = wlan_crypto_check_open_none(mac_ctx->psoc, |
| 5277 | session_id); |
| 5278 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5279 | match = csr_validate_open_none(bss_desc, mc_enc_type, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5280 | auth_type); |
| 5281 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5282 | break; |
| 5283 | |
| 5284 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 5285 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5286 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 5287 | case eCSR_ENCRYPT_TYPE_WEP104: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5288 | /* |
| 5289 | * !! might want to check for WEP keys set in the |
| 5290 | * Profile.... ? !! don't need to have the privacy bit |
| 5291 | * in the Bss description. Many AP policies make |
| 5292 | * legacy encryption 'optional' so we don't know if we |
| 5293 | * can associate or not. The AP will reject if |
| 5294 | * encryption is not allowed without the Privacy bit |
| 5295 | * turned on. |
| 5296 | */ |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5297 | #ifdef WLAN_CONV_CRYPTO_IE_SUPPORT |
| 5298 | if (!csr_is_privacy(bss_desc)) |
| 5299 | return false; |
| 5300 | |
| 5301 | match = wlan_crypto_check_wep(mac_ctx->psoc, |
| 5302 | session_id); |
| 5303 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5304 | match = csr_validate_wep(mac_ctx, uc_cipher, auth_type, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5305 | mc_enc_type, bss_desc, |
| 5306 | ies_ptr); |
| 5307 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5308 | |
| 5309 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5310 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 5311 | case eCSR_ENCRYPT_TYPE_AES: |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5312 | case eCSR_ENCRYPT_TYPE_AES_GCMP: |
| 5313 | case eCSR_ENCRYPT_TYPE_AES_GCMP_256: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5314 | if (!ies_ptr) { |
| 5315 | match = false; |
| 5316 | break; |
| 5317 | } |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5318 | #ifdef WLAN_CONV_CRYPTO_IE_SUPPORT |
| 5319 | match = wlan_crypto_check_rsn_match(mac_ctx->psoc, |
| 5320 | session_id, |
| 5321 | (uint8_t *) |
| 5322 | &bss_desc->ieFields, |
| 5323 | ie_len); |
| 5324 | if (match) |
| 5325 | break; |
| 5326 | match = wlan_crypto_check_wpa_match(mac_ctx->psoc, |
| 5327 | session_id, |
| 5328 | (uint8_t *) |
| 5329 | &bss_desc->ieFields, |
| 5330 | ie_len); |
| 5331 | #else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5332 | /* First check if there is a RSN match */ |
| 5333 | match = csr_is_rsn_match(mac_ctx, auth_type, |
| 5334 | uc_cipher, mc_enc_type, |
| 5335 | mfp_enabled, mfp_required, |
| 5336 | mfp_capable, ies_ptr, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5337 | NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5338 | /* If not RSN, then check WPA match */ |
| 5339 | if (!match) |
| 5340 | match = csr_is_wpa_encryption_match( |
| 5341 | mac_ctx, auth_type, |
| 5342 | uc_cipher, mc_enc_type, |
| 5343 | ies_ptr, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5344 | NULL, NULL); |
| 5345 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5346 | break; |
| 5347 | #ifdef FEATURE_WLAN_WAPI |
| 5348 | case eCSR_ENCRYPT_TYPE_WPI: /* WAPI */ |
| 5349 | if (ies_ptr) |
Jeff Johnson | ad4e805 | 2018-06-03 21:24:49 -0700 | [diff] [blame] | 5350 | match = csr_is_wapi_match(mac_ctx, auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5351 | uc_cipher, mc_enc_type, ies_ptr, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5352 | NULL, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5353 | else |
| 5354 | match = false; |
| 5355 | break; |
| 5356 | #endif /* FEATURE_WLAN_WAPI */ |
| 5357 | case eCSR_ENCRYPT_TYPE_ANY: |
| 5358 | default: |
Jeff Johnson | ad4e805 | 2018-06-03 21:24:49 -0700 | [diff] [blame] | 5359 | match = csr_validate_any_default(mac_ctx, auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5360 | mc_enc_type, mfp_enabled, mfp_required, |
| 5361 | mfp_capable, ies_ptr, |
Kiran Kumar Lokere | 4ce4048 | 2018-08-30 16:31:00 -0700 | [diff] [blame] | 5362 | NULL, bss_desc, |
| 5363 | &uc_cipher, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5364 | break; |
| 5365 | } |
| 5366 | |
| 5367 | } |
| 5368 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5369 | return match; |
| 5370 | } |
| 5371 | |
| 5372 | bool csr_is_ssid_match(tpAniSirGlobal pMac, uint8_t *ssid1, uint8_t ssid1Len, |
| 5373 | uint8_t *bssSsid, uint8_t bssSsidLen, bool fSsidRequired) |
| 5374 | { |
| 5375 | bool fMatch = false; |
| 5376 | |
| 5377 | do { |
| 5378 | /* |
| 5379 | * Check for the specification of the Broadcast SSID at the |
| 5380 | * beginning of the list. If specified, then all SSIDs are |
| 5381 | * matches (broadcast SSID means accept all SSIDs). |
| 5382 | */ |
| 5383 | if (ssid1Len == 0) { |
| 5384 | fMatch = true; |
| 5385 | break; |
| 5386 | } |
| 5387 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5388 | /* There are a few special cases. If the Bss description has |
| 5389 | * a Broadcast SSID, then our Profile must have a single SSID |
| 5390 | * without Wildcards so we can program the SSID. |
| 5391 | * |
| 5392 | * SSID could be suppressed in beacons. In that case SSID IE |
| 5393 | * has valid length but the SSID value is all NULL characters. |
| 5394 | * That condition is trated same as NULL SSID |
| 5395 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5396 | if (csr_is_nullssid(bssSsid, bssSsidLen)) { |
| 5397 | if (false == fSsidRequired) { |
| 5398 | fMatch = true; |
| 5399 | break; |
| 5400 | } |
| 5401 | } |
| 5402 | |
| 5403 | if (ssid1Len != bssSsidLen) |
| 5404 | break; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5405 | if (!qdf_mem_cmp(bssSsid, ssid1, bssSsidLen)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5406 | fMatch = true; |
| 5407 | break; |
| 5408 | } |
| 5409 | |
| 5410 | } while (0); |
| 5411 | |
| 5412 | return fMatch; |
| 5413 | } |
| 5414 | |
| 5415 | /* Null ssid means match */ |
Jeff Johnson | b9307a9 | 2018-06-03 11:22:32 -0700 | [diff] [blame] | 5416 | bool csr_is_ssid_in_list(tSirMacSSid *pSsid, tCsrSSIDs *pSsidList) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5417 | { |
| 5418 | bool fMatch = false; |
| 5419 | uint32_t i; |
| 5420 | |
| 5421 | if (pSsidList && pSsid) { |
| 5422 | for (i = 0; i < pSsidList->numOfSSIDs; i++) { |
| 5423 | if (csr_is_nullssid |
| 5424 | (pSsidList->SSIDList[i].SSID.ssId, |
| 5425 | pSsidList->SSIDList[i].SSID.length) |
| 5426 | || |
| 5427 | ((pSsidList->SSIDList[i].SSID.length == |
| 5428 | pSsid->length) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5429 | && (!qdf_mem_cmp(pSsid->ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5430 | pSsidList->SSIDList[i].SSID. |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5431 | ssId, pSsid->length)))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5432 | fMatch = true; |
| 5433 | break; |
| 5434 | } |
| 5435 | } |
| 5436 | } |
| 5437 | |
| 5438 | return fMatch; |
| 5439 | } |
| 5440 | |
Jeff Johnson | 0da6fed | 2018-06-03 11:41:09 -0700 | [diff] [blame] | 5441 | bool csr_is_bssid_match(struct qdf_mac_addr *pProfBssid, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5442 | struct qdf_mac_addr *BssBssid) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5443 | { |
| 5444 | bool fMatch = false; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5445 | struct qdf_mac_addr ProfileBssid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5446 | |
| 5447 | /* for efficiency of the MAC_ADDRESS functions, move the */ |
| 5448 | /* Bssid's into MAC_ADDRESS structs. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5449 | qdf_mem_copy(&ProfileBssid, pProfBssid, sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5450 | |
| 5451 | do { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5452 | /* Give the profile the benefit of the doubt... accept |
| 5453 | * either all 0 or the real broadcast Bssid (all 0xff) |
| 5454 | * as broadcast Bssids (meaning to match any Bssids). |
| 5455 | */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5456 | if (qdf_is_macaddr_zero(&ProfileBssid) || |
| 5457 | qdf_is_macaddr_broadcast(&ProfileBssid)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5458 | fMatch = true; |
| 5459 | break; |
| 5460 | } |
| 5461 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5462 | if (qdf_is_macaddr_equal(BssBssid, &ProfileBssid)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5463 | fMatch = true; |
| 5464 | break; |
| 5465 | } |
| 5466 | |
| 5467 | } while (0); |
| 5468 | |
| 5469 | return fMatch; |
| 5470 | } |
| 5471 | |
| 5472 | bool csr_is_bss_type_match(eCsrRoamBssType bssType1, eCsrRoamBssType bssType2) |
| 5473 | { |
| 5474 | if ((eCSR_BSS_TYPE_ANY != bssType1 && eCSR_BSS_TYPE_ANY != bssType2) |
| 5475 | && (bssType1 != bssType2)) |
| 5476 | return false; |
| 5477 | else |
| 5478 | return true; |
| 5479 | } |
| 5480 | |
| 5481 | bool csr_is_bss_type_ibss(eCsrRoamBssType bssType) |
| 5482 | { |
| 5483 | return (bool) |
| 5484 | (eCSR_BSS_TYPE_START_IBSS == bssType |
| 5485 | || eCSR_BSS_TYPE_IBSS == bssType); |
| 5486 | } |
| 5487 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5488 | /** |
| 5489 | * csr_is_aggregate_rate_supported() - to check if aggregate rate is supported |
| 5490 | * @mac_ctx: pointer to mac context |
| 5491 | * @rate: A rate in units of 500kbps |
| 5492 | * |
| 5493 | * |
| 5494 | * The rate encoding is just as in 802.11 Information Elements, except |
| 5495 | * that the high bit is \em not interpreted as indicating a Basic Rate, |
| 5496 | * and proprietary rates are allowed, too. |
| 5497 | * |
| 5498 | * Note that if the adapter's dot11Mode is g, we don't restrict the |
| 5499 | * rates. According to hwReadEepromParameters, this will happen when: |
| 5500 | * ... the card is configured for ALL bands through the property |
| 5501 | * page. If this occurs, and the card is not an ABG card ,then this |
| 5502 | * code is setting the dot11Mode to assume the mode that the |
| 5503 | * hardware can support. For example, if the card is an 11BG card |
| 5504 | * and we are configured to support ALL bands, then we change the |
| 5505 | * dot11Mode to 11g because ALL in this case is only what the |
| 5506 | * hardware can support. |
| 5507 | * |
| 5508 | * Return: true if the adapter is currently capable of supporting this rate |
| 5509 | */ |
| 5510 | |
| 5511 | static bool csr_is_aggregate_rate_supported(tpAniSirGlobal mac_ctx, |
| 5512 | uint16_t rate) |
| 5513 | { |
| 5514 | bool supported = false; |
| 5515 | uint16_t idx, new_rate; |
| 5516 | |
| 5517 | /* In case basic rate flag is set */ |
| 5518 | new_rate = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK); |
| 5519 | if (eCSR_CFG_DOT11_MODE_11A == |
| 5520 | mac_ctx->roam.configParam.uCfgDot11Mode) { |
| 5521 | switch (new_rate) { |
| 5522 | case eCsrSuppRate_6Mbps: |
| 5523 | case eCsrSuppRate_9Mbps: |
| 5524 | case eCsrSuppRate_12Mbps: |
| 5525 | case eCsrSuppRate_18Mbps: |
| 5526 | case eCsrSuppRate_24Mbps: |
| 5527 | case eCsrSuppRate_36Mbps: |
| 5528 | case eCsrSuppRate_48Mbps: |
| 5529 | case eCsrSuppRate_54Mbps: |
| 5530 | supported = true; |
| 5531 | break; |
| 5532 | default: |
| 5533 | supported = false; |
| 5534 | break; |
| 5535 | } |
| 5536 | |
| 5537 | } else if (eCSR_CFG_DOT11_MODE_11B == |
| 5538 | mac_ctx->roam.configParam.uCfgDot11Mode) { |
| 5539 | switch (new_rate) { |
| 5540 | case eCsrSuppRate_1Mbps: |
| 5541 | case eCsrSuppRate_2Mbps: |
| 5542 | case eCsrSuppRate_5_5Mbps: |
| 5543 | case eCsrSuppRate_11Mbps: |
| 5544 | supported = true; |
| 5545 | break; |
| 5546 | default: |
| 5547 | supported = false; |
| 5548 | break; |
| 5549 | } |
| 5550 | } else if (!mac_ctx->roam.configParam.ProprietaryRatesEnabled) { |
| 5551 | |
| 5552 | switch (new_rate) { |
| 5553 | case eCsrSuppRate_1Mbps: |
| 5554 | case eCsrSuppRate_2Mbps: |
| 5555 | case eCsrSuppRate_5_5Mbps: |
| 5556 | case eCsrSuppRate_6Mbps: |
| 5557 | case eCsrSuppRate_9Mbps: |
| 5558 | case eCsrSuppRate_11Mbps: |
| 5559 | case eCsrSuppRate_12Mbps: |
| 5560 | case eCsrSuppRate_18Mbps: |
| 5561 | case eCsrSuppRate_24Mbps: |
| 5562 | case eCsrSuppRate_36Mbps: |
| 5563 | case eCsrSuppRate_48Mbps: |
| 5564 | case eCsrSuppRate_54Mbps: |
| 5565 | supported = true; |
| 5566 | break; |
| 5567 | default: |
| 5568 | supported = false; |
| 5569 | break; |
| 5570 | } |
| 5571 | } else if (eCsrSuppRate_1Mbps == new_rate || |
| 5572 | eCsrSuppRate_2Mbps == new_rate || |
| 5573 | eCsrSuppRate_5_5Mbps == new_rate || |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5574 | eCsrSuppRate_11Mbps == new_rate) |
| 5575 | supported = true; |
| 5576 | else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5577 | idx = 0x1; |
| 5578 | |
| 5579 | switch (new_rate) { |
| 5580 | case eCsrSuppRate_6Mbps: |
| 5581 | supported = g_phy_rates_suppt[0][idx]; |
| 5582 | break; |
| 5583 | case eCsrSuppRate_9Mbps: |
| 5584 | supported = g_phy_rates_suppt[1][idx]; |
| 5585 | break; |
| 5586 | case eCsrSuppRate_12Mbps: |
| 5587 | supported = g_phy_rates_suppt[2][idx]; |
| 5588 | break; |
| 5589 | case eCsrSuppRate_18Mbps: |
| 5590 | supported = g_phy_rates_suppt[3][idx]; |
| 5591 | break; |
| 5592 | case eCsrSuppRate_20Mbps: |
| 5593 | supported = g_phy_rates_suppt[4][idx]; |
| 5594 | break; |
| 5595 | case eCsrSuppRate_24Mbps: |
| 5596 | supported = g_phy_rates_suppt[5][idx]; |
| 5597 | break; |
| 5598 | case eCsrSuppRate_36Mbps: |
| 5599 | supported = g_phy_rates_suppt[6][idx]; |
| 5600 | break; |
| 5601 | case eCsrSuppRate_40Mbps: |
| 5602 | supported = g_phy_rates_suppt[7][idx]; |
| 5603 | break; |
| 5604 | case eCsrSuppRate_42Mbps: |
| 5605 | supported = g_phy_rates_suppt[8][idx]; |
| 5606 | break; |
| 5607 | case eCsrSuppRate_48Mbps: |
| 5608 | supported = g_phy_rates_suppt[9][idx]; |
| 5609 | break; |
| 5610 | case eCsrSuppRate_54Mbps: |
| 5611 | supported = g_phy_rates_suppt[10][idx]; |
| 5612 | break; |
| 5613 | case eCsrSuppRate_72Mbps: |
| 5614 | supported = g_phy_rates_suppt[11][idx]; |
| 5615 | break; |
| 5616 | case eCsrSuppRate_80Mbps: |
| 5617 | supported = g_phy_rates_suppt[12][idx]; |
| 5618 | break; |
| 5619 | case eCsrSuppRate_84Mbps: |
| 5620 | supported = g_phy_rates_suppt[13][idx]; |
| 5621 | break; |
| 5622 | case eCsrSuppRate_96Mbps: |
| 5623 | supported = g_phy_rates_suppt[14][idx]; |
| 5624 | break; |
| 5625 | case eCsrSuppRate_108Mbps: |
| 5626 | supported = g_phy_rates_suppt[15][idx]; |
| 5627 | break; |
| 5628 | case eCsrSuppRate_120Mbps: |
| 5629 | supported = g_phy_rates_suppt[16][idx]; |
| 5630 | break; |
| 5631 | case eCsrSuppRate_126Mbps: |
| 5632 | supported = g_phy_rates_suppt[17][idx]; |
| 5633 | break; |
| 5634 | case eCsrSuppRate_144Mbps: |
| 5635 | supported = g_phy_rates_suppt[18][idx]; |
| 5636 | break; |
| 5637 | case eCsrSuppRate_160Mbps: |
| 5638 | supported = g_phy_rates_suppt[19][idx]; |
| 5639 | break; |
| 5640 | case eCsrSuppRate_168Mbps: |
| 5641 | supported = g_phy_rates_suppt[20][idx]; |
| 5642 | break; |
| 5643 | case eCsrSuppRate_192Mbps: |
| 5644 | supported = g_phy_rates_suppt[21][idx]; |
| 5645 | break; |
| 5646 | case eCsrSuppRate_216Mbps: |
| 5647 | supported = g_phy_rates_suppt[22][idx]; |
| 5648 | break; |
| 5649 | case eCsrSuppRate_240Mbps: |
| 5650 | supported = g_phy_rates_suppt[23][idx]; |
| 5651 | break; |
| 5652 | default: |
| 5653 | supported = false; |
| 5654 | break; |
| 5655 | } |
| 5656 | } |
| 5657 | return supported; |
| 5658 | } |
| 5659 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5660 | void csr_add_rate_bitmap(uint8_t rate, uint16_t *pRateBitmap) |
| 5661 | { |
| 5662 | uint16_t rateBitmap; |
| 5663 | uint16_t n = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK); |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5664 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5665 | rateBitmap = *pRateBitmap; |
| 5666 | switch (n) { |
| 5667 | case SIR_MAC_RATE_1: |
| 5668 | rateBitmap |= SIR_MAC_RATE_1_BITMAP; |
| 5669 | break; |
| 5670 | case SIR_MAC_RATE_2: |
| 5671 | rateBitmap |= SIR_MAC_RATE_2_BITMAP; |
| 5672 | break; |
| 5673 | case SIR_MAC_RATE_5_5: |
| 5674 | rateBitmap |= SIR_MAC_RATE_5_5_BITMAP; |
| 5675 | break; |
| 5676 | case SIR_MAC_RATE_11: |
| 5677 | rateBitmap |= SIR_MAC_RATE_11_BITMAP; |
| 5678 | break; |
| 5679 | case SIR_MAC_RATE_6: |
| 5680 | rateBitmap |= SIR_MAC_RATE_6_BITMAP; |
| 5681 | break; |
| 5682 | case SIR_MAC_RATE_9: |
| 5683 | rateBitmap |= SIR_MAC_RATE_9_BITMAP; |
| 5684 | break; |
| 5685 | case SIR_MAC_RATE_12: |
| 5686 | rateBitmap |= SIR_MAC_RATE_12_BITMAP; |
| 5687 | break; |
| 5688 | case SIR_MAC_RATE_18: |
| 5689 | rateBitmap |= SIR_MAC_RATE_18_BITMAP; |
| 5690 | break; |
| 5691 | case SIR_MAC_RATE_24: |
| 5692 | rateBitmap |= SIR_MAC_RATE_24_BITMAP; |
| 5693 | break; |
| 5694 | case SIR_MAC_RATE_36: |
| 5695 | rateBitmap |= SIR_MAC_RATE_36_BITMAP; |
| 5696 | break; |
| 5697 | case SIR_MAC_RATE_48: |
| 5698 | rateBitmap |= SIR_MAC_RATE_48_BITMAP; |
| 5699 | break; |
| 5700 | case SIR_MAC_RATE_54: |
| 5701 | rateBitmap |= SIR_MAC_RATE_54_BITMAP; |
| 5702 | break; |
| 5703 | } |
| 5704 | *pRateBitmap = rateBitmap; |
| 5705 | } |
| 5706 | |
| 5707 | bool csr_check_rate_bitmap(uint8_t rate, uint16_t rateBitmap) |
| 5708 | { |
| 5709 | uint16_t n = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK); |
| 5710 | |
| 5711 | switch (n) { |
| 5712 | case SIR_MAC_RATE_1: |
| 5713 | rateBitmap &= SIR_MAC_RATE_1_BITMAP; |
| 5714 | break; |
| 5715 | case SIR_MAC_RATE_2: |
| 5716 | rateBitmap &= SIR_MAC_RATE_2_BITMAP; |
| 5717 | break; |
| 5718 | case SIR_MAC_RATE_5_5: |
| 5719 | rateBitmap &= SIR_MAC_RATE_5_5_BITMAP; |
| 5720 | break; |
| 5721 | case SIR_MAC_RATE_11: |
| 5722 | rateBitmap &= SIR_MAC_RATE_11_BITMAP; |
| 5723 | break; |
| 5724 | case SIR_MAC_RATE_6: |
| 5725 | rateBitmap &= SIR_MAC_RATE_6_BITMAP; |
| 5726 | break; |
| 5727 | case SIR_MAC_RATE_9: |
| 5728 | rateBitmap &= SIR_MAC_RATE_9_BITMAP; |
| 5729 | break; |
| 5730 | case SIR_MAC_RATE_12: |
| 5731 | rateBitmap &= SIR_MAC_RATE_12_BITMAP; |
| 5732 | break; |
| 5733 | case SIR_MAC_RATE_18: |
| 5734 | rateBitmap &= SIR_MAC_RATE_18_BITMAP; |
| 5735 | break; |
| 5736 | case SIR_MAC_RATE_24: |
| 5737 | rateBitmap &= SIR_MAC_RATE_24_BITMAP; |
| 5738 | break; |
| 5739 | case SIR_MAC_RATE_36: |
| 5740 | rateBitmap &= SIR_MAC_RATE_36_BITMAP; |
| 5741 | break; |
| 5742 | case SIR_MAC_RATE_48: |
| 5743 | rateBitmap &= SIR_MAC_RATE_48_BITMAP; |
| 5744 | break; |
| 5745 | case SIR_MAC_RATE_54: |
| 5746 | rateBitmap &= SIR_MAC_RATE_54_BITMAP; |
| 5747 | break; |
| 5748 | } |
| 5749 | return !!rateBitmap; |
| 5750 | } |
| 5751 | |
Jeff Johnson | ed463e1 | 2018-06-03 21:33:33 -0700 | [diff] [blame] | 5752 | bool csr_rates_is_dot11_rate_supported(tpAniSirGlobal mac_ctx, uint8_t rate) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5753 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5754 | uint16_t n = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK); |
| 5755 | |
Jeff Johnson | ed463e1 | 2018-06-03 21:33:33 -0700 | [diff] [blame] | 5756 | return csr_is_aggregate_rate_supported(mac_ctx, n); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5757 | } |
| 5758 | |
Jeff Johnson | 054d028 | 2016-10-07 10:35:54 -0700 | [diff] [blame] | 5759 | static uint16_t csr_rates_mac_prop_to_dot11(uint16_t Rate) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5760 | { |
| 5761 | uint16_t ConvertedRate = Rate; |
| 5762 | |
| 5763 | switch (Rate) { |
| 5764 | case SIR_MAC_RATE_1: |
| 5765 | ConvertedRate = 2; |
| 5766 | break; |
| 5767 | case SIR_MAC_RATE_2: |
| 5768 | ConvertedRate = 4; |
| 5769 | break; |
| 5770 | case SIR_MAC_RATE_5_5: |
| 5771 | ConvertedRate = 11; |
| 5772 | break; |
| 5773 | case SIR_MAC_RATE_11: |
| 5774 | ConvertedRate = 22; |
| 5775 | break; |
| 5776 | |
| 5777 | case SIR_MAC_RATE_6: |
| 5778 | ConvertedRate = 12; |
| 5779 | break; |
| 5780 | case SIR_MAC_RATE_9: |
| 5781 | ConvertedRate = 18; |
| 5782 | break; |
| 5783 | case SIR_MAC_RATE_12: |
| 5784 | ConvertedRate = 24; |
| 5785 | break; |
| 5786 | case SIR_MAC_RATE_18: |
| 5787 | ConvertedRate = 36; |
| 5788 | break; |
| 5789 | case SIR_MAC_RATE_24: |
| 5790 | ConvertedRate = 48; |
| 5791 | break; |
| 5792 | case SIR_MAC_RATE_36: |
| 5793 | ConvertedRate = 72; |
| 5794 | break; |
| 5795 | case SIR_MAC_RATE_42: |
| 5796 | ConvertedRate = 84; |
| 5797 | break; |
| 5798 | case SIR_MAC_RATE_48: |
| 5799 | ConvertedRate = 96; |
| 5800 | break; |
| 5801 | case SIR_MAC_RATE_54: |
| 5802 | ConvertedRate = 108; |
| 5803 | break; |
| 5804 | |
| 5805 | case SIR_MAC_RATE_72: |
| 5806 | ConvertedRate = 144; |
| 5807 | break; |
| 5808 | case SIR_MAC_RATE_84: |
| 5809 | ConvertedRate = 168; |
| 5810 | break; |
| 5811 | case SIR_MAC_RATE_96: |
| 5812 | ConvertedRate = 192; |
| 5813 | break; |
| 5814 | case SIR_MAC_RATE_108: |
| 5815 | ConvertedRate = 216; |
| 5816 | break; |
| 5817 | case SIR_MAC_RATE_126: |
| 5818 | ConvertedRate = 252; |
| 5819 | break; |
| 5820 | case SIR_MAC_RATE_144: |
| 5821 | ConvertedRate = 288; |
| 5822 | break; |
| 5823 | case SIR_MAC_RATE_168: |
| 5824 | ConvertedRate = 336; |
| 5825 | break; |
| 5826 | case SIR_MAC_RATE_192: |
| 5827 | ConvertedRate = 384; |
| 5828 | break; |
| 5829 | case SIR_MAC_RATE_216: |
| 5830 | ConvertedRate = 432; |
| 5831 | break; |
| 5832 | case SIR_MAC_RATE_240: |
| 5833 | ConvertedRate = 480; |
| 5834 | break; |
| 5835 | |
| 5836 | case 0xff: |
| 5837 | ConvertedRate = 0; |
| 5838 | break; |
| 5839 | } |
| 5840 | |
| 5841 | return ConvertedRate; |
| 5842 | } |
| 5843 | |
| 5844 | uint16_t csr_rates_find_best_rate(tSirMacRateSet *pSuppRates, |
| 5845 | tSirMacRateSet *pExtRates, |
| 5846 | tSirMacPropRateSet *pPropRates) |
| 5847 | { |
| 5848 | uint8_t i; |
| 5849 | uint16_t nBest; |
| 5850 | |
| 5851 | nBest = pSuppRates->rate[0] & (~CSR_DOT11_BASIC_RATE_MASK); |
| 5852 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5853 | if (pSuppRates->numRates > SIR_MAC_RATESET_EID_MAX) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5854 | pSuppRates->numRates = SIR_MAC_RATESET_EID_MAX; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5855 | |
| 5856 | for (i = 1U; i < pSuppRates->numRates; ++i) { |
| 5857 | nBest = |
| 5858 | (uint16_t) CSR_MAX(nBest, |
| 5859 | pSuppRates-> |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5860 | rate[i] & (~CSR_DOT11_BASIC_RATE_MASK)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5861 | } |
| 5862 | |
| 5863 | if (NULL != pExtRates) { |
| 5864 | for (i = 0U; i < pExtRates->numRates; ++i) { |
| 5865 | nBest = |
| 5866 | (uint16_t) CSR_MAX(nBest, |
| 5867 | pExtRates-> |
| 5868 | rate[i] & |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5869 | (~CSR_DOT11_BASIC_RATE_MASK)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5870 | } |
| 5871 | } |
| 5872 | |
| 5873 | if (NULL != pPropRates) { |
| 5874 | for (i = 0U; i < pPropRates->numPropRates; ++i) { |
| 5875 | nBest = |
| 5876 | (uint16_t) CSR_MAX(nBest, |
| 5877 | csr_rates_mac_prop_to_dot11 |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5878 | (pPropRates->propRate[i])); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5879 | } |
| 5880 | } |
| 5881 | |
| 5882 | return nBest; |
| 5883 | } |
| 5884 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5885 | #ifdef WLAN_FEATURE_FILS_SK |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 5886 | static inline void csr_free_fils_profile_info(struct csr_roam_profile *profile) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5887 | { |
| 5888 | if (profile->fils_con_info) { |
| 5889 | qdf_mem_free(profile->fils_con_info); |
| 5890 | profile->fils_con_info = NULL; |
| 5891 | } |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 5892 | |
| 5893 | if (profile->hlp_ie) { |
| 5894 | qdf_mem_free(profile->hlp_ie); |
| 5895 | profile->hlp_ie = NULL; |
| 5896 | profile->hlp_ie_len = 0; |
| 5897 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5898 | } |
| 5899 | #else |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 5900 | static inline void csr_free_fils_profile_info(struct csr_roam_profile *profile) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5901 | { } |
| 5902 | #endif |
| 5903 | |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 5904 | void csr_release_profile(tpAniSirGlobal pMac, struct csr_roam_profile *pProfile) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5905 | { |
| 5906 | if (pProfile) { |
| 5907 | if (pProfile->BSSIDs.bssid) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5908 | qdf_mem_free(pProfile->BSSIDs.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5909 | pProfile->BSSIDs.bssid = NULL; |
| 5910 | } |
| 5911 | if (pProfile->SSIDs.SSIDList) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5912 | qdf_mem_free(pProfile->SSIDs.SSIDList); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5913 | pProfile->SSIDs.SSIDList = NULL; |
| 5914 | } |
| 5915 | if (pProfile->pWPAReqIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5916 | qdf_mem_free(pProfile->pWPAReqIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5917 | pProfile->pWPAReqIE = NULL; |
| 5918 | } |
| 5919 | if (pProfile->pRSNReqIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5920 | qdf_mem_free(pProfile->pRSNReqIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5921 | pProfile->pRSNReqIE = NULL; |
| 5922 | } |
| 5923 | #ifdef FEATURE_WLAN_WAPI |
| 5924 | if (pProfile->pWAPIReqIE) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5925 | qdf_mem_free(pProfile->pWAPIReqIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5926 | pProfile->pWAPIReqIE = NULL; |
| 5927 | } |
| 5928 | #endif /* FEATURE_WLAN_WAPI */ |
| 5929 | |
| 5930 | if (pProfile->pAddIEScan) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5931 | qdf_mem_free(pProfile->pAddIEScan); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5932 | pProfile->pAddIEScan = NULL; |
| 5933 | } |
| 5934 | |
| 5935 | if (pProfile->pAddIEAssoc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5936 | qdf_mem_free(pProfile->pAddIEAssoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5937 | pProfile->pAddIEAssoc = NULL; |
| 5938 | } |
| 5939 | if (pProfile->ChannelInfo.ChannelList) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5940 | qdf_mem_free(pProfile->ChannelInfo.ChannelList); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5941 | pProfile->ChannelInfo.ChannelList = NULL; |
| 5942 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5943 | csr_free_fils_profile_info(pProfile); |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 5944 | qdf_mem_set(pProfile, sizeof(struct csr_roam_profile), 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5945 | } |
| 5946 | } |
| 5947 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 5948 | void csr_free_scan_filter(tpAniSirGlobal pMac, tCsrScanResultFilter |
| 5949 | *pScanFilter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5950 | { |
| 5951 | if (pScanFilter->BSSIDs.bssid) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5952 | qdf_mem_free(pScanFilter->BSSIDs.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5953 | pScanFilter->BSSIDs.bssid = NULL; |
| 5954 | } |
| 5955 | if (pScanFilter->ChannelInfo.ChannelList) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5956 | qdf_mem_free(pScanFilter->ChannelInfo.ChannelList); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5957 | pScanFilter->ChannelInfo.ChannelList = NULL; |
| 5958 | } |
| 5959 | if (pScanFilter->SSIDs.SSIDList) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5960 | qdf_mem_free(pScanFilter->SSIDs.SSIDList); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5961 | pScanFilter->SSIDs.SSIDList = NULL; |
| 5962 | } |
| 5963 | } |
| 5964 | |
| 5965 | void csr_free_roam_profile(tpAniSirGlobal pMac, uint32_t sessionId) |
| 5966 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5967 | struct csr_roam_session *pSession = &pMac->roam.roamSession[sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5968 | |
| 5969 | if (pSession->pCurRoamProfile) { |
| 5970 | csr_release_profile(pMac, pSession->pCurRoamProfile); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5971 | qdf_mem_free(pSession->pCurRoamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5972 | pSession->pCurRoamProfile = NULL; |
| 5973 | } |
| 5974 | } |
| 5975 | |
| 5976 | void csr_free_connect_bss_desc(tpAniSirGlobal pMac, uint32_t sessionId) |
| 5977 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 5978 | struct csr_roam_session *pSession = &pMac->roam.roamSession[sessionId]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5979 | |
| 5980 | if (pSession->pConnectBssDesc) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5981 | qdf_mem_free(pSession->pConnectBssDesc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5982 | pSession->pConnectBssDesc = NULL; |
| 5983 | } |
| 5984 | } |
| 5985 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5986 | tSirResultCodes csr_get_de_auth_rsp_status_code(tSirSmeDeauthRsp *pSmeRsp) |
| 5987 | { |
| 5988 | uint8_t *pBuffer = (uint8_t *) pSmeRsp; |
| 5989 | uint32_t ret; |
| 5990 | |
| 5991 | pBuffer += |
| 5992 | (sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint8_t) + |
| 5993 | sizeof(uint16_t)); |
| 5994 | /* tSirResultCodes is an enum, assuming is 32bit */ |
| 5995 | /* If we cannot make this assumption, use copymemory */ |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 5996 | qdf_get_u32(pBuffer, &ret); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5997 | |
| 5998 | return (tSirResultCodes) ret; |
| 5999 | } |
| 6000 | |
| 6001 | tSirScanType csr_get_scan_type(tpAniSirGlobal pMac, uint8_t chnId) |
| 6002 | { |
| 6003 | tSirScanType scanType = eSIR_PASSIVE_SCAN; |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 6004 | enum channel_state channelEnabledType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6005 | |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6006 | channelEnabledType = wlan_reg_get_channel_state(pMac->pdev, chnId); |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6007 | if (CHANNEL_STATE_ENABLE == channelEnabledType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6008 | scanType = eSIR_ACTIVE_SCAN; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6009 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6010 | return scanType; |
| 6011 | } |
| 6012 | |
| 6013 | uint8_t csr_to_upper(uint8_t ch) |
| 6014 | { |
| 6015 | uint8_t chOut; |
| 6016 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6017 | if (ch >= 'a' && ch <= 'z') |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6018 | chOut = ch - 'a' + 'A'; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6019 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6020 | chOut = ch; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6021 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6022 | return chOut; |
| 6023 | } |
| 6024 | |
| 6025 | tSirBssType csr_translate_bsstype_to_mac_type(eCsrRoamBssType csrtype) |
| 6026 | { |
| 6027 | tSirBssType ret; |
| 6028 | |
| 6029 | switch (csrtype) { |
| 6030 | case eCSR_BSS_TYPE_INFRASTRUCTURE: |
| 6031 | ret = eSIR_INFRASTRUCTURE_MODE; |
| 6032 | break; |
| 6033 | case eCSR_BSS_TYPE_IBSS: |
| 6034 | case eCSR_BSS_TYPE_START_IBSS: |
| 6035 | ret = eSIR_IBSS_MODE; |
| 6036 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6037 | case eCSR_BSS_TYPE_INFRA_AP: |
| 6038 | ret = eSIR_INFRA_AP_MODE; |
| 6039 | break; |
Deepak Dhamdhere | e2dd544 | 2016-05-27 15:05:51 -0700 | [diff] [blame] | 6040 | case eCSR_BSS_TYPE_NDI: |
| 6041 | ret = eSIR_NDI_MODE; |
| 6042 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6043 | case eCSR_BSS_TYPE_ANY: |
| 6044 | default: |
| 6045 | ret = eSIR_AUTO_MODE; |
| 6046 | break; |
| 6047 | } |
| 6048 | |
| 6049 | return ret; |
| 6050 | } |
| 6051 | |
| 6052 | /* This function use the parameters to decide the CFG value. */ |
| 6053 | /* CSR never sets WNI_CFG_DOT11_MODE_ALL to the CFG */ |
| 6054 | /* So PE should not see WNI_CFG_DOT11_MODE_ALL when it gets the CFG value */ |
Jeff Johnson | 66ee8a9 | 2018-03-17 15:24:26 -0700 | [diff] [blame] | 6055 | enum csr_cfgdot11mode |
| 6056 | csr_get_cfg_dot11_mode_from_csr_phy_mode(struct csr_roam_profile *pProfile, |
| 6057 | eCsrPhyMode phyMode, |
| 6058 | bool fProprietary) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6059 | { |
| 6060 | uint32_t cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG; |
| 6061 | |
| 6062 | switch (phyMode) { |
| 6063 | case eCSR_DOT11_MODE_11a: |
| 6064 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11A; |
| 6065 | break; |
| 6066 | case eCSR_DOT11_MODE_11b: |
| 6067 | case eCSR_DOT11_MODE_11b_ONLY: |
| 6068 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11B; |
| 6069 | break; |
| 6070 | case eCSR_DOT11_MODE_11g: |
| 6071 | case eCSR_DOT11_MODE_11g_ONLY: |
| 6072 | if (pProfile && (CSR_IS_INFRA_AP(pProfile)) |
| 6073 | && (phyMode == eCSR_DOT11_MODE_11g_ONLY)) |
| 6074 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G_ONLY; |
| 6075 | else |
| 6076 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11G; |
| 6077 | break; |
| 6078 | case eCSR_DOT11_MODE_11n: |
| 6079 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 6080 | break; |
| 6081 | case eCSR_DOT11_MODE_11n_ONLY: |
| 6082 | if (pProfile && CSR_IS_INFRA_AP(pProfile)) |
| 6083 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N_ONLY; |
| 6084 | else |
| 6085 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 6086 | break; |
| 6087 | case eCSR_DOT11_MODE_abg: |
| 6088 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_ABG; |
| 6089 | break; |
| 6090 | case eCSR_DOT11_MODE_AUTO: |
| 6091 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO; |
| 6092 | break; |
| 6093 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6094 | case eCSR_DOT11_MODE_11ac: |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6095 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6096 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6097 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6098 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6099 | break; |
| 6100 | case eCSR_DOT11_MODE_11ac_ONLY: |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6101 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6102 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC_ONLY; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6103 | else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6104 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6105 | break; |
Krishna Kumaar Natarajan | 4f1d772 | 2017-03-03 21:12:51 -0800 | [diff] [blame] | 6106 | case eCSR_DOT11_MODE_11ax: |
| 6107 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) |
| 6108 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX; |
| 6109 | else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 6110 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 6111 | else |
| 6112 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 6113 | break; |
| 6114 | case eCSR_DOT11_MODE_11ax_ONLY: |
| 6115 | if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AX)) |
| 6116 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AX_ONLY; |
| 6117 | else if (IS_FEATURE_SUPPORTED_BY_FW(DOT11AC)) |
| 6118 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11AC; |
| 6119 | else |
| 6120 | cfgDot11Mode = eCSR_CFG_DOT11_MODE_11N; |
| 6121 | break; |
| 6122 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6123 | default: |
| 6124 | /* No need to assign anything here */ |
| 6125 | break; |
| 6126 | } |
| 6127 | |
| 6128 | return cfgDot11Mode; |
| 6129 | } |
| 6130 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6131 | QDF_STATUS csr_get_regulatory_domain_for_country(tpAniSirGlobal pMac, |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 6132 | uint8_t *pCountry, |
| 6133 | v_REGDOMAIN_t *pDomainId, |
| 6134 | enum country_src source) |
| 6135 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6136 | QDF_STATUS status = QDF_STATUS_E_INVAL; |
| 6137 | QDF_STATUS qdf_status; |
Amar Singhal | a297bfa | 2015-10-15 15:07:29 -0700 | [diff] [blame] | 6138 | uint8_t countryCode[CDS_COUNTRY_CODE_LEN + 1]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6139 | v_REGDOMAIN_t domainId; |
| 6140 | |
| 6141 | if (pCountry) { |
| 6142 | countryCode[0] = pCountry[0]; |
| 6143 | countryCode[1] = pCountry[1]; |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6144 | qdf_status = wlan_reg_get_domain_from_country_code(&domainId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6145 | countryCode, |
| 6146 | source); |
| 6147 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6148 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6149 | if (pDomainId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6150 | *pDomainId = domainId; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6151 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6152 | } else { |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 6153 | sme_warn("Couldn't find domain for country code %c%c", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6154 | pCountry[0], pCountry[1]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6155 | status = QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6156 | } |
| 6157 | } |
| 6158 | |
| 6159 | return status; |
| 6160 | } |
| 6161 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6162 | QDF_STATUS csr_get_modify_profile_fields(tpAniSirGlobal pMac, |
| 6163 | uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6164 | tCsrRoamModifyProfileFields * |
| 6165 | pModifyProfileFields) |
| 6166 | { |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6167 | if (!pModifyProfileFields) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6168 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6169 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6170 | qdf_mem_copy(pModifyProfileFields, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6171 | &pMac->roam.roamSession[sessionId].connectedProfile. |
| 6172 | modifyProfileFields, sizeof(tCsrRoamModifyProfileFields)); |
| 6173 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6174 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6175 | } |
| 6176 | |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6177 | QDF_STATUS csr_set_modify_profile_fields(tpAniSirGlobal pMac, |
| 6178 | uint32_t sessionId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6179 | tCsrRoamModifyProfileFields * |
| 6180 | pModifyProfileFields) |
| 6181 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6182 | struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6183 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6184 | qdf_mem_copy(&pSession->connectedProfile.modifyProfileFields, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6185 | pModifyProfileFields, sizeof(tCsrRoamModifyProfileFields)); |
| 6186 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6187 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6188 | } |
| 6189 | |
| 6190 | |
| 6191 | bool csr_is_set_key_allowed(tpAniSirGlobal pMac, uint32_t sessionId) |
| 6192 | { |
| 6193 | bool fRet = true; |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6194 | struct csr_roam_session *pSession; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6195 | |
| 6196 | pSession = CSR_GET_SESSION(pMac, sessionId); |
| 6197 | |
| 6198 | /* |
| 6199 | * This condition is not working for infra state. When infra is in |
| 6200 | * not-connected state the pSession->pCurRoamProfile is NULL, this |
| 6201 | * function returns true, that is incorrect. |
| 6202 | * Since SAP requires to set key without any BSS started, it needs |
| 6203 | * this condition to be met. In other words, this function is useless. |
| 6204 | * The current work-around is to process setcontext_rsp no matter |
| 6205 | * what the state is. |
| 6206 | */ |
Srinivas Girigowda | e00f73f | 2017-03-17 14:07:26 -0700 | [diff] [blame] | 6207 | sme_debug("is not what it intends to. Must be revisit or removed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6208 | if ((NULL == pSession) |
| 6209 | || (csr_is_conn_state_disconnected(pMac, sessionId) |
| 6210 | && (pSession->pCurRoamProfile != NULL) |
| 6211 | && (!(CSR_IS_INFRA_AP(pSession->pCurRoamProfile)))) |
| 6212 | ) { |
| 6213 | fRet = false; |
| 6214 | } |
| 6215 | |
| 6216 | return fRet; |
| 6217 | } |
| 6218 | |
| 6219 | /* no need to acquire lock for this basic function */ |
| 6220 | uint16_t sme_chn_to_freq(uint8_t chanNum) |
| 6221 | { |
| 6222 | int i; |
| 6223 | |
Amar Singhal | b8d4f15 | 2016-02-10 10:21:43 -0800 | [diff] [blame] | 6224 | for (i = 0; i < NUM_CHANNELS; i++) { |
Kiran Kumar Lokere | a3de226 | 2017-04-12 12:15:04 -0700 | [diff] [blame] | 6225 | if (WLAN_REG_CH_NUM(i) == chanNum) |
| 6226 | return WLAN_REG_CH_TO_FREQ(i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6227 | } |
| 6228 | |
| 6229 | return 0; |
| 6230 | } |
| 6231 | |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6232 | struct lim_channel_status * |
| 6233 | csr_get_channel_status(tpAniSirGlobal mac, uint32_t channel_id) |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6234 | { |
| 6235 | uint8_t i; |
| 6236 | struct lim_scan_channel_status *channel_status; |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6237 | struct lim_channel_status *entry; |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6238 | |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6239 | if (!mac->sap.acs_with_more_param) |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6240 | return NULL; |
| 6241 | |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6242 | channel_status = &mac->lim.scan_channel_status; |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6243 | for (i = 0; i < channel_status->total_channel; i++) { |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6244 | entry = &channel_status->channel_status_list[i]; |
| 6245 | if (entry->channel_id == channel_id) |
| 6246 | return entry; |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6247 | } |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6248 | sme_err("Channel %d status info not exist", channel_id); |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6249 | |
| 6250 | return NULL; |
| 6251 | } |
| 6252 | |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6253 | void csr_clear_channel_status(tpAniSirGlobal mac) |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6254 | { |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6255 | struct lim_scan_channel_status *channel_status; |
| 6256 | |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6257 | if (!mac->sap.acs_with_more_param) |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6258 | return; |
| 6259 | |
Jeff Johnson | 1be200a | 2018-07-07 10:57:32 -0700 | [diff] [blame] | 6260 | channel_status = &mac->lim.scan_channel_status; |
gaolez | e510894 | 2017-03-31 16:56:42 +0800 | [diff] [blame] | 6261 | channel_status->total_channel = 0; |
| 6262 | |
| 6263 | return; |
| 6264 | } |
| 6265 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6266 | bool csr_is_channel_present_in_list(uint8_t *pChannelList, |
| 6267 | int numChannels, uint8_t channel) |
| 6268 | { |
| 6269 | int i = 0; |
| 6270 | |
| 6271 | /* Check for NULL pointer */ |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6272 | if (!pChannelList || (numChannels == 0)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6273 | return false; |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6274 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6275 | /* Look for the channel in the list */ |
| 6276 | for (i = 0; (i < numChannels) && |
| 6277 | (i < WNI_CFG_VALID_CHANNEL_LIST_LEN); i++) { |
| 6278 | if (pChannelList[i] == channel) |
| 6279 | return true; |
| 6280 | } |
| 6281 | |
| 6282 | return false; |
| 6283 | } |
| 6284 | |
Sreelakshmi Konamki | 39acb13 | 2015-12-16 13:06:22 +0530 | [diff] [blame] | 6285 | /** |
Rajeev Kumar | 43e25b1 | 2016-04-15 16:26:36 -0700 | [diff] [blame] | 6286 | * sme_bsstype_to_string() - converts bss type to string. |
| 6287 | * @bss_type: bss type enum |
| 6288 | * |
| 6289 | * Return: printable string for bss type |
| 6290 | */ |
| 6291 | const char *sme_bss_type_to_string(const uint8_t bss_type) |
| 6292 | { |
| 6293 | switch (bss_type) { |
| 6294 | CASE_RETURN_STRING(eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 6295 | CASE_RETURN_STRING(eCSR_BSS_TYPE_INFRA_AP); |
| 6296 | CASE_RETURN_STRING(eCSR_BSS_TYPE_IBSS); |
| 6297 | CASE_RETURN_STRING(eCSR_BSS_TYPE_START_IBSS); |
| 6298 | CASE_RETURN_STRING(eCSR_BSS_TYPE_ANY); |
| 6299 | default: |
| 6300 | return "unknown bss type"; |
| 6301 | } |
| 6302 | } |
| 6303 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6304 | QDF_STATUS csr_add_to_channel_list_front(uint8_t *pChannelList, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6305 | int numChannels, uint8_t channel) |
| 6306 | { |
| 6307 | int i = 0; |
| 6308 | |
| 6309 | /* Check for NULL pointer */ |
| 6310 | if (!pChannelList) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6311 | return QDF_STATUS_E_NULL_VALUE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6312 | |
| 6313 | /* Make room for the addition. (Start moving from the back.) */ |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6314 | for (i = numChannels; i > 0; i--) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6315 | pChannelList[i] = pChannelList[i - 1]; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6316 | |
| 6317 | /* Now add the NEW channel...at the front */ |
| 6318 | pChannelList[0] = channel; |
| 6319 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6320 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6321 | } |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 6322 | |
| 6323 | /** |
| 6324 | * csr_wait_for_connection_update() - Wait for hw mode update |
| 6325 | * @mac: Pointer to the MAC context |
| 6326 | * @do_release_reacquire_lock: Indicates whether release and |
| 6327 | * re-acquisition of SME global lock is required. |
| 6328 | * |
| 6329 | * Waits for CONNECTION_UPDATE_TIMEOUT time so that the |
| 6330 | * hw mode update can get processed. |
| 6331 | * |
| 6332 | * Return: True if the wait was successful, false otherwise |
| 6333 | */ |
| 6334 | bool csr_wait_for_connection_update(tpAniSirGlobal mac, |
| 6335 | bool do_release_reacquire_lock) |
| 6336 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6337 | QDF_STATUS status, ret; |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 6338 | |
| 6339 | if (do_release_reacquire_lock == true) { |
| 6340 | ret = sme_release_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6341 | if (!QDF_IS_STATUS_SUCCESS(ret)) { |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 6342 | cds_err("lock release fail %d", ret); |
| 6343 | return false; |
| 6344 | } |
| 6345 | } |
| 6346 | |
Tushnim Bhattacharyya | 0c4ad2d | 2017-03-09 15:59:03 -0800 | [diff] [blame] | 6347 | status = policy_mgr_wait_for_connection_update(mac->psoc); |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 6348 | |
| 6349 | if (do_release_reacquire_lock == true) { |
| 6350 | ret = sme_acquire_global_lock(&mac->sme); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6351 | if (!QDF_IS_STATUS_SUCCESS(ret)) { |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 6352 | cds_err("lock acquire fail %d", ret); |
| 6353 | return false; |
| 6354 | } |
| 6355 | } |
| 6356 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 6357 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
Chandrasekaran, Manishekar | 430ee2e | 2015-11-16 16:28:30 +0530 | [diff] [blame] | 6358 | cds_err("wait for event failed"); |
| 6359 | return false; |
| 6360 | } |
| 6361 | |
| 6362 | return true; |
| 6363 | } |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 6364 | |
| 6365 | /** |
| 6366 | * csr_get_session_persona() - get persona of a session |
| 6367 | * @pmac: pointer to global MAC context |
| 6368 | * @session_id: session id |
| 6369 | * |
| 6370 | * This function is to return the persona of a session |
| 6371 | * |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 6372 | * Reture: enum QDF_OPMODE persona |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 6373 | */ |
Jeff Johnson | c1e6278 | 2017-11-09 09:50:17 -0800 | [diff] [blame] | 6374 | enum QDF_OPMODE csr_get_session_persona(tpAniSirGlobal pmac, |
| 6375 | uint32_t session_id) |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 6376 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6377 | struct csr_roam_session *session = NULL; |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 6378 | |
| 6379 | session = CSR_GET_SESSION(pmac, session_id); |
| 6380 | if (NULL == session || NULL == session->pCurRoamProfile) |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6381 | return QDF_MAX_NO_OF_MODE; |
Peng Xu | f5d60c8 | 2015-10-02 17:17:03 -0700 | [diff] [blame] | 6382 | |
| 6383 | return session->pCurRoamProfile->csrPersona; |
| 6384 | } |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 6385 | |
| 6386 | /** |
| 6387 | * csr_is_ndi_started() - function to check if NDI is started |
| 6388 | * @mac_ctx: handle to mac context |
| 6389 | * @session_id: session identifier |
| 6390 | * |
| 6391 | * returns: true if NDI is started, false otherwise |
| 6392 | */ |
| 6393 | bool csr_is_ndi_started(tpAniSirGlobal mac_ctx, uint32_t session_id) |
| 6394 | { |
gaurank kathpalia | 14e2f91 | 2017-08-31 14:51:45 +0530 | [diff] [blame] | 6395 | struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, session_id); |
Nishank Aggarwal | 9ca3255 | 2017-03-31 16:23:26 +0530 | [diff] [blame] | 6396 | |
Ravi Joshi | 4f447cb | 2016-07-19 13:42:01 -0700 | [diff] [blame] | 6397 | if (!session) |
| 6398 | return false; |
| 6399 | |
| 6400 | return eCSR_CONNECT_STATE_TYPE_NDI_STARTED == session->connectState; |
| 6401 | } |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 6402 | |
Jeff Johnson | 9d11885 | 2018-06-10 16:54:59 -0700 | [diff] [blame] | 6403 | bool csr_is_mcc_channel(tpAniSirGlobal mac_ctx, uint8_t channel) |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 6404 | { |
Vignesh Viswanathan | 9dd88d3 | 2017-11-22 14:22:03 +0530 | [diff] [blame] | 6405 | struct csr_roam_session *session; |
| 6406 | enum QDF_OPMODE oper_mode; |
| 6407 | uint8_t oper_channel = 0; |
| 6408 | uint8_t session_id; |
| 6409 | |
| 6410 | if (channel == 0) |
| 6411 | return false; |
| 6412 | |
| 6413 | for (session_id = 0; session_id < CSR_ROAM_SESSION_MAX; session_id++) { |
| 6414 | if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) { |
| 6415 | session = CSR_GET_SESSION(mac_ctx, session_id); |
| 6416 | if (NULL == session->pCurRoamProfile) |
| 6417 | continue; |
| 6418 | oper_mode = session->pCurRoamProfile->csrPersona; |
| 6419 | if ((((oper_mode == QDF_STA_MODE) || |
| 6420 | (oper_mode == QDF_P2P_CLIENT_MODE)) && |
| 6421 | (session->connectState == |
| 6422 | eCSR_ASSOC_STATE_TYPE_INFRA_ASSOCIATED)) || |
| 6423 | (((oper_mode == QDF_P2P_GO_MODE) || |
| 6424 | (oper_mode == QDF_SAP_MODE)) |
| 6425 | && (session->connectState != |
| 6426 | eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED))) |
| 6427 | oper_channel = session->connectedProfile. |
| 6428 | operationChannel; |
| 6429 | |
| 6430 | if (oper_channel && channel != oper_channel && |
| 6431 | (!policy_mgr_is_hw_dbs_capable(mac_ctx->psoc) || |
| 6432 | WLAN_REG_IS_SAME_BAND_CHANNELS(channel, |
| 6433 | oper_channel))) |
| 6434 | return true; |
| 6435 | } |
| 6436 | } |
| 6437 | |
| 6438 | return false; |
| 6439 | } |
| 6440 | |