Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 2 | * Copyright (c) 2012-2019 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 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 19 | /** |
| 20 | * DOC: wlan_hdd_assoc.c |
| 21 | * |
| 22 | * WLAN Host Device Driver implementation |
| 23 | * |
| 24 | */ |
| 25 | |
| 26 | #include "wlan_hdd_includes.h" |
| 27 | #include <ani_global.h> |
| 28 | #include "dot11f.h" |
| 29 | #include "wlan_hdd_power.h" |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 30 | #include "wlan_hdd_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 31 | #include <linux/ieee80211.h> |
| 32 | #include <linux/wireless.h> |
| 33 | #include <linux/etherdevice.h> |
| 34 | #include <net/cfg80211.h> |
| 35 | #include "wlan_hdd_cfg80211.h" |
| 36 | #include "csr_inside_api.h" |
| 37 | #include "wlan_hdd_p2p.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 38 | #include "wlan_hdd_tdls.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 39 | #include "sme_api.h" |
| 40 | #include "wlan_hdd_hostapd.h" |
Jeff Johnson | 8bb6111 | 2018-03-31 13:33:54 -0700 | [diff] [blame] | 41 | #include <wlan_hdd_green_ap.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 42 | #include <wlan_hdd_ipa.h> |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 43 | #include "wlan_hdd_lpass.h" |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 44 | #include <wlan_logging_sock_svc.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 45 | #include <cds_sched.h> |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 46 | #include "wlan_policy_mgr_api.h" |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 47 | #include <cds_utils.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "sme_power_save_api.h" |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 49 | #include "wlan_hdd_napi.h" |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 50 | #include <cdp_txrx_cmn.h> |
| 51 | #include <cdp_txrx_flow_ctrl_legacy.h> |
| 52 | #include <cdp_txrx_peer_ops.h> |
| 53 | #include <cdp_txrx_misc.h> |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 54 | #include <cdp_txrx_ctrl.h> |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 55 | #include <wlan_logging_sock_svc.h> |
Rajeev Kumar | 59e011b | 2017-01-13 11:42:20 -0800 | [diff] [blame] | 56 | #include <wlan_hdd_object_manager.h> |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 57 | #include <cdp_txrx_handle.h> |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 58 | #include "wlan_pmo_ucfg_api.h" |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 59 | #include "wlan_hdd_tsf.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 60 | #include "wlan_utility.h" |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 61 | #include "wlan_p2p_ucfg_api.h" |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 62 | #include "wlan_ipa_ucfg_api.h" |
Qiwei Cai | 3719efe | 2018-06-11 21:09:29 +0800 | [diff] [blame] | 63 | #include "wlan_hdd_stats.h" |
Paul Zhang | cb573e0 | 2018-11-06 10:37:16 +0800 | [diff] [blame] | 64 | #include "wlan_hdd_scan.h" |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 65 | #include "wlan_crypto_global_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | |
Alok Kumar | b64650c | 2018-03-23 17:05:11 +0530 | [diff] [blame] | 67 | #include "wlan_hdd_nud_tracking.h" |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 68 | #include <wlan_cfg80211_crypto.h> |
| 69 | #include <wlan_crypto_global_api.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | /* These are needed to recognize WPA and RSN suite types */ |
| 71 | #define HDD_WPA_OUI_SIZE 4 |
| 72 | #define HDD_RSN_OUI_SIZE 4 |
| 73 | uint8_t ccp_wpa_oui00[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 74 | uint8_t ccp_wpa_oui01[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 75 | uint8_t ccp_wpa_oui02[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 76 | uint8_t ccp_wpa_oui03[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 77 | uint8_t ccp_wpa_oui04[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 78 | uint8_t ccp_wpa_oui05[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 79 | |
| 80 | #ifdef FEATURE_WLAN_ESE |
| 81 | /* CCKM */ |
| 82 | uint8_t ccp_wpa_oui06[HDD_WPA_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 83 | /* CCKM */ |
| 84 | uint8_t ccp_rsn_oui06[HDD_RSN_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 85 | #endif /* FEATURE_WLAN_ESE */ |
| 86 | |
| 87 | /* group cipher */ |
| 88 | uint8_t ccp_rsn_oui00[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x00 }; |
| 89 | |
| 90 | /* WEP-40 or RSN */ |
| 91 | uint8_t ccp_rsn_oui01[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x01 }; |
| 92 | |
| 93 | /* TKIP or RSN-PSK */ |
| 94 | uint8_t ccp_rsn_oui02[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x02 }; |
| 95 | |
| 96 | /* Reserved */ |
| 97 | uint8_t ccp_rsn_oui03[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x03 }; |
| 98 | |
| 99 | /* AES-CCMP */ |
| 100 | uint8_t ccp_rsn_oui04[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x04 }; |
| 101 | |
| 102 | /* WEP-104 */ |
| 103 | uint8_t ccp_rsn_oui05[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 104 | |
| 105 | #ifdef WLAN_FEATURE_11W |
| 106 | /* RSN-PSK-SHA256 */ |
| 107 | uint8_t ccp_rsn_oui07[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x06 }; |
| 108 | |
| 109 | /* RSN-8021X-SHA256 */ |
| 110 | uint8_t ccp_rsn_oui08[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 111 | #endif |
| 112 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 113 | /* AES-GCMP-128 */ |
| 114 | uint8_t ccp_rsn_oui09[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x08 }; |
| 115 | |
| 116 | /* AES-GCMP-256 */ |
| 117 | uint8_t ccp_rsn_oui0a[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x09 }; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 118 | #ifdef WLAN_FEATURE_FILS_SK |
| 119 | uint8_t ccp_rsn_oui_0e[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0E}; |
| 120 | uint8_t ccp_rsn_oui_0f[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0F}; |
| 121 | uint8_t ccp_rsn_oui_10[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x10}; |
| 122 | uint8_t ccp_rsn_oui_11[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x11}; |
| 123 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 124 | uint8_t ccp_rsn_oui_12[HDD_RSN_OUI_SIZE] = {0x50, 0x6F, 0x9A, 0x02}; |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 125 | uint8_t ccp_rsn_oui_0b[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0B}; |
| 126 | uint8_t ccp_rsn_oui_0c[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0C}; |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 127 | /* FT-SUITE-B AKM */ |
| 128 | uint8_t ccp_rsn_oui_0d[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0D}; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 129 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 130 | /* OWE https://tools.ietf.org/html/rfc8110 */ |
| 131 | uint8_t ccp_rsn_oui_18[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x12}; |
| 132 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 133 | #ifdef WLAN_FEATURE_SAE |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 134 | /* SAE AKM */ |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 135 | uint8_t ccp_rsn_oui_80[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x08}; |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 136 | /* FT SAE AKM */ |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 137 | uint8_t ccp_rsn_oui_90[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x09}; |
| 138 | #endif |
Srinivas Dasari | b328f1a | 2018-12-18 17:45:06 +0530 | [diff] [blame] | 139 | static const |
| 140 | u8 ccp_rsn_oui_13[HDD_RSN_OUI_SIZE] = {0x50, 0x6F, 0x9A, 0x01}; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 141 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 142 | /* Offset where the EID-Len-IE, start. */ |
| 143 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 144 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 145 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 146 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 147 | |
| 148 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 149 | * beacon_filter_table - table of IEs used for beacon filtering |
| 150 | */ |
| 151 | static const int beacon_filter_table[] = { |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 152 | WLAN_ELEMID_DSPARMS, |
| 153 | WLAN_ELEMID_ERP, |
| 154 | WLAN_ELEMID_EDCAPARMS, |
| 155 | WLAN_ELEMID_QOS_CAPABILITY, |
| 156 | WLAN_ELEMID_HTINFO_ANA, |
| 157 | WLAN_ELEMID_OP_MODE_NOTIFY, |
| 158 | WLAN_ELEMID_VHTOP, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 159 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 160 | /* |
| 161 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 162 | * bss-color-change IE till it gets any fixed number. This |
| 163 | * vendor EID needs to be replaced with bss-color-change IE |
| 164 | * number. |
| 165 | */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 166 | WLAN_ELEMID_VENDOR, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 167 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 168 | }; |
| 169 | |
Padma, Santhosh Kumar | eb90a55 | 2018-01-16 19:41:58 +0530 | [diff] [blame] | 170 | #if defined(WLAN_FEATURE_SAE) && \ |
| 171 | defined(CFG80211_EXTERNAL_AUTH_SUPPORT) |
| 172 | /** |
| 173 | * wlan_hdd_sae_callback() - Sends SAE info to supplicant |
| 174 | * @adapter: pointer adapter context |
| 175 | * @roam_info: pointer to roam info |
| 176 | * |
| 177 | * This API is used to send required SAE info to trigger SAE in supplicant. |
| 178 | * |
| 179 | * Return: None |
| 180 | */ |
| 181 | static void wlan_hdd_sae_callback(struct hdd_adapter *adapter, |
| 182 | struct csr_roam_info *roam_info) |
| 183 | { |
| 184 | struct hdd_context *hdd_ctx = adapter->hdd_ctx; |
| 185 | int flags; |
| 186 | struct sir_sae_info *sae_info = roam_info->sae_info; |
| 187 | struct cfg80211_external_auth_params params = {0}; |
| 188 | |
| 189 | if (wlan_hdd_validate_context(hdd_ctx)) |
| 190 | return; |
| 191 | |
| 192 | if (!sae_info) { |
| 193 | hdd_err("SAE info in NULL"); |
| 194 | return; |
| 195 | } |
| 196 | |
| 197 | flags = cds_get_gfp_flags(); |
| 198 | |
| 199 | params.key_mgmt_suite = 0x00; |
| 200 | params.key_mgmt_suite |= 0x0F << 8; |
| 201 | params.key_mgmt_suite |= 0xAC << 16; |
| 202 | params.key_mgmt_suite |= 0x8 << 24; |
| 203 | |
| 204 | params.action = NL80211_EXTERNAL_AUTH_START; |
| 205 | qdf_mem_copy(params.bssid, sae_info->peer_mac_addr.bytes, |
| 206 | QDF_MAC_ADDR_SIZE); |
| 207 | qdf_mem_copy(params.ssid.ssid, sae_info->ssid.ssId, |
| 208 | sae_info->ssid.length); |
| 209 | params.ssid.ssid_len = sae_info->ssid.length; |
| 210 | |
| 211 | cfg80211_external_auth_request(adapter->dev, ¶ms, flags); |
| 212 | hdd_debug("SAE: sent cmd"); |
| 213 | } |
| 214 | #else |
| 215 | static inline void wlan_hdd_sae_callback(struct hdd_adapter *adapter, |
| 216 | struct csr_roam_info *roam_info) |
| 217 | { } |
| 218 | #endif |
| 219 | |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 220 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 221 | * hdd_conn_set_authenticated() - set authentication state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 222 | * @adapter: pointer to the adapter |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 223 | * @auth_state: authentication state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 224 | * |
| 225 | * This function updates the global HDD station context |
| 226 | * authentication state. |
| 227 | * |
| 228 | * Return: none |
| 229 | */ |
| 230 | static void |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 231 | hdd_conn_set_authenticated(struct hdd_adapter *adapter, uint8_t auth_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 232 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 233 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 234 | char *auth_time; |
| 235 | uint32_t time_buffer_size; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 236 | |
| 237 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 238 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Jeff Johnson | 457c242 | 2019-02-27 13:56:04 -0800 | [diff] [blame] | 239 | sta_ctx->conn_info.is_authenticated, auth_state); |
| 240 | sta_ctx->conn_info.is_authenticated = auth_state; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 241 | |
| 242 | auth_time = sta_ctx->conn_info.auth_time; |
| 243 | time_buffer_size = sizeof(sta_ctx->conn_info.auth_time); |
| 244 | |
| 245 | if (auth_state) |
| 246 | qdf_get_time_of_the_day_in_hr_min_sec_usec(auth_time, |
| 247 | time_buffer_size); |
| 248 | else |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 249 | qdf_mem_zero(auth_time, time_buffer_size); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 250 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 251 | } |
| 252 | |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 253 | void hdd_conn_set_connection_state(struct hdd_adapter *adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 254 | eConnectionState conn_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 255 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 256 | struct hdd_station_ctx *hdd_sta_ctx = |
| 257 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 258 | char *connect_time; |
| 259 | uint32_t time_buffer_size; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 260 | |
| 261 | /* save the new connection state */ |
Jun Wang | 92cd836 | 2018-07-27 16:52:47 +0800 | [diff] [blame] | 262 | hdd_debug("Changed conn state from old:%d to new:%d for dev %s", |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 263 | hdd_sta_ctx->conn_info.conn_state, conn_state, |
Jun Wang | 92cd836 | 2018-07-27 16:52:47 +0800 | [diff] [blame] | 264 | adapter->dev->name); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 265 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 266 | hdd_tsf_notify_wlan_state_change(adapter, |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 267 | hdd_sta_ctx->conn_info.conn_state, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 268 | conn_state); |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 269 | hdd_sta_ctx->conn_info.conn_state = conn_state; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 270 | |
| 271 | connect_time = hdd_sta_ctx->conn_info.connect_time; |
| 272 | time_buffer_size = sizeof(hdd_sta_ctx->conn_info.connect_time); |
| 273 | if (conn_state == eConnectionState_Associated) |
| 274 | qdf_get_time_of_the_day_in_hr_min_sec_usec(connect_time, |
| 275 | time_buffer_size); |
| 276 | else |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 277 | qdf_mem_zero(connect_time, time_buffer_size); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 278 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | /** |
| 282 | * hdd_conn_get_connection_state() - get connection state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 283 | * @adapter: pointer to the adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 284 | * @pConnState: pointer to connection state |
| 285 | * |
| 286 | * This function updates the global HDD station context connection state. |
| 287 | * |
| 288 | * Return: true if (Infra Associated or IBSS Connected) |
| 289 | * and sets output parameter pConnState; |
| 290 | * false otherwise |
| 291 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 292 | static inline bool |
| 293 | hdd_conn_get_connection_state(struct hdd_station_ctx *sta_ctx, |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 294 | eConnectionState *out_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | { |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 296 | eConnectionState state = sta_ctx->conn_info.conn_state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 297 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 298 | if (out_state) |
| 299 | *out_state = state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 301 | switch (state) { |
| 302 | case eConnectionState_Associated: |
| 303 | case eConnectionState_IbssConnected: |
| 304 | case eConnectionState_IbssDisconnected: |
| 305 | case eConnectionState_NdiConnected: |
| 306 | return true; |
| 307 | default: |
| 308 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 310 | } |
| 311 | |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 312 | bool hdd_is_connecting(struct hdd_station_ctx *hdd_sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | { |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 314 | return hdd_sta_ctx->conn_info.conn_state == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 315 | eConnectionState_Connecting; |
| 316 | } |
| 317 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 318 | bool hdd_conn_is_connected(struct hdd_station_ctx *sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 319 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 320 | return hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 321 | } |
| 322 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 323 | bool hdd_adapter_is_connected_sta(struct hdd_adapter *adapter) |
| 324 | { |
| 325 | switch (adapter->device_mode) { |
| 326 | case QDF_STA_MODE: |
| 327 | case QDF_P2P_CLIENT_MODE: |
| 328 | case QDF_NDI_MODE: |
| 329 | return hdd_conn_is_connected(&adapter->session.station); |
| 330 | default: |
| 331 | return false; |
| 332 | } |
| 333 | } |
| 334 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 335 | enum band_info hdd_conn_get_connected_band(struct hdd_station_ctx *sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 336 | { |
| 337 | uint8_t staChannel = 0; |
| 338 | |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 339 | if (eConnectionState_Associated == sta_ctx->conn_info.conn_state) |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 340 | staChannel = sta_ctx->conn_info.channel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | |
| 342 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 343 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 345 | return BAND_5G; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 346 | else /* If station is not connected return as BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 347 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | /** |
| 351 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 352 | * @sta_ctx: pointer to global HDD Station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 353 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 354 | * |
| 355 | * Return: false if any errors encountered, true otherwise |
| 356 | */ |
| 357 | static inline bool |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 358 | hdd_conn_get_connected_cipher_algo(struct hdd_station_ctx *sta_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 359 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 360 | { |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 361 | bool connected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 363 | connected = hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 364 | |
| 365 | if (pConnectedCipherAlgo) |
Jeff Johnson | b195984 | 2019-02-27 13:04:04 -0800 | [diff] [blame] | 366 | *pConnectedCipherAlgo = sta_ctx->conn_info.uc_encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 368 | return connected; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | } |
| 370 | |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 371 | struct hdd_adapter *hdd_get_sta_connection_in_progress( |
| 372 | struct hdd_context *hdd_ctx) |
| 373 | { |
| 374 | struct hdd_adapter *adapter = NULL; |
| 375 | struct hdd_station_ctx *hdd_sta_ctx; |
| 376 | |
| 377 | if (!hdd_ctx) { |
| 378 | hdd_err("HDD context is NULL"); |
| 379 | return NULL; |
| 380 | } |
| 381 | |
| 382 | hdd_for_each_adapter(hdd_ctx, adapter) { |
| 383 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 384 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 385 | (QDF_P2P_CLIENT_MODE == adapter->device_mode) || |
| 386 | (QDF_P2P_DEVICE_MODE == adapter->device_mode)) { |
| 387 | if (eConnectionState_Connecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 388 | hdd_sta_ctx->conn_info.conn_state) { |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 389 | hdd_debug("vdev_id %d: Connection is in progress", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 390 | adapter->vdev_id); |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 391 | return adapter; |
| 392 | } else if ((eConnectionState_Associated == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 393 | hdd_sta_ctx->conn_info.conn_state) && |
Vignesh Viswanathan | 0a56929 | 2018-02-14 15:34:47 +0530 | [diff] [blame] | 394 | sme_is_sta_key_exchange_in_progress( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 395 | hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 396 | adapter->vdev_id)) { |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 397 | hdd_debug("vdev_id %d: Key exchange is in progress", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 398 | adapter->vdev_id); |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 399 | return adapter; |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | return NULL; |
| 404 | } |
| 405 | |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 406 | void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx) |
| 407 | { |
| 408 | struct hdd_adapter *sta_adapter; |
| 409 | QDF_STATUS status; |
| 410 | |
| 411 | sta_adapter = hdd_get_sta_connection_in_progress(hdd_ctx); |
| 412 | if (sta_adapter) { |
| 413 | hdd_debug("Disconnecting STA on vdev: %d", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 414 | sta_adapter->vdev_id); |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 415 | status = wlan_hdd_disconnect(sta_adapter, |
| 416 | eCSR_DISCONNECT_REASON_DEAUTH); |
| 417 | if (QDF_IS_STATUS_ERROR(status)) { |
| 418 | hdd_err("wlan_hdd_disconnect failed, status: %d", |
| 419 | status); |
| 420 | } |
| 421 | } |
| 422 | } |
| 423 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 424 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 425 | * hdd_remove_beacon_filter() - remove beacon filter |
| 426 | * @adapter: Pointer to the hdd adapter |
| 427 | * |
| 428 | * Return: 0 on success and errno on failure |
| 429 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 430 | static int hdd_remove_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 431 | { |
| 432 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 433 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 434 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 435 | status = sme_remove_beacon_filter(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 436 | adapter->vdev_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 437 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 438 | hdd_err("sme_remove_beacon_filter() failed"); |
| 439 | return -EFAULT; |
| 440 | } |
| 441 | |
| 442 | return 0; |
| 443 | } |
| 444 | |
| 445 | /** |
| 446 | * hdd_add_beacon_filter() - add beacon filter |
| 447 | * @adapter: Pointer to the hdd adapter |
| 448 | * |
| 449 | * Return: 0 on success and errno on failure |
| 450 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 451 | static int hdd_add_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 452 | { |
| 453 | int i; |
| 454 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 455 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 456 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 457 | |
| 458 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 459 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 460 | (unsigned long int *)ie_map); |
| 461 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 462 | status = sme_add_beacon_filter(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 463 | adapter->vdev_id, ie_map); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 464 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 465 | hdd_err("sme_add_beacon_filter() failed"); |
| 466 | return -EFAULT; |
| 467 | } |
| 468 | return 0; |
| 469 | } |
| 470 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 471 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 472 | tDot11fIEHTCaps *roam_ht_cap) |
| 473 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 474 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 475 | uint32_t i, temp_ht_cap; |
| 476 | |
| 477 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 478 | |
| 479 | if (roam_ht_cap->advCodingCap) |
| 480 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 481 | if (roam_ht_cap->supportedChannelWidthSet) |
| 482 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 483 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 484 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 485 | if (temp_ht_cap) |
| 486 | hdd_ht_cap->cap_info |= |
| 487 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 488 | if (roam_ht_cap->greenField) |
| 489 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 490 | if (roam_ht_cap->shortGI20MHz) |
| 491 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 492 | if (roam_ht_cap->shortGI40MHz) |
| 493 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 494 | if (roam_ht_cap->txSTBC) |
| 495 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 496 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 497 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 498 | if (temp_ht_cap) |
| 499 | hdd_ht_cap->cap_info |= |
| 500 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 501 | if (roam_ht_cap->delayedBA) |
| 502 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 503 | if (roam_ht_cap->maximalAMSDUsize) |
| 504 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 505 | if (roam_ht_cap->dsssCckMode40MHz) |
| 506 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 507 | if (roam_ht_cap->psmp) |
| 508 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 509 | if (roam_ht_cap->stbcControlFrame) |
| 510 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 511 | if (roam_ht_cap->lsigTXOPProtection) |
| 512 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 513 | |
| 514 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 515 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 516 | hdd_ht_cap->ampdu_params_info |= |
| 517 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 518 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 519 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 520 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 521 | if (temp_ht_cap) |
| 522 | hdd_ht_cap->ampdu_params_info |= |
| 523 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 524 | |
| 525 | /* 802.11n HT extended capabilities masks */ |
| 526 | if (roam_ht_cap->pco) |
| 527 | hdd_ht_cap->extended_ht_cap_info |= |
| 528 | IEEE80211_HT_EXT_CAP_PCO; |
| 529 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 530 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 531 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 532 | if (temp_ht_cap) |
| 533 | hdd_ht_cap->extended_ht_cap_info |= |
| 534 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 535 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 536 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 537 | if (temp_ht_cap) |
| 538 | hdd_ht_cap->extended_ht_cap_info |= |
| 539 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 540 | |
| 541 | /* tx_bf_cap_info capabilities */ |
| 542 | if (roam_ht_cap->txBF) |
| 543 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 544 | if (roam_ht_cap->rxStaggeredSounding) |
| 545 | hdd_ht_cap->tx_BF_cap_info |= |
| 546 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 547 | if (roam_ht_cap->txStaggeredSounding) |
| 548 | hdd_ht_cap->tx_BF_cap_info |= |
| 549 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 550 | if (roam_ht_cap->rxZLF) |
| 551 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 552 | if (roam_ht_cap->txZLF) |
| 553 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 554 | if (roam_ht_cap->implicitTxBF) |
| 555 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 556 | temp_ht_cap = roam_ht_cap->calibration & |
| 557 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 558 | if (temp_ht_cap) |
| 559 | hdd_ht_cap->tx_BF_cap_info |= |
| 560 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 561 | if (roam_ht_cap->explicitCSITxBF) |
| 562 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 563 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 564 | hdd_ht_cap->tx_BF_cap_info |= |
| 565 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 566 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 567 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 568 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 569 | if (temp_ht_cap) |
| 570 | hdd_ht_cap->tx_BF_cap_info |= |
| 571 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 572 | temp_ht_cap = |
| 573 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 574 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 575 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 576 | if (temp_ht_cap) |
| 577 | hdd_ht_cap->tx_BF_cap_info |= |
| 578 | temp_ht_cap << |
| 579 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 580 | temp_ht_cap = |
| 581 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 582 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 583 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 584 | if (temp_ht_cap) |
| 585 | hdd_ht_cap->tx_BF_cap_info |= |
| 586 | temp_ht_cap << |
| 587 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 588 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 589 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 590 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 591 | if (temp_ht_cap) |
| 592 | hdd_ht_cap->tx_BF_cap_info |= |
| 593 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 594 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 595 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 596 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 597 | if (temp_ht_cap) |
| 598 | hdd_ht_cap->tx_BF_cap_info |= |
| 599 | temp_ht_cap << |
| 600 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 601 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 602 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 603 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 604 | if (temp_ht_cap) |
| 605 | hdd_ht_cap->tx_BF_cap_info |= |
| 606 | temp_ht_cap << |
| 607 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 608 | |
| 609 | /* antenna selection */ |
| 610 | if (roam_ht_cap->antennaSelection) |
| 611 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 612 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 613 | hdd_ht_cap->antenna_selection_info |= |
| 614 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 615 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 616 | hdd_ht_cap->antenna_selection_info |= |
| 617 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 618 | if (roam_ht_cap->explicitCSIFeedback) |
| 619 | hdd_ht_cap->antenna_selection_info |= |
| 620 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 621 | if (roam_ht_cap->antennaIndicesFeedback) |
| 622 | hdd_ht_cap->antenna_selection_info |= |
| 623 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 624 | if (roam_ht_cap->rxAS) |
| 625 | hdd_ht_cap->antenna_selection_info |= |
| 626 | ANTENNA_SEL_INFO_RX_AS; |
| 627 | if (roam_ht_cap->txSoundingPPDUs) |
| 628 | hdd_ht_cap->antenna_selection_info |= |
| 629 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 630 | |
| 631 | /* mcs data rate */ |
| 632 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 633 | hdd_ht_cap->mcs.rx_mask[i] = |
| 634 | roam_ht_cap->supportedMCSSet[i]; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 635 | hdd_ht_cap->mcs.rx_highest = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 636 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 637 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 638 | hdd_ht_cap->mcs.tx_params = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 639 | roam_ht_cap->supportedMCSSet[12]; |
| 640 | } |
| 641 | |
| 642 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 643 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 644 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 645 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 646 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 647 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 648 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 649 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 650 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 651 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 652 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 653 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 654 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 655 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 656 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 657 | tDot11fIEVHTCaps *roam_vht_cap) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 658 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 659 | uint32_t temp_vht_cap; |
| 660 | |
| 661 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 662 | |
| 663 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 664 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 665 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 666 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 667 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 668 | if (temp_vht_cap) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 669 | if (roam_vht_cap->supportedChannelWidthSet & |
| 670 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 671 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 672 | hdd_vht_cap->vht_cap_info |= |
| 673 | temp_vht_cap << |
| 674 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 675 | if (roam_vht_cap->supportedChannelWidthSet & |
| 676 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 677 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 678 | hdd_vht_cap->vht_cap_info |= |
| 679 | temp_vht_cap << |
| 680 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 681 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 682 | if (roam_vht_cap->ldpcCodingCap) |
| 683 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 684 | if (roam_vht_cap->shortGI80MHz) |
| 685 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 686 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 687 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 688 | if (roam_vht_cap->txSTBC) |
| 689 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 690 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 691 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 692 | if (temp_vht_cap) |
| 693 | hdd_vht_cap->vht_cap_info |= |
| 694 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 695 | if (roam_vht_cap->suBeamFormerCap) |
| 696 | hdd_vht_cap->vht_cap_info |= |
| 697 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 698 | if (roam_vht_cap->suBeamformeeCap) |
| 699 | hdd_vht_cap->vht_cap_info |= |
| 700 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 701 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 702 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 703 | if (temp_vht_cap) |
| 704 | hdd_vht_cap->vht_cap_info |= |
| 705 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 706 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 707 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 708 | if (temp_vht_cap) |
| 709 | hdd_vht_cap->vht_cap_info |= |
| 710 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 711 | if (roam_vht_cap->muBeamformerCap) |
| 712 | hdd_vht_cap->vht_cap_info |= |
| 713 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 714 | if (roam_vht_cap->muBeamformeeCap) |
| 715 | hdd_vht_cap->vht_cap_info |= |
| 716 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 717 | if (roam_vht_cap->vhtTXOPPS) |
| 718 | hdd_vht_cap->vht_cap_info |= |
| 719 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 720 | if (roam_vht_cap->htcVHTCap) |
| 721 | hdd_vht_cap->vht_cap_info |= |
| 722 | IEEE80211_VHT_CAP_HTC_VHT; |
| 723 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 724 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 725 | if (temp_vht_cap) |
| 726 | hdd_vht_cap->vht_cap_info |= |
| 727 | temp_vht_cap << |
| 728 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 729 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 730 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 731 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 732 | if (temp_vht_cap) |
| 733 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 734 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 735 | if (roam_vht_cap->rxAntPattern) |
| 736 | hdd_vht_cap->vht_cap_info |= |
| 737 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 738 | if (roam_vht_cap->txAntPattern) |
| 739 | hdd_vht_cap->vht_cap_info |= |
| 740 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 741 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 742 | hdd_vht_cap->supp_mcs.rx_highest = |
| 743 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 744 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 745 | hdd_vht_cap->supp_mcs.tx_highest = |
| 746 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 747 | } |
| 748 | |
| 749 | /* ht param */ |
| 750 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 751 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 752 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 753 | |
| 754 | /* operatinon mode */ |
| 755 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 756 | |
| 757 | /* stbc_param */ |
| 758 | #define HT_STBC_PARAM_MCS 0x007f |
| 759 | |
| 760 | /** |
| 761 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 762 | * hdd station context. |
| 763 | * @hdd_sta_ctx: pointer to hdd station context |
| 764 | * @roam_info: pointer to roam info |
| 765 | * |
| 766 | * Return: None |
| 767 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 768 | static void hdd_copy_ht_operation(struct hdd_station_ctx *hdd_sta_ctx, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 769 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 770 | { |
| 771 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 772 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 773 | &hdd_sta_ctx->conn_info.ht_operation; |
| 774 | uint32_t i, temp_ht_ops; |
| 775 | |
| 776 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 777 | |
| 778 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 779 | |
| 780 | /* HT_PARAMS */ |
| 781 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 782 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 783 | if (temp_ht_ops) |
| 784 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 785 | else |
| 786 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 787 | if (roam_ht_ops->recommendedTxWidthSet) |
| 788 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 789 | if (roam_ht_ops->rifsMode) |
| 790 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 791 | if (roam_ht_ops->controlledAccessOnly) |
| 792 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 793 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 794 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 795 | if (temp_ht_ops) |
| 796 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 797 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 798 | |
| 799 | /* operation mode */ |
| 800 | temp_ht_ops = roam_ht_ops->opMode & |
| 801 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 802 | switch (temp_ht_ops) { |
| 803 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 804 | hdd_ht_ops->operation_mode |= |
| 805 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 806 | break; |
| 807 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 808 | hdd_ht_ops->operation_mode |= |
| 809 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 810 | break; |
| 811 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 812 | hdd_ht_ops->operation_mode |= |
| 813 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 814 | break; |
| 815 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 816 | default: |
| 817 | hdd_ht_ops->operation_mode |= |
| 818 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 819 | } |
| 820 | if (roam_ht_ops->nonGFDevicesPresent) |
| 821 | hdd_ht_ops->operation_mode |= |
| 822 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 823 | if (roam_ht_ops->transmitBurstLimit) |
| 824 | hdd_ht_ops->operation_mode |= |
| 825 | HT_OP_MODE_TX_BURST_LIMIT; |
| 826 | if (roam_ht_ops->obssNonHTStaPresent) |
| 827 | hdd_ht_ops->operation_mode |= |
| 828 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 829 | |
| 830 | /* stbc_param */ |
| 831 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 832 | HT_STBC_PARAM_MCS; |
| 833 | if (temp_ht_ops) |
| 834 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 835 | if (roam_ht_ops->dualCTSProtection) |
| 836 | hdd_ht_ops->stbc_param |= |
| 837 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 838 | if (roam_ht_ops->secondaryBeacon) |
| 839 | hdd_ht_ops->stbc_param |= |
| 840 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 841 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 842 | hdd_ht_ops->stbc_param |= |
| 843 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 844 | if (roam_ht_ops->pcoActive) |
| 845 | hdd_ht_ops->stbc_param |= |
| 846 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 847 | if (roam_ht_ops->pcoPhase) |
| 848 | hdd_ht_ops->stbc_param |= |
| 849 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 850 | |
| 851 | /* basic MCs set */ |
| 852 | for (i = 0; i < 16; ++i) |
| 853 | hdd_ht_ops->basic_set[i] = |
| 854 | roam_ht_ops->basicMCSSet[i]; |
| 855 | } |
| 856 | |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 857 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) |
| 858 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 859 | tDot11fIEVHTOperation *roam_ops) |
| 860 | { |
| 861 | ieee_ops->center_freq_seg0_idx = roam_ops->chanCenterFreqSeg1; |
| 862 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg2; |
| 863 | } |
| 864 | #else |
| 865 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 866 | tDot11fIEVHTOperation *roam_ops) |
| 867 | { |
| 868 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg1; |
| 869 | ieee_ops->center_freq_seg2_idx = roam_ops->chanCenterFreqSeg2; |
| 870 | } |
| 871 | #endif /* KERNEL_VERSION(4, 12, 0) */ |
| 872 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 873 | /** |
| 874 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 875 | * hdd station context. |
| 876 | * @hdd_sta_ctx: pointer to hdd station context |
| 877 | * @roam_info: pointer to roam info |
| 878 | * |
| 879 | * Return: None |
| 880 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 881 | static void hdd_copy_vht_operation(struct hdd_station_ctx *hdd_sta_ctx, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 882 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 883 | { |
| 884 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 885 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 886 | &hdd_sta_ctx->conn_info.vht_operation; |
| 887 | |
| 888 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 889 | |
| 890 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 891 | hdd_copy_vht_center_freq(hdd_vht_ops, roam_vht_ops); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 892 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 893 | } |
| 894 | |
| 895 | |
| 896 | /** |
| 897 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 898 | * @adapter: Pointer to adapter |
| 899 | * @roam_info: pointer to roam info |
| 900 | * |
| 901 | * Return: None |
| 902 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 903 | static void hdd_save_bss_info(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 904 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 905 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 906 | struct hdd_station_ctx *hdd_sta_ctx = |
| 907 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 908 | |
| 909 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 910 | hdd_sta_ctx->conn_info.channel); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 911 | if (roam_info->vht_caps.present) { |
| 912 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 913 | hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps, |
| 914 | &roam_info->vht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 915 | } else { |
| 916 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 917 | } |
| 918 | if (roam_info->ht_caps.present) { |
| 919 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 920 | hdd_copy_ht_caps(&hdd_sta_ctx->conn_info.ht_caps, |
| 921 | &roam_info->ht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 922 | } else { |
| 923 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 924 | } |
| 925 | if (roam_info->reassoc) |
| 926 | hdd_sta_ctx->conn_info.roam_count++; |
| 927 | if (roam_info->hs20vendor_ie.present) { |
| 928 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 929 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 930 | &roam_info->hs20vendor_ie, |
| 931 | sizeof(roam_info->hs20vendor_ie)); |
| 932 | } else { |
| 933 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 934 | } |
| 935 | if (roam_info->ht_operation.present) { |
| 936 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 937 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 938 | } else { |
| 939 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 940 | } |
| 941 | if (roam_info->vht_operation.present) { |
| 942 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 943 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 944 | } else { |
| 945 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 946 | } |
Ashish Kumar Dhanotiya | 36d19b0 | 2018-02-22 00:59:49 +0530 | [diff] [blame] | 947 | /* Cache last connection info */ |
| 948 | qdf_mem_copy(&hdd_sta_ctx->cache_conn_info, &hdd_sta_ctx->conn_info, |
Ashish Kumar Dhanotiya | 0213793 | 2019-02-26 21:43:32 +0530 | [diff] [blame] | 949 | sizeof(hdd_sta_ctx->cache_conn_info)); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 950 | } |
| 951 | |
| 952 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | * hdd_conn_save_connect_info() - save current connection information |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 954 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 955 | * @roam_info: pointer to roam info |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 956 | * @bss_type: bss type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 957 | * |
| 958 | * Return: none |
| 959 | */ |
| 960 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 961 | hdd_conn_save_connect_info(struct hdd_adapter *adapter, |
| 962 | struct csr_roam_info *roam_info, |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 963 | eCsrRoamBssType bss_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 965 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 966 | eCsrEncryptionType encrypt_type = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 968 | QDF_ASSERT(roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 969 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 970 | if (roam_info) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | /* Save the BSSID for the connection */ |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 972 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == bss_type) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 973 | QDF_ASSERT(roam_info->pBssDesc); |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 974 | qdf_copy_macaddr(&sta_ctx->conn_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 975 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 976 | |
| 977 | /* |
| 978 | * Save the Station ID for this station from |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 979 | * the 'Roam Info'. For IBSS mode, sta_id is |
| 980 | * assigned in NEW_PEER_IND. For reassoc, the |
| 981 | * sta_id doesn't change and it may be invalid |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | * in this structure so no change here. |
| 983 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 984 | if (!roam_info->fReassocReq) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 985 | sta_ctx->conn_info.sta_id[0] = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 986 | roam_info->staId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 987 | } |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 988 | } else if (eCSR_BSS_TYPE_IBSS == bss_type) { |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 989 | qdf_copy_macaddr(&sta_ctx->conn_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 990 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 991 | } else { |
| 992 | /* |
| 993 | * can't happen. We need a valid IBSS or Infra setting |
| 994 | * in the BSSDescription or we can't function. |
| 995 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 996 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 997 | } |
| 998 | |
| 999 | /* notify WMM */ |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 1000 | hdd_wmm_connect(adapter, roam_info, bss_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1001 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1002 | if (!roam_info->u.pConnectedProfile) { |
| 1003 | QDF_ASSERT(roam_info->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1004 | } else { |
| 1005 | /* Get Multicast Encryption Type */ |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1006 | encrypt_type = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1007 | roam_info->u.pConnectedProfile->mcEncryptionType; |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1008 | sta_ctx->conn_info.mc_encrypt_type = encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1009 | /* Get Unicast Encryption Type */ |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1010 | encrypt_type = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1011 | roam_info->u.pConnectedProfile->EncryptionType; |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1012 | sta_ctx->conn_info.uc_encrypt_type = encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 1014 | sta_ctx->conn_info.auth_type = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1015 | roam_info->u.pConnectedProfile->AuthType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1016 | sta_ctx->conn_info.last_auth_type = |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 1017 | sta_ctx->conn_info.auth_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1018 | |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 1019 | sta_ctx->conn_info.channel = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1020 | roam_info->u.pConnectedProfile->operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1021 | |
| 1022 | /* Save the ssid for the connection */ |
Jeff Johnson | 4aea180 | 2019-02-27 10:21:33 -0800 | [diff] [blame] | 1023 | qdf_mem_copy(&sta_ctx->conn_info.ssid.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1024 | &roam_info->u.pConnectedProfile->SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1025 | sizeof(tSirMacSSid)); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1026 | qdf_mem_copy(&sta_ctx->conn_info.last_ssid.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1027 | &roam_info->u.pConnectedProfile->SSID, |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1028 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1029 | |
| 1030 | /* Save dot11mode in which STA associated to AP */ |
Jeff Johnson | c52bc8b | 2019-02-27 17:49:33 -0800 | [diff] [blame] | 1031 | sta_ctx->conn_info.dot11mode = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1032 | roam_info->u.pConnectedProfile->dot11Mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1033 | |
Jeff Johnson | ac5170c | 2019-02-27 10:55:24 -0800 | [diff] [blame] | 1034 | sta_ctx->conn_info.proxy_arp_service = |
| 1035 | roam_info->u.pConnectedProfile->proxy_arp_service; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1036 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1037 | sta_ctx->conn_info.nss = roam_info->chan_info.nss; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1038 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1039 | sta_ctx->conn_info.rate_flags = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1040 | roam_info->chan_info.rate_flags; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 1041 | |
| 1042 | sta_ctx->conn_info.ch_width = |
| 1043 | roam_info->chan_info.ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1044 | } |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1045 | hdd_save_bss_info(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1046 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1047 | } |
| 1048 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1049 | /** |
| 1050 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 1051 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1052 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1053 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1054 | * |
| 1055 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 1056 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 1057 | * for the same purpose.) |
| 1058 | * |
| 1059 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 1060 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 1061 | * This is the Assoc Response. |
| 1062 | * |
| 1063 | * Return: none |
| 1064 | */ |
| 1065 | static void |
| 1066 | hdd_send_ft_assoc_response(struct net_device *dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1067 | struct hdd_adapter *adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1068 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1069 | { |
| 1070 | union iwreq_data wrqu; |
| 1071 | char *buff; |
| 1072 | unsigned int len = 0; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1073 | u8 *assoc_rsp = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1074 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1075 | if (roam_info->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1076 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1077 | return; |
| 1078 | } |
| 1079 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1080 | assoc_rsp = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1081 | (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength + |
| 1082 | roam_info->nAssocReqLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1083 | if (!assoc_rsp) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1084 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1085 | return; |
| 1086 | } |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1087 | /* assoc_rsp needs to point to the IEs */ |
| 1088 | assoc_rsp += FT_ASSOC_RSP_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1089 | |
| 1090 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1091 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1092 | if (!buff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1093 | return; |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1094 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1095 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1096 | len = roam_info->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1097 | wrqu.data.length = len; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1098 | memcpy(buff, assoc_rsp, len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1099 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 1100 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1101 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1102 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1103 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1104 | /** |
| 1105 | * hdd_send_ft_event() - send fast transition event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1106 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1107 | * |
| 1108 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 1109 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 1110 | * followed by the auth response IEs to the supplicant. |
| 1111 | * Once both are received in the supplicant, an FT event is generated |
| 1112 | * to the supplicant. |
| 1113 | * |
| 1114 | * Return: none |
| 1115 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1116 | static void hdd_send_ft_event(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1117 | { |
| 1118 | uint16_t auth_resp_len = 0; |
| 1119 | uint32_t ric_ies_length = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1120 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1121 | mac_handle_t mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1122 | |
| 1123 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 1124 | struct cfg80211_ft_event_params ftEvent; |
| 1125 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1126 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1127 | struct net_device *dev = adapter->dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1128 | #else |
| 1129 | char *buff; |
| 1130 | union iwreq_data wrqu; |
| 1131 | uint16_t str_len; |
| 1132 | #endif |
| 1133 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1134 | mac_handle = hdd_ctx->mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1135 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1136 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1137 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1138 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1139 | sme_get_rici_es(mac_handle, adapter->vdev_id, (u8 *) ricIe, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1140 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1141 | if (ric_ies_length == 0) |
| 1142 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1143 | |
| 1144 | ftEvent.ric_ies = ricIe; |
| 1145 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1146 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1147 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1148 | sme_get_ft_pre_auth_response(mac_handle, adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1149 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1150 | &auth_resp_len); |
| 1151 | |
| 1152 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1153 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1154 | return; |
| 1155 | } |
| 1156 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1157 | sme_set_ft_pre_auth_state(mac_handle, adapter->vdev_id, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1158 | |
| 1159 | ftEvent.target_ap = ftIe; |
| 1160 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1161 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1162 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1163 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1164 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1165 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1166 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1167 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1168 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1169 | ftEvent.target_ap[5]); |
| 1170 | |
| 1171 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1172 | |
| 1173 | #else |
| 1174 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1175 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1176 | if (!buff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1177 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1178 | |
| 1179 | /* Sme needs to send the RIC IEs first */ |
| 1180 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1181 | sme_get_rici_es(mac_handle, adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1182 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1183 | &ric_ies_length); |
| 1184 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1185 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1186 | } else { |
| 1187 | wrqu.data.length = str_len + ric_ies_length; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1188 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1189 | } |
| 1190 | |
| 1191 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1192 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1193 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1194 | sme_get_ft_pre_auth_response(mac_handle, adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1195 | (u8 *) &buff[str_len], |
| 1196 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1197 | |
| 1198 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1199 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1200 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1201 | return; |
| 1202 | } |
| 1203 | |
| 1204 | wrqu.data.length = str_len + auth_resp_len; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1205 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1206 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1207 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1208 | #endif |
| 1209 | } |
| 1210 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1211 | #ifdef FEATURE_WLAN_ESE |
| 1212 | /** |
| 1213 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1214 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1215 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1216 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1217 | * |
| 1218 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1219 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1220 | * |
| 1221 | * The current (new AP) channel information is passed in. |
| 1222 | * |
| 1223 | * Return: none |
| 1224 | */ |
| 1225 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1226 | hdd_send_new_ap_channel_info(struct net_device *dev, |
| 1227 | struct hdd_adapter *adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1228 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1229 | { |
| 1230 | union iwreq_data wrqu; |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1231 | struct bss_description *descriptor = roam_info->pBssDesc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1232 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1233 | if (!descriptor) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1234 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1235 | return; |
| 1236 | } |
| 1237 | /* |
| 1238 | * Send the Channel event, the supplicant needs this to generate |
| 1239 | * the Adjacent AP report. |
| 1240 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1241 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1242 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1243 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1244 | wrqu.freq.m = descriptor->channelId; |
| 1245 | wrqu.freq.e = 0; |
| 1246 | wrqu.freq.i = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1247 | wireless_send_event(adapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1248 | } |
| 1249 | |
| 1250 | #endif /* FEATURE_WLAN_ESE */ |
| 1251 | |
| 1252 | /** |
| 1253 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1254 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1255 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1256 | * |
| 1257 | * Return: none |
| 1258 | */ |
| 1259 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1260 | hdd_send_update_beacon_ies_event(struct hdd_adapter *adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1261 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1262 | { |
| 1263 | union iwreq_data wrqu; |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1264 | u8 *beacon_ies; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1265 | u8 currentLen = 0; |
| 1266 | char *buff; |
| 1267 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1268 | |
| 1269 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1270 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1271 | if (0 == roam_info->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1272 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1273 | return; |
| 1274 | } |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1275 | beacon_ies = (u8 *) (roam_info->pbFrames + BEACON_FRAME_IES_OFFSET); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1276 | if (!beacon_ies) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1277 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1278 | return; |
| 1279 | } |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1280 | /* beacon_ies needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1281 | hdd_debug("Beacon IEs is now at %02x%02x", |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1282 | (unsigned int)beacon_ies[0], |
| 1283 | (unsigned int)beacon_ies[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1284 | hdd_debug("Beacon IEs length = %d", |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1285 | roam_info->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1286 | |
| 1287 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1288 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1289 | if (!buff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1290 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1291 | |
| 1292 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1293 | currentLen = strLen + 1; |
| 1294 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1295 | totalIeLen = roam_info->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1296 | do { |
| 1297 | /* |
| 1298 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1299 | * into chunks of CUSTOM event max size and send it to |
| 1300 | * supplicant. Changes are done in supplicant to handle this. |
| 1301 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1302 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1303 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1304 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1305 | qdf_mem_copy(&buff[strLen + 1], beacon_ies + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1306 | currentLen); |
| 1307 | currentOffset += currentLen; |
| 1308 | totalIeLen -= currentLen; |
| 1309 | wrqu.data.length = strLen + 1 + currentLen; |
| 1310 | if (totalIeLen) |
| 1311 | buff[strLen] = 1; /* more chunks pending */ |
| 1312 | else |
| 1313 | buff[strLen] = 0; /* last chunk */ |
| 1314 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1315 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1316 | currentLen); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1317 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1318 | } while (totalIeLen > 0); |
| 1319 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1320 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1321 | } |
| 1322 | |
| 1323 | /** |
| 1324 | * hdd_send_association_event() - send association event |
| 1325 | * @dev: pointer to net device |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1326 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1327 | * |
| 1328 | * Return: none |
| 1329 | */ |
| 1330 | static void hdd_send_association_event(struct net_device *dev, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1331 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1332 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1333 | int ret; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1334 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1335 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1336 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1337 | union iwreq_data wrqu; |
| 1338 | int we_event; |
| 1339 | char *msg; |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1340 | struct qdf_mac_addr peer_macaddr; |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1341 | struct csr_roam_profile *roam_profile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1342 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1343 | roam_profile = hdd_roam_profile(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1344 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1345 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1346 | we_event = SIOCGIWAP; |
| 1347 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1348 | if (roam_info) |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1349 | if (roam_info->roamSynchInProgress) { |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1350 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1351 | hdd_notify_sta_disconnect(adapter->vdev_id, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1352 | true, false, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1353 | adapter->vdev); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1354 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1355 | #endif |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1356 | if (eConnectionState_Associated == sta_ctx->conn_info.conn_state) { |
Jeff Johnson | a7d5b54 | 2019-02-03 10:15:46 -0800 | [diff] [blame] | 1357 | struct oem_channel_info chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1358 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1359 | if (!roam_info || !roam_info->pBssDesc) { |
| 1360 | hdd_warn("STA in associated state but roam_info is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1361 | return; |
| 1362 | } |
| 1363 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1364 | if (!hdd_is_roam_sync_in_progress(roam_info)) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1365 | policy_mgr_incr_active_session(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1366 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 1367 | hdd_green_ap_start_state_mc(hdd_ctx, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 1368 | adapter->device_mode, true); |
| 1369 | } |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1370 | memcpy(wrqu.ap_addr.sa_data, roam_info->pBssDesc->bssId, |
| 1371 | sizeof(roam_info->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1372 | |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1373 | ucfg_p2p_status_connect(adapter->vdev); |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1374 | |
Abhinav Kumar | 50d4dc7 | 2018-06-15 16:35:50 +0530 | [diff] [blame] | 1375 | hdd_info("wlan: " MAC_ADDRESS_STR " connected to " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1376 | MAC_ADDRESS_STR "\n", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1377 | QDF_MAC_ADDR_ARRAY(adapter->mac_addr.bytes), |
| 1378 | QDF_MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1379 | hdd_send_update_beacon_ies_event(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1380 | |
| 1381 | /* |
| 1382 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1383 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1384 | * fFTEnable is true. |
| 1385 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1386 | */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1387 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1388 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1389 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1390 | eCSR_AUTH_TYPE_FT_RSN) |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 1391 | || (roam_profile->AuthType.authType[0] == |
| 1392 | eCSR_AUTH_TYPE_FT_SAE) |
| 1393 | || (roam_profile->AuthType.authType[0] == |
| 1394 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1395 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1396 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1397 | eCSR_AUTH_TYPE_CCKM_RSN) |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1398 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1399 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1400 | #endif |
| 1401 | ) { |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1402 | hdd_send_ft_assoc_response(dev, adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1403 | } |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1404 | qdf_copy_macaddr(&peer_macaddr, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1405 | &sta_ctx->conn_info.bssid); |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1406 | chan_info.chan_id = roam_info->chan_info.chan_id; |
| 1407 | chan_info.mhz = roam_info->chan_info.mhz; |
| 1408 | chan_info.info = roam_info->chan_info.info; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1409 | chan_info.band_center_freq1 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1410 | roam_info->chan_info.band_center_freq1; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1411 | chan_info.band_center_freq2 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1412 | roam_info->chan_info.band_center_freq2; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1413 | chan_info.reg_info_1 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1414 | roam_info->chan_info.reg_info_1; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1415 | chan_info.reg_info_2 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1416 | roam_info->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1417 | |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1418 | ret = hdd_objmgr_set_peer_mlme_state(adapter->vdev, |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1419 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1420 | if (ret) |
| 1421 | hdd_err("Peer object %pM fail to set associated state", |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1422 | peer_macaddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1423 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1424 | /* send peer status indication to oem app */ |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1425 | hdd_send_peer_status_ind_to_app(&peer_macaddr, |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1426 | ePeerConnected, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1427 | roam_info->timingMeasCap, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1428 | adapter->vdev_id, &chan_info, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1429 | adapter->device_mode); |
jiad | 7b8a5e0 | 2018-11-26 16:37:57 +0800 | [diff] [blame] | 1430 | |
| 1431 | #ifdef FEATURE_WLAN_TDLS |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1432 | /* Update tdls module about connection event */ |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1433 | hdd_notify_sta_connect(adapter->vdev_id, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1434 | roam_info->tdls_chan_swit_prohibited, |
| 1435 | roam_info->tdls_prohibited, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1436 | adapter->vdev); |
jiad | 7b8a5e0 | 2018-11-26 16:37:57 +0800 | [diff] [blame] | 1437 | #endif |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1438 | |
Tiger Yu | 8b119e9 | 2019-04-09 13:55:07 +0800 | [diff] [blame^] | 1439 | #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1440 | /* start timer in sta/p2p_cli */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1441 | spin_lock_bh(&hdd_ctx->bus_bw_lock); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1442 | adapter->prev_tx_packets = adapter->stats.tx_packets; |
| 1443 | adapter->prev_rx_packets = adapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1444 | cdp_get_intra_bss_fwd_pkts_count( |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1445 | cds_get_context(QDF_MODULE_ID_SOC), adapter->vdev_id, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1446 | &adapter->prev_fwd_tx_packets, |
| 1447 | &adapter->prev_fwd_rx_packets); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1448 | spin_unlock_bh(&hdd_ctx->bus_bw_lock); |
| 1449 | hdd_bus_bw_compute_timer_start(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1450 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1451 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1452 | sta_ctx->conn_info.conn_state) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1453 | policy_mgr_update_connection_info(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1454 | adapter->vdev_id); |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1455 | memcpy(wrqu.ap_addr.sa_data, sta_ctx->conn_info.bssid.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1456 | ETH_ALEN); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1457 | hdd_debug("wlan: new IBSS peer connection to BSSID " MAC_ADDRESS_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1458 | QDF_MAC_ADDR_ARRAY(sta_ctx->conn_info.bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1459 | } else { /* Not Associated */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1460 | hdd_debug("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1461 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1462 | policy_mgr_decr_session_set_pcl(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1463 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 1464 | hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 1465 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1466 | |
| 1467 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1468 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1469 | #endif |
| 1470 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1471 | if ((adapter->device_mode == QDF_STA_MODE) || |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1472 | (adapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1473 | qdf_copy_macaddr(&peer_macaddr, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1474 | &sta_ctx->conn_info.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1475 | |
| 1476 | /* send peer status indication to oem app */ |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1477 | hdd_send_peer_status_ind_to_app(&peer_macaddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1478 | ePeerDisconnected, 0, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1479 | adapter->vdev_id, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1480 | NULL, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1481 | adapter->device_mode); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1482 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1483 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1484 | hdd_lpass_notify_disconnect(adapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1485 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1486 | hdd_notify_sta_disconnect(adapter->vdev_id, |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1487 | false, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1488 | false, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1489 | adapter->vdev); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1490 | |
Tiger Yu | 8b119e9 | 2019-04-09 13:55:07 +0800 | [diff] [blame^] | 1491 | #ifdef WLAN_FEATURE_DP_BUS_BANDWIDTH |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1492 | /* stop timer in sta/p2p_cli */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1493 | spin_lock_bh(&hdd_ctx->bus_bw_lock); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1494 | adapter->prev_tx_packets = 0; |
| 1495 | adapter->prev_rx_packets = 0; |
| 1496 | adapter->prev_fwd_tx_packets = 0; |
| 1497 | adapter->prev_fwd_rx_packets = 0; |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1498 | spin_unlock_bh(&hdd_ctx->bus_bw_lock); |
| 1499 | hdd_bus_bw_compute_timer_try_stop(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1500 | #endif |
| 1501 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1502 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1503 | |
| 1504 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1505 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1506 | * driver so not sending the status of the connection to supplicant |
| 1507 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1508 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1509 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1510 | #ifdef FEATURE_WLAN_ESE |
| 1511 | if (eConnectionState_Associated == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1512 | sta_ctx->conn_info.conn_state) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1513 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1514 | eCSR_AUTH_TYPE_CCKM_RSN) || |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1515 | (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1516 | eCSR_AUTH_TYPE_CCKM_WPA)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1517 | hdd_send_new_ap_channel_info(dev, adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1518 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1519 | } |
| 1520 | #endif |
| 1521 | } |
| 1522 | } |
| 1523 | |
| 1524 | /** |
| 1525 | * hdd_conn_remove_connect_info() - remove connection info |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1526 | * @sta_ctx: pointer to global HDD station context |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1527 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1528 | * |
| 1529 | * Return: none |
| 1530 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1531 | static void hdd_conn_remove_connect_info(struct hdd_station_ctx *sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1532 | { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1533 | /* Remove sta_id, bssid and peer_macaddr */ |
| 1534 | sta_ctx->conn_info.sta_id[0] = HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1535 | qdf_mem_zero(&sta_ctx->conn_info.bssid, QDF_MAC_ADDR_SIZE); |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 1536 | qdf_mem_zero(&sta_ctx->conn_info.peer_macaddr[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1537 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1538 | |
| 1539 | /* Clear all security settings */ |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 1540 | sta_ctx->conn_info.auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | b195984 | 2019-02-27 13:04:04 -0800 | [diff] [blame] | 1541 | sta_ctx->conn_info.mc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE; |
| 1542 | sta_ctx->conn_info.uc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1543 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1544 | qdf_mem_zero(&sta_ctx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1545 | |
Jeff Johnson | ac5170c | 2019-02-27 10:55:24 -0800 | [diff] [blame] | 1546 | sta_ctx->conn_info.proxy_arp_service = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1547 | |
Jeff Johnson | 4aea180 | 2019-02-27 10:21:33 -0800 | [diff] [blame] | 1548 | qdf_mem_zero(&sta_ctx->conn_info.ssid, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1549 | } |
| 1550 | |
| 1551 | /** |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 1552 | * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs |
| 1553 | * @adapter: adapter who's IEs are to be cleared |
| 1554 | * |
| 1555 | * Return: None |
| 1556 | */ |
| 1557 | static void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter) |
| 1558 | { |
| 1559 | struct hdd_station_ctx *sta_ctx; |
| 1560 | struct csr_roam_profile *roam_profile; |
| 1561 | |
| 1562 | hdd_enter(); |
| 1563 | |
| 1564 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 1565 | roam_profile = hdd_roam_profile(adapter); |
| 1566 | |
| 1567 | roam_profile->nWPAReqIELength = 0; |
| 1568 | roam_profile->pWPAReqIE = NULL; |
| 1569 | roam_profile->nRSNReqIELength = 0; |
| 1570 | roam_profile->pRSNReqIE = NULL; |
| 1571 | |
| 1572 | #ifdef FEATURE_WLAN_WAPI |
| 1573 | roam_profile->nWAPIReqIELength = 0; |
| 1574 | roam_profile->pWAPIReqIE = NULL; |
| 1575 | #endif |
| 1576 | |
| 1577 | roam_profile->bWPSAssociation = false; |
| 1578 | roam_profile->bOSENAssociation = false; |
| 1579 | roam_profile->pAddIEScan = NULL; |
| 1580 | roam_profile->nAddIEScanLength = 0; |
| 1581 | roam_profile->pAddIEAssoc = NULL; |
| 1582 | roam_profile->nAddIEAssocLength = 0; |
| 1583 | |
| 1584 | roam_profile->EncryptionType.numEntries = 1; |
| 1585 | roam_profile->EncryptionType.encryptionType[0] = |
| 1586 | eCSR_ENCRYPT_TYPE_NONE; |
| 1587 | |
| 1588 | roam_profile->mcEncryptionType.numEntries = 1; |
| 1589 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 1590 | eCSR_ENCRYPT_TYPE_NONE; |
| 1591 | |
| 1592 | roam_profile->AuthType.numEntries = 1; |
| 1593 | roam_profile->AuthType.authType[0] = |
| 1594 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1595 | |
| 1596 | qdf_mem_zero(roam_profile->bssid_hint.bytes, QDF_MAC_ADDR_SIZE); |
| 1597 | |
| 1598 | #ifdef WLAN_FEATURE_11W |
| 1599 | roam_profile->MFPEnabled = false; |
| 1600 | roam_profile->MFPRequired = 0; |
| 1601 | roam_profile->MFPCapable = 0; |
| 1602 | #endif |
| 1603 | |
| 1604 | qdf_mem_zero(roam_profile->Keys.KeyLength, CSR_MAX_NUM_KEY); |
Ashish Kumar Dhanotiya | 0213793 | 2019-02-26 21:43:32 +0530 | [diff] [blame] | 1605 | qdf_mem_zero(roam_profile->Keys.KeyMaterial, |
| 1606 | sizeof(roam_profile->Keys.KeyMaterial)); |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 1607 | #ifdef FEATURE_WLAN_WAPI |
| 1608 | adapter->wapi_info.wapi_auth_mode = WAPI_AUTH_MODE_OPEN; |
| 1609 | adapter->wapi_info.wapi_mode = false; |
| 1610 | #endif |
| 1611 | |
| 1612 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1613 | sta_ctx->auth_key_mgmt = 0; |
| 1614 | qdf_zero_macaddr(&sta_ctx->requested_bssid); |
Srinivas Dasari | e3ef7c6 | 2018-12-28 13:16:09 +0530 | [diff] [blame] | 1615 | hdd_clear_fils_connection_info(adapter); |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 1616 | hdd_exit(); |
| 1617 | } |
| 1618 | |
| 1619 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1620 | * hdd_roam_deregister_sta() - deregister station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1621 | * @adapter: pointer to adapter |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1622 | * @sta_id: station identifier |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1623 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1624 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1625 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1626 | QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter, uint8_t sta_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1627 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1628 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1629 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1630 | qdf_status = cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC), |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1631 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1632 | sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1633 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1634 | hdd_err("cdp_clear_peer() failed for sta_id %d. Status(%d) [0x%08X]", |
| 1635 | sta_id, qdf_status, qdf_status); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1636 | } |
| 1637 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1638 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1642 | * hdd_print_bss_info() - print bss info |
| 1643 | * @hdd_sta_ctx: pointer to hdd station context |
| 1644 | * |
| 1645 | * Return: None |
| 1646 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1647 | static void hdd_print_bss_info(struct hdd_station_ctx *hdd_sta_ctx) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1648 | { |
| 1649 | uint32_t *cap_info; |
| 1650 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1651 | hdd_debug("WIFI DATA LOGGER"); |
| 1652 | hdd_debug("channel: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1653 | hdd_sta_ctx->conn_info.freq); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1654 | hdd_debug("dot11mode: %d", |
Jeff Johnson | c52bc8b | 2019-02-27 17:49:33 -0800 | [diff] [blame] | 1655 | hdd_sta_ctx->conn_info.dot11mode); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1656 | hdd_debug("AKM: %d", |
| 1657 | hdd_sta_ctx->conn_info.last_auth_type); |
| 1658 | hdd_debug("ssid: %.*s", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1659 | hdd_sta_ctx->conn_info.last_ssid.SSID.length, |
| 1660 | hdd_sta_ctx->conn_info.last_ssid.SSID.ssId); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1661 | hdd_debug("roam count: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1662 | hdd_sta_ctx->conn_info.roam_count); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1663 | hdd_debug("ant_info: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1664 | hdd_sta_ctx->conn_info.txrate.nss); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1665 | hdd_debug("datarate legacy %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1666 | hdd_sta_ctx->conn_info.txrate.legacy); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1667 | hdd_debug("datarate mcs: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1668 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1669 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1670 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1671 | hdd_debug("ht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1672 | } |
| 1673 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1674 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1675 | hdd_debug("vht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1676 | } |
| 1677 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1678 | hdd_debug("hs20 info: %x", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1679 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1680 | hdd_debug("signal: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1681 | hdd_sta_ctx->conn_info.signal); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1682 | hdd_debug("noise: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1683 | hdd_sta_ctx->conn_info.noise); |
| 1684 | } |
| 1685 | |
| 1686 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | * hdd_dis_connect_handler() - disconnect event handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1688 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1689 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1690 | * @roam_id: roam identifier |
| 1691 | * @roam_status: roam status |
| 1692 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1693 | * |
| 1694 | * This function handles disconnect event: |
| 1695 | * 1. Disable transmit queues; |
| 1696 | * 2. Clean up internal connection states and data structures; |
| 1697 | * 3. Send disconnect indication to supplicant. |
| 1698 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1699 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1700 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1701 | static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1702 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1703 | uint32_t roam_id, |
| 1704 | eRoamCmdStatus roam_status, |
| 1705 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1706 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1707 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1708 | QDF_STATUS vstatus; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1709 | struct net_device *dev = adapter->dev; |
| 1710 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1711 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | uint8_t sta_id; |
| 1713 | bool sendDisconInd = true; |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1714 | mac_handle_t mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1715 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1716 | if (!dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1717 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1718 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1719 | } |
| 1720 | /* notify apps that we can't pass traffic anymore */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1721 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1722 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1723 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1724 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1725 | |
gaurank kathpalia | 63311d1 | 2018-04-12 14:34:26 +0530 | [diff] [blame] | 1726 | if (ucfg_ipa_is_enabled() && |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1727 | (sta_ctx->conn_info.sta_id[0] != HDD_WLAN_INVALID_STA_ID)) |
Dustin Brown | 07901ec | 2018-09-07 11:02:41 -0700 | [diff] [blame] | 1728 | ucfg_ipa_wlan_evt(hdd_ctx->pdev, adapter->dev, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 1729 | adapter->device_mode, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1730 | sta_ctx->conn_info.sta_id[0], |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1731 | adapter->vdev_id, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 1732 | WLAN_IPA_STA_DISCONNECT, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1733 | sta_ctx->conn_info.bssid.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1734 | |
| 1735 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1736 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1737 | #endif |
| 1738 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1739 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1740 | adapter->vdev_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1741 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1742 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1743 | |
| 1744 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1745 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1746 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1747 | * to cfg80211_disconnected. |
| 1748 | */ |
| 1749 | if ((eConnectionState_Disconnecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1750 | sta_ctx->conn_info.conn_state) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1751 | (eConnectionState_NotConnected == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1752 | sta_ctx->conn_info.conn_state) || |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1753 | (eConnectionState_Connecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1754 | sta_ctx->conn_info.conn_state)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1755 | hdd_debug("HDD has initiated a disconnect, no need to send disconnect indication to kernel"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1756 | sendDisconInd = false; |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1757 | } else { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1758 | INIT_COMPLETION(adapter->disconnect_comp_var); |
| 1759 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1760 | eConnectionState_Disconnecting); |
| 1761 | } |
| 1762 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1763 | hdd_clear_roam_profile_ie(adapter); |
| 1764 | hdd_wmm_init(adapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1765 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1766 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1767 | |
| 1768 | /* indicate 'disconnect' status to wpa_supplicant... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1769 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1770 | /* indicate disconnected event to nl80211 */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1771 | if (roam_status != eCSR_ROAM_IBSS_LEAVE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1772 | /* |
| 1773 | * Only send indication to kernel if not initiated |
| 1774 | * by kernel |
| 1775 | */ |
| 1776 | if (sendDisconInd) { |
| 1777 | /* |
| 1778 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1779 | * to ICS UI. |
| 1780 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1781 | if (eCSR_ROAM_LOSTLINK == roam_status) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1782 | if (roam_info->reasonCode == |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1783 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1784 | pr_info("wlan: disconnected due to poor signal, rssi is %d dB\n", |
| 1785 | roam_info->rxRssi); |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1786 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1787 | dev, false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1788 | roam_info->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1789 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1790 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1791 | dev, false, |
| 1792 | WLAN_REASON_UNSPECIFIED |
| 1793 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1794 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1795 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1796 | hdd_debug("sent disconnected event to nl80211, reason code %d", |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1797 | (eCSR_ROAM_LOSTLINK == roam_status) ? |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1798 | roam_info->reasonCode : |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1799 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1800 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1801 | |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1802 | /* update P2P connection status */ |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1803 | ucfg_p2p_status_disconnect(adapter->vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1804 | } |
| 1805 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1806 | hdd_wmm_adapter_clear(adapter); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1807 | mac_handle = hdd_ctx->mac_handle; |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1808 | sme_ft_reset(mac_handle, adapter->vdev_id); |
Ashish Kumar Dhanotiya | 0213793 | 2019-02-26 21:43:32 +0530 | [diff] [blame] | 1809 | sme_reset_key(mac_handle, adapter->vdev_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1810 | if (hdd_remove_beacon_filter(adapter) != 0) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1811 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1812 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1813 | if (eCSR_ROAM_IBSS_LEAVE == roam_status) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1814 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1815 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1816 | sta_id = sta_ctx->broadcast_sta_id; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1817 | vstatus = hdd_roam_deregister_sta(adapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1818 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1819 | hdd_err("hdd_roam_deregister_sta() failed for staID %d Status: %d [0x%x]", |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 1820 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1821 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1822 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1823 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1824 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
| 1825 | else |
| 1826 | hdd_debug("invalid sta id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1827 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1828 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1829 | if (HDD_WLAN_INVALID_STA_ID == |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1830 | sta_ctx->conn_info.sta_id[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1831 | continue; |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1832 | sta_id = sta_ctx->conn_info.sta_id[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1833 | hdd_debug("Deregister StaID %d", sta_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1834 | vstatus = hdd_roam_deregister_sta(adapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1835 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1836 | hdd_err("hdd_roam_deregister_sta() failed to for staID %d Status: %d [0x%x]", |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1837 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1838 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1839 | } |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1840 | /* set the sta_id and peer mac as 0, all other |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1841 | * reset are done in hdd_connRemoveConnectInfo. |
| 1842 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1843 | sta_ctx->conn_info.sta_id[i] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1844 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 1845 | qdf_mem_zero(&sta_ctx->conn_info.peer_macaddr[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1846 | sizeof(struct qdf_mac_addr)); |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1847 | if (sta_id < HDD_MAX_ADAPTERS) |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1848 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1849 | else |
| 1850 | hdd_debug("invalid sta_id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1851 | } |
| 1852 | } else { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1853 | sta_id = sta_ctx->conn_info.sta_id[0]; |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1854 | hdd_debug("roam_result: %d", roam_result); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1855 | |
| 1856 | /* clear scan cache for Link Lost */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1857 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roam_result || |
| 1858 | eCSR_ROAM_RESULT_DISASSOC_IND == roam_result || |
| 1859 | eCSR_ROAM_LOSTLINK == roam_status) { |
Abhishek Singh | 85283ae | 2019-03-08 12:00:51 +0530 | [diff] [blame] | 1860 | wlan_hdd_cfg80211_unlink_bss(adapter, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1861 | sta_ctx->conn_info.bssid.bytes); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1862 | sme_remove_bssid_from_scan_list(mac_handle, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1863 | sta_ctx->conn_info.bssid.bytes); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1864 | } |
Rajeev Kumar | 4bc998f | 2017-10-19 14:41:43 -0700 | [diff] [blame] | 1865 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1866 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1867 | else |
| 1868 | hdd_debug("invalid sta_id %d", sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1869 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1870 | /* Clear saved connection information in HDD */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1871 | hdd_conn_remove_connect_info(sta_ctx); |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1872 | /* |
| 1873 | * eConnectionState_Connecting state mean that connection is in |
| 1874 | * progress so no need to set state to eConnectionState_NotConnected |
| 1875 | */ |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1876 | if ((eConnectionState_Connecting != sta_ctx->conn_info.conn_state)) { |
Srinivas Girigowda | 683726a | 2018-09-07 15:10:40 -0700 | [diff] [blame] | 1877 | hdd_conn_set_connection_state(adapter, |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1878 | eConnectionState_NotConnected); |
Dundi Raviteja | 04037a1 | 2018-08-31 18:41:44 +0530 | [diff] [blame] | 1879 | hdd_set_roaming_in_progress(false); |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1880 | } |
Wu Gao | d7dd6e4 | 2018-10-16 17:22:56 +0800 | [diff] [blame] | 1881 | ucfg_pmo_flush_gtk_offload_req(adapter->vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1882 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1883 | if ((QDF_STA_MODE == adapter->device_mode) || |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1884 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
| 1885 | sme_ps_disable_auto_ps_timer(mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1886 | adapter->vdev_id); |
Yeshwanth Sriram Guntuka | 4fe30bd | 2018-06-13 11:41:42 +0530 | [diff] [blame] | 1887 | adapter->send_mode_change = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1888 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1889 | wlan_hdd_clear_link_layer_stats(adapter); |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1890 | |
Bala Venkatesh | 9f95814 | 2018-06-27 12:36:08 +0530 | [diff] [blame] | 1891 | hdd_debug("check for SAP restart"); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1892 | policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->psoc); |
Jeff Johnson | 6ced42c | 2017-10-20 12:48:11 -0700 | [diff] [blame] | 1893 | adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0; |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1894 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1895 | /* Unblock anyone waiting for disconnect to complete */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1896 | complete(&adapter->disconnect_comp_var); |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 1897 | |
Alok Kumar | b64650c | 2018-03-23 17:05:11 +0530 | [diff] [blame] | 1898 | hdd_nud_reset_tracking(adapter); |
| 1899 | |
| 1900 | hdd_set_disconnect_status(adapter, false); |
| 1901 | |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 1902 | hdd_reset_limit_off_chan(adapter); |
| 1903 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1904 | hdd_print_bss_info(sta_ctx); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1905 | |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1906 | if (policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1907 | sme_enable_roaming_on_connected_sta(mac_handle); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1908 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1909 | return status; |
| 1910 | } |
| 1911 | |
| 1912 | /** |
| 1913 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1914 | * @vdev_id: vdevid |
| 1915 | * |
| 1916 | * Return: None |
| 1917 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1918 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1919 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1920 | struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 1921 | struct hdd_adapter *adapter = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1922 | |
Ashish Kumar Dhanotiya | ab2a929 | 2018-06-16 15:11:27 +0530 | [diff] [blame] | 1923 | if (!hdd_ctx) { |
| 1924 | hdd_err("Invalid hdd context"); |
| 1925 | return; |
| 1926 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1927 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1928 | if (!adapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1929 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1930 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1931 | } |
| 1932 | complete(&adapter->sta_authorized_event); |
| 1933 | } |
| 1934 | |
| 1935 | /** |
| 1936 | * hdd_change_peer_state() - change peer state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1937 | * @adapter: HDD adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1938 | * @sta_state: peer state |
| 1939 | * @roam_synch_in_progress: roam synch in progress |
| 1940 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1941 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1942 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1943 | QDF_STATUS hdd_change_peer_state(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | uint8_t sta_id, |
| 1945 | enum ol_txrx_peer_state sta_state, |
| 1946 | bool roam_synch_in_progress) |
| 1947 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1948 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1949 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1950 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1951 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1952 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1953 | |
| 1954 | if (!pdev) { |
| 1955 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1956 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1957 | } |
| 1958 | |
| 1959 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1960 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1961 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1962 | } |
| 1963 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1964 | peer = cdp_peer_find_by_local_id(soc, |
| 1965 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1966 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1967 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1968 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1969 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1970 | if (!peer_mac_addr) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1971 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1972 | return QDF_STATUS_E_FAULT; |
| 1973 | } |
| 1974 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1975 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1976 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1977 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1978 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1979 | } |
| 1980 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1981 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1982 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1983 | #endif |
| 1984 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1985 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Abhinav Kumar | 2b431b6 | 2019-03-18 20:23:58 +0530 | [diff] [blame] | 1986 | /* Reset scan reject params on successful set key */ |
| 1987 | hdd_debug("Reset scan reject params"); |
| 1988 | hdd_init_scan_reject_params(adapter->hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1989 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1990 | /* make sure event is reset */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1991 | INIT_COMPLETION(adapter->sta_authorized_event); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1992 | #endif |
| 1993 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1994 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | hdd_set_peer_authorized_event, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1996 | adapter->vdev_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1997 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1998 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1999 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2000 | } |
| 2001 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2002 | if (adapter->device_mode == QDF_STA_MODE || |
| 2003 | adapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2004 | #if defined(QCA_LL_LEGACY_TX_FLOW_CONTROL) || defined(QCA_LL_TX_FLOW_CONTROL_V2) |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2005 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2006 | unsigned long rc; |
| 2007 | |
| 2008 | /* wait for event from firmware to set the event */ |
| 2009 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2010 | &adapter->sta_authorized_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2011 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2012 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2013 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2014 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2015 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 2016 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 2017 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2018 | #endif |
| 2019 | } |
| 2020 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2021 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | } |
| 2023 | |
| 2024 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2025 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 2026 | * @cbk_data: callback data |
| 2027 | * @sta_id: station id |
| 2028 | * @vdev_param: vdev parameter |
| 2029 | * @is_link_up: link state up or down |
| 2030 | * |
| 2031 | * Return: QDF status |
| 2032 | */ |
| 2033 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 2034 | uint8_t sta_id, |
| 2035 | uint32_t vdev_param, |
| 2036 | bool is_link_up) |
| 2037 | { |
| 2038 | struct cdp_vdev *data_vdev; |
| 2039 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2040 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2041 | struct hdd_context *hdd_ctx; |
Yun Park | 0dad100 | 2017-07-14 14:57:01 -0700 | [diff] [blame] | 2042 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2043 | struct wlan_objmgr_psoc **psoc; |
| 2044 | |
| 2045 | if (!cbk_data) |
| 2046 | return status; |
| 2047 | |
| 2048 | psoc = cbk_data; |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2049 | |
Kabilan Kannan | c0e3d58 | 2017-09-13 00:26:33 -0700 | [diff] [blame] | 2050 | hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Sourav Mohapatra | 5febc93 | 2018-01-08 14:38:30 +0530 | [diff] [blame] | 2051 | if (!hdd_ctx) { |
| 2052 | hdd_err("Invalid HDD Context"); |
| 2053 | return QDF_STATUS_E_INVAL; |
| 2054 | } |
| 2055 | |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2056 | if (!hdd_ctx->tdls_nap_active) |
| 2057 | return status; |
| 2058 | |
Yun Park | 0dad100 | 2017-07-14 14:57:01 -0700 | [diff] [blame] | 2059 | data_vdev = cdp_peer_get_vdev_by_sta_id(soc, pdev, sta_id); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2060 | if (!data_vdev) { |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2061 | status = QDF_STATUS_E_FAILURE; |
| 2062 | return status; |
| 2063 | } |
| 2064 | |
| 2065 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 2066 | |
| 2067 | return status; |
| 2068 | } |
| 2069 | |
| 2070 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2071 | * hdd_roam_register_sta() - register station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2072 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2073 | * @roam_info: pointer to roam info |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2074 | * @sta_id: station identifier |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2075 | * @pBssDesc: pointer to BSS description |
| 2076 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2077 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2078 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2079 | QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2080 | struct csr_roam_info *roam_info, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2081 | uint8_t sta_id, |
Jeff Johnson | 4ba73cb | 2017-10-06 11:12:33 -0700 | [diff] [blame] | 2082 | struct bss_description *pBssDesc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2084 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2085 | struct ol_txrx_desc_type txrx_desc = { 0 }; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2086 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 2087 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2088 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2089 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2091 | if (!pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2092 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2093 | |
| 2094 | /* Get the Station ID from the one saved during the association */ |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2095 | txrx_desc.sta_id = sta_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | |
| 2097 | /* set the QoS field appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2098 | if (hdd_wmm_is_active(adapter)) |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2099 | txrx_desc.is_qos_enabled = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2100 | else |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2101 | txrx_desc.is_qos_enabled = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2102 | |
| 2103 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 2104 | hdd_debug("WAPI STA Registered: %d", |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2105 | adapter->wapi_info.is_wapi_sta); |
| 2106 | if (adapter->wapi_info.is_wapi_sta) |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2107 | txrx_desc.is_wapi_supported = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2108 | else |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2109 | txrx_desc.is_wapi_supported = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2110 | #endif /* FEATURE_WLAN_WAPI */ |
| 2111 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 2112 | /* Register the vdev transmit and receive functions */ |
| 2113 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
Mohit Khanna | 7032200 | 2018-05-15 19:21:32 -0700 | [diff] [blame] | 2114 | |
| 2115 | if (adapter->hdd_ctx->enable_dp_rx_threads) { |
| 2116 | txrx_ops.rx.rx = hdd_rx_pkt_thread_enqueue_cbk; |
| 2117 | txrx_ops.rx.rx_stack = hdd_rx_packet_cbk; |
| 2118 | } else { |
| 2119 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
| 2120 | txrx_ops.rx.rx_stack = NULL; |
| 2121 | } |
| 2122 | |
Poddar, Siddarth | 31797fa | 2018-01-22 17:24:15 +0530 | [diff] [blame] | 2123 | txrx_ops.rx.stats_rx = hdd_tx_rx_collect_connectivity_stats_info; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2124 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2125 | adapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2126 | (struct cdp_pdev *)pdev, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2127 | adapter->vdev_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2128 | if (!adapter->txrx_vdev) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2129 | hdd_err("%s find vdev fail", __func__); |
| 2130 | return QDF_STATUS_E_FAILURE; |
| 2131 | } |
| 2132 | |
| 2133 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2134 | cdp_vdev_register(soc, |
Sravan Kumar Kairam | 43f191b | 2018-05-04 17:00:39 +0530 | [diff] [blame] | 2135 | (struct cdp_vdev *)adapter->txrx_vdev, adapter, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2136 | (struct cdp_ctrl_objmgr_vdev *)adapter->vdev, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2137 | if (!txrx_ops.tx.tx) { |
| 2138 | hdd_err("%s vdev register fail", __func__); |
| 2139 | return QDF_STATUS_E_FAILURE; |
| 2140 | } |
| 2141 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2142 | adapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2143 | qdf_status = cdp_peer_register(soc, |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2144 | (struct cdp_pdev *)pdev, &txrx_desc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2145 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2146 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2147 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2148 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2149 | } |
| 2150 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2151 | if (!roam_info->fAuthRequired) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2152 | /* |
| 2153 | * Connections that do not need Upper layer auth, transition |
| 2154 | * TLSHIM directly to 'Authenticated' state |
| 2155 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2156 | qdf_status = |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2157 | hdd_change_peer_state(adapter, txrx_desc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2158 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2159 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2160 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2161 | #else |
| 2162 | false |
| 2163 | #endif |
| 2164 | ); |
| 2165 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2166 | hdd_conn_set_authenticated(adapter, true); |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2167 | hdd_objmgr_set_peer_mlme_auth_state(adapter->vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2168 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2169 | hdd_debug("ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2170 | sta_ctx->conn_info.sta_id[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2171 | qdf_status = |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2172 | hdd_change_peer_state(adapter, txrx_desc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2173 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2174 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2175 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2176 | #else |
| 2177 | false |
| 2178 | #endif |
| 2179 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2180 | hdd_conn_set_authenticated(adapter, false); |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2181 | hdd_objmgr_set_peer_mlme_auth_state(adapter->vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2182 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2183 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2184 | } |
| 2185 | |
| 2186 | /** |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2187 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 2188 | * @dev: network device |
| 2189 | * @bss: cfg80211 roamed bss pointer |
| 2190 | * @req_ie: IEs used in reassociation request |
| 2191 | * @req_ie_len: Length of the @req_ie |
| 2192 | * @resp_ie: IEs received in successful reassociation response |
| 2193 | * @resp_ie_len: Length of @resp_ie |
| 2194 | * |
| 2195 | * Return: none |
| 2196 | */ |
| 2197 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 2198 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 2199 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 2200 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 2201 | size_t req_ie_len, const uint8_t *resp_ie, |
| 2202 | size_t resp_ie_len) |
| 2203 | { |
| 2204 | struct cfg80211_roam_info info = {0}; |
| 2205 | |
| 2206 | info.bss = bss; |
| 2207 | info.req_ie = req_ie; |
| 2208 | info.req_ie_len = req_ie_len; |
| 2209 | info.resp_ie = resp_ie; |
| 2210 | info.resp_ie_len = resp_ie_len; |
| 2211 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 2212 | } |
| 2213 | #else |
| 2214 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 2215 | struct cfg80211_bss *bss, |
| 2216 | const uint8_t *req_ie, size_t req_ie_len, |
| 2217 | const uint8_t *resp_ie, |
| 2218 | size_t resp_ie_len) |
| 2219 | { |
| 2220 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 2221 | GFP_KERNEL); |
| 2222 | } |
| 2223 | #endif |
| 2224 | |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2225 | #if defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2226 | #if defined(WLAN_FEATURE_FILS_SK) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2227 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2228 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2229 | { |
| 2230 | uint8_t *kek; |
| 2231 | uint32_t kek_len; |
| 2232 | |
| 2233 | if (is_reassoc) { |
| 2234 | kek = csr_roam_info->kek; |
| 2235 | kek_len = csr_roam_info->kek_len; |
| 2236 | } else { |
| 2237 | /* |
| 2238 | * This should come for FILS case only. |
| 2239 | * Caller should make sure fils_join_rsp is |
| 2240 | * not NULL, if there is need to use else where. |
| 2241 | */ |
| 2242 | kek = csr_roam_info->fils_join_rsp->kek; |
| 2243 | kek_len = csr_roam_info->fils_join_rsp->kek_len; |
| 2244 | } |
| 2245 | |
| 2246 | wlan_hdd_save_gtk_offload_params(adapter, NULL, kek, kek_len, |
| 2247 | csr_roam_info->replay_ctr, true); |
| 2248 | |
| 2249 | hdd_debug("Kek len %d", kek_len); |
| 2250 | } |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2251 | #else |
| 2252 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2253 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2254 | { |
| 2255 | uint8_t *kek; |
| 2256 | uint32_t kek_len; |
| 2257 | |
| 2258 | /* |
| 2259 | * is_reassoc is set to true always for Legacy GTK offload |
| 2260 | * case, It is false only for FILS case |
| 2261 | */ |
| 2262 | kek = csr_roam_info->kek; |
| 2263 | kek_len = csr_roam_info->kek_len; |
| 2264 | |
| 2265 | wlan_hdd_save_gtk_offload_params(adapter, NULL, kek, kek_len, |
| 2266 | csr_roam_info->replay_ctr, true); |
| 2267 | |
| 2268 | hdd_debug("Kek len %d", kek_len); |
| 2269 | } |
| 2270 | #endif |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2271 | #endif |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2272 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2273 | * hdd_send_re_assoc_event() - send reassoc event |
| 2274 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2275 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2276 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2277 | * @reqRsnIe: pointer to RSN Information element |
| 2278 | * @reqRsnLength: length of RSN IE |
| 2279 | * |
| 2280 | * Return: none |
| 2281 | */ |
| 2282 | static void hdd_send_re_assoc_event(struct net_device *dev, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2283 | struct hdd_adapter *adapter, struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2284 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2285 | { |
| 2286 | unsigned int len = 0; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2287 | u8 *assoc_rsp = NULL; |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2288 | uint8_t *rsp_rsn_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2289 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2290 | uint32_t rsp_rsn_lemgth = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2291 | struct ieee80211_channel *chan; |
Srinivas Girigowda | b8fdc64 | 2019-03-19 15:33:03 -0700 | [diff] [blame] | 2292 | uint8_t buf_ssid_ie[2 + WLAN_SSID_MAX_LEN]; /* 2 bytes-EID and len */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2293 | uint8_t *buf_ptr, ssid_ie_len; |
| 2294 | struct cfg80211_bss *bss = NULL; |
| 2295 | uint8_t *final_req_ie = NULL; |
| 2296 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2297 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2298 | int chan_no; |
| 2299 | int freq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2300 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2301 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2302 | |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2303 | if (!rsp_rsn_ie) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2304 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2305 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2306 | } |
| 2307 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2308 | if (!assoc_req_ies) { |
| 2309 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2310 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2311 | } |
Rajeev Kumar Sirasanagandla | e5582aa | 2018-05-02 18:20:20 +0530 | [diff] [blame] | 2312 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2313 | if (!roam_info || !roam_info->pBssDesc) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2314 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2315 | goto done; |
| 2316 | } |
| 2317 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2318 | if (roam_info->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2319 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2320 | goto done; |
| 2321 | } |
| 2322 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2323 | assoc_rsp = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2324 | (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength + |
| 2325 | roam_info->nAssocReqLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2326 | if (!assoc_rsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2327 | goto done; |
| 2328 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2329 | /* assoc_rsp needs to point to the IEs */ |
| 2330 | assoc_rsp += FT_ASSOC_RSP_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2331 | |
| 2332 | /* |
| 2333 | * Active session count is decremented upon disconnection, but during |
| 2334 | * roaming, there is no disconnect indication and hence active session |
| 2335 | * count is not decremented. |
| 2336 | * After roaming is completed, active session count is incremented |
| 2337 | * as a part of connect indication but effectively after roaming the |
| 2338 | * active session count should still be the same and hence upon |
| 2339 | * successful reassoc decrement the active session count here. |
| 2340 | */ |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2341 | if (!hdd_is_roam_sync_in_progress(roam_info)) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 2342 | policy_mgr_decr_session_set_pcl(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2343 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 2344 | hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 2345 | false); |
| 2346 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2347 | |
| 2348 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2349 | len = roam_info->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2350 | rsp_rsn_lemgth = len; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2351 | qdf_mem_copy(rsp_rsn_ie, assoc_rsp, len); |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2352 | qdf_mem_zero(rsp_rsn_ie + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2353 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2354 | chan_no = roam_info->pBssDesc->channelId; |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2355 | if (chan_no <= 14) |
| 2356 | freq = ieee80211_channel_to_frequency(chan_no, |
| 2357 | NL80211_BAND_2GHZ); |
| 2358 | else |
| 2359 | freq = ieee80211_channel_to_frequency(chan_no, |
| 2360 | NL80211_BAND_5GHZ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2361 | chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2362 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2363 | sme_roam_get_connect_profile(hdd_ctx->mac_handle, adapter->vdev_id, |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2364 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2365 | |
Abhishek Singh | 59cdca1 | 2019-03-08 13:48:20 +0530 | [diff] [blame] | 2366 | bss = wlan_cfg80211_get_bss(adapter->wdev.wiphy, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2367 | chan, roam_info->bssid.bytes, |
Abhishek Singh | 59cdca1 | 2019-03-08 13:48:20 +0530 | [diff] [blame] | 2368 | &roam_profile.SSID.ssId[0], |
| 2369 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2370 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2371 | if (!bss) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2372 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2373 | buf_ptr = buf_ssid_ie; |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2374 | *buf_ptr = WLAN_ELEMID_SSID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2375 | buf_ptr++; |
| 2376 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2377 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2378 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2379 | roam_profile.SSID.length); |
| 2380 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2381 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2382 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2383 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2384 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2385 | if (!final_req_ie) { |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2386 | if (bss) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2387 | cfg80211_put_bss(adapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2388 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2389 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2390 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2391 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2392 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2393 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2394 | qdf_mem_copy(rsp_rsn_ie, assoc_rsp, len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2395 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2396 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2397 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2398 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2399 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2400 | hdd_send_roamed_ind(dev, bss, final_req_ie, |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2401 | (ssid_ie_len + reqRsnLength), rsp_rsn_ie, |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2402 | rsp_rsn_lemgth); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2403 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2404 | qdf_mem_copy(assoc_req_ies, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2405 | (u8 *)roam_info->pbFrames + roam_info->nBeaconLength, |
| 2406 | roam_info->nAssocReqLength); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2407 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2408 | hdd_save_gtk_params(adapter, roam_info, true); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2409 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2410 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2411 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2412 | assoc_req_ies, roam_info->nAssocReqLength); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2413 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2414 | wlan_hdd_send_roam_auth_event(adapter, roam_info->bssid.bytes, |
| 2415 | assoc_req_ies, roam_info->nAssocReqLength, |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2416 | rsp_rsn_ie, rsp_rsn_lemgth, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2417 | roam_info); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2418 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2419 | hdd_update_hlp_info(dev, roam_info); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2420 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2422 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2423 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2424 | qdf_mem_free(final_req_ie); |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2425 | qdf_mem_free(rsp_rsn_ie); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2426 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2427 | } |
| 2428 | |
| 2429 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2430 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2431 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2432 | * |
| 2433 | * Return: roam sync status if roaming offloaded else false |
| 2434 | */ |
| 2435 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2436 | bool hdd_is_roam_sync_in_progress(struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2437 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2438 | if (roaminfo) |
| 2439 | return roaminfo->roamSynchInProgress; |
| 2440 | else |
| 2441 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2442 | } |
| 2443 | #endif |
| 2444 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2445 | /** |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2446 | * hdd_get_ibss_peer_sta_id() - get sta id for IBSS peer |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2447 | * @hddstactx: pointer to HDD sta context |
| 2448 | * @roaminfo: pointer to roaminfo structure |
| 2449 | * |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2450 | * This function returns sta_id for IBSS peer. If peer is broadcast |
| 2451 | * MAC address return self sta_id(0) else find the peer sta id of |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2452 | * the peer. |
| 2453 | * |
| 2454 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2455 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2456 | static uint8_t hdd_get_ibss_peer_sta_id(struct hdd_station_ctx *hddstactx, |
| 2457 | struct csr_roam_info *roaminfo) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2458 | { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2459 | uint8_t sta_id = HDD_WLAN_INVALID_STA_ID; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2460 | QDF_STATUS status; |
| 2461 | |
| 2462 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2463 | sta_id = 0; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2464 | } else { |
| 2465 | status = hdd_get_peer_sta_id(hddstactx, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2466 | &roaminfo->peerMac, &sta_id); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2467 | if (status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2468 | hdd_err("Unable to find station ID for " |
| 2469 | MAC_ADDRESS_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2470 | QDF_MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2471 | } |
| 2472 | } |
| 2473 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2474 | return sta_id; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2475 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2476 | |
| 2477 | /** |
| 2478 | * hdd_change_sta_state_authenticated()- |
| 2479 | * This function changes STA state to authenticated |
| 2480 | * @adapter: pointer to the adapter structure. |
| 2481 | * @roaminfo: pointer to the RoamInfo structure. |
| 2482 | * |
| 2483 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2484 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2485 | * |
| 2486 | * Return: 0 on success and errno on failure |
| 2487 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2488 | static int hdd_change_sta_state_authenticated(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2489 | struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2490 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2491 | QDF_STATUS status; |
Pragaspathi Thilagaraj | 784c492 | 2018-12-02 22:47:29 +0530 | [diff] [blame] | 2492 | uint32_t timeout, auto_bmps_timer_val; |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2493 | uint8_t sta_id = HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2494 | struct hdd_station_ctx *hddstactx = |
| 2495 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2496 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2497 | |
Pragaspathi Thilagaraj | 784c492 | 2018-12-02 22:47:29 +0530 | [diff] [blame] | 2498 | ucfg_mlme_get_auto_bmps_timer_value(hdd_ctx->psoc, |
| 2499 | &auto_bmps_timer_val); |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 2500 | timeout = hddstactx->hdd_reassoc_scenario ? |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2501 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Pragaspathi Thilagaraj | 784c492 | 2018-12-02 22:47:29 +0530 | [diff] [blame] | 2502 | (auto_bmps_timer_val * 1000); |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2503 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2504 | if (QDF_IBSS_MODE == adapter->device_mode) |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2505 | sta_id = hdd_get_ibss_peer_sta_id(hddstactx, roaminfo); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2506 | else |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2507 | sta_id = hddstactx->conn_info.sta_id[0]; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2508 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2509 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", |
| 2510 | sta_id); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2511 | |
| 2512 | /* Connections that do not need Upper layer authentication, |
| 2513 | * transition TL to 'Authenticated' state after the keys are set |
| 2514 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2515 | status = hdd_change_peer_state(adapter, sta_id, OL_TXRX_PEER_STATE_AUTH, |
| 2516 | hdd_is_roam_sync_in_progress(roaminfo)); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2517 | hdd_conn_set_authenticated(adapter, true); |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2518 | hdd_objmgr_set_peer_mlme_auth_state(adapter->vdev, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2519 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2520 | if ((QDF_STA_MODE == adapter->device_mode) || |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2521 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
| 2522 | sme_ps_enable_auto_ps_timer(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2523 | adapter->vdev_id, |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2524 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2525 | } |
| 2526 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2527 | return qdf_status_to_os_return(status); |
| 2528 | } |
| 2529 | |
| 2530 | /** |
| 2531 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2532 | * if key installation is required |
| 2533 | * @encr_type: encryption type |
| 2534 | * |
| 2535 | * Return: true if key installation is required and false otherwise. |
| 2536 | */ |
| 2537 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2538 | eCsrEncryptionType encr_type) |
| 2539 | { |
| 2540 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2541 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2542 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2543 | eCSR_ENCRYPT_TYPE_AES_GCMP == encr_type || |
| 2544 | eCSR_ENCRYPT_TYPE_AES_GCMP_256 == encr_type || |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2545 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2546 | return true; |
| 2547 | else |
| 2548 | return false; |
| 2549 | } |
| 2550 | |
| 2551 | /** |
| 2552 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2553 | * complete |
| 2554 | * @adapter: pointer to HDD adapter |
| 2555 | * @roaminfo: pointer to roam info |
| 2556 | * @roam_result: roam result |
| 2557 | * |
| 2558 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2559 | * This function checks for the successful set key completion and update |
| 2560 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2561 | * |
| 2562 | * Return: None |
| 2563 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2564 | static void hdd_change_peer_state_after_set_key(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2565 | struct csr_roam_info *roaminfo, |
| 2566 | eCsrRoamResult roam_result) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2567 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2568 | struct hdd_station_ctx *hdd_sta_ctx = |
| 2569 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | b195984 | 2019-02-27 13:04:04 -0800 | [diff] [blame] | 2570 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.uc_encrypt_type; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2571 | |
| 2572 | /* |
| 2573 | * If the security mode is one of the following, IBSS peer will be |
| 2574 | * waiting in CONN state and we will move the peer state to AUTH |
| 2575 | * here. For non-secure connection, no need to wait for set-key complete |
| 2576 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2577 | */ |
| 2578 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2579 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2580 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2581 | |
| 2582 | return; |
| 2583 | } |
| 2584 | |
| 2585 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2586 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2587 | /* |
| 2588 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2589 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2590 | * after roaming. STA TL state moves to authenticated only if |
| 2591 | * ptk_installed is true. So, make ptk_installed to true in |
| 2592 | * case of 11R roaming. |
| 2593 | */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2594 | if (sme_neighbor_roam_is11r_assoc(adapter->hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2595 | adapter->vdev_id)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2596 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2597 | } else { |
| 2598 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2599 | } |
| 2600 | |
| 2601 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2602 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2603 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2604 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2605 | * set the unicast and broadcast key. |
| 2606 | */ |
| 2607 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2608 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2609 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2610 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2611 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2612 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2613 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2614 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2615 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2616 | } |
| 2617 | |
| 2618 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2619 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2620 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2621 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2622 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2623 | } |
| 2624 | |
| 2625 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2626 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2627 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2628 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2629 | * @roam_id: roam id |
| 2630 | * @roam_status: roam status |
| 2631 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2632 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2633 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2634 | */ |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2635 | static QDF_STATUS |
| 2636 | hdd_roam_set_key_complete_handler(struct hdd_adapter *adapter, |
| 2637 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2638 | uint32_t roam_id, |
| 2639 | eRoamCmdStatus roam_status, |
| 2640 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2641 | { |
Jeff Johnson | e16f082 | 2019-03-10 18:27:30 -0700 | [diff] [blame] | 2642 | eCsrEncryptionType algorithm; |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2643 | bool connected = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2644 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2645 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 2646 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2647 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2648 | if (!roam_info) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2649 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2650 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2651 | } |
| 2652 | /* |
| 2653 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2654 | * then go to 'authenticated'. For all other authentication types |
| 2655 | * (those that do not require upper layer authentication) we can put TL |
| 2656 | * directly into 'authenticated' state. |
| 2657 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2658 | hdd_debug("Set Key completion roam_status =%d roam_result=%d " |
| 2659 | MAC_ADDRESS_STR, roam_status, roam_result, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2660 | QDF_MAC_ADDR_ARRAY(roam_info->peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2661 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2662 | connected = hdd_conn_get_connected_cipher_algo(sta_ctx, |
Jeff Johnson | e16f082 | 2019-03-10 18:27:30 -0700 | [diff] [blame] | 2663 | &algorithm); |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2664 | if (connected) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2665 | hdd_change_peer_state_after_set_key(adapter, roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2666 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2667 | } |
| 2668 | |
Jianmin Zhu | 4bcf837 | 2018-12-27 19:38:55 +0800 | [diff] [blame] | 2669 | if (!adapter->hdd_ctx || !adapter->hdd_ctx->psoc) { |
| 2670 | hdd_err("hdd_ctx or psoc is NULL"); |
| 2671 | return QDF_STATUS_E_FAILURE; |
| 2672 | } |
| 2673 | policy_mgr_restart_opportunistic_timer(adapter->hdd_ctx->psoc, false); |
| 2674 | |
Dustin Brown | e74003f | 2018-03-14 12:51:58 -0700 | [diff] [blame] | 2675 | hdd_exit(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2676 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2677 | } |
| 2678 | |
| 2679 | /** |
| 2680 | * hdd_perform_roam_set_key_complete() - perform set key complete |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2681 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2682 | * |
| 2683 | * Return: none |
| 2684 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2685 | void hdd_perform_roam_set_key_complete(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2686 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2687 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2688 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2689 | struct csr_roam_info *roam_info; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2690 | |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2691 | roam_info = qdf_mem_malloc(sizeof(*roam_info)); |
| 2692 | if (!roam_info) |
| 2693 | return; |
| 2694 | roam_info->fAuthRequired = false; |
| 2695 | qdf_mem_copy(roam_info->bssid.bytes, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2696 | sta_ctx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2697 | qdf_mem_copy(roam_info->peerMac.bytes, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2698 | sta_ctx->roam_info.peer_mac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2699 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2700 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2701 | hdd_roam_set_key_complete_handler(adapter, |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2702 | roam_info, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2703 | sta_ctx->roam_info.roam_id, |
| 2704 | sta_ctx->roam_info.roam_status, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2705 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2706 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2707 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2708 | |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2709 | sta_ctx->roam_info.defer_key_complete = false; |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2710 | qdf_mem_free(roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2711 | } |
| 2712 | |
Vignesh Viswanathan | 3fa1d38 | 2017-08-02 19:36:43 +0530 | [diff] [blame] | 2713 | #if defined(WLAN_FEATURE_FILS_SK) && \ |
| 2714 | (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \ |
| 2715 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))) |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2716 | void hdd_clear_fils_connection_info(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2717 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2718 | struct csr_roam_profile *roam_profile; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2719 | |
| 2720 | if ((adapter->device_mode == QDF_SAP_MODE) || |
| 2721 | (adapter->device_mode == QDF_P2P_GO_MODE)) |
| 2722 | return; |
| 2723 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2724 | roam_profile = hdd_roam_profile(adapter); |
| 2725 | if (roam_profile->fils_con_info) { |
| 2726 | qdf_mem_free(roam_profile->fils_con_info); |
| 2727 | roam_profile->fils_con_info = NULL; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2728 | } |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2729 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2730 | if (roam_profile->hlp_ie) { |
| 2731 | qdf_mem_free(roam_profile->hlp_ie); |
| 2732 | roam_profile->hlp_ie = NULL; |
| 2733 | roam_profile->hlp_ie_len = 0; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2734 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2735 | } |
| 2736 | #endif |
| 2737 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2738 | /** |
| 2739 | * hdd_association_completion_handler() - association completion handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2740 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2741 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2742 | * @roam_id: roam id |
| 2743 | * @roam_status: roam status |
| 2744 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2745 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2746 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2747 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2748 | static QDF_STATUS |
| 2749 | hdd_association_completion_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2750 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2751 | uint32_t roam_id, |
| 2752 | eRoamCmdStatus roam_status, |
| 2753 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2754 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2755 | struct net_device *dev = adapter->dev; |
| 2756 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2757 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2758 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2759 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2760 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2761 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2762 | bool hddDisconInProgress = false; |
| 2763 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2764 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2765 | bool ok; |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2766 | mac_handle_t mac_handle; |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 2767 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2768 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2769 | if (!hdd_ctx) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2770 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2771 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2772 | } |
| 2773 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2774 | /* validate config */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2775 | if (!hdd_ctx->config) { |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2776 | hdd_err("config is NULL"); |
| 2777 | return QDF_STATUS_E_NULL_VALUE; |
| 2778 | } |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 2779 | |
| 2780 | /* |
Paul Zhang | cb573e0 | 2018-11-06 10:37:16 +0800 | [diff] [blame] | 2781 | * reset scan reject params if connection is success or we received |
| 2782 | * final failure from CSR after trying with all APs. |
| 2783 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2784 | hdd_reset_scan_reject_params(hdd_ctx, roam_status, roam_result); |
Paul Zhang | cb573e0 | 2018-11-06 10:37:16 +0800 | [diff] [blame] | 2785 | |
| 2786 | /* |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 2787 | * Enable roaming on other STA iface except this one. |
| 2788 | * Firmware dosent support connection on one STA iface while |
| 2789 | * roaming on other STA iface |
| 2790 | */ |
| 2791 | wlan_hdd_enable_roaming(adapter); |
| 2792 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2793 | /* HDD has initiated disconnect, do not send connect result indication |
| 2794 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2795 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2796 | if (((eConnectionState_Disconnecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 2797 | sta_ctx->conn_info.conn_state) || |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2798 | (eConnectionState_NotConnected == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 2799 | sta_ctx->conn_info.conn_state)) && |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2800 | ((eCSR_ROAM_RESULT_ASSOCIATED == roam_result) || |
| 2801 | (eCSR_ROAM_ASSOCIATION_FAILURE == roam_status))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2802 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 2803 | sta_ctx->conn_info.conn_state, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2804 | roam_result, roam_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2805 | hddDisconInProgress = true; |
| 2806 | } |
| 2807 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2808 | mac_handle = hdd_ctx->mac_handle; |
| 2809 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2810 | if (eCSR_ROAM_RESULT_ASSOCIATED == roam_result) { |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2811 | if (!roam_info) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2812 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2813 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2814 | } |
| 2815 | if (!hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2816 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2817 | eConnectionState_Associated); |
| 2818 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2819 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2820 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2821 | hdd_conn_save_connect_info(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2822 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2823 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2824 | if (hdd_add_beacon_filter(adapter) != 0) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2825 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2826 | #ifdef FEATURE_WLAN_WAPI |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2827 | if (roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2828 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2829 | || roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2830 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2831 | adapter->wapi_info.is_wapi_sta = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2832 | } else { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2833 | adapter->wapi_info.is_wapi_sta = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2834 | } |
| 2835 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2836 | hdd_debug("bss_descr[%d] devicemode[%d]", !!roam_info->pBssDesc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2837 | adapter->device_mode); |
| 2838 | if ((QDF_STA_MODE == adapter->device_mode) && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2839 | roam_info->pBssDesc) { |
| 2840 | ie_len = GET_IE_LEN_IN_BSS(roam_info->pBssDesc->length); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2841 | sta_ctx->ap_supports_immediate_power_save = |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2842 | wlan_hdd_is_ap_supports_immediate_power_save( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2843 | (uint8_t *) roam_info->pBssDesc->ieFields, |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2844 | ie_len); |
| 2845 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2846 | sta_ctx->ap_supports_immediate_power_save); |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2847 | } |
| 2848 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2849 | /* Indicate 'connect' status to user space */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2850 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2851 | |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 2852 | if (policy_mgr_is_mcc_in_24G(hdd_ctx->psoc)) { |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2853 | if (hdd_ctx->miracast_value) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2854 | wlan_hdd_set_mas(adapter, |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2855 | hdd_ctx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2856 | } |
| 2857 | |
| 2858 | /* Initialize the Linkup event completion variable */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2859 | INIT_COMPLETION(adapter->linkup_event_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2860 | |
| 2861 | /* |
| 2862 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2863 | * the device properly. Before allowing any packet to go up to |
| 2864 | * the application, device activation has to be ensured for |
| 2865 | * proper queue mapping by the kernel. we have registered net |
| 2866 | * device notifier for device change notification. With this we |
| 2867 | * will come to know that the device is getting |
| 2868 | * activated properly. |
| 2869 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2870 | if (sta_ctx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2871 | /* |
| 2872 | * Enable Linkup Event Servicing which allows the net |
| 2873 | * device notifier to set the linkup event variable. |
| 2874 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2875 | adapter->is_link_up_service_needed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2876 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2877 | /* Switch on the Carrier to activate the device */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2878 | wlan_hdd_netif_queue_control(adapter, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2879 | WLAN_NETIF_CARRIER_ON, |
| 2880 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2881 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2882 | /* |
| 2883 | * Wait for the Link to up to ensure all the queues |
| 2884 | * are set properly by the kernel. |
| 2885 | */ |
| 2886 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2887 | &adapter->linkup_event_var, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2888 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2889 | ); |
| 2890 | if (!rc) |
| 2891 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2892 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2893 | /* |
| 2894 | * Disable Linkup Event Servicing - no more service |
| 2895 | * required from the net device notifier call. |
| 2896 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2897 | adapter->is_link_up_service_needed = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2898 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2899 | sta_ctx->ft_carrier_on = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2900 | ft_carrier_on = true; |
| 2901 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 2902 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2903 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2904 | else |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2905 | hdd_err("Wrong Staid: %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2906 | |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 2907 | if (ucfg_ipa_is_enabled()) |
Dustin Brown | 07901ec | 2018-09-07 11:02:41 -0700 | [diff] [blame] | 2908 | ucfg_ipa_wlan_evt(hdd_ctx->pdev, adapter->dev, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 2909 | adapter->device_mode, |
| 2910 | roam_info->staId, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2911 | adapter->vdev_id, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 2912 | WLAN_IPA_STA_CONNECT, |
| 2913 | roam_info->bssid.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2914 | |
| 2915 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2916 | wlan_hdd_auto_shutdown_enable(hdd_ctx, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2917 | #endif |
| 2918 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2919 | hdd_debug("check if STA chan ok for DNBS"); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 2920 | if (policy_mgr_is_chan_ok_for_dnbs(hdd_ctx->psoc, |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 2921 | sta_ctx->conn_info.channel, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2922 | &ok)) { |
| 2923 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 2924 | sta_ctx->conn_info.channel); |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2925 | return QDF_STATUS_E_FAILURE; |
| 2926 | } |
| 2927 | |
| 2928 | if (!ok) { |
| 2929 | hdd_err("Chan:%d not suitable for DNBS", |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 2930 | sta_ctx->conn_info.channel); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2931 | wlan_hdd_netif_queue_control(adapter, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2932 | WLAN_NETIF_CARRIER_OFF, |
| 2933 | WLAN_CONTROL_PATH); |
| 2934 | if (!hddDisconInProgress) { |
| 2935 | hdd_err("Disconnecting..."); |
| 2936 | sme_roam_disconnect( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2937 | mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2938 | adapter->vdev_id, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2939 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2940 | } |
| 2941 | return QDF_STATUS_E_FAILURE; |
| 2942 | } |
| 2943 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2944 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2945 | adapter->vdev_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2946 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2947 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2948 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2949 | /* |
| 2950 | * For reassoc, the station is already registered, all we need |
| 2951 | * is to change the state of the STA in TL. |
| 2952 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2953 | * CONNECTED instead of AUTHENTICATED. |
| 2954 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2955 | if (!roam_info->fReassocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2956 | struct cfg80211_bss *bss; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2957 | u8 *assoc_rsp = NULL; |
| 2958 | unsigned int assoc_rsp_len = 0; |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 2959 | u8 *assoc_req = NULL; |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 2960 | unsigned int assoc_req_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2961 | struct ieee80211_channel *chan; |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2962 | uint8_t rsp_rsn_ie[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2963 | uint32_t rsp_rsn_lemgth = DOT11F_IE_RSN_MAX_LEN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2964 | |
| 2965 | /* add bss_id to cfg80211 data base */ |
| 2966 | bss = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2967 | wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2968 | roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2969 | if (!bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2970 | hdd_err("wlan: Not able to create BSS entry"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2971 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2972 | WLAN_NETIF_CARRIER_OFF, |
| 2973 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2974 | if (!hddDisconInProgress) { |
| 2975 | /* |
| 2976 | * Here driver was not able to add bss |
| 2977 | * in cfg80211 database this can happen |
| 2978 | * if connected channel is not valid, |
| 2979 | * i.e reg domain was changed during |
| 2980 | * connection. Queue disconnect for the |
| 2981 | * session if disconnect is not in |
| 2982 | * progress. |
| 2983 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2984 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2985 | sme_roam_disconnect( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2986 | mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2987 | adapter->vdev_id, |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2988 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2989 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2990 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2991 | } |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2992 | |
Jeff Johnson | c66d310 | 2018-02-28 11:58:26 -0800 | [diff] [blame] | 2993 | cfg80211_put_bss(hdd_ctx->wiphy, bss); |
| 2994 | |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2995 | /* Association Response */ |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2996 | assoc_rsp = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2997 | (u8 *) (roam_info->pbFrames + |
| 2998 | roam_info->nBeaconLength + |
| 2999 | roam_info->nAssocReqLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3000 | if (assoc_rsp) { |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3001 | /* |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3002 | * assoc_rsp needs to point to the IEs |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3003 | */ |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3004 | assoc_rsp += FT_ASSOC_RSP_IES_OFFSET; |
| 3005 | assoc_rsp_len = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3006 | roam_info->nAssocRspLength - |
| 3007 | FT_ASSOC_RSP_IES_OFFSET; |
| 3008 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3009 | hdd_debug("assoc_rsp_len %d", assoc_rsp_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3010 | hdd_debug("Assoc Rsp IE dump"); |
| 3011 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 3012 | QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3013 | assoc_rsp, |
| 3014 | assoc_rsp_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3015 | } else { |
| 3016 | hdd_debug("AssocRsp is NULL"); |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3017 | assoc_rsp_len = 0; |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3018 | } |
| 3019 | |
| 3020 | /* Association Request */ |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3021 | assoc_req = (u8 *) (roam_info->pbFrames + |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3022 | roam_info->nBeaconLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3023 | if (assoc_req) { |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3024 | if (!ft_carrier_on) { |
| 3025 | /* |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3026 | * assoc_req needs to point to |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3027 | * the IEs |
| 3028 | */ |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3029 | assoc_req += |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3030 | FT_ASSOC_REQ_IES_OFFSET; |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3031 | hdd_debug("assoc_req is now at %02x%02x", |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3032 | (unsigned int) |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3033 | assoc_req[0], |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3034 | (unsigned int) |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3035 | assoc_req[1]); |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3036 | assoc_req_len = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3037 | roam_info->nAssocReqLength - |
| 3038 | FT_ASSOC_REQ_IES_OFFSET; |
| 3039 | } else { |
| 3040 | /* |
| 3041 | * This should contain only the |
| 3042 | * FTIEs |
| 3043 | */ |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3044 | assoc_req_len = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3045 | roam_info->nAssocReqLength; |
| 3046 | } |
| 3047 | |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3048 | hdd_debug("assoc_req_len %d", assoc_req_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3049 | hdd_debug("Assoc/Reassoc Req IE dump"); |
| 3050 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 3051 | QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3052 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3053 | assoc_req_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3054 | } else { |
| 3055 | hdd_debug("AssocReq is NULL"); |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3056 | assoc_req_len = 0; |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3057 | } |
| 3058 | |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 3059 | if ((roam_info->u.pConnectedProfile->AuthType == |
| 3060 | eCSR_AUTH_TYPE_FT_RSN) || |
| 3061 | (roam_info->u.pConnectedProfile->AuthType == |
| 3062 | eCSR_AUTH_TYPE_FT_RSN_PSK) || |
| 3063 | (roam_info->u.pConnectedProfile->AuthType == |
| 3064 | eCSR_AUTH_TYPE_FT_SAE) || |
| 3065 | (roam_info->u.pConnectedProfile->AuthType == |
| 3066 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3067 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 3068 | if (!hddDisconInProgress && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3069 | roam_info->pBssDesc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 3070 | struct cfg80211_bss *roam_bss; |
| 3071 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | /* |
| 3073 | * After roaming is completed, |
| 3074 | * active session count is |
| 3075 | * incremented as a part of |
| 3076 | * connect indication but |
| 3077 | * effectively the active |
| 3078 | * session count should still |
| 3079 | * be the same and hence upon |
| 3080 | * successful reassoc |
| 3081 | * decrement the active session |
| 3082 | * count here. |
| 3083 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 3084 | if (!hdd_is_roam_sync_in_progress |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3085 | (roam_info)) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3086 | policy_mgr_decr_session_set_pcl( |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3087 | hdd_ctx->psoc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3088 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3089 | adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 3090 | hdd_green_ap_start_state_mc( |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3091 | hdd_ctx, |
| 3092 | adapter->device_mode, |
| 3093 | false); |
| 3094 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3095 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3096 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3097 | chan = |
| 3098 | ieee80211_get_channel |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3099 | (adapter->wdev.wiphy, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3100 | (int)roam_info->pBssDesc-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3101 | channelId); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 3102 | |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3103 | roam_bss = |
Abhishek Singh | 59cdca1 | 2019-03-08 13:48:20 +0530 | [diff] [blame] | 3104 | wlan_cfg80211_get_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3105 | adapter->wdev.wiphy, |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3106 | chan, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3107 | roam_info->bssid.bytes, |
| 3108 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3109 | pConnectedProfile->SSID.ssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3110 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3111 | pConnectedProfile->SSID.length); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3112 | |
| 3113 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3114 | adapter->vdev_id, |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3115 | sta_ctx-> |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 3116 | conn_info.channel); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3117 | |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 3118 | hdd_send_roamed_ind( |
| 3119 | dev, |
| 3120 | roam_bss, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3121 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3122 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3123 | assoc_rsp, |
| 3124 | assoc_rsp_len); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3125 | wlan_hdd_send_roam_auth_event( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3126 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3127 | roam_info->bssid.bytes, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3128 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3129 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3130 | assoc_rsp, |
| 3131 | assoc_rsp_len, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3132 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3133 | } |
| 3134 | if (sme_get_ftptk_state |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3135 | (mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3136 | adapter->vdev_id)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3137 | sme_set_ftptk_state |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3138 | (mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3139 | adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3140 | false); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3141 | roam_info->fAuthRequired = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3142 | false; |
| 3143 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3144 | qdf_mem_copy(sta_ctx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3145 | roam_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3146 | roam_info->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3147 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3148 | qdf_mem_copy(sta_ctx-> |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3149 | roam_info.peer_mac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3150 | roam_info->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3151 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3152 | sta_ctx->roam_info.roam_id = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3153 | roam_id; |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3154 | sta_ctx->roam_info.roam_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3155 | roam_status; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3156 | sta_ctx->roam_info. |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3157 | defer_key_complete = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3158 | } |
| 3159 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3160 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3161 | ft_carrier_on); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3162 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3163 | adapter->vdev_id, |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 3164 | sta_ctx->conn_info.channel); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3165 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3166 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3167 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3168 | roam_info, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3169 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3170 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3171 | assoc_rsp, |
| 3172 | assoc_rsp_len, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3173 | WLAN_STATUS_SUCCESS, |
| 3174 | GFP_KERNEL, |
| 3175 | false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3176 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3177 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 3178 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3179 | /* |
| 3180 | * wpa supplicant expecting WPA/RSN IE in |
| 3181 | * connect result. |
| 3182 | */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3183 | sme_roam_get_wpa_rsn_req_ie(mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3184 | adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3185 | &reqRsnLength, |
| 3186 | reqRsnIe); |
| 3187 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3188 | sme_roam_get_wpa_rsn_rsp_ie(mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3189 | adapter->vdev_id, |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 3190 | &rsp_rsn_lemgth, |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 3191 | rsp_rsn_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3192 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3193 | if (ft_carrier_on) |
| 3194 | hdd_send_re_assoc_event(dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3195 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3196 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3197 | reqRsnIe, |
| 3198 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 3199 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3200 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3201 | MAC_ADDRESS_STR |
| 3202 | " result:%d and Status:%d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3203 | QDF_MAC_ADDR_ARRAY |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3204 | (roam_info->bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3205 | roam_result, roam_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3206 | |
| 3207 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3208 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3209 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3210 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3211 | roam_info, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3212 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3213 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3214 | assoc_rsp, |
| 3215 | assoc_rsp_len, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3216 | WLAN_STATUS_SUCCESS, |
| 3217 | GFP_KERNEL, |
| 3218 | false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3219 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3220 | } |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3221 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3222 | adapter->vdev_id, |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 3223 | sta_ctx->conn_info.channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3224 | } |
| 3225 | } |
| 3226 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | /* |
| 3228 | * Perform any WMM-related association |
| 3229 | * processing. |
| 3230 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3231 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3232 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3233 | |
| 3234 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 3235 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3236 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3237 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3238 | roam_info, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3239 | sta_ctx->conn_info.sta_id[0], |
Jeff Johnson | 71a1d5c | 2018-12-30 11:31:04 -0800 | [diff] [blame] | 3240 | roam_info->pBssDesc); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3241 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3242 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3243 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3244 | WLAN_CONTROL_PATH); |
| 3245 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3246 | } |
| 3247 | } else { |
| 3248 | /* |
| 3249 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 3250 | * in case of reassociation also need to indicate it to |
| 3251 | * supplicant. |
| 3252 | */ |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3253 | sme_roam_get_wpa_rsn_req_ie( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3254 | mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3255 | adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | &reqRsnLength, reqRsnIe); |
| 3257 | |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3258 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3259 | adapter->vdev_id, |
Jeff Johnson | 8626e93 | 2019-02-27 18:35:22 -0800 | [diff] [blame] | 3260 | sta_ctx->conn_info.channel); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3261 | hdd_send_re_assoc_event(dev, adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3262 | reqRsnIe, reqRsnLength); |
| 3263 | /* Reassoc successfully */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3264 | if (roam_info->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3265 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3266 | hdd_change_peer_state(adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3267 | sta_ctx->conn_info.sta_id[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3268 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3269 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3270 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3271 | #else |
| 3272 | false |
| 3273 | #endif |
| 3274 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3275 | hdd_conn_set_authenticated(adapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3276 | hdd_objmgr_set_peer_mlme_auth_state( |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 3277 | adapter->vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3278 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3279 | } else { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3280 | hdd_debug("sta_id: %d Changing TL state to AUTHENTICATED", |
| 3281 | sta_ctx->conn_info.sta_id[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3282 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3283 | hdd_change_peer_state(adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3284 | sta_ctx->conn_info.sta_id[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3285 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3286 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3287 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3288 | #else |
| 3289 | false |
| 3290 | #endif |
| 3291 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3292 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3293 | hdd_objmgr_set_peer_mlme_auth_state( |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 3294 | adapter->vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3295 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3296 | } |
| 3297 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3298 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3299 | /* |
| 3300 | * Perform any WMM-related association |
| 3301 | * processing |
| 3302 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3303 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3304 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3305 | } |
| 3306 | |
| 3307 | /* Start the tx queues */ |
| 3308 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3309 | if (roam_info->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3310 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | #endif |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3312 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3313 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3314 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3315 | WLAN_CONTROL_PATH); |
| 3316 | } |
| 3317 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3318 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3319 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3320 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | } |
| 3322 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 3323 | qdf_mem_zero(&adapter->hdd_stats.hdd_pmf_stats, |
| 3324 | sizeof(adapter->hdd_stats.hdd_pmf_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3325 | #endif |
Abhishek Singh | bfaebe3 | 2019-03-19 13:37:55 +0530 | [diff] [blame] | 3326 | policy_mgr_check_n_start_opportunistic_timer(hdd_ctx->psoc); |
Frank Liu | 064ebd4 | 2018-05-03 14:22:39 +0800 | [diff] [blame] | 3327 | hdd_debug("check for SAP restart"); |
| 3328 | policy_mgr_check_concurrent_intf_and_restart_sap( |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3329 | hdd_ctx->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3330 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3331 | bool connect_timeout = false; |
Tushnim Bhattacharyya | 3f78053 | 2018-08-01 19:11:40 -0700 | [diff] [blame] | 3332 | /* do we need to change the HW mode */ |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3333 | policy_mgr_check_n_start_opportunistic_timer(hdd_ctx->psoc); |
Vignesh Viswanathan | 014096a | 2017-12-07 01:24:44 +0530 | [diff] [blame] | 3334 | if (roam_info && roam_info->is_fils_connection && |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3335 | eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roam_result) |
Vignesh Viswanathan | 014096a | 2017-12-07 01:24:44 +0530 | [diff] [blame] | 3336 | qdf_copy_macaddr(&roam_info->bssid, |
| 3337 | &sta_ctx->requested_bssid); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3338 | if (roam_info) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3339 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3340 | " result: %d and Status: %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3341 | QDF_MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3342 | roam_result, roam_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3343 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3344 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3345 | " result: %d and Status: %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3346 | QDF_MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3347 | roam_result, roam_status); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3348 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3349 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roam_result) || |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3350 | (roam_info && |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3351 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3352 | roam_info->statusCode) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3353 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3354 | roam_info->statusCode) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3355 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3356 | roam_info->statusCode)))) { |
Abhishek Singh | 85283ae | 2019-03-08 12:00:51 +0530 | [diff] [blame] | 3357 | wlan_hdd_cfg80211_unlink_bss(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3358 | roam_info ? |
| 3359 | roam_info->bssid.bytes : |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3360 | sta_ctx->requested_bssid.bytes); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3361 | sme_remove_bssid_from_scan_list(mac_handle, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3362 | roam_info ? |
| 3363 | roam_info->bssid.bytes : |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3364 | sta_ctx->requested_bssid.bytes); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3365 | if (roam_result != |
Arun Kumar Khandavalli | 34f69cf | 2019-02-25 16:46:52 +0530 | [diff] [blame] | 3366 | eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE) |
| 3367 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3368 | } |
| 3369 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3370 | /* |
| 3371 | * CR465478: Only send up a connection failure result when CSR |
| 3372 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3373 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3374 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roam_status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3375 | && !hddDisconInProgress) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3376 | if (roam_info) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3377 | hdd_err("send connect failure to nl80211: for bssid " |
| 3378 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3379 | " result: %d and Status: %d reasoncode: %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3380 | QDF_MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3381 | roam_result, roam_status, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3382 | roam_info->reasonCode); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3383 | sta_ctx->conn_info.assoc_status_code = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3384 | roam_info->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3385 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3386 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3387 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3388 | " result: %d and status: %d ", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3389 | QDF_MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3390 | roam_result, roam_status); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3391 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3392 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3393 | wlan_deregister_txrx_packetdump(); |
| 3394 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3395 | /* inform association failure event to nl80211 */ |
| 3396 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3397 | roam_result) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3398 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3399 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3400 | roam_info->bssid.bytes, |
| 3401 | roam_info, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3402 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3403 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3404 | connect_timeout, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3405 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3406 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3407 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3408 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3409 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3410 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3411 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3412 | connect_timeout, |
| 3413 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3414 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3415 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3416 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3417 | roam_info->bssid.bytes, |
| 3418 | roam_info, NULL, 0, NULL, 0, |
| 3419 | roam_info->reasonCode ? |
| 3420 | roam_info->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3421 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3422 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3423 | connect_timeout, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3424 | roam_info->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3425 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3426 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3427 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3428 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3429 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3430 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3431 | connect_timeout, |
| 3432 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3433 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3434 | hdd_clear_roam_profile_ie(adapter); |
Ashish Kumar Dhanotiya | 0213793 | 2019-02-26 21:43:32 +0530 | [diff] [blame] | 3435 | sme_reset_key(hdd_ctx->mac_handle, |
| 3436 | adapter->vdev_id); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3437 | } else if ((eCSR_ROAM_CANCELLED == roam_status |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3438 | && !hddDisconInProgress)) { |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3439 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3440 | sta_ctx->requested_bssid.bytes, |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3441 | NULL, NULL, 0, NULL, 0, |
| 3442 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
| 3443 | GFP_KERNEL, |
| 3444 | connect_timeout, |
| 3445 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3446 | } |
| 3447 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3448 | /* |
| 3449 | * Set connection state to eConnectionState_NotConnected only |
| 3450 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3451 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3452 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3453 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roam_status) || |
| 3454 | (eCSR_ROAM_CANCELLED == roam_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3455 | && !hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3456 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3457 | eConnectionState_NotConnected); |
| 3458 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3459 | hdd_wmm_init(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3460 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3461 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3462 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3463 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3464 | WLAN_CONTROL_PATH); |
Abhishek Singh | 0edeba0 | 2018-06-05 10:04:08 +0530 | [diff] [blame] | 3465 | /* |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3466 | * if hddDisconInProgress is set and roam_result is |
Abhishek Singh | 0edeba0 | 2018-06-05 10:04:08 +0530 | [diff] [blame] | 3467 | * eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE that mean HDD is |
| 3468 | * waiting on disconnect_comp_var so unblock anyone waiting for |
| 3469 | * disconnect to complete. |
| 3470 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3471 | if ((roam_result == eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE) && |
Abhishek Singh | 0edeba0 | 2018-06-05 10:04:08 +0530 | [diff] [blame] | 3472 | hddDisconInProgress) |
| 3473 | complete(&adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3474 | } |
| 3475 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3476 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3477 | } |
| 3478 | |
| 3479 | /** |
| 3480 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3481 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3482 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3483 | * @roam_id: roam id |
| 3484 | * @roam_status: roam status |
| 3485 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3486 | * |
| 3487 | * Here we update the status of the Ibss when we receive information that we |
| 3488 | * have started/joined an ibss session. |
| 3489 | * |
| 3490 | * Return: none |
| 3491 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3492 | static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3493 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3494 | uint32_t roam_id, |
| 3495 | eRoamCmdStatus roam_status, |
| 3496 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3497 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3498 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3499 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3500 | hdd_debug("%s: id %d, status %d, result %d", |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3501 | adapter->dev->name, roam_id, |
| 3502 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3503 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3504 | switch (roam_result) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3505 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3506 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3507 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3508 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3509 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3510 | struct hdd_station_ctx *hdd_sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3511 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3512 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3513 | if (!roam_info) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3514 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3515 | return; |
| 3516 | } |
| 3517 | |
| 3518 | /* When IBSS Started comes from CSR, we need to move |
| 3519 | * connection state to IBSS Disconnected (meaning no peers |
| 3520 | * are in the IBSS). |
| 3521 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3522 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3523 | eConnectionState_IbssDisconnected); |
| 3524 | /* notify wmm */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3525 | hdd_wmm_connect(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3526 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3527 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3528 | hdd_sta_ctx->broadcast_sta_id = roam_info->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3529 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3530 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3531 | hdd_ctx->sta_to_adapter[roam_info->staId] = |
| 3532 | adapter; |
| 3533 | else |
| 3534 | hdd_debug("invalid sta id %d", roam_info->staId); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3535 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3536 | hdd_roam_register_sta(adapter, roam_info, |
| 3537 | roam_info->staId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3538 | roam_info->pBssDesc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3539 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3540 | if (roam_info->pBssDesc) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | struct cfg80211_bss *bss; |
| 3542 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3543 | struct ieee80211_channel *chan; |
| 3544 | int chan_no; |
| 3545 | unsigned int freq; |
| 3546 | #endif |
| 3547 | /* we created the IBSS, notify supplicant */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3548 | hdd_debug("%s: created ibss " MAC_ADDRESS_STR, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3549 | adapter->dev->name, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3550 | QDF_MAC_ADDR_ARRAY( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3551 | roam_info->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3552 | |
| 3553 | /* we must first give cfg80211 the BSS information */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3554 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3555 | roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3556 | if (!bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3557 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3558 | adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3559 | return; |
| 3560 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3561 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3562 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3563 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3564 | WLAN_CONTROL_PATH); |
| 3565 | |
| 3566 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3567 | chan_no = roam_info->pBssDesc->channelId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3568 | |
| 3569 | if (chan_no <= 14) |
| 3570 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3571 | HDD_NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3572 | else |
| 3573 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3574 | HDD_NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3575 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3576 | chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3577 | |
| 3578 | if (chan) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3579 | cfg80211_ibss_joined(adapter->dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3580 | bss->bssid, chan, |
| 3581 | GFP_KERNEL); |
| 3582 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3583 | hdd_warn("%s: chanId: %d, can't find channel", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3584 | adapter->dev->name, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3585 | (int)roam_info->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3587 | cfg80211_ibss_joined(adapter->dev, bss->bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3588 | GFP_KERNEL); |
| 3589 | #endif |
| 3590 | cfg80211_put_bss( |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 3591 | hdd_ctx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3592 | bss); |
| 3593 | } |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3594 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roam_result) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3595 | policy_mgr_incr_active_session(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3596 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 3597 | hdd_green_ap_start_state_mc(hdd_ctx, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3598 | adapter->device_mode, true); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3599 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roam_result || |
| 3600 | eCSR_ROAM_RESULT_IBSS_COALESCED == roam_result) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3601 | policy_mgr_update_connection_info(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3602 | adapter->vdev_id); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3603 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3604 | break; |
| 3605 | } |
| 3606 | |
| 3607 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3608 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3609 | hdd_err("%s: unable to create IBSS", adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | break; |
| 3611 | } |
| 3612 | |
| 3613 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3614 | hdd_err("%s: unexpected result %d", |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3615 | adapter->dev->name, (int)roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3616 | break; |
| 3617 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3618 | } |
| 3619 | |
| 3620 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3621 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3622 | * @sta_ctx: pointer to hdd station context |
| 3623 | * @sta_id: station ID |
| 3624 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3625 | * |
| 3626 | * This information is passed to iwconfig later. The peer that joined |
| 3627 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3628 | |
| 3629 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3630 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3631 | bool hdd_save_peer(struct hdd_station_ctx *sta_ctx, uint8_t sta_id, |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3632 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3633 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3634 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3635 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3636 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3637 | if (HDD_WLAN_INVALID_STA_ID == sta_ctx->conn_info.sta_id[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3638 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3639 | peer_mac_addr, sta_id, idx); |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3640 | sta_ctx->conn_info.sta_id[idx] = sta_id; |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3641 | qdf_copy_macaddr( |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3642 | &sta_ctx->conn_info.peer_macaddr[idx], |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3643 | peer_mac_addr); |
| 3644 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3645 | } |
| 3646 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3647 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3648 | } |
| 3649 | |
| 3650 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3651 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3652 | * @sta_ctx: pointer to hdd station context |
| 3653 | * @sta_id: station ID |
| 3654 | * |
| 3655 | * Return: None |
| 3656 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3657 | void hdd_delete_peer(struct hdd_station_ctx *sta_ctx, uint8_t sta_id) |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3658 | { |
| 3659 | int i; |
| 3660 | |
| 3661 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3662 | if (sta_id == sta_ctx->conn_info.sta_id[i]) { |
| 3663 | sta_ctx->conn_info.sta_id[i] = HDD_WLAN_INVALID_STA_ID; |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3664 | return; |
| 3665 | } |
| 3666 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3667 | } |
| 3668 | |
| 3669 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3670 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3671 | * @adapter: pointer to adapter |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3672 | * @sta_id: station id |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3673 | * |
| 3674 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3675 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3676 | * false otherwise. |
| 3677 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3678 | static bool roam_remove_ibss_station(struct hdd_adapter *adapter, |
| 3679 | uint8_t sta_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3680 | { |
Jeff Johnson | 24c26fd | 2019-03-10 00:29:29 -0800 | [diff] [blame] | 3681 | bool successful = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3682 | int idx = 0; |
| 3683 | uint8_t valid_idx = 0; |
| 3684 | uint8_t del_idx = 0; |
| 3685 | uint8_t empty_slots = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3686 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3687 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3688 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3689 | if (sta_id == sta_ctx->conn_info.sta_id[idx]) { |
| 3690 | sta_ctx->conn_info.sta_id[idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3691 | HDD_WLAN_INVALID_STA_ID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3692 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3693 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3694 | peer_macaddr[idx]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3695 | |
Jeff Johnson | 24c26fd | 2019-03-10 00:29:29 -0800 | [diff] [blame] | 3696 | successful = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3697 | |
| 3698 | /* |
| 3699 | * Note the deleted Index, if its 0 we need special |
| 3700 | * handling. |
| 3701 | */ |
| 3702 | del_idx = idx; |
| 3703 | |
| 3704 | empty_slots++; |
| 3705 | } else { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3706 | if (sta_ctx->conn_info.sta_id[idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3707 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3708 | valid_idx = idx; |
| 3709 | } else { |
| 3710 | /* Found an empty slot */ |
| 3711 | empty_slots++; |
| 3712 | } |
| 3713 | } |
| 3714 | } |
| 3715 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3716 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3717 | /* Last peer departed, set the IBSS state appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3718 | hdd_conn_set_connection_state(adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3719 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3720 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3721 | } |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3722 | /* Find next active sta_id, to have a valid sta trigger for TL. */ |
Jeff Johnson | 24c26fd | 2019-03-10 00:29:29 -0800 | [diff] [blame] | 3723 | if (successful) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3724 | if (del_idx == 0) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3725 | if (sta_ctx->conn_info.sta_id[valid_idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3726 | HDD_WLAN_INVALID_STA_ID) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3727 | sta_ctx->conn_info.sta_id[0] = |
| 3728 | sta_ctx->conn_info.sta_id[valid_idx]; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3729 | qdf_copy_macaddr(&sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3730 | peer_macaddr[0], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3731 | &sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3732 | peer_macaddr[valid_idx]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3733 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3734 | sta_ctx->conn_info.sta_id[valid_idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3735 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3736 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3737 | peer_macaddr[valid_idx]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3738 | } |
| 3739 | } |
| 3740 | } |
Jeff Johnson | 24c26fd | 2019-03-10 00:29:29 -0800 | [diff] [blame] | 3741 | return successful; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3742 | } |
| 3743 | |
| 3744 | /** |
| 3745 | * roam_ibss_connect_handler() - IBSS connection handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3746 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3747 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3748 | * |
| 3749 | * We update the status of the IBSS to connected in this function. |
| 3750 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3751 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3752 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3753 | static QDF_STATUS roam_ibss_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3754 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | { |
| 3756 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3757 | /* |
| 3758 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3759 | * a partner stations). |
| 3760 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3761 | hdd_conn_set_connection_state(adapter, eConnectionState_IbssConnected); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3762 | |
| 3763 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3764 | hdd_conn_save_connect_info(adapter, roam_info, eCSR_BSS_TYPE_IBSS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3765 | |
| 3766 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3767 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3768 | /* add bss_id to cfg80211 data base */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3769 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3770 | if (!bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3771 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3772 | adapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3773 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3774 | } |
| 3775 | cfg80211_put_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3776 | WLAN_HDD_GET_CTX(adapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3777 | bss); |
| 3778 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3779 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3780 | } |
| 3781 | |
| 3782 | /** |
| 3783 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3784 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3785 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3786 | * @roam_id: roam id |
| 3787 | * @roam_status: roam status |
| 3788 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3789 | * |
| 3790 | * This function indicates the Mic failure to the supplicant |
| 3791 | * |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3792 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3793 | */ |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3794 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3795 | hdd_roam_mic_error_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3796 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3797 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3798 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3799 | tSirMicFailureInfo *mic_failure_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 3801 | if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3802 | return; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3803 | |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3804 | mic_failure_info = roam_info->u.pMICFailureInfo; |
| 3805 | cfg80211_michael_mic_failure(adapter->dev, |
| 3806 | mic_failure_info->taMacAddr, |
| 3807 | mic_failure_info->multicast ? |
| 3808 | NL80211_KEYTYPE_GROUP : |
| 3809 | NL80211_KEYTYPE_PAIRWISE, |
| 3810 | mic_failure_info->keyId, |
| 3811 | mic_failure_info->TSC, |
| 3812 | GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3813 | } |
| 3814 | |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3815 | #ifdef CRYPTO_SET_KEY_CONVERGED |
| 3816 | static QDF_STATUS wlan_hdd_set_key_helper(struct hdd_adapter *adapter, |
| 3817 | uint32_t *roam_id) |
| 3818 | { |
| 3819 | int ret; |
| 3820 | struct wlan_objmgr_vdev *vdev; |
| 3821 | |
| 3822 | vdev = hdd_objmgr_get_vdev(adapter); |
| 3823 | if (!vdev) |
| 3824 | return QDF_STATUS_E_FAILURE; |
Kiran Kumar Lokere | 47d0dac | 2019-01-24 18:38:33 -0800 | [diff] [blame] | 3825 | ret = wlan_cfg80211_crypto_add_key(vdev, |
| 3826 | WLAN_CRYPTO_KEY_TYPE_UNICAST, 0); |
Rajeev Kumar Sirasanagandla | 25bdfad | 2019-02-15 19:15:49 +0530 | [diff] [blame] | 3827 | hdd_objmgr_put_vdev(vdev); |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3828 | if (ret != 0) { |
| 3829 | hdd_err("crypto add key fail, status: %d", ret); |
| 3830 | return QDF_STATUS_E_FAILURE; |
| 3831 | } |
| 3832 | |
| 3833 | return QDF_STATUS_SUCCESS; |
| 3834 | } |
| 3835 | #else |
| 3836 | static QDF_STATUS wlan_hdd_set_key_helper(struct hdd_adapter *adapter, |
| 3837 | uint32_t *roam_id) |
| 3838 | { |
| 3839 | struct hdd_station_ctx *sta_ctx = |
| 3840 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 3841 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3842 | |
| 3843 | return sme_roam_set_key(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3844 | adapter->vdev_id, |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3845 | &sta_ctx->ibss_enc_key, |
| 3846 | roam_id); |
| 3847 | } |
| 3848 | #endif |
| 3849 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3850 | /** |
| 3851 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3852 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3853 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3854 | * @roam_id: roam id |
| 3855 | * @roam_status: roam status |
| 3856 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3857 | * |
| 3858 | * The Ibss connection status is updated regularly here in this function. |
| 3859 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3860 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3861 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3862 | static QDF_STATUS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3863 | roam_roam_connect_status_update_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3864 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3865 | uint32_t roam_id, |
| 3866 | eRoamCmdStatus roam_status, |
| 3867 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3868 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3869 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3870 | struct wlan_objmgr_vdev *vdev; |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3871 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3872 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3873 | switch (roam_result) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3874 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3875 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3876 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3877 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3878 | struct station_info *stainfo; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3879 | eCsrEncryptionType encr_type = sta_ctx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3880 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3881 | hdd_debug("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3882 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3883 | MAC_ADDRESS_STR " and stationID= %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3884 | QDF_MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3885 | QDF_MAC_ADDR_ARRAY(sta_ctx->conn_info.bssid.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3886 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3887 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3888 | if (!hdd_save_peer |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3889 | (WLAN_HDD_GET_STATION_CTX_PTR(adapter), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3890 | roam_info->staId, |
| 3891 | &roam_info->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3892 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3893 | break; |
| 3894 | } |
| 3895 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3896 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3897 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
| 3898 | else |
| 3899 | hdd_debug("invalid sta id %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3900 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3901 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3902 | roam_info->fAuthRequired = true; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3903 | |
Jeff Johnson | 71a1d5c | 2018-12-30 11:31:04 -0800 | [diff] [blame] | 3904 | /* Register the Station with datapath for the new peer. */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3905 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3906 | roam_info, |
| 3907 | roam_info->staId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3908 | roam_info->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3909 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 71a1d5c | 2018-12-30 11:31:04 -0800 | [diff] [blame] | 3910 | hdd_err("Cannot register STA for IBSS. qdf_status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3911 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3912 | } |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3913 | sta_ctx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3914 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 3915 | if (!stainfo) |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3916 | return QDF_STATUS_E_NOMEM; |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 3917 | |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3918 | stainfo->filled = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3919 | stainfo->generation = sta_ctx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3920 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3921 | cfg80211_new_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3922 | (const u8 *)roam_info->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3923 | stainfo, GFP_KERNEL); |
| 3924 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3925 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3926 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3927 | sta_ctx->ibss_enc_key.keyDirection = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3928 | eSIR_TX_RX; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3929 | qdf_copy_macaddr(&sta_ctx->ibss_enc_key.peerMac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3930 | &roam_info->peerMac); |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3931 | vdev = hdd_objmgr_get_vdev(adapter); |
| 3932 | if (!vdev) |
| 3933 | return QDF_STATUS_E_FAILURE; |
| 3934 | wlan_crypto_update_set_key_peer(vdev, true, 0, |
| 3935 | &roam_info->peerMac); |
Rajeev Kumar Sirasanagandla | 25bdfad | 2019-02-15 19:15:49 +0530 | [diff] [blame] | 3936 | hdd_objmgr_put_vdev(vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3937 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3938 | hdd_debug("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3939 | encr_type); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3940 | qdf_status = wlan_hdd_set_key_helper(adapter, &roam_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3941 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3942 | hdd_err("sme set_key fail status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3943 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3944 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3945 | } |
| 3946 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3947 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3948 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3949 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3950 | WLAN_CONTROL_PATH); |
| 3951 | break; |
| 3952 | } |
| 3953 | |
| 3954 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3955 | { |
| 3956 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3957 | roam_ibss_connect_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3958 | |
| 3959 | break; |
| 3960 | } |
| 3961 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3962 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3963 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3964 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3965 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3966 | if (!roam_remove_ibss_station(adapter, roam_info->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3967 | hdd_warn("IBSS peer departed by cannot find peer in our registration table with TL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3968 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3969 | hdd_debug("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3970 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3971 | MAC_ADDRESS_STR " and stationID= %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3972 | QDF_MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3973 | QDF_MAC_ADDR_ARRAY(sta_ctx->conn_info.bssid.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3974 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3975 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3976 | hdd_roam_deregister_sta(adapter, roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3977 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3978 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3979 | hdd_ctx->sta_to_adapter[roam_info->staId] = NULL; |
| 3980 | else |
| 3981 | hdd_debug("invalid sta id %d", roam_info->staId); |
| 3982 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3983 | sta_ctx->ibss_sta_generation++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3984 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3985 | cfg80211_del_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3986 | (const u8 *)&roam_info->peerMac.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3987 | GFP_KERNEL); |
| 3988 | break; |
| 3989 | } |
| 3990 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3991 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3992 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | /* Stop only when we are inactive */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3994 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3995 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3996 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3997 | WLAN_CONTROL_PATH); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3998 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3999 | eConnectionState_NotConnected); |
| 4000 | |
| 4001 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4002 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4003 | break; |
| 4004 | } |
| 4005 | default: |
| 4006 | break; |
| 4007 | |
| 4008 | } |
| 4009 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4010 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4011 | } |
| 4012 | |
| 4013 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4014 | QDF_STATUS hdd_roam_register_tdlssta(struct hdd_adapter *adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 4015 | const uint8_t *peerMac, uint16_t sta_id, |
Jeff Johnson | a8ce127 | 2018-03-01 14:39:10 -0800 | [diff] [blame] | 4016 | uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4017 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4018 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 4019 | struct ol_txrx_desc_type txrx_desc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 4020 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 4021 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 4022 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4023 | |
| 4024 | /* |
| 4025 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 4026 | * be peer MAC, here we are working on direct Link |
| 4027 | */ |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 4028 | txrx_desc.sta_id = sta_id; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4029 | |
| 4030 | /* set the QoS field appropriately .. */ |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 4031 | txrx_desc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4032 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 4033 | /* Register the vdev transmit and receive functions */ |
| 4034 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
Jinwei Chen | e614397 | 2019-03-25 19:38:05 +0800 | [diff] [blame] | 4035 | if (adapter->hdd_ctx->enable_dp_rx_threads) { |
| 4036 | txrx_ops.rx.rx = hdd_rx_pkt_thread_enqueue_cbk; |
| 4037 | txrx_ops.rx.rx_stack = hdd_rx_packet_cbk; |
| 4038 | } else { |
| 4039 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
| 4040 | txrx_ops.rx.rx_stack = NULL; |
| 4041 | } |
| 4042 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 4043 | cdp_vdev_register(soc, |
Sravan Kumar Kairam | 43f191b | 2018-05-04 17:00:39 +0530 | [diff] [blame] | 4044 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4045 | (struct cdp_pdev *)pdev, adapter->vdev_id), |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 4046 | adapter, (struct cdp_ctrl_objmgr_vdev *)adapter->vdev, |
Sravan Kumar Kairam | 43f191b | 2018-05-04 17:00:39 +0530 | [diff] [blame] | 4047 | &txrx_ops); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4048 | adapter->tx_fn = txrx_ops.tx.tx; |
Poddar, Siddarth | 31797fa | 2018-01-22 17:24:15 +0530 | [diff] [blame] | 4049 | txrx_ops.rx.stats_rx = hdd_tx_rx_collect_connectivity_stats_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4050 | |
| 4051 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 4052 | qdf_status = cdp_peer_register(soc, |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 4053 | (struct cdp_pdev *)pdev, &txrx_desc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4054 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4055 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4056 | qdf_status, qdf_status); |
| 4057 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4058 | } |
| 4059 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4060 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4061 | } |
| 4062 | |
| 4063 | /** |
| 4064 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4065 | * @adapter: pointer to adapter |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 4066 | * @sta_id: station identifier |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4067 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4068 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4069 | */ |
Jeff Johnson | 5336784 | 2017-10-03 11:10:34 -0700 | [diff] [blame] | 4070 | QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 4071 | uint8_t sta_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4072 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4073 | QDF_STATUS qdf_status; |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 4074 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 4075 | qdf_status = cdp_clear_peer(cds_get_context(QDF_MODULE_ID_SOC), |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 4076 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 4077 | sta_id); |
Kabilan Kannan | b4e0137 | 2018-01-15 13:33:10 -0800 | [diff] [blame] | 4078 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4079 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4080 | } |
| 4081 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4082 | #else |
| 4083 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4084 | inline QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 4085 | uint8_t sta_id) |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4086 | { |
| 4087 | return QDF_STATUS_SUCCESS; |
| 4088 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4089 | #endif |
| 4090 | |
| 4091 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4092 | |
| 4093 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4094 | |
| 4095 | static void hdd_rx_unprot_disassoc(struct net_device *dev, |
| 4096 | const u8 *buf, size_t len) |
| 4097 | { |
| 4098 | cfg80211_rx_unprot_mlme_mgmt(dev, buf, len); |
| 4099 | } |
| 4100 | |
| 4101 | static void hdd_rx_unprot_deauth(struct net_device *dev, |
| 4102 | const u8 *buf, size_t len) |
| 4103 | { |
| 4104 | cfg80211_rx_unprot_mlme_mgmt(dev, buf, len); |
| 4105 | } |
| 4106 | |
| 4107 | #else |
| 4108 | |
| 4109 | static void hdd_rx_unprot_disassoc(struct net_device *dev, |
| 4110 | const u8 *buf, size_t len) |
| 4111 | { |
| 4112 | cfg80211_send_unprot_disassoc(dev, buf, len); |
| 4113 | } |
| 4114 | |
| 4115 | static void hdd_rx_unprot_deauth(struct net_device *dev, |
| 4116 | const u8 *buf, size_t len) |
| 4117 | { |
| 4118 | cfg80211_send_unprot_deauth(dev, buf, len); |
| 4119 | } |
| 4120 | |
| 4121 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) */ |
| 4122 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4123 | /** |
| 4124 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4125 | * @adapter: pointer to the adapter |
| 4126 | * @frame_length: Length of the unprotected frame being passed |
| 4127 | * @frame: Pointer to the frame buffer |
| 4128 | * @frame_type: 802.11 frame type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | * |
| 4130 | * This function forwards the unprotected management frame to the supplicant. |
| 4131 | * |
| 4132 | * Return: nothing |
| 4133 | */ |
| 4134 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4135 | hdd_indicate_unprot_mgmt_frame(struct hdd_adapter *adapter, |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4136 | uint32_t frame_length, |
| 4137 | uint8_t *frame, uint8_t frame_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4138 | { |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4139 | uint8_t type, subtype; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4140 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4141 | hdd_debug("Frame Type = %d Frame Length = %d", |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4142 | frame_type, frame_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4143 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4144 | if (hdd_validate_adapter(adapter)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4145 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4146 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4147 | if (!frame_length) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4148 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4149 | return; |
| 4150 | } |
| 4151 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4152 | if (!frame) { |
| 4153 | hdd_err("frame is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4154 | return; |
| 4155 | } |
| 4156 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4157 | type = WLAN_HDD_GET_TYPE_FRM_FC(frame[0]); |
| 4158 | if (type != SIR_MAC_MGMT_FRAME) { |
| 4159 | hdd_warn("Unexpected frame type %d", type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4160 | return; |
| 4161 | } |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4162 | |
| 4163 | subtype = WLAN_HDD_GET_SUBTYPE_FRM_FC(frame[0]); |
| 4164 | switch (subtype) { |
| 4165 | case SIR_MAC_MGMT_DISASSOC: |
| 4166 | hdd_rx_unprot_disassoc(adapter->dev, frame, frame_length); |
| 4167 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_disassoc_rx++; |
| 4168 | break; |
| 4169 | case SIR_MAC_MGMT_DEAUTH: |
| 4170 | hdd_rx_unprot_deauth(adapter->dev, frame, frame_length); |
| 4171 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_deauth_rx++; |
| 4172 | break; |
| 4173 | default: |
| 4174 | hdd_warn("Unexpected frame subtype %d", subtype); |
| 4175 | break; |
| 4176 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4177 | } |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4178 | #endif /* WLAN_FEATURE_11W */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4179 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4180 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4181 | /** |
| 4182 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4183 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4184 | * @tid: traffic identifier |
| 4185 | * @state: state |
| 4186 | * @measInterval: measurement interval |
| 4187 | * |
| 4188 | * This function sends traffic stream metrics IE information to |
| 4189 | * the supplicant via wireless event. |
| 4190 | * |
| 4191 | * Return: none |
| 4192 | */ |
| 4193 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4194 | hdd_indicate_tsm_ie(struct hdd_adapter *adapter, uint8_t tid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4195 | uint8_t state, uint16_t measInterval) |
| 4196 | { |
| 4197 | union iwreq_data wrqu; |
| 4198 | char buf[IW_CUSTOM_MAX + 1]; |
| 4199 | int nBytes = 0; |
| 4200 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4201 | if (!adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4202 | return; |
| 4203 | |
| 4204 | /* create the event */ |
| 4205 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4206 | memset(buf, '\0', sizeof(buf)); |
| 4207 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4208 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4209 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4210 | |
| 4211 | nBytes = |
| 4212 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4213 | measInterval); |
| 4214 | |
| 4215 | wrqu.data.pointer = buf; |
| 4216 | wrqu.data.length = nBytes; |
| 4217 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4218 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4219 | } |
| 4220 | |
| 4221 | /** |
| 4222 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4223 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4224 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4225 | * |
| 4226 | * This function sends cckm preauth indication to the supplicant |
| 4227 | * via wireless custom event. |
| 4228 | * |
| 4229 | * Return: none |
| 4230 | */ |
| 4231 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4232 | hdd_indicate_cckm_pre_auth(struct hdd_adapter *adapter, |
| 4233 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4234 | { |
| 4235 | union iwreq_data wrqu; |
| 4236 | char buf[IW_CUSTOM_MAX + 1]; |
| 4237 | char *pos = buf; |
| 4238 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4239 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4240 | if ((!adapter) || (!roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4241 | return; |
| 4242 | |
| 4243 | /* create the event */ |
| 4244 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4245 | memset(buf, '\0', sizeof(buf)); |
| 4246 | |
| 4247 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4248 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 4249 | QDF_MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4250 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4251 | |
| 4252 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4253 | pos += nBytes; |
| 4254 | freeBytes -= nBytes; |
| 4255 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4256 | qdf_mem_copy(pos, roam_info->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4257 | pos += QDF_MAC_ADDR_SIZE; |
| 4258 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4259 | |
| 4260 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4261 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4262 | freeBytes -= nBytes; |
| 4263 | |
| 4264 | wrqu.data.pointer = buf; |
| 4265 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4266 | |
| 4267 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4268 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4269 | } |
| 4270 | |
| 4271 | /** |
| 4272 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4273 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4274 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4275 | * |
| 4276 | * Return: none |
| 4277 | */ |
| 4278 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4279 | hdd_indicate_ese_adj_ap_rep_ind(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4280 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4281 | { |
| 4282 | union iwreq_data wrqu; |
| 4283 | char buf[IW_CUSTOM_MAX + 1]; |
| 4284 | int nBytes = 0; |
| 4285 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4286 | if ((!adapter) || (!roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4287 | return; |
| 4288 | |
| 4289 | /* create the event */ |
| 4290 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4291 | memset(buf, '\0', sizeof(buf)); |
| 4292 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4293 | hdd_debug("CCXADJAPREP=%u", roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4294 | |
| 4295 | nBytes = |
| 4296 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4297 | roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4298 | |
| 4299 | wrqu.data.pointer = buf; |
| 4300 | wrqu.data.length = nBytes; |
| 4301 | |
| 4302 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4303 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4304 | } |
| 4305 | |
| 4306 | /** |
| 4307 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4308 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4309 | * @measurementToken: measurement token |
| 4310 | * @flag: flag |
| 4311 | * @numBss: number of bss |
| 4312 | * |
| 4313 | * If the measurement is none and no scan results found, |
| 4314 | * indicate the supplicant about measurement done. |
| 4315 | * |
| 4316 | * Return: none |
| 4317 | */ |
| 4318 | void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4319 | hdd_indicate_ese_bcn_report_no_results(const struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4320 | const uint16_t measurementToken, |
| 4321 | const bool flag, const uint8_t numBss) |
| 4322 | { |
| 4323 | union iwreq_data wrqu; |
| 4324 | char buf[IW_CUSTOM_MAX]; |
| 4325 | char *pos = buf; |
| 4326 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4327 | |
| 4328 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4329 | memset(buf, '\0', sizeof(buf)); |
| 4330 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4331 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4332 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4333 | |
| 4334 | nBytes = |
| 4335 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4336 | flag, numBss); |
| 4337 | |
| 4338 | wrqu.data.pointer = buf; |
| 4339 | wrqu.data.length = nBytes; |
| 4340 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4341 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4342 | } |
| 4343 | |
| 4344 | /** |
| 4345 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4346 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4347 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4348 | * |
| 4349 | * If the measurement is none and no scan results found, |
| 4350 | * indicate the supplicant about measurement done. |
| 4351 | * |
| 4352 | * Return: none |
| 4353 | */ |
| 4354 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4355 | hdd_indicate_ese_bcn_report_ind(const struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4356 | const struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4357 | { |
| 4358 | union iwreq_data wrqu; |
| 4359 | char buf[IW_CUSTOM_MAX]; |
| 4360 | char *pos = buf; |
| 4361 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4362 | uint8_t i = 0, len = 0; |
| 4363 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4364 | uint8_t lastSent = 0, sendBss = 0; |
| 4365 | int bcnRepFieldSize = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4366 | sizeof(roam_info->pEseBcnReportRsp->bcnRepBssInfo[0]. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4367 | bcnReportFields); |
| 4368 | uint8_t ieLenByte = 1; |
| 4369 | /* |
| 4370 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4371 | */ |
| 4372 | #define ESEBCNREPHEADER_LEN (18) |
| 4373 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4374 | if ((!adapter) || (!roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4375 | return; |
| 4376 | |
| 4377 | /* |
| 4378 | * Custom event can pass maximum of 256 bytes of data, |
| 4379 | * based on the IE len we need to identify how many BSS info can |
| 4380 | * be filled in to custom event data. |
| 4381 | */ |
| 4382 | /* |
| 4383 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4384 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4385 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4386 | */ |
| 4387 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4388 | if ((roam_info->pEseBcnReportRsp->flag >> 1) |
| 4389 | && (!roam_info->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4390 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4391 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4392 | * indicate the supplicant about measurement done |
| 4393 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4394 | hdd_indicate_ese_bcn_report_no_results( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4395 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4396 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4397 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4398 | roam_info->pEseBcnReportRsp->flag, |
| 4399 | roam_info->pEseBcnReportRsp->numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4400 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4401 | while (lastSent < roam_info->pEseBcnReportRsp->numBss) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4402 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4403 | memset(buf, '\0', sizeof(buf)); |
| 4404 | tot_bcn_ieLen = 0; |
| 4405 | sendBss = 0; |
| 4406 | pos = buf; |
| 4407 | freeBytes = IW_CUSTOM_MAX; |
| 4408 | |
| 4409 | for (i = lastSent; |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4410 | i < roam_info->pEseBcnReportRsp->numBss; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4411 | len = |
| 4412 | bcnRepFieldSize + ieLenByte + |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4413 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4414 | bcnRepBssInfo[i].ieLen; |
| 4415 | if ((len + tot_bcn_ieLen) > |
| 4416 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4417 | break; |
| 4418 | } |
| 4419 | tot_bcn_ieLen += len; |
| 4420 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4421 | hdd_debug("i(%d) sizeof bcnReportFields(%d) IeLength(%d) Length of Ie(%d) totLen(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4422 | i, bcnRepFieldSize, 1, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4423 | roam_info->pEseBcnReportRsp-> |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4424 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4425 | } |
| 4426 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4427 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4428 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4429 | roam_info->pEseBcnReportRsp->measurementToken, |
| 4430 | roam_info->pEseBcnReportRsp->flag, sendBss, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4431 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4432 | |
| 4433 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4434 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4435 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4436 | roam_info->pEseBcnReportRsp->flag, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4437 | sendBss); |
| 4438 | pos += nBytes; |
| 4439 | freeBytes -= nBytes; |
| 4440 | |
| 4441 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4442 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4443 | sizeof(tot_bcn_ieLen)); |
| 4444 | pos += sizeof(tot_bcn_ieLen); |
| 4445 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4446 | |
| 4447 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4448 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4449 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4450 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4451 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4452 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4453 | bcnRepBssInfo[i + |
| 4454 | lastSent].bcnReportFields. |
| 4455 | ChanNum, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4456 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4457 | bcnRepBssInfo[i + |
| 4458 | lastSent].bcnReportFields. |
| 4459 | Spare, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4460 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4461 | bcnRepBssInfo[i + |
| 4462 | lastSent].bcnReportFields. |
| 4463 | MeasDuration, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4464 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4465 | bcnRepBssInfo[i + |
| 4466 | lastSent].bcnReportFields. |
| 4467 | PhyType, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4468 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4469 | bcnRepBssInfo[i + |
| 4470 | lastSent].bcnReportFields. |
| 4471 | RecvSigPower, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4472 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4473 | bcnRepBssInfo[i + |
| 4474 | lastSent].bcnReportFields. |
| 4475 | ParentTsf, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4476 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4477 | bcnRepBssInfo[i + |
| 4478 | lastSent].bcnReportFields. |
| 4479 | TargetTsf[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4480 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | bcnRepBssInfo[i + |
| 4482 | lastSent].bcnReportFields. |
| 4483 | TargetTsf[1], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4484 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4485 | bcnRepBssInfo[i + |
| 4486 | lastSent].bcnReportFields. |
| 4487 | BcnInterval, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4488 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4489 | bcnRepBssInfo[i + |
| 4490 | lastSent].bcnReportFields. |
| 4491 | CapabilityInfo, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4492 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4493 | bcnRepBssInfo[i + |
| 4494 | lastSent].bcnReportFields. |
| 4495 | Bssid[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4496 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4497 | bcnRepBssInfo[i + |
| 4498 | lastSent].bcnReportFields. |
| 4499 | Bssid[1], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4500 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4501 | bcnRepBssInfo[i + |
| 4502 | lastSent].bcnReportFields. |
| 4503 | Bssid[2], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4504 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4505 | bcnRepBssInfo[i + |
| 4506 | lastSent].bcnReportFields. |
| 4507 | Bssid[3], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4508 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4509 | bcnRepBssInfo[i + |
| 4510 | lastSent].bcnReportFields. |
| 4511 | Bssid[4], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4512 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4513 | bcnRepBssInfo[i + |
| 4514 | lastSent].bcnReportFields. |
| 4515 | Bssid[5]); |
| 4516 | |
| 4517 | /* bcn report fields are copied */ |
| 4518 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4519 | sizeof(roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4520 | bcnRepBssInfo[i + |
| 4521 | lastSent]. |
| 4522 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4523 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4524 | (char *)&roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4525 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4526 | lastSent]. |
| 4527 | bcnReportFields, len); |
| 4528 | pos += len; |
| 4529 | freeBytes -= len; |
| 4530 | |
| 4531 | /* Add 1 byte of ie len */ |
| 4532 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4533 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4534 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4535 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4536 | pos += sizeof(len); |
| 4537 | freeBytes -= sizeof(len); |
| 4538 | |
| 4539 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4540 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4541 | (char *)roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4542 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4543 | lastSent]. |
| 4544 | pBuf, len); |
| 4545 | pos += len; |
| 4546 | freeBytes -= len; |
| 4547 | } |
| 4548 | |
| 4549 | wrqu.data.pointer = buf; |
| 4550 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4551 | |
| 4552 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4553 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4554 | buf); |
| 4555 | lastSent += sendBss; |
| 4556 | } |
| 4557 | } |
| 4558 | } |
| 4559 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4560 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4561 | |
| 4562 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4563 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4564 | * @sta_ctx: Station Context |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4565 | * |
| 4566 | * API to check if the connection authentication type is 8021x_sha256. |
| 4567 | * |
| 4568 | * Return: bool |
| 4569 | */ |
| 4570 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4571 | static inline bool |
| 4572 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4573 | { |
| 4574 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4575 | sta_ctx->conn_info.auth_type; |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4576 | } |
| 4577 | #else |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4578 | static inline bool |
| 4579 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4580 | { |
| 4581 | return false; |
| 4582 | } |
| 4583 | #endif |
| 4584 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4585 | /* |
| 4586 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4587 | * @adapter: Pointer to adapter context |
| 4588 | * @roam_info: Pointer to roam info |
| 4589 | * |
| 4590 | * Return: None |
| 4591 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 4592 | static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4593 | struct csr_roam_info *roam_info) |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4594 | { |
| 4595 | struct hdd_chan_change_params chan_change; |
| 4596 | struct cfg80211_bss *bss; |
| 4597 | struct net_device *dev = adapter->dev; |
| 4598 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4599 | struct wiphy *wiphy = wdev->wiphy; |
| 4600 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4601 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4602 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4603 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4604 | hdd_debug("channel switch for session:%d to channel:%d", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4605 | adapter->vdev_id, roam_info->chan_info.chan_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4606 | |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4607 | /* Enable Roaming on STA interface which was disabled before CSA */ |
| 4608 | if (adapter->device_mode == QDF_STA_MODE) |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4609 | sme_start_roaming(mac_handle, adapter->vdev_id, |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4610 | REASON_DRIVER_ENABLED); |
| 4611 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4612 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4613 | chan_change.chan_params.ch_width = |
| 4614 | roam_info->chan_info.ch_width; |
| 4615 | chan_change.chan_params.sec_ch_offset = |
| 4616 | roam_info->chan_info.sec_ch_offset; |
| 4617 | chan_change.chan_params.center_freq_seg0 = |
| 4618 | roam_info->chan_info.band_center_freq1; |
| 4619 | chan_change.chan_params.center_freq_seg1 = |
| 4620 | roam_info->chan_info.band_center_freq2; |
| 4621 | |
| 4622 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4623 | if (!bss) |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4624 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4625 | else |
| 4626 | cfg80211_put_bss(wiphy, bss); |
| 4627 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4628 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4629 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4630 | if (QDF_IS_STATUS_ERROR(status)) |
| 4631 | hdd_err("channel change notification failed"); |
| 4632 | |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 4633 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4634 | adapter->vdev_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4635 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4636 | hdd_debug("set hw mode change not done"); |
Abhishek Singh | bfaebe3 | 2019-03-19 13:37:55 +0530 | [diff] [blame] | 4637 | |
| 4638 | hdd_debug("check for SAP restart"); |
| 4639 | policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->psoc); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4640 | } |
| 4641 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4642 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4643 | * hdd_sme_roam_callback() - hdd sme roam callback |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4644 | * @context: pointer to adapter context |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4645 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4646 | * @roam_id: roam id |
| 4647 | * @roam_status: roam status |
| 4648 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4649 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4650 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4651 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4652 | QDF_STATUS |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4653 | hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4654 | uint32_t roam_id, |
| 4655 | eRoamCmdStatus roam_status, eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4656 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4657 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4658 | struct hdd_adapter *adapter = context; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4659 | struct hdd_station_ctx *sta_ctx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4660 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4661 | struct cfg80211_bss *bss_status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4662 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4663 | |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4664 | hdd_debug("CSR Callback: status=%d result=%d roamID=%d", |
| 4665 | roam_status, roam_result, roam_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4666 | |
| 4667 | /* Sanity check */ |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4668 | if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4669 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4670 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4671 | } |
| 4672 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4673 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4674 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4675 | |
Abhishek Singh | f723e3d | 2018-02-20 18:02:37 +0530 | [diff] [blame] | 4676 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4677 | adapter->vdev_id, roam_status)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4678 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4679 | switch (roam_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4680 | /* |
| 4681 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4682 | * reassoc failed due to failure, timeout, reject from ap |
| 4683 | * in any case tell the OS, our carrier is off and mark |
| 4684 | * interface down. |
| 4685 | */ |
| 4686 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4687 | hdd_err("Reassoc Failed with roam_status: %d roam_result: %d SessionID: %d", |
| 4688 | roam_status, roam_result, adapter->vdev_id); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4689 | qdf_ret_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4690 | hdd_dis_connect_handler(adapter, roam_info, roam_id, |
| 4691 | roam_status, roam_result); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4692 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4693 | sta_ctx->hdd_reassoc_scenario = false; |
| 4694 | hdd_debug("hdd_reassoc_scenario set to: %d, ReAssoc Failed, session: %d", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4695 | sta_ctx->hdd_reassoc_scenario, adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4696 | break; |
| 4697 | |
| 4698 | case eCSR_ROAM_FT_START: |
| 4699 | /* |
| 4700 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4701 | * informed that the link is down. So mark the link ready for |
| 4702 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4703 | * be received. Where in we will not mark the link down |
| 4704 | * Also we want to stop tx at this point when we will be |
| 4705 | * doing disassoc at this time. This saves 30-60 msec |
| 4706 | * after reassoc. |
| 4707 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4708 | hdd_debug("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4709 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4710 | hdd_napi_serialize(1); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4711 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4712 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4713 | WLAN_CONTROL_PATH); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4714 | status = hdd_roam_deregister_sta(adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 4715 | sta_ctx->conn_info.sta_id[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4716 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4717 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4718 | sta_ctx->ft_carrier_on = true; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4719 | sta_ctx->hdd_reassoc_scenario = true; |
| 4720 | hdd_debug("hdd_reassoc_scenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4721 | sta_ctx->hdd_reassoc_scenario, adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4722 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4723 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4724 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4725 | hdd_napi_serialize(0); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4726 | if (roam_result == eCSR_ROAM_RESULT_FAILURE) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4727 | adapter->roam_ho_fail = true; |
Pragaspathi Thilagaraj | 8ea625d | 2019-02-14 16:11:45 +0530 | [diff] [blame] | 4728 | hdd_set_roaming_in_progress(false); |
| 4729 | } else { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4730 | adapter->roam_ho_fail = false; |
Pragaspathi Thilagaraj | 8ea625d | 2019-02-14 16:11:45 +0530 | [diff] [blame] | 4731 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4732 | complete(&adapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4733 | break; |
Pragaspathi Thilagaraj | 8ea625d | 2019-02-14 16:11:45 +0530 | [diff] [blame] | 4734 | case eCSR_ROAM_SYNCH_COMPLETE: |
| 4735 | hdd_debug("LFR3: Roam synch complete"); |
| 4736 | hdd_set_roaming_in_progress(false); |
| 4737 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4738 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4739 | /* notify apps that we can't pass traffic anymore */ |
Dustin Brown | a7bb6ae | 2018-08-16 16:51:50 -0700 | [diff] [blame] | 4740 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4741 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4742 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4743 | WLAN_CONTROL_PATH); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4744 | if (sta_ctx->ft_carrier_on == false) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4745 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4746 | WLAN_NETIF_CARRIER_OFF, |
| 4747 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4748 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4749 | break; |
| 4750 | case eCSR_ROAM_LOSTLINK: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4751 | if (roam_result == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4752 | hdd_debug("Roaming started due to connection lost"); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4753 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4754 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4755 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4756 | WLAN_CONTROL_PATH); |
| 4757 | break; |
| 4758 | } |
| 4759 | case eCSR_ROAM_DISASSOCIATED: |
| 4760 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4761 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4762 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 4763 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4764 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4765 | adapter->roam_ho_fail = false; |
| 4766 | complete(&adapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4767 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4768 | /* Call to clear any MC Addr List filter applied after |
| 4769 | * successful connection. |
| 4770 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4771 | hdd_disable_and_flush_mc_addr_list(adapter, |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4772 | pmo_peer_disconnect); |
| 4773 | qdf_ret_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4774 | hdd_dis_connect_handler(adapter, roam_info, roam_id, |
| 4775 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4776 | } |
| 4777 | break; |
| 4778 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4779 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4780 | qdf_ret_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4781 | hdd_dis_connect_handler(adapter, roam_info, roam_id, |
| 4782 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4783 | break; |
| 4784 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4785 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4786 | /* |
| 4787 | * To Do - address probable memory leak with WEP encryption upon |
| 4788 | * successful association. |
| 4789 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4790 | if (eCSR_ROAM_RESULT_ASSOCIATED != roam_result) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4791 | /* Clear saved connection information in HDD */ |
| 4792 | hdd_conn_remove_connect_info( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4793 | WLAN_HDD_GET_STATION_CTX_PTR(adapter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4794 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4795 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4796 | hdd_association_completion_handler(adapter, roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4797 | roam_id, roam_status, |
| 4798 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4799 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4800 | if (roam_info) |
| 4801 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4802 | #endif |
| 4803 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 4804 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4805 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Jeff Johnson | 48c05c7 | 2018-04-29 19:47:12 -0700 | [diff] [blame] | 4806 | /* fallthrough */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4807 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4808 | qdf_ret_status = hdd_association_completion_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4809 | roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4810 | roam_id, |
| 4811 | roam_status, |
| 4812 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4813 | break; |
| 4814 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4815 | hdd_roam_ibss_indication_handler(adapter, roam_info, roam_id, |
| 4816 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4817 | break; |
| 4818 | |
| 4819 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4820 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4821 | roam_roam_connect_status_update_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4822 | roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4823 | roam_id, |
| 4824 | roam_status, |
| 4825 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4826 | break; |
| 4827 | |
| 4828 | case eCSR_ROAM_MIC_ERROR_IND: |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 4829 | hdd_roam_mic_error_indication_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4830 | break; |
| 4831 | |
| 4832 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 4833 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4834 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4835 | hdd_roam_set_key_complete_handler(adapter, roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4836 | roam_id, roam_status, |
| 4837 | roam_result); |
| 4838 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4839 | sta_ctx->hdd_reassoc_scenario = false; |
| 4840 | hdd_debug("hdd_reassoc_scenario set to: %d, set key complete, session: %d", |
| 4841 | sta_ctx->hdd_reassoc_scenario, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4842 | adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4843 | } |
| 4844 | } |
| 4845 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4846 | if (roam_info) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4847 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4848 | #endif |
| 4849 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4850 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4851 | case eCSR_ROAM_FT_RESPONSE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4852 | hdd_send_ft_event(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4853 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4854 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4855 | case eCSR_ROAM_PMK_NOTIFY: |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4856 | if (eCSR_AUTH_TYPE_RSN == sta_ctx->conn_info.auth_type |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4857 | || hdd_is_8021x_sha256_auth_type(sta_ctx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4858 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4859 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4860 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4861 | adapter, roam_info, 1, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4862 | } |
| 4863 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4864 | |
| 4865 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4866 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4867 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4868 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4869 | wlan_hdd_cfg80211_roam_metrics_preauth(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4870 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4871 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4872 | } |
| 4873 | break; |
| 4874 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4875 | /* |
| 4876 | * This event will notify pre-auth completion in case of success |
| 4877 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4878 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4879 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4880 | roam_info, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4881 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4882 | } |
| 4883 | break; |
| 4884 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4885 | /* |
| 4886 | * This event will notify pre-auth completion incase of failure. |
| 4887 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4888 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4889 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4890 | roam_info, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4891 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4892 | } |
| 4893 | break; |
| 4894 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4895 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4896 | * It will be only invoked on success |
| 4897 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4898 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4899 | wlan_hdd_cfg80211_roam_metrics_handover(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4900 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4901 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4902 | } |
| 4903 | break; |
| 4904 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4905 | #ifdef WLAN_FEATURE_11W |
| 4906 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
gaurank kathpalia | ea6b5e6 | 2018-07-05 20:41:28 +0530 | [diff] [blame] | 4907 | if (roam_info) |
| 4908 | hdd_indicate_unprot_mgmt_frame(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4909 | roam_info->nFrameLength, |
| 4910 | roam_info->pbFrames, |
| 4911 | roam_info->frameType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4912 | break; |
| 4913 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4914 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4915 | case eCSR_ROAM_TSM_IE_IND: |
gaurank kathpalia | ea6b5e6 | 2018-07-05 20:41:28 +0530 | [diff] [blame] | 4916 | if (roam_info) |
Jeff Johnson | 85ddb77 | 2019-02-02 19:01:52 -0800 | [diff] [blame] | 4917 | hdd_indicate_tsm_ie(adapter, roam_info->tsm_ie.tsid, |
| 4918 | roam_info->tsm_ie.state, |
| 4919 | roam_info->tsm_ie.msmt_interval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4920 | break; |
| 4921 | |
| 4922 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4923 | { |
| 4924 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4925 | sta_ctx->conn_info.auth_type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | || eCSR_AUTH_TYPE_CCKM_RSN == |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4927 | sta_ctx->conn_info.auth_type) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4928 | hdd_indicate_cckm_pre_auth(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4929 | } |
| 4930 | break; |
| 4931 | } |
| 4932 | |
| 4933 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 4934 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4935 | hdd_indicate_ese_adj_ap_rep_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4936 | break; |
| 4937 | } |
| 4938 | |
| 4939 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 4940 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4941 | hdd_indicate_ese_bcn_report_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4942 | break; |
| 4943 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4944 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4945 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4946 | hdd_roam_channel_switch_handler(adapter, roam_info); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4947 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4948 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4949 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4950 | if ((roam_info) && (roam_info->pBssDesc)) { |
Abhishek Singh | f05b0cb6 | 2018-02-20 18:06:13 +0530 | [diff] [blame] | 4951 | bss_status = wlan_hdd_inform_bss_frame(adapter, |
| 4952 | roam_info->pBssDesc); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4953 | if (!bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4954 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4955 | else |
| 4956 | cfg80211_put_bss( |
| 4957 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4958 | (WLAN_HDD_GET_CTX(adapter))->wiphy, |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4959 | #endif |
| 4960 | bss_status); |
| 4961 | } |
| 4962 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4963 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4964 | hdd_ndp_event_handler(adapter, roam_info, roam_id, roam_status, |
| 4965 | roam_result); |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4966 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4967 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4968 | hdd_debug("Process ROAM_START from firmware"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4969 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4970 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4971 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 4972 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4973 | hdd_set_roaming_in_progress(true); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 4974 | policy_mgr_restart_opportunistic_timer(hdd_ctx->psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4975 | break; |
| 4976 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4977 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4978 | hdd_napi_serialize(0); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4979 | wlan_hdd_netif_queue_control(adapter, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4980 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 4981 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 4982 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4983 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4984 | adapter->roam_ho_fail = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4985 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4986 | complete(&adapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4987 | break; |
| 4988 | |
Padma, Santhosh Kumar | eb90a55 | 2018-01-16 19:41:58 +0530 | [diff] [blame] | 4989 | case eCSR_ROAM_SAE_COMPUTE: |
| 4990 | if (roam_info) |
| 4991 | wlan_hdd_sae_callback(adapter, roam_info); |
| 4992 | break; |
| 4993 | |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 4994 | case eCSR_ROAM_ROAMING_START: |
| 4995 | /* |
| 4996 | * For LFR2, Handle roaming start to remove disassociated |
| 4997 | * session |
| 4998 | */ |
| 4999 | if (roaming_offload_enabled(hdd_ctx)) |
| 5000 | break; |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 5001 | if (roam_result == eCSR_ROAM_RESULT_NOT_ASSOCIATED) { |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 5002 | hdd_debug("Decrement session of disassociated AP device_mode %d sessionId %d", |
| 5003 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 5004 | adapter->vdev_id); |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 5005 | policy_mgr_decr_session_set_pcl(hdd_ctx->psoc, |
| 5006 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 5007 | adapter->vdev_id); |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 5008 | } |
| 5009 | break; |
| 5010 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5011 | default: |
| 5012 | break; |
| 5013 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5014 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5015 | } |
| 5016 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5017 | #ifdef WLAN_FEATURE_FILS_SK |
| 5018 | /** |
| 5019 | * hdd_translate_fils_rsn_to_csr_auth() - Translate FILS RSN to CSR auth type |
| 5020 | * @auth_suite: auth suite |
| 5021 | * @auth_type: pointer to eCsrAuthType |
| 5022 | * |
| 5023 | * Return: None |
| 5024 | */ |
| 5025 | static void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5026 | eCsrAuthType *auth_type) |
| 5027 | { |
| 5028 | if (!memcmp(auth_suite, ccp_rsn_oui_0e, 4)) |
| 5029 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA256; |
| 5030 | else if (!memcmp(auth_suite, ccp_rsn_oui_0f, 4)) |
| 5031 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA384; |
| 5032 | else if (!memcmp(auth_suite, ccp_rsn_oui_10, 4)) |
| 5033 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA256; |
| 5034 | else if (!memcmp(auth_suite, ccp_rsn_oui_11, 4)) |
| 5035 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA384; |
| 5036 | } |
| 5037 | #else |
| 5038 | static inline void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5039 | eCsrAuthType *auth_type) |
| 5040 | { |
| 5041 | } |
| 5042 | #endif |
| 5043 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5044 | #ifdef WLAN_FEATURE_SAE |
| 5045 | /** |
| 5046 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 5047 | * @auth_suite: auth suite |
| 5048 | * @auth_type: pointer to eCsrAuthType |
| 5049 | * |
| 5050 | * Return: None |
| 5051 | */ |
| 5052 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5053 | eCsrAuthType *auth_type) |
| 5054 | { |
| 5055 | if (qdf_mem_cmp(auth_suite, ccp_rsn_oui_80, 4) == 0) |
| 5056 | *auth_type = eCSR_AUTH_TYPE_SAE; |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5057 | else if (qdf_mem_cmp(auth_suite, ccp_rsn_oui_90, 4) == 0) |
| 5058 | *auth_type = eCSR_AUTH_TYPE_FT_SAE; |
| 5059 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5060 | } |
| 5061 | #else |
| 5062 | static inline void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5063 | eCsrAuthType *auth_type) |
| 5064 | { |
| 5065 | } |
| 5066 | #endif |
| 5067 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5068 | /** |
| 5069 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5070 | * @auth_suite: auth suite |
| 5071 | * |
| 5072 | * Return: eCsrAuthType enumeration |
| 5073 | */ |
| 5074 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5075 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5076 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5077 | /* is the auth type supported? */ |
| 5078 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5079 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5080 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5081 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5082 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5083 | /* Check for 11r FT Authentication with PSK */ |
| 5084 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5085 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5086 | /* Check for 11R FT Authentication with 802.1X */ |
| 5087 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5088 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5089 | #ifdef FEATURE_WLAN_ESE |
| 5090 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5091 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5092 | } else |
| 5093 | #endif /* FEATURE_WLAN_ESE */ |
| 5094 | #ifdef WLAN_FEATURE_11W |
| 5095 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5096 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5097 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5098 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5099 | } else if (memcmp(auth_suite, ccp_rsn_oui_18, 4) == 0) { |
| 5100 | auth_type = eCSR_AUTH_TYPE_OWE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5101 | } else |
| 5102 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 5103 | if (memcmp(auth_suite, ccp_rsn_oui_12, 4) == 0) { |
| 5104 | auth_type = eCSR_AUTH_TYPE_DPP_RSN; |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5105 | } else if (memcmp(auth_suite, ccp_rsn_oui_0b, 4) == 0) { |
| 5106 | /* Check for Suite B EAP 256 */ |
| 5107 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
| 5108 | } else if (memcmp(auth_suite, ccp_rsn_oui_0c, 4) == 0) { |
| 5109 | /* Check for Suite B EAP 384 */ |
| 5110 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5111 | } else if (memcmp(auth_suite, ccp_rsn_oui_0d, 4) == 0) { |
| 5112 | /* Check for FT Suite B EAP 384 */ |
| 5113 | auth_type = eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384; |
Srinivas Dasari | b328f1a | 2018-12-18 17:45:06 +0530 | [diff] [blame] | 5114 | } else if (memcmp(auth_suite, ccp_rsn_oui_13, 4) == 0) { |
| 5115 | auth_type = eCSR_AUTH_TYPE_OSEN; |
Jeff Johnson | 109e79d | 2018-02-27 15:10:04 -0800 | [diff] [blame] | 5116 | } else { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5117 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5118 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5119 | } |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5120 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5121 | return auth_type; |
| 5122 | } |
| 5123 | |
| 5124 | /** |
| 5125 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5126 | * @auth_suite: auth suite |
| 5127 | * |
| 5128 | * Return: eCsrAuthType enumeration |
| 5129 | */ |
| 5130 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5131 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5132 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5133 | /* is the auth type supported? */ |
| 5134 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5135 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5136 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5137 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5138 | } else |
| 5139 | #ifdef FEATURE_WLAN_ESE |
| 5140 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5141 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5142 | } else |
| 5143 | #endif /* FEATURE_WLAN_ESE */ |
| 5144 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5145 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5146 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5147 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5148 | return auth_type; |
| 5149 | } |
| 5150 | |
| 5151 | /** |
| 5152 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5153 | * Translate RSN to CSR encryption type |
| 5154 | * @cipher_suite: cipher suite |
| 5155 | * |
| 5156 | * Return: eCsrEncryptionType enumeration |
| 5157 | */ |
| 5158 | eCsrEncryptionType |
| 5159 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5160 | { |
| 5161 | eCsrEncryptionType cipher_type; |
| 5162 | |
| 5163 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5164 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5165 | else if (memcmp(cipher_suite, ccp_rsn_oui09, 4) == 0) |
| 5166 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP; |
| 5167 | else if (memcmp(cipher_suite, ccp_rsn_oui0a, 4) == 0) |
| 5168 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5169 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5170 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5171 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5172 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5173 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5174 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5175 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5176 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5177 | else |
| 5178 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5179 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5180 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5181 | return cipher_type; |
| 5182 | } |
| 5183 | |
| 5184 | /** |
| 5185 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5186 | * Translate WPA to CSR encryption type |
| 5187 | * @cipher_suite: cipher suite |
| 5188 | * |
| 5189 | * Return: eCsrEncryptionType enumeration |
| 5190 | */ |
| 5191 | eCsrEncryptionType |
| 5192 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5193 | { |
| 5194 | eCsrEncryptionType cipher_type; |
| 5195 | |
| 5196 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5197 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5198 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5199 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5200 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5201 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5202 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5203 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5204 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5205 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5206 | else |
| 5207 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5208 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5209 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5210 | return cipher_type; |
| 5211 | } |
| 5212 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5213 | #ifdef WLAN_FEATURE_FILS_SK |
gaurank kathpalia | 82a1b2b | 2018-07-10 16:49:10 +0530 | [diff] [blame] | 5214 | bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5215 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5216 | struct csr_roam_profile *roam_profile; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5217 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5218 | roam_profile = hdd_roam_profile(adapter); |
| 5219 | if (roam_profile->fils_con_info) |
| 5220 | return roam_profile->fils_con_info->is_fils_connection; |
Min Liu | ab6ed4f | 2018-01-09 13:13:57 +0800 | [diff] [blame] | 5221 | |
| 5222 | return false; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5223 | } |
| 5224 | #else |
gaurank kathpalia | 82a1b2b | 2018-07-10 16:49:10 +0530 | [diff] [blame] | 5225 | bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5226 | { |
| 5227 | return false; |
| 5228 | } |
| 5229 | #endif |
| 5230 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5231 | /** |
| 5232 | * hdd_process_genie() - process gen ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5233 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5234 | * @bssid: pointer to mac address |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5235 | * @encrypt_type: pointer to encryption type |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5236 | * @mc_encrypt_type: pointer to multicast encryption type |
Jeff Johnson | 4f1be2d | 2019-03-09 22:52:04 -0800 | [diff] [blame] | 5237 | * @auth_type: pointer to auth type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5238 | * |
| 5239 | * Return: 0 on success, error number otherwise |
| 5240 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5241 | static int32_t hdd_process_genie(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5242 | u8 *bssid, |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5243 | eCsrEncryptionType *encrypt_type, |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5244 | eCsrEncryptionType *mc_encrypt_type, |
Jeff Johnson | 4f1be2d | 2019-03-09 22:52:04 -0800 | [diff] [blame] | 5245 | eCsrAuthType *auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5246 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 78cbade | 2019-03-10 21:59:35 -0700 | [diff] [blame] | 5247 | uint8_t *mfp_required, uint8_t *mfp_capable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5248 | #endif |
| 5249 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5250 | { |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 5251 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5252 | tDot11fIERSN dot11_rsn_ie = {0}; |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5253 | tDot11fIEWPA dot11_wpa_ie = {0}; |
Jeff Johnson | d062b8d | 2019-03-09 20:31:13 -0800 | [diff] [blame] | 5254 | uint8_t *rsn_ie; |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5255 | uint16_t rsn_ie_len; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5256 | uint32_t parse_status; |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 5257 | #ifdef WLAN_CONV_CRYPTO_SUPPORTED |
| 5258 | uint16_t rsn_cap = 0; |
| 5259 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5260 | |
| 5261 | /* |
| 5262 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5263 | * setting present flag to 0. |
| 5264 | */ |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5265 | memset(&dot11_wpa_ie, 0, sizeof(tDot11fIEWPA)); |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5266 | memset(&dot11_rsn_ie, 0, sizeof(tDot11fIERSN)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5267 | |
| 5268 | /* Type check */ |
| 5269 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5270 | /* Validity checks */ |
| 5271 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5272 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5273 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5274 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5275 | return -EINVAL; |
| 5276 | } |
| 5277 | /* Skip past the EID byte and length byte */ |
Jeff Johnson | d062b8d | 2019-03-09 20:31:13 -0800 | [diff] [blame] | 5278 | rsn_ie = gen_ie + 2; |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5279 | rsn_ie_len = gen_ie_len - 2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5280 | /* Unpack the RSN IE */ |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5281 | parse_status = sme_unpack_rsn_ie(mac_handle, rsn_ie, rsn_ie_len, |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5282 | &dot11_rsn_ie, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5283 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5284 | hdd_err("Invalid RSN IE: parse status %d", |
| 5285 | parse_status); |
| 5286 | return -EINVAL; |
| 5287 | } |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5288 | hdd_debug("gp_cipher_suite_present: %d", |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5289 | dot11_rsn_ie.gp_cipher_suite_present); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5290 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5291 | hdd_debug("pairwise cipher suite count: %d", |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5292 | dot11_rsn_ie.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5293 | hdd_debug("authentication suite count: %d", |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5294 | dot11_rsn_ie.akm_suite_cnt); |
| 5295 | /* dot11_rsn_ie.akm_suite_cnt */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5296 | /* Just translate the FIRST one */ |
Jeff Johnson | 4f1be2d | 2019-03-09 22:52:04 -0800 | [diff] [blame] | 5297 | *auth_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5298 | hdd_translate_rsn_to_csr_auth_type( |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5299 | dot11_rsn_ie.akm_suite[0]); |
| 5300 | /* dot11_rsn_ie.pwise_cipher_suite_count */ |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5301 | *encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5302 | hdd_translate_rsn_to_csr_encryption_type( |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5303 | dot11_rsn_ie.pwise_cipher_suites[0]); |
| 5304 | /* dot11_rsn_ie.gp_cipher_suite_count */ |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5305 | *mc_encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5306 | hdd_translate_rsn_to_csr_encryption_type( |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5307 | dot11_rsn_ie.gp_cipher_suite); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5308 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 9bf800e | 2019-03-10 21:58:34 -0700 | [diff] [blame] | 5309 | *mfp_required = (dot11_rsn_ie.RSN_Cap[0] >> 6) & 0x1; |
Jeff Johnson | 78cbade | 2019-03-10 21:59:35 -0700 | [diff] [blame] | 5310 | *mfp_capable = csr_is_mfpc_capable(&dot11_rsn_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5311 | #endif |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 5312 | #ifdef WLAN_CONV_CRYPTO_SUPPORTED |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5313 | qdf_mem_copy(&rsn_cap, dot11_rsn_ie.RSN_Cap, sizeof(rsn_cap)); |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 5314 | wlan_crypto_set_vdev_param(adapter->vdev, |
| 5315 | WLAN_CRYPTO_PARAM_RSN_CAP, rsn_cap); |
| 5316 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5317 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5318 | /* Validity checks */ |
| 5319 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5320 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5321 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5322 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5323 | return -EINVAL; |
| 5324 | } |
| 5325 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
Jeff Johnson | d062b8d | 2019-03-09 20:31:13 -0800 | [diff] [blame] | 5326 | rsn_ie = gen_ie + 2 + 4; |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5327 | rsn_ie_len = gen_ie_len - (2 + 4); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5328 | /* Unpack the WPA IE */ |
Jeff Johnson | 034f3c9 | 2018-11-09 10:46:21 -0800 | [diff] [blame] | 5329 | parse_status = dot11f_unpack_ie_wpa(MAC_CONTEXT(mac_handle), |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5330 | rsn_ie, rsn_ie_len, |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5331 | &dot11_wpa_ie, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5332 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5333 | hdd_err("Invalid WPA IE: parse status %d", |
| 5334 | parse_status); |
| 5335 | return -EINVAL; |
| 5336 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5337 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5338 | hdd_debug("WPA unicast cipher suite count: %d", |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5339 | dot11_wpa_ie.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5340 | hdd_debug("WPA authentication suite count: %d", |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5341 | dot11_wpa_ie.auth_suite_count); |
| 5342 | /* dot11_wpa_ie.auth_suite_count */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5343 | /* Just translate the FIRST one */ |
Jeff Johnson | 4f1be2d | 2019-03-09 22:52:04 -0800 | [diff] [blame] | 5344 | *auth_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5345 | hdd_translate_wpa_to_csr_auth_type( |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5346 | dot11_wpa_ie.auth_suites[0]); |
| 5347 | /* dot11_wpa_ie.unicast_cipher_count */ |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5348 | *encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5349 | hdd_translate_wpa_to_csr_encryption_type( |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5350 | dot11_wpa_ie.unicast_ciphers[0]); |
| 5351 | /* dot11_wpa_ie.unicast_cipher_count */ |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5352 | *mc_encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5353 | hdd_translate_wpa_to_csr_encryption_type( |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5354 | dot11_wpa_ie.multicast_cipher); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5355 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5356 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5357 | return -EINVAL; |
| 5358 | } |
| 5359 | return 0; |
| 5360 | } |
| 5361 | |
| 5362 | /** |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5363 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 5364 | * in profile. |
| 5365 | * @roam_profile: pointer to adapter |
| 5366 | * @auth_type: pointer to auth type |
| 5367 | * |
| 5368 | * Set default value of encryption type and auth type in profile to |
| 5369 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 5370 | * currupt and we might not get the proper encryption type and auth type |
| 5371 | * while parsing the RSNIE. |
| 5372 | * |
| 5373 | * Return: void |
| 5374 | */ |
| 5375 | static void hdd_set_def_rsne_override( |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5376 | struct csr_roam_profile *roam_profile, eCsrAuthType *auth_type) |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5377 | { |
| 5378 | |
| 5379 | hdd_debug("Set def values in roam profile"); |
| 5380 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 5381 | roam_profile->EncryptionType.numEntries = 2; |
| 5382 | roam_profile->mcEncryptionType.numEntries = 2; |
| 5383 | /* Use the cipher type in the RSN IE */ |
| 5384 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 5385 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 5386 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 5387 | eCSR_ENCRYPT_TYPE_AES; |
| 5388 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 5389 | eCSR_ENCRYPT_TYPE_TKIP; |
| 5390 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 5391 | } |
| 5392 | |
| 5393 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5394 | * hdd_set_genie_to_csr() - set genie to csr |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5395 | * @adapter: pointer to adapter |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5396 | * @rsn_auth_type: pointer to auth type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5397 | * |
| 5398 | * Return: 0 on success, error number otherwise |
| 5399 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5400 | int hdd_set_genie_to_csr(struct hdd_adapter *adapter, |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5401 | eCsrAuthType *rsn_auth_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5402 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5403 | struct csr_roam_profile *roam_profile; |
| 5404 | uint8_t *security_ie; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5405 | uint32_t status = 0; |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5406 | eCsrEncryptionType rsn_encrypt_type; |
| 5407 | eCsrEncryptionType mc_rsn_encrypt_type; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5408 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5409 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 5abc32d | 2019-03-10 22:01:17 -0700 | [diff] [blame] | 5410 | uint8_t mfp_required = 0; |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5411 | uint8_t mfp_capable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5412 | #endif |
| 5413 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5414 | |
| 5415 | roam_profile = hdd_roam_profile(adapter); |
| 5416 | security_ie = hdd_security_ie(adapter); |
| 5417 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5418 | /* MAC address of assoc peer */ |
| 5419 | /* But, this routine is only called when we are NOT associated. */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5420 | qdf_mem_copy(bssid, roam_profile->BSSIDs.bssid, sizeof(bssid)); |
| 5421 | if (security_ie[0] == DOT11F_EID_RSN || |
| 5422 | security_ie[0] == DOT11F_EID_WPA) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5423 | /* continue */ |
| 5424 | } else { |
| 5425 | return 0; |
| 5426 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5427 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5428 | /* The actual processing may eventually be more extensive than this. */ |
| 5429 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5430 | status = hdd_process_genie(adapter, bssid, |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5431 | &rsn_encrypt_type, |
| 5432 | &mc_rsn_encrypt_type, rsn_auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5433 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5434 | &mfp_required, &mfp_capable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5435 | #endif |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5436 | security_ie[1] + 2, |
| 5437 | security_ie); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5438 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5439 | if (status == 0) { |
| 5440 | /* |
| 5441 | * Now copy over all the security attributes |
| 5442 | * you have parsed out. |
| 5443 | */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5444 | roam_profile->EncryptionType.numEntries = 1; |
| 5445 | roam_profile->mcEncryptionType.numEntries = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5446 | |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 5447 | /* Use the cipher type in the RSN IE */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5448 | roam_profile->EncryptionType.encryptionType[0] = |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5449 | rsn_encrypt_type; |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5450 | roam_profile->mcEncryptionType.encryptionType[0] = |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5451 | mc_rsn_encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5452 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5453 | if ((QDF_IBSS_MODE == adapter->device_mode) && |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5454 | ((eCSR_ENCRYPT_TYPE_AES == mc_rsn_encrypt_type) || |
| 5455 | (eCSR_ENCRYPT_TYPE_AES_GCMP == mc_rsn_encrypt_type) || |
| 5456 | (eCSR_ENCRYPT_TYPE_AES_GCMP_256 == mc_rsn_encrypt_type) || |
| 5457 | (eCSR_ENCRYPT_TYPE_TKIP == mc_rsn_encrypt_type))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5458 | /* |
| 5459 | * For wpa none supplicant sends the WPA IE with unicast |
| 5460 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5461 | * multicast cipher as either AES/TKIP based on group |
| 5462 | * cipher configuration mentioned in the |
| 5463 | * wpa_supplicant.conf. |
| 5464 | */ |
| 5465 | |
| 5466 | /* Set the unicast cipher same as multicast cipher */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5467 | roam_profile->EncryptionType.encryptionType[0] |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5468 | = mc_rsn_encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5469 | } |
| 5470 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5471 | hdd_debug("mfp_required = %d, mfp_capable = %d", |
| 5472 | mfp_required, mfp_capable); |
Jeff Johnson | 5abc32d | 2019-03-10 22:01:17 -0700 | [diff] [blame] | 5473 | roam_profile->MFPRequired = mfp_required; |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5474 | roam_profile->MFPCapable = mfp_capable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5475 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5476 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5477 | *rsn_auth_type, rsn_encrypt_type, mc_rsn_encrypt_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5478 | } |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 5479 | #ifdef WLAN_CONV_CRYPTO_SUPPORTED |
| 5480 | if (QDF_STATUS_SUCCESS != wlan_set_vdev_crypto_prarams_from_ie( |
| 5481 | adapter->vdev, security_ie, |
| 5482 | (security_ie[1] + 2))) |
| 5483 | hdd_err("Failed to set the crypto params from IE"); |
| 5484 | #endif |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5485 | |
| 5486 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5487 | if (hdd_ctx->force_rsne_override && |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5488 | (security_ie[0] == DOT11F_EID_RSN)) { |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5489 | hdd_warn("Test mode enabled set def Auth and enc type. RSN IE passed in connect req: "); |
| 5490 | qdf_trace_hex_dump(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5491 | roam_profile->pRSNReqIE, |
| 5492 | roam_profile->nRSNReqIELength); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5493 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5494 | roam_profile->force_rsne_override = true; |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5495 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5496 | hdd_debug("MFPEnabled %d", roam_profile->MFPEnabled); |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5497 | /* |
Jeff Johnson | 33142e6 | 2018-05-06 17:58:36 -0700 | [diff] [blame] | 5498 | * Reset MFPEnabled if testmode RSNE passed doesn't have MFPR |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5499 | * or MFPC bit set |
| 5500 | */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5501 | if (roam_profile->MFPEnabled && |
| 5502 | !(roam_profile->MFPRequired || |
| 5503 | roam_profile->MFPCapable)) { |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5504 | hdd_debug("Reset MFPEnabled"); |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5505 | roam_profile->MFPEnabled = 0; |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5506 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5507 | /* If parsing failed set the def value for the roam profile */ |
| 5508 | if (status) |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5509 | hdd_set_def_rsne_override(roam_profile, rsn_auth_type); |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5510 | return 0; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5511 | } |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5512 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5513 | } |
| 5514 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5515 | #ifdef WLAN_FEATURE_FILS_SK |
| 5516 | /** |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5517 | * hdd_check_fils_rsn_n_set_auth_type() - This API checks whether a give |
| 5518 | * auth type is fils if yes, sets it in profile. |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5519 | * @rsn_auth_type: auth type |
| 5520 | * |
| 5521 | * Return: true if FILS auth else false |
| 5522 | */ |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5523 | static |
| 5524 | bool hdd_check_fils_rsn_n_set_auth_type(struct csr_roam_profile *roam_profile, |
| 5525 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5526 | { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5527 | bool is_fils_rsn = false; |
| 5528 | |
| 5529 | if (!roam_profile->fils_con_info) |
| 5530 | return false; |
| 5531 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5532 | if ((rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA256) || |
| 5533 | (rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA384) || |
| 5534 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA256) || |
| 5535 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA384)) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5536 | is_fils_rsn = true; |
| 5537 | if (is_fils_rsn) |
| 5538 | roam_profile->fils_con_info->akm_type = rsn_auth_type; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5539 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5540 | return is_fils_rsn; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5541 | } |
| 5542 | #else |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5543 | static |
| 5544 | bool hdd_check_fils_rsn_n_set_auth_type(struct csr_roam_profile *roam_profile, |
| 5545 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5546 | { |
| 5547 | return false; |
| 5548 | } |
| 5549 | #endif |
| 5550 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5551 | /** |
| 5552 | * hdd_set_csr_auth_type() - set csr auth type |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5553 | * @adapter: pointer to adapter |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5554 | * @rsn_auth_type: auth type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5555 | * |
| 5556 | * Return: 0 on success, error number otherwise |
| 5557 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5558 | int hdd_set_csr_auth_type(struct hdd_adapter *adapter, |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5559 | eCsrAuthType rsn_auth_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5560 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5561 | struct csr_roam_profile *roam_profile; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5562 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5563 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5564 | enum hdd_auth_key_mgmt key_mgmt = sta_ctx->auth_key_mgmt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5565 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5566 | roam_profile = hdd_roam_profile(adapter); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5567 | roam_profile->AuthType.numEntries = 1; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5568 | hdd_debug("auth_type = %d rsn_auth_type %d wpa_versions %d", |
| 5569 | sta_ctx->conn_info.auth_type, rsn_auth_type, |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5570 | sta_ctx->wpa_versions); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5571 | |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 5572 | switch (sta_ctx->conn_info.auth_type) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5573 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Abhinav Kumar | bd41baa | 2018-10-12 17:46:04 +0530 | [diff] [blame] | 5574 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5575 | #ifdef FEATURE_WLAN_ESE |
| 5576 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5577 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5578 | #endif |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5579 | if (!sta_ctx->wpa_versions) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5580 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5581 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5582 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5583 | } else if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_1) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5584 | |
| 5585 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5586 | if ((rsn_auth_type == eCSR_AUTH_TYPE_CCKM_WPA) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5587 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5588 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5589 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5590 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5591 | eCSR_AUTH_TYPE_CCKM_WPA; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5592 | } else if (rsn_auth_type == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5593 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5594 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5595 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5596 | } else |
| 5597 | #endif |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5598 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5599 | == HDD_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5600 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5601 | eCSR_AUTH_TYPE_WPA; |
| 5602 | } else |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5603 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5604 | == HDD_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5605 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5606 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5607 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5608 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5609 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5610 | } |
| 5611 | } |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5612 | if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_2) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5613 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5614 | if ((rsn_auth_type == eCSR_AUTH_TYPE_CCKM_RSN) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5615 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5616 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5617 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5618 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5619 | eCSR_AUTH_TYPE_CCKM_RSN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5620 | } else if (rsn_auth_type == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5621 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5622 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5623 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5624 | } else |
| 5625 | #endif |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5626 | if (rsn_auth_type == eCSR_AUTH_TYPE_DPP_RSN) { |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 5627 | roam_profile->AuthType.authType[0] = |
| 5628 | eCSR_AUTH_TYPE_DPP_RSN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5629 | } else if (rsn_auth_type == eCSR_AUTH_TYPE_OSEN) { |
Srinivas Dasari | b328f1a | 2018-12-18 17:45:06 +0530 | [diff] [blame] | 5630 | roam_profile->AuthType.authType[0] = |
| 5631 | eCSR_AUTH_TYPE_OSEN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5632 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_FT_RSN) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5633 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5634 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5635 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5636 | eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5637 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_FT_RSN_PSK) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5638 | && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5639 | ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5640 | == HDD_AUTH_KEY_MGMT_PSK)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5641 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5642 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5643 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5644 | |
| 5645 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5646 | if (rsn_auth_type == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5647 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5648 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5649 | } else if (rsn_auth_type == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5650 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5651 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5652 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5653 | } else |
| 5654 | #endif |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5655 | if (hdd_check_fils_rsn_n_set_auth_type(roam_profile, |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5656 | rsn_auth_type)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5657 | roam_profile->AuthType.authType[0] = |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5658 | rsn_auth_type; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 5659 | hdd_debug("updated profile authtype as %d", |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5660 | rsn_auth_type); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5661 | |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5662 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_OWE) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5663 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5664 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5665 | /* OWE case */ |
| 5666 | roam_profile->AuthType.authType[0] = |
| 5667 | eCSR_AUTH_TYPE_OWE; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5668 | } else if ((rsn_auth_type == |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5669 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5670 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5671 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5672 | /* Suite B EAP SHA 256 */ |
| 5673 | roam_profile->AuthType.authType[0] = |
| 5674 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5675 | } else if ((rsn_auth_type == |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5676 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5677 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5678 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5679 | /* Suite B EAP SHA 384 */ |
| 5680 | roam_profile->AuthType.authType[0] = |
| 5681 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5682 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_FT_SAE) && |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5683 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) == |
| 5684 | HDD_AUTH_KEY_MGMT_802_1X)) { |
| 5685 | roam_profile->AuthType.authType[0] = |
| 5686 | eCSR_AUTH_TYPE_FT_SAE; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5687 | } else if ((rsn_auth_type == |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5688 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384) && |
| 5689 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5690 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
| 5691 | /* FT Suite-B EAP SHA 384 */ |
| 5692 | roam_profile->AuthType.authType[0] = |
| 5693 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384; |
| 5694 | |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5695 | } else if ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5696 | == HDD_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5697 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5698 | eCSR_AUTH_TYPE_RSN; |
| 5699 | } else |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5700 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5701 | == HDD_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5702 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5703 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5704 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5705 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5706 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5707 | } |
| 5708 | } |
| 5709 | break; |
| 5710 | |
| 5711 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5712 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5713 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5714 | break; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5715 | |
| 5716 | case eCSR_AUTH_TYPE_SAE: |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5717 | |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5718 | if (rsn_auth_type == eCSR_AUTH_TYPE_FT_SAE) |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5719 | roam_profile->AuthType.authType[0] = |
| 5720 | eCSR_AUTH_TYPE_FT_SAE; |
| 5721 | else |
| 5722 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5723 | break; |
| 5724 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5725 | default: |
| 5726 | |
| 5727 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5728 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5729 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5730 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5731 | break; |
| 5732 | } |
| 5733 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5734 | hdd_debug("Set roam Authtype to %d", |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5735 | roam_profile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5736 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5737 | return 0; |
| 5738 | } |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5739 | |
| 5740 | #ifdef WLAN_FEATURE_FILS_SK |
| 5741 | static void hdd_initialize_fils_info(struct hdd_adapter *adapter) |
| 5742 | { |
| 5743 | struct csr_roam_profile *roam_profile; |
| 5744 | |
| 5745 | roam_profile = hdd_roam_profile(adapter); |
| 5746 | roam_profile->fils_con_info = NULL; |
| 5747 | roam_profile->hlp_ie = NULL; |
| 5748 | roam_profile->hlp_ie_len = 0; |
| 5749 | } |
| 5750 | #else |
| 5751 | static void hdd_initialize_fils_info(struct hdd_adapter *adapter) |
| 5752 | { } |
| 5753 | #endif |
| 5754 | |
| 5755 | void hdd_roam_profile_init(struct hdd_adapter *adapter) |
| 5756 | { |
| 5757 | struct csr_roam_profile *roam_profile; |
| 5758 | uint8_t *security_ie; |
| 5759 | tSirAddie *assoc_additional_ie; |
| 5760 | struct hdd_station_ctx *sta_ctx; |
| 5761 | |
| 5762 | hdd_enter(); |
| 5763 | |
| 5764 | roam_profile = hdd_roam_profile(adapter); |
| 5765 | qdf_mem_zero(roam_profile, sizeof(*roam_profile)); |
| 5766 | |
| 5767 | security_ie = hdd_security_ie(adapter); |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 5768 | qdf_mem_zero(security_ie, WLAN_MAX_IE_LEN); |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5769 | |
| 5770 | assoc_additional_ie = hdd_assoc_additional_ie(adapter); |
| 5771 | qdf_mem_zero(assoc_additional_ie, sizeof(*assoc_additional_ie)); |
| 5772 | |
| 5773 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 5774 | |
| 5775 | /* Configure the roaming profile links to SSID and bssid. */ |
| 5776 | roam_profile->SSIDs.numOfSSIDs = 0; |
Jeff Johnson | 4aea180 | 2019-02-27 10:21:33 -0800 | [diff] [blame] | 5777 | roam_profile->SSIDs.SSIDList = &sta_ctx->conn_info.ssid; |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5778 | |
| 5779 | roam_profile->BSSIDs.numOfBSSIDs = 0; |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 5780 | roam_profile->BSSIDs.bssid = &sta_ctx->conn_info.bssid; |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5781 | |
| 5782 | /* Set the numOfChannels to zero to scan all the channels */ |
| 5783 | roam_profile->ChannelInfo.numOfChannels = 0; |
| 5784 | roam_profile->ChannelInfo.ChannelList = NULL; |
| 5785 | |
| 5786 | roam_profile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 5787 | |
| 5788 | roam_profile->phyMode = eCSR_DOT11_MODE_AUTO; |
| 5789 | sta_ctx->wpa_versions = 0; |
| 5790 | |
| 5791 | /* Set the default scan mode */ |
| 5792 | adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
| 5793 | |
| 5794 | hdd_clear_roam_profile_ie(adapter); |
| 5795 | |
| 5796 | hdd_initialize_fils_info(adapter); |
| 5797 | |
| 5798 | hdd_exit(); |
| 5799 | } |