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" |
Abhinav Kumar | 3922215 | 2019-05-13 23:53:40 +0530 | [diff] [blame] | 66 | #include "wlan_hdd_bcn_recv.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 67 | |
Alok Kumar | b64650c | 2018-03-23 17:05:11 +0530 | [diff] [blame] | 68 | #include "wlan_hdd_nud_tracking.h" |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 69 | #include <wlan_cfg80211_crypto.h> |
| 70 | #include <wlan_crypto_global_api.h> |
gaurank kathpalia | 7ef7218 | 2019-05-29 19:41:25 +0530 | [diff] [blame] | 71 | #include "wlan_blm_ucfg_api.h" |
| 72 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 73 | /* These are needed to recognize WPA and RSN suite types */ |
| 74 | #define HDD_WPA_OUI_SIZE 4 |
| 75 | #define HDD_RSN_OUI_SIZE 4 |
| 76 | uint8_t ccp_wpa_oui00[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 77 | uint8_t ccp_wpa_oui01[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 78 | uint8_t ccp_wpa_oui02[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 79 | uint8_t ccp_wpa_oui03[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 80 | uint8_t ccp_wpa_oui04[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 81 | uint8_t ccp_wpa_oui05[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 82 | |
| 83 | #ifdef FEATURE_WLAN_ESE |
| 84 | /* CCKM */ |
| 85 | uint8_t ccp_wpa_oui06[HDD_WPA_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 86 | /* CCKM */ |
| 87 | uint8_t ccp_rsn_oui06[HDD_RSN_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 88 | #endif /* FEATURE_WLAN_ESE */ |
| 89 | |
| 90 | /* group cipher */ |
| 91 | uint8_t ccp_rsn_oui00[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x00 }; |
| 92 | |
| 93 | /* WEP-40 or RSN */ |
| 94 | uint8_t ccp_rsn_oui01[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x01 }; |
| 95 | |
| 96 | /* TKIP or RSN-PSK */ |
| 97 | uint8_t ccp_rsn_oui02[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x02 }; |
| 98 | |
| 99 | /* Reserved */ |
| 100 | uint8_t ccp_rsn_oui03[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x03 }; |
| 101 | |
| 102 | /* AES-CCMP */ |
| 103 | uint8_t ccp_rsn_oui04[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x04 }; |
| 104 | |
| 105 | /* WEP-104 */ |
| 106 | uint8_t ccp_rsn_oui05[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 107 | |
| 108 | #ifdef WLAN_FEATURE_11W |
| 109 | /* RSN-PSK-SHA256 */ |
| 110 | uint8_t ccp_rsn_oui07[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x06 }; |
| 111 | |
| 112 | /* RSN-8021X-SHA256 */ |
| 113 | uint8_t ccp_rsn_oui08[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 114 | #endif |
| 115 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 116 | /* AES-GCMP-128 */ |
| 117 | uint8_t ccp_rsn_oui09[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x08 }; |
| 118 | |
| 119 | /* AES-GCMP-256 */ |
| 120 | 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] | 121 | #ifdef WLAN_FEATURE_FILS_SK |
| 122 | uint8_t ccp_rsn_oui_0e[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0E}; |
| 123 | uint8_t ccp_rsn_oui_0f[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0F}; |
| 124 | uint8_t ccp_rsn_oui_10[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x10}; |
| 125 | uint8_t ccp_rsn_oui_11[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x11}; |
| 126 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 127 | 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] | 128 | uint8_t ccp_rsn_oui_0b[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0B}; |
| 129 | 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] | 130 | /* FT-SUITE-B AKM */ |
| 131 | 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] | 132 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 133 | /* OWE https://tools.ietf.org/html/rfc8110 */ |
| 134 | uint8_t ccp_rsn_oui_18[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x12}; |
| 135 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 136 | #ifdef WLAN_FEATURE_SAE |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 137 | /* SAE AKM */ |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 138 | 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] | 139 | /* FT SAE AKM */ |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 140 | uint8_t ccp_rsn_oui_90[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x09}; |
| 141 | #endif |
Srinivas Dasari | b328f1a | 2018-12-18 17:45:06 +0530 | [diff] [blame] | 142 | static const |
| 143 | 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] | 144 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 145 | /* Offset where the EID-Len-IE, start. */ |
| 146 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 147 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 149 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 150 | |
| 151 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 152 | * beacon_filter_table - table of IEs used for beacon filtering |
| 153 | */ |
| 154 | static const int beacon_filter_table[] = { |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 155 | WLAN_ELEMID_DSPARMS, |
| 156 | WLAN_ELEMID_ERP, |
| 157 | WLAN_ELEMID_EDCAPARMS, |
| 158 | WLAN_ELEMID_QOS_CAPABILITY, |
| 159 | WLAN_ELEMID_HTINFO_ANA, |
| 160 | WLAN_ELEMID_OP_MODE_NOTIFY, |
| 161 | WLAN_ELEMID_VHTOP, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 162 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 163 | /* |
| 164 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 165 | * bss-color-change IE till it gets any fixed number. This |
| 166 | * vendor EID needs to be replaced with bss-color-change IE |
| 167 | * number. |
| 168 | */ |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 169 | WLAN_ELEMID_VENDOR, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 170 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 171 | }; |
| 172 | |
Padma, Santhosh Kumar | eb90a55 | 2018-01-16 19:41:58 +0530 | [diff] [blame] | 173 | #if defined(WLAN_FEATURE_SAE) && \ |
| 174 | defined(CFG80211_EXTERNAL_AUTH_SUPPORT) |
| 175 | /** |
| 176 | * wlan_hdd_sae_callback() - Sends SAE info to supplicant |
| 177 | * @adapter: pointer adapter context |
| 178 | * @roam_info: pointer to roam info |
| 179 | * |
| 180 | * This API is used to send required SAE info to trigger SAE in supplicant. |
| 181 | * |
| 182 | * Return: None |
| 183 | */ |
| 184 | static void wlan_hdd_sae_callback(struct hdd_adapter *adapter, |
| 185 | struct csr_roam_info *roam_info) |
| 186 | { |
| 187 | struct hdd_context *hdd_ctx = adapter->hdd_ctx; |
| 188 | int flags; |
| 189 | struct sir_sae_info *sae_info = roam_info->sae_info; |
| 190 | struct cfg80211_external_auth_params params = {0}; |
| 191 | |
| 192 | if (wlan_hdd_validate_context(hdd_ctx)) |
| 193 | return; |
| 194 | |
| 195 | if (!sae_info) { |
| 196 | hdd_err("SAE info in NULL"); |
| 197 | return; |
| 198 | } |
| 199 | |
| 200 | flags = cds_get_gfp_flags(); |
| 201 | |
| 202 | params.key_mgmt_suite = 0x00; |
| 203 | params.key_mgmt_suite |= 0x0F << 8; |
| 204 | params.key_mgmt_suite |= 0xAC << 16; |
| 205 | params.key_mgmt_suite |= 0x8 << 24; |
| 206 | |
| 207 | params.action = NL80211_EXTERNAL_AUTH_START; |
| 208 | qdf_mem_copy(params.bssid, sae_info->peer_mac_addr.bytes, |
| 209 | QDF_MAC_ADDR_SIZE); |
| 210 | qdf_mem_copy(params.ssid.ssid, sae_info->ssid.ssId, |
| 211 | sae_info->ssid.length); |
| 212 | params.ssid.ssid_len = sae_info->ssid.length; |
| 213 | |
| 214 | cfg80211_external_auth_request(adapter->dev, ¶ms, flags); |
| 215 | hdd_debug("SAE: sent cmd"); |
| 216 | } |
| 217 | #else |
| 218 | static inline void wlan_hdd_sae_callback(struct hdd_adapter *adapter, |
| 219 | struct csr_roam_info *roam_info) |
| 220 | { } |
| 221 | #endif |
| 222 | |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 223 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 224 | * hdd_conn_set_authenticated() - set authentication state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 225 | * @adapter: pointer to the adapter |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 226 | * @auth_state: authentication state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | * |
| 228 | * This function updates the global HDD station context |
| 229 | * authentication state. |
| 230 | * |
| 231 | * Return: none |
| 232 | */ |
| 233 | static void |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 234 | hdd_conn_set_authenticated(struct hdd_adapter *adapter, uint8_t auth_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 235 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 236 | 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] | 237 | char *auth_time; |
| 238 | uint32_t time_buffer_size; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 239 | |
| 240 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 241 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Jeff Johnson | 457c242 | 2019-02-27 13:56:04 -0800 | [diff] [blame] | 242 | sta_ctx->conn_info.is_authenticated, auth_state); |
| 243 | sta_ctx->conn_info.is_authenticated = auth_state; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 244 | |
| 245 | auth_time = sta_ctx->conn_info.auth_time; |
| 246 | time_buffer_size = sizeof(sta_ctx->conn_info.auth_time); |
| 247 | |
| 248 | if (auth_state) |
| 249 | qdf_get_time_of_the_day_in_hr_min_sec_usec(auth_time, |
| 250 | time_buffer_size); |
| 251 | else |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 252 | qdf_mem_zero(auth_time, time_buffer_size); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 253 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 254 | } |
| 255 | |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 256 | void hdd_conn_set_connection_state(struct hdd_adapter *adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 257 | eConnectionState conn_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 258 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 259 | struct hdd_station_ctx *hdd_sta_ctx = |
| 260 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 261 | char *connect_time; |
| 262 | uint32_t time_buffer_size; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 263 | |
| 264 | /* save the new connection state */ |
Jun Wang | 92cd836 | 2018-07-27 16:52:47 +0800 | [diff] [blame] | 265 | 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] | 266 | hdd_sta_ctx->conn_info.conn_state, conn_state, |
Jun Wang | 92cd836 | 2018-07-27 16:52:47 +0800 | [diff] [blame] | 267 | adapter->dev->name); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 268 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 269 | hdd_tsf_notify_wlan_state_change(adapter, |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 270 | hdd_sta_ctx->conn_info.conn_state, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 271 | conn_state); |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 272 | hdd_sta_ctx->conn_info.conn_state = conn_state; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 273 | |
| 274 | connect_time = hdd_sta_ctx->conn_info.connect_time; |
| 275 | time_buffer_size = sizeof(hdd_sta_ctx->conn_info.connect_time); |
| 276 | if (conn_state == eConnectionState_Associated) |
| 277 | qdf_get_time_of_the_day_in_hr_min_sec_usec(connect_time, |
| 278 | time_buffer_size); |
| 279 | else |
hangtian | 127c953 | 2019-01-12 13:29:07 +0800 | [diff] [blame] | 280 | qdf_mem_zero(connect_time, time_buffer_size); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 281 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | /** |
| 285 | * hdd_conn_get_connection_state() - get connection state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 286 | * @adapter: pointer to the adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 287 | * @pConnState: pointer to connection state |
| 288 | * |
| 289 | * This function updates the global HDD station context connection state. |
| 290 | * |
| 291 | * Return: true if (Infra Associated or IBSS Connected) |
| 292 | * and sets output parameter pConnState; |
| 293 | * false otherwise |
| 294 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 295 | static inline bool |
| 296 | hdd_conn_get_connection_state(struct hdd_station_ctx *sta_ctx, |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 297 | eConnectionState *out_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 298 | { |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 299 | eConnectionState state = sta_ctx->conn_info.conn_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 | if (out_state) |
| 302 | *out_state = state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 303 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 304 | switch (state) { |
| 305 | case eConnectionState_Associated: |
| 306 | case eConnectionState_IbssConnected: |
| 307 | case eConnectionState_IbssDisconnected: |
| 308 | case eConnectionState_NdiConnected: |
| 309 | return true; |
| 310 | default: |
| 311 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 312 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | } |
| 314 | |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 315 | bool hdd_is_connecting(struct hdd_station_ctx *hdd_sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 316 | { |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 317 | return hdd_sta_ctx->conn_info.conn_state == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 318 | eConnectionState_Connecting; |
| 319 | } |
| 320 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 321 | bool hdd_conn_is_connected(struct hdd_station_ctx *sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 322 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 323 | return hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 324 | } |
| 325 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 326 | bool hdd_adapter_is_connected_sta(struct hdd_adapter *adapter) |
| 327 | { |
| 328 | switch (adapter->device_mode) { |
| 329 | case QDF_STA_MODE: |
| 330 | case QDF_P2P_CLIENT_MODE: |
| 331 | case QDF_NDI_MODE: |
| 332 | return hdd_conn_is_connected(&adapter->session.station); |
| 333 | default: |
| 334 | return false; |
| 335 | } |
| 336 | } |
| 337 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 338 | 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] | 339 | { |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 340 | uint32_t sta_freq = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 342 | if (eConnectionState_Associated == sta_ctx->conn_info.conn_state) |
Jingxiang Ge | ae80dc6 | 2019-08-13 17:32:22 +0800 | [diff] [blame^] | 343 | sta_freq = sta_ctx->conn_info.chan_freq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 345 | if (wlan_reg_is_24ghz_ch_freq(sta_freq)) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 346 | return BAND_2G; |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 347 | else if (wlan_reg_is_5ghz_ch_freq(sta_freq)) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 348 | return BAND_5G; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 349 | else /* If station is not connected return as BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 350 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 351 | } |
| 352 | |
| 353 | /** |
| 354 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 355 | * @sta_ctx: pointer to global HDD Station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 356 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 357 | * |
| 358 | * Return: false if any errors encountered, true otherwise |
| 359 | */ |
| 360 | static inline bool |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 361 | hdd_conn_get_connected_cipher_algo(struct hdd_station_ctx *sta_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 363 | { |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 364 | bool connected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 365 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 366 | connected = hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | |
| 368 | if (pConnectedCipherAlgo) |
Jeff Johnson | b195984 | 2019-02-27 13:04:04 -0800 | [diff] [blame] | 369 | *pConnectedCipherAlgo = sta_ctx->conn_info.uc_encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 370 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 371 | return connected; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 372 | } |
| 373 | |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 374 | struct hdd_adapter *hdd_get_sta_connection_in_progress( |
| 375 | struct hdd_context *hdd_ctx) |
| 376 | { |
| 377 | struct hdd_adapter *adapter = NULL; |
| 378 | struct hdd_station_ctx *hdd_sta_ctx; |
| 379 | |
| 380 | if (!hdd_ctx) { |
| 381 | hdd_err("HDD context is NULL"); |
| 382 | return NULL; |
| 383 | } |
| 384 | |
| 385 | hdd_for_each_adapter(hdd_ctx, adapter) { |
| 386 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 387 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 388 | (QDF_P2P_CLIENT_MODE == adapter->device_mode) || |
| 389 | (QDF_P2P_DEVICE_MODE == adapter->device_mode)) { |
| 390 | if (eConnectionState_Connecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 391 | hdd_sta_ctx->conn_info.conn_state) { |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 392 | hdd_debug("vdev_id %d: Connection is in progress", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 393 | adapter->vdev_id); |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 394 | return adapter; |
| 395 | } else if ((eConnectionState_Associated == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 396 | hdd_sta_ctx->conn_info.conn_state) && |
Vignesh Viswanathan | 0a56929 | 2018-02-14 15:34:47 +0530 | [diff] [blame] | 397 | sme_is_sta_key_exchange_in_progress( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 398 | hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 399 | adapter->vdev_id)) { |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 400 | hdd_debug("vdev_id %d: Key exchange is in progress", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 401 | adapter->vdev_id); |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 402 | return adapter; |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | return NULL; |
| 407 | } |
| 408 | |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 409 | void hdd_abort_ongoing_sta_connection(struct hdd_context *hdd_ctx) |
| 410 | { |
| 411 | struct hdd_adapter *sta_adapter; |
| 412 | QDF_STATUS status; |
| 413 | |
| 414 | sta_adapter = hdd_get_sta_connection_in_progress(hdd_ctx); |
| 415 | if (sta_adapter) { |
| 416 | hdd_debug("Disconnecting STA on vdev: %d", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 417 | sta_adapter->vdev_id); |
Pragaspathi Thilagaraj | e6f37e0 | 2019-01-04 12:24:33 +0530 | [diff] [blame] | 418 | status = wlan_hdd_disconnect(sta_adapter, |
| 419 | eCSR_DISCONNECT_REASON_DEAUTH); |
| 420 | if (QDF_IS_STATUS_ERROR(status)) { |
| 421 | hdd_err("wlan_hdd_disconnect failed, status: %d", |
| 422 | status); |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 427 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 428 | * hdd_remove_beacon_filter() - remove beacon filter |
| 429 | * @adapter: Pointer to the hdd adapter |
| 430 | * |
| 431 | * Return: 0 on success and errno on failure |
| 432 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 433 | static int hdd_remove_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 434 | { |
| 435 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 436 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 437 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 438 | status = sme_remove_beacon_filter(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 439 | adapter->vdev_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 440 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 441 | hdd_err("sme_remove_beacon_filter() failed"); |
| 442 | return -EFAULT; |
| 443 | } |
| 444 | |
| 445 | return 0; |
| 446 | } |
| 447 | |
Abhinav Kumar | 3922215 | 2019-05-13 23:53:40 +0530 | [diff] [blame] | 448 | int hdd_add_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 449 | { |
| 450 | int i; |
| 451 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 452 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 453 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 454 | |
| 455 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 456 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 457 | (unsigned long int *)ie_map); |
| 458 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 459 | status = sme_add_beacon_filter(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 460 | adapter->vdev_id, ie_map); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 461 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 462 | hdd_err("sme_add_beacon_filter() failed"); |
| 463 | return -EFAULT; |
| 464 | } |
| 465 | return 0; |
| 466 | } |
| 467 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 468 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 469 | tDot11fIEHTCaps *roam_ht_cap) |
| 470 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 471 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 472 | uint32_t i, temp_ht_cap; |
| 473 | |
| 474 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 475 | |
| 476 | if (roam_ht_cap->advCodingCap) |
| 477 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 478 | if (roam_ht_cap->supportedChannelWidthSet) |
| 479 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 480 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 481 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 482 | if (temp_ht_cap) |
| 483 | hdd_ht_cap->cap_info |= |
| 484 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 485 | if (roam_ht_cap->greenField) |
| 486 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 487 | if (roam_ht_cap->shortGI20MHz) |
| 488 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 489 | if (roam_ht_cap->shortGI40MHz) |
| 490 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 491 | if (roam_ht_cap->txSTBC) |
| 492 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 493 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 494 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 495 | if (temp_ht_cap) |
| 496 | hdd_ht_cap->cap_info |= |
| 497 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 498 | if (roam_ht_cap->delayedBA) |
| 499 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 500 | if (roam_ht_cap->maximalAMSDUsize) |
| 501 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 502 | if (roam_ht_cap->dsssCckMode40MHz) |
| 503 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 504 | if (roam_ht_cap->psmp) |
| 505 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 506 | if (roam_ht_cap->stbcControlFrame) |
| 507 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 508 | if (roam_ht_cap->lsigTXOPProtection) |
| 509 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 510 | |
| 511 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 512 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 513 | hdd_ht_cap->ampdu_params_info |= |
| 514 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 515 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 516 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 517 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 518 | if (temp_ht_cap) |
| 519 | hdd_ht_cap->ampdu_params_info |= |
| 520 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 521 | |
| 522 | /* 802.11n HT extended capabilities masks */ |
| 523 | if (roam_ht_cap->pco) |
| 524 | hdd_ht_cap->extended_ht_cap_info |= |
| 525 | IEEE80211_HT_EXT_CAP_PCO; |
| 526 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 527 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 528 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 529 | if (temp_ht_cap) |
| 530 | hdd_ht_cap->extended_ht_cap_info |= |
| 531 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 532 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 533 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 534 | if (temp_ht_cap) |
| 535 | hdd_ht_cap->extended_ht_cap_info |= |
| 536 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 537 | |
| 538 | /* tx_bf_cap_info capabilities */ |
| 539 | if (roam_ht_cap->txBF) |
| 540 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 541 | if (roam_ht_cap->rxStaggeredSounding) |
| 542 | hdd_ht_cap->tx_BF_cap_info |= |
| 543 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 544 | if (roam_ht_cap->txStaggeredSounding) |
| 545 | hdd_ht_cap->tx_BF_cap_info |= |
| 546 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 547 | if (roam_ht_cap->rxZLF) |
| 548 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 549 | if (roam_ht_cap->txZLF) |
| 550 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 551 | if (roam_ht_cap->implicitTxBF) |
| 552 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 553 | temp_ht_cap = roam_ht_cap->calibration & |
| 554 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 555 | if (temp_ht_cap) |
| 556 | hdd_ht_cap->tx_BF_cap_info |= |
| 557 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 558 | if (roam_ht_cap->explicitCSITxBF) |
| 559 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 560 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 561 | hdd_ht_cap->tx_BF_cap_info |= |
| 562 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 563 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 564 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 565 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 566 | if (temp_ht_cap) |
| 567 | hdd_ht_cap->tx_BF_cap_info |= |
| 568 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 569 | temp_ht_cap = |
| 570 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 571 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 572 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 573 | if (temp_ht_cap) |
| 574 | hdd_ht_cap->tx_BF_cap_info |= |
| 575 | temp_ht_cap << |
| 576 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 577 | temp_ht_cap = |
| 578 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 579 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 580 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 581 | if (temp_ht_cap) |
| 582 | hdd_ht_cap->tx_BF_cap_info |= |
| 583 | temp_ht_cap << |
| 584 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 585 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 586 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 587 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 588 | if (temp_ht_cap) |
| 589 | hdd_ht_cap->tx_BF_cap_info |= |
| 590 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 591 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 592 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 593 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 594 | if (temp_ht_cap) |
| 595 | hdd_ht_cap->tx_BF_cap_info |= |
| 596 | temp_ht_cap << |
| 597 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 598 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 599 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 600 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 601 | if (temp_ht_cap) |
| 602 | hdd_ht_cap->tx_BF_cap_info |= |
| 603 | temp_ht_cap << |
| 604 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 605 | |
| 606 | /* antenna selection */ |
| 607 | if (roam_ht_cap->antennaSelection) |
| 608 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 609 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 610 | hdd_ht_cap->antenna_selection_info |= |
| 611 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 612 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 613 | hdd_ht_cap->antenna_selection_info |= |
| 614 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 615 | if (roam_ht_cap->explicitCSIFeedback) |
| 616 | hdd_ht_cap->antenna_selection_info |= |
| 617 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 618 | if (roam_ht_cap->antennaIndicesFeedback) |
| 619 | hdd_ht_cap->antenna_selection_info |= |
| 620 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 621 | if (roam_ht_cap->rxAS) |
| 622 | hdd_ht_cap->antenna_selection_info |= |
| 623 | ANTENNA_SEL_INFO_RX_AS; |
| 624 | if (roam_ht_cap->txSoundingPPDUs) |
| 625 | hdd_ht_cap->antenna_selection_info |= |
| 626 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 627 | |
| 628 | /* mcs data rate */ |
| 629 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 630 | hdd_ht_cap->mcs.rx_mask[i] = |
| 631 | roam_ht_cap->supportedMCSSet[i]; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 632 | hdd_ht_cap->mcs.rx_highest = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 633 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 634 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 635 | hdd_ht_cap->mcs.tx_params = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 636 | roam_ht_cap->supportedMCSSet[12]; |
| 637 | } |
| 638 | |
| 639 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 640 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 641 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 642 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 643 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 644 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 645 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 646 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 647 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 648 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 649 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 650 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 651 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 652 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 653 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 654 | tDot11fIEVHTCaps *roam_vht_cap) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 655 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 656 | uint32_t temp_vht_cap; |
| 657 | |
| 658 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 659 | |
| 660 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 661 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 662 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 663 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 664 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 665 | if (temp_vht_cap) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 666 | if (roam_vht_cap->supportedChannelWidthSet & |
| 667 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 668 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 669 | hdd_vht_cap->vht_cap_info |= |
| 670 | temp_vht_cap << |
| 671 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 672 | if (roam_vht_cap->supportedChannelWidthSet & |
| 673 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 674 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 675 | hdd_vht_cap->vht_cap_info |= |
| 676 | temp_vht_cap << |
| 677 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 678 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 679 | if (roam_vht_cap->ldpcCodingCap) |
| 680 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 681 | if (roam_vht_cap->shortGI80MHz) |
| 682 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 683 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 684 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 685 | if (roam_vht_cap->txSTBC) |
| 686 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 687 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 688 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 689 | if (temp_vht_cap) |
| 690 | hdd_vht_cap->vht_cap_info |= |
| 691 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 692 | if (roam_vht_cap->suBeamFormerCap) |
| 693 | hdd_vht_cap->vht_cap_info |= |
| 694 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 695 | if (roam_vht_cap->suBeamformeeCap) |
| 696 | hdd_vht_cap->vht_cap_info |= |
| 697 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 698 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 699 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 700 | if (temp_vht_cap) |
| 701 | hdd_vht_cap->vht_cap_info |= |
| 702 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 703 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 704 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 705 | if (temp_vht_cap) |
| 706 | hdd_vht_cap->vht_cap_info |= |
| 707 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 708 | if (roam_vht_cap->muBeamformerCap) |
| 709 | hdd_vht_cap->vht_cap_info |= |
| 710 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 711 | if (roam_vht_cap->muBeamformeeCap) |
| 712 | hdd_vht_cap->vht_cap_info |= |
| 713 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 714 | if (roam_vht_cap->vhtTXOPPS) |
| 715 | hdd_vht_cap->vht_cap_info |= |
| 716 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 717 | if (roam_vht_cap->htcVHTCap) |
| 718 | hdd_vht_cap->vht_cap_info |= |
| 719 | IEEE80211_VHT_CAP_HTC_VHT; |
| 720 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 721 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 722 | if (temp_vht_cap) |
| 723 | hdd_vht_cap->vht_cap_info |= |
| 724 | temp_vht_cap << |
| 725 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 726 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 727 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 728 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 729 | if (temp_vht_cap) |
| 730 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 731 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 732 | if (roam_vht_cap->rxAntPattern) |
| 733 | hdd_vht_cap->vht_cap_info |= |
| 734 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 735 | if (roam_vht_cap->txAntPattern) |
| 736 | hdd_vht_cap->vht_cap_info |= |
| 737 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 738 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 739 | hdd_vht_cap->supp_mcs.rx_highest = |
| 740 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 741 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 742 | hdd_vht_cap->supp_mcs.tx_highest = |
| 743 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 744 | } |
| 745 | |
| 746 | /* ht param */ |
| 747 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 748 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 749 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 750 | |
| 751 | /* operatinon mode */ |
| 752 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 753 | |
| 754 | /* stbc_param */ |
| 755 | #define HT_STBC_PARAM_MCS 0x007f |
| 756 | |
| 757 | /** |
| 758 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 759 | * hdd station context. |
| 760 | * @hdd_sta_ctx: pointer to hdd station context |
| 761 | * @roam_info: pointer to roam info |
| 762 | * |
| 763 | * Return: None |
| 764 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 765 | 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] | 766 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 767 | { |
| 768 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 769 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 770 | &hdd_sta_ctx->conn_info.ht_operation; |
| 771 | uint32_t i, temp_ht_ops; |
| 772 | |
| 773 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 774 | |
| 775 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 776 | |
| 777 | /* HT_PARAMS */ |
| 778 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 779 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 780 | if (temp_ht_ops) |
| 781 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 782 | else |
| 783 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 784 | if (roam_ht_ops->recommendedTxWidthSet) |
| 785 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 786 | if (roam_ht_ops->rifsMode) |
| 787 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 788 | if (roam_ht_ops->controlledAccessOnly) |
| 789 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 790 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 791 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 792 | if (temp_ht_ops) |
| 793 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 794 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 795 | |
| 796 | /* operation mode */ |
| 797 | temp_ht_ops = roam_ht_ops->opMode & |
| 798 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 799 | switch (temp_ht_ops) { |
| 800 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 801 | hdd_ht_ops->operation_mode |= |
| 802 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 803 | break; |
| 804 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 805 | hdd_ht_ops->operation_mode |= |
| 806 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 807 | break; |
| 808 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 809 | hdd_ht_ops->operation_mode |= |
| 810 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 811 | break; |
| 812 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 813 | default: |
| 814 | hdd_ht_ops->operation_mode |= |
| 815 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 816 | } |
| 817 | if (roam_ht_ops->nonGFDevicesPresent) |
| 818 | hdd_ht_ops->operation_mode |= |
| 819 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 820 | if (roam_ht_ops->transmitBurstLimit) |
| 821 | hdd_ht_ops->operation_mode |= |
| 822 | HT_OP_MODE_TX_BURST_LIMIT; |
| 823 | if (roam_ht_ops->obssNonHTStaPresent) |
| 824 | hdd_ht_ops->operation_mode |= |
| 825 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 826 | |
| 827 | /* stbc_param */ |
| 828 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 829 | HT_STBC_PARAM_MCS; |
| 830 | if (temp_ht_ops) |
| 831 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 832 | if (roam_ht_ops->dualCTSProtection) |
| 833 | hdd_ht_ops->stbc_param |= |
| 834 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 835 | if (roam_ht_ops->secondaryBeacon) |
| 836 | hdd_ht_ops->stbc_param |= |
| 837 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 838 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 839 | hdd_ht_ops->stbc_param |= |
| 840 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 841 | if (roam_ht_ops->pcoActive) |
| 842 | hdd_ht_ops->stbc_param |= |
| 843 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 844 | if (roam_ht_ops->pcoPhase) |
| 845 | hdd_ht_ops->stbc_param |= |
| 846 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 847 | |
| 848 | /* basic MCs set */ |
| 849 | for (i = 0; i < 16; ++i) |
| 850 | hdd_ht_ops->basic_set[i] = |
| 851 | roam_ht_ops->basicMCSSet[i]; |
| 852 | } |
| 853 | |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 854 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) |
| 855 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 856 | tDot11fIEVHTOperation *roam_ops) |
| 857 | { |
| 858 | ieee_ops->center_freq_seg0_idx = roam_ops->chanCenterFreqSeg1; |
| 859 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg2; |
| 860 | } |
| 861 | #else |
| 862 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 863 | tDot11fIEVHTOperation *roam_ops) |
| 864 | { |
| 865 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg1; |
| 866 | ieee_ops->center_freq_seg2_idx = roam_ops->chanCenterFreqSeg2; |
| 867 | } |
| 868 | #endif /* KERNEL_VERSION(4, 12, 0) */ |
| 869 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 870 | /** |
| 871 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 872 | * hdd station context. |
| 873 | * @hdd_sta_ctx: pointer to hdd station context |
| 874 | * @roam_info: pointer to roam info |
| 875 | * |
| 876 | * Return: None |
| 877 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 878 | 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] | 879 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 880 | { |
| 881 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 882 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 883 | &hdd_sta_ctx->conn_info.vht_operation; |
| 884 | |
| 885 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 886 | |
| 887 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 888 | hdd_copy_vht_center_freq(hdd_vht_ops, roam_vht_ops); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 889 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 890 | } |
| 891 | |
| 892 | |
| 893 | /** |
| 894 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 895 | * @adapter: Pointer to adapter |
| 896 | * @roam_info: pointer to roam info |
| 897 | * |
| 898 | * Return: None |
| 899 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 900 | static void hdd_save_bss_info(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 901 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 902 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 903 | struct hdd_station_ctx *hdd_sta_ctx = |
| 904 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 905 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 906 | if (roam_info->vht_caps.present) { |
| 907 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 908 | hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps, |
| 909 | &roam_info->vht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 910 | } else { |
| 911 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 912 | } |
| 913 | if (roam_info->ht_caps.present) { |
| 914 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 915 | hdd_copy_ht_caps(&hdd_sta_ctx->conn_info.ht_caps, |
| 916 | &roam_info->ht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 917 | } else { |
| 918 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 919 | } |
| 920 | if (roam_info->reassoc) |
| 921 | hdd_sta_ctx->conn_info.roam_count++; |
| 922 | if (roam_info->hs20vendor_ie.present) { |
| 923 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 924 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 925 | &roam_info->hs20vendor_ie, |
| 926 | sizeof(roam_info->hs20vendor_ie)); |
| 927 | } else { |
| 928 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 929 | } |
| 930 | if (roam_info->ht_operation.present) { |
| 931 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 932 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 933 | } else { |
| 934 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 935 | } |
| 936 | if (roam_info->vht_operation.present) { |
| 937 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 938 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 939 | } else { |
| 940 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 941 | } |
Ashish Kumar Dhanotiya | 36d19b0 | 2018-02-22 00:59:49 +0530 | [diff] [blame] | 942 | /* Cache last connection info */ |
| 943 | 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] | 944 | sizeof(hdd_sta_ctx->cache_conn_info)); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 945 | } |
| 946 | |
| 947 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 948 | * hdd_conn_save_connect_info() - save current connection information |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 949 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 950 | * @roam_info: pointer to roam info |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 951 | * @bss_type: bss type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 952 | * |
| 953 | * Return: none |
| 954 | */ |
| 955 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 956 | hdd_conn_save_connect_info(struct hdd_adapter *adapter, |
| 957 | struct csr_roam_info *roam_info, |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 958 | eCsrRoamBssType bss_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 959 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 960 | 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] | 961 | eCsrEncryptionType encrypt_type = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 962 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 963 | QDF_ASSERT(roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 965 | if (roam_info) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 966 | /* Save the BSSID for the connection */ |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 967 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == bss_type) { |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 968 | QDF_ASSERT(roam_info->bss_desc); |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 969 | qdf_copy_macaddr(&sta_ctx->conn_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 970 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | |
| 972 | /* |
| 973 | * Save the Station ID for this station from |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 974 | * the 'Roam Info'. For IBSS mode, sta_id is |
| 975 | * assigned in NEW_PEER_IND. For reassoc, the |
| 976 | * sta_id doesn't change and it may be invalid |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 977 | * in this structure so no change here. |
| 978 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 979 | if (!roam_info->fReassocReq) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 980 | sta_ctx->conn_info.sta_id[0] = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 981 | roam_info->staId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | } |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 983 | } else if (eCSR_BSS_TYPE_IBSS == bss_type) { |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 984 | qdf_copy_macaddr(&sta_ctx->conn_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 985 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 986 | } else { |
| 987 | /* |
| 988 | * can't happen. We need a valid IBSS or Infra setting |
| 989 | * in the BSSDescription or we can't function. |
| 990 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 991 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | /* notify WMM */ |
Jeff Johnson | fdb993c | 2019-02-27 09:38:08 -0800 | [diff] [blame] | 995 | hdd_wmm_connect(adapter, roam_info, bss_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 996 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 997 | if (!roam_info->u.pConnectedProfile) { |
| 998 | QDF_ASSERT(roam_info->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 999 | } else { |
| 1000 | /* Get Multicast Encryption Type */ |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1001 | encrypt_type = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1002 | roam_info->u.pConnectedProfile->mcEncryptionType; |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1003 | sta_ctx->conn_info.mc_encrypt_type = encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1004 | /* Get Unicast Encryption Type */ |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1005 | encrypt_type = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1006 | roam_info->u.pConnectedProfile->EncryptionType; |
Jeff Johnson | 1627e75 | 2019-03-23 12:33:37 -0700 | [diff] [blame] | 1007 | sta_ctx->conn_info.uc_encrypt_type = encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1008 | |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 1009 | sta_ctx->conn_info.auth_type = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1010 | roam_info->u.pConnectedProfile->AuthType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1011 | sta_ctx->conn_info.last_auth_type = |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 1012 | sta_ctx->conn_info.auth_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | |
Jingxiang Ge | ae80dc6 | 2019-08-13 17:32:22 +0800 | [diff] [blame^] | 1014 | sta_ctx->conn_info.chan_freq = |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 1015 | roam_info->u.pConnectedProfile->op_freq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1016 | |
| 1017 | /* Save the ssid for the connection */ |
Jeff Johnson | 4aea180 | 2019-02-27 10:21:33 -0800 | [diff] [blame] | 1018 | qdf_mem_copy(&sta_ctx->conn_info.ssid.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1019 | &roam_info->u.pConnectedProfile->SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1020 | sizeof(tSirMacSSid)); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1021 | qdf_mem_copy(&sta_ctx->conn_info.last_ssid.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1022 | &roam_info->u.pConnectedProfile->SSID, |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1023 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1024 | |
| 1025 | /* Save dot11mode in which STA associated to AP */ |
Jeff Johnson | c52bc8b | 2019-02-27 17:49:33 -0800 | [diff] [blame] | 1026 | sta_ctx->conn_info.dot11mode = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1027 | roam_info->u.pConnectedProfile->dot11Mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1028 | |
Jeff Johnson | ac5170c | 2019-02-27 10:55:24 -0800 | [diff] [blame] | 1029 | sta_ctx->conn_info.proxy_arp_service = |
| 1030 | roam_info->u.pConnectedProfile->proxy_arp_service; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1031 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1032 | sta_ctx->conn_info.nss = roam_info->chan_info.nss; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1033 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1034 | sta_ctx->conn_info.rate_flags = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1035 | roam_info->chan_info.rate_flags; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame] | 1036 | |
| 1037 | sta_ctx->conn_info.ch_width = |
| 1038 | roam_info->chan_info.ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | } |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1040 | hdd_save_bss_info(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1042 | } |
| 1043 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1044 | /** |
| 1045 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 1046 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1047 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1048 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1049 | * |
| 1050 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 1051 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 1052 | * for the same purpose.) |
| 1053 | * |
| 1054 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 1055 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 1056 | * This is the Assoc Response. |
| 1057 | * |
| 1058 | * Return: none |
| 1059 | */ |
| 1060 | static void |
| 1061 | hdd_send_ft_assoc_response(struct net_device *dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1062 | struct hdd_adapter *adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1063 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1064 | { |
| 1065 | union iwreq_data wrqu; |
| 1066 | char *buff; |
| 1067 | unsigned int len = 0; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1068 | u8 *assoc_rsp = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1069 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1070 | if (roam_info->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1071 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1072 | return; |
| 1073 | } |
| 1074 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1075 | assoc_rsp = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1076 | (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength + |
| 1077 | roam_info->nAssocReqLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1078 | if (!assoc_rsp) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1079 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | return; |
| 1081 | } |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1082 | /* assoc_rsp needs to point to the IEs */ |
| 1083 | assoc_rsp += FT_ASSOC_RSP_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1084 | |
| 1085 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1086 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1087 | if (!buff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1088 | return; |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1089 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1091 | len = roam_info->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1092 | wrqu.data.length = len; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 1093 | memcpy(buff, assoc_rsp, len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1094 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 1095 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1096 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1097 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1098 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1099 | /** |
| 1100 | * hdd_send_ft_event() - send fast transition event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1101 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1102 | * |
| 1103 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 1104 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 1105 | * followed by the auth response IEs to the supplicant. |
| 1106 | * Once both are received in the supplicant, an FT event is generated |
| 1107 | * to the supplicant. |
| 1108 | * |
| 1109 | * Return: none |
| 1110 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1111 | static void hdd_send_ft_event(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1112 | { |
| 1113 | uint16_t auth_resp_len = 0; |
| 1114 | uint32_t ric_ies_length = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1115 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1116 | mac_handle_t mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1117 | |
| 1118 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 1119 | struct cfg80211_ft_event_params ftEvent; |
| 1120 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1121 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1122 | struct net_device *dev = adapter->dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1123 | #else |
| 1124 | char *buff; |
| 1125 | union iwreq_data wrqu; |
| 1126 | uint16_t str_len; |
| 1127 | #endif |
| 1128 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1129 | mac_handle = hdd_ctx->mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1130 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1131 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1132 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1133 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1134 | sme_get_rici_es(mac_handle, adapter->vdev_id, (u8 *) ricIe, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1135 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1136 | if (ric_ies_length == 0) |
| 1137 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1138 | |
| 1139 | ftEvent.ric_ies = ricIe; |
| 1140 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1141 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1142 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1143 | sme_get_ft_pre_auth_response(mac_handle, adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1144 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1145 | &auth_resp_len); |
| 1146 | |
| 1147 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1148 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1149 | return; |
| 1150 | } |
| 1151 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1152 | sme_set_ft_pre_auth_state(mac_handle, adapter->vdev_id, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | |
| 1154 | ftEvent.target_ap = ftIe; |
| 1155 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1156 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1157 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1158 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1159 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1160 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1161 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1162 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1163 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1164 | ftEvent.target_ap[5]); |
| 1165 | |
| 1166 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1167 | |
| 1168 | #else |
| 1169 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1170 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1171 | if (!buff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1172 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1173 | |
| 1174 | /* Sme needs to send the RIC IEs first */ |
| 1175 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1176 | sme_get_rici_es(mac_handle, adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1177 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1178 | &ric_ies_length); |
| 1179 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1180 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1181 | } else { |
| 1182 | wrqu.data.length = str_len + ric_ies_length; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1183 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1184 | } |
| 1185 | |
| 1186 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1187 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1188 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1189 | sme_get_ft_pre_auth_response(mac_handle, adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1190 | (u8 *) &buff[str_len], |
| 1191 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1192 | |
| 1193 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1194 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1195 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1196 | return; |
| 1197 | } |
| 1198 | |
| 1199 | wrqu.data.length = str_len + auth_resp_len; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1200 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1201 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1202 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1203 | #endif |
| 1204 | } |
| 1205 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1206 | #ifdef FEATURE_WLAN_ESE |
| 1207 | /** |
| 1208 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1209 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1210 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1211 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1212 | * |
| 1213 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1214 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1215 | * |
| 1216 | * The current (new AP) channel information is passed in. |
| 1217 | * |
| 1218 | * Return: none |
| 1219 | */ |
| 1220 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1221 | hdd_send_new_ap_channel_info(struct net_device *dev, |
| 1222 | struct hdd_adapter *adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1223 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1224 | { |
| 1225 | union iwreq_data wrqu; |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 1226 | struct bss_description *descriptor = roam_info->bss_desc; |
wadesong | 91a2c1b | 2019-07-12 12:18:06 +0800 | [diff] [blame] | 1227 | mac_handle_t mac_hdl; |
| 1228 | struct wlan_objmgr_pdev *pdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1229 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1230 | if (!descriptor) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1231 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1232 | return; |
| 1233 | } |
| 1234 | /* |
| 1235 | * Send the Channel event, the supplicant needs this to generate |
| 1236 | * the Adjacent AP report. |
| 1237 | */ |
wadesong | 91a2c1b | 2019-07-12 12:18:06 +0800 | [diff] [blame] | 1238 | hdd_debug("Sending up an SIOCGIWFREQ, channel freq: %d", |
| 1239 | descriptor->chan_freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1240 | memset(&wrqu, '\0', sizeof(wrqu)); |
wadesong | 91a2c1b | 2019-07-12 12:18:06 +0800 | [diff] [blame] | 1241 | mac_hdl = hdd_adapter_get_mac_handle(adapter); |
| 1242 | if (!mac_hdl) { |
| 1243 | hdd_err("MAC handle invalid, falling back!"); |
| 1244 | return; |
| 1245 | } |
| 1246 | pdev = MAC_CONTEXT(mac_hdl)->pdev; |
| 1247 | if (!pdev) { |
| 1248 | hdd_err("pdev invalid in MAC context, falling back!"); |
| 1249 | return; |
| 1250 | } |
| 1251 | wrqu.freq.m = wlan_reg_freq_to_chan(pdev, descriptor->chan_freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1252 | wrqu.freq.e = 0; |
| 1253 | wrqu.freq.i = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1254 | wireless_send_event(adapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1255 | } |
| 1256 | |
| 1257 | #endif /* FEATURE_WLAN_ESE */ |
| 1258 | |
| 1259 | /** |
| 1260 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1261 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1262 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1263 | * |
| 1264 | * Return: none |
| 1265 | */ |
| 1266 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1267 | hdd_send_update_beacon_ies_event(struct hdd_adapter *adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1268 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1269 | { |
| 1270 | union iwreq_data wrqu; |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1271 | u8 *beacon_ies; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1272 | u8 currentLen = 0; |
| 1273 | char *buff; |
| 1274 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1275 | |
| 1276 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1277 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1278 | if (0 == roam_info->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1279 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1280 | return; |
| 1281 | } |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1282 | beacon_ies = (u8 *) (roam_info->pbFrames + BEACON_FRAME_IES_OFFSET); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1283 | if (!beacon_ies) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1284 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1285 | return; |
| 1286 | } |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1287 | /* beacon_ies needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1288 | hdd_debug("Beacon IEs is now at %02x%02x", |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1289 | (unsigned int)beacon_ies[0], |
| 1290 | (unsigned int)beacon_ies[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1291 | hdd_debug("Beacon IEs length = %d", |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1292 | roam_info->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1293 | |
| 1294 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1295 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 1296 | if (!buff) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1297 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1298 | |
| 1299 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1300 | currentLen = strLen + 1; |
| 1301 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1302 | totalIeLen = roam_info->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1303 | do { |
| 1304 | /* |
| 1305 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1306 | * into chunks of CUSTOM event max size and send it to |
| 1307 | * supplicant. Changes are done in supplicant to handle this. |
| 1308 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1309 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1310 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1311 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1312 | qdf_mem_copy(&buff[strLen + 1], beacon_ies + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1313 | currentLen); |
| 1314 | currentOffset += currentLen; |
| 1315 | totalIeLen -= currentLen; |
| 1316 | wrqu.data.length = strLen + 1 + currentLen; |
| 1317 | if (totalIeLen) |
| 1318 | buff[strLen] = 1; /* more chunks pending */ |
| 1319 | else |
| 1320 | buff[strLen] = 0; /* last chunk */ |
| 1321 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1322 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1323 | currentLen); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1324 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1325 | } while (totalIeLen > 0); |
| 1326 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1327 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1328 | } |
| 1329 | |
| 1330 | /** |
| 1331 | * hdd_send_association_event() - send association event |
| 1332 | * @dev: pointer to net device |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1333 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1334 | * |
| 1335 | * Return: none |
| 1336 | */ |
| 1337 | static void hdd_send_association_event(struct net_device *dev, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1338 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1340 | int ret; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1341 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1342 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1343 | 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] | 1344 | union iwreq_data wrqu; |
| 1345 | int we_event; |
| 1346 | char *msg; |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1347 | struct qdf_mac_addr peer_macaddr; |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1348 | struct csr_roam_profile *roam_profile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1349 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1350 | roam_profile = hdd_roam_profile(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1351 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1352 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1353 | we_event = SIOCGIWAP; |
| 1354 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1355 | if (roam_info) |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1356 | if (roam_info->roamSynchInProgress) { |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1357 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1358 | hdd_notify_sta_disconnect(adapter->vdev_id, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1359 | true, false, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1360 | adapter->vdev); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1361 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1362 | #endif |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1363 | if (eConnectionState_Associated == sta_ctx->conn_info.conn_state) { |
Jeff Johnson | a7d5b54 | 2019-02-03 10:15:46 -0800 | [diff] [blame] | 1364 | struct oem_channel_info chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1365 | |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 1366 | if (!roam_info || !roam_info->bss_desc) { |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1367 | hdd_warn("STA in associated state but roam_info is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1368 | return; |
| 1369 | } |
| 1370 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1371 | if (!hdd_is_roam_sync_in_progress(roam_info)) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1372 | policy_mgr_incr_active_session(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1373 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 1374 | hdd_green_ap_start_state_mc(hdd_ctx, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 1375 | adapter->device_mode, true); |
| 1376 | } |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 1377 | memcpy(wrqu.ap_addr.sa_data, roam_info->bss_desc->bssId, |
| 1378 | sizeof(roam_info->bss_desc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1379 | |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1380 | ucfg_p2p_status_connect(adapter->vdev); |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1381 | |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1382 | hdd_info("wlan: " QDF_MAC_ADDR_STR " connected to " |
| 1383 | QDF_MAC_ADDR_STR "\n", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1384 | QDF_MAC_ADDR_ARRAY(adapter->mac_addr.bytes), |
| 1385 | QDF_MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1386 | hdd_send_update_beacon_ies_event(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1387 | |
| 1388 | /* |
| 1389 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1390 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1391 | * fFTEnable is true. |
| 1392 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1393 | */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1394 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1395 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
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_FT_RSN) |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 1398 | || (roam_profile->AuthType.authType[0] == |
| 1399 | eCSR_AUTH_TYPE_FT_SAE) |
| 1400 | || (roam_profile->AuthType.authType[0] == |
| 1401 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1402 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1403 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1404 | eCSR_AUTH_TYPE_CCKM_RSN) |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1405 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1406 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1407 | #endif |
| 1408 | ) { |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1409 | hdd_send_ft_assoc_response(dev, adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1410 | } |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1411 | qdf_copy_macaddr(&peer_macaddr, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1412 | &sta_ctx->conn_info.bssid); |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1413 | chan_info.chan_id = roam_info->chan_info.chan_id; |
| 1414 | chan_info.mhz = roam_info->chan_info.mhz; |
| 1415 | chan_info.info = roam_info->chan_info.info; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1416 | chan_info.band_center_freq1 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1417 | roam_info->chan_info.band_center_freq1; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1418 | chan_info.band_center_freq2 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1419 | roam_info->chan_info.band_center_freq2; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1420 | chan_info.reg_info_1 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1421 | roam_info->chan_info.reg_info_1; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1422 | chan_info.reg_info_2 = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1423 | roam_info->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1424 | |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1425 | ret = hdd_objmgr_set_peer_mlme_state(adapter->vdev, |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1426 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1427 | if (ret) |
| 1428 | hdd_err("Peer object %pM fail to set associated state", |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1429 | peer_macaddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1430 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1431 | /* send peer status indication to oem app */ |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1432 | hdd_send_peer_status_ind_to_app(&peer_macaddr, |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1433 | ePeerConnected, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1434 | roam_info->timingMeasCap, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1435 | adapter->vdev_id, &chan_info, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1436 | adapter->device_mode); |
jiad | 7b8a5e0 | 2018-11-26 16:37:57 +0800 | [diff] [blame] | 1437 | |
| 1438 | #ifdef FEATURE_WLAN_TDLS |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1439 | /* Update tdls module about connection event */ |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1440 | hdd_notify_sta_connect(adapter->vdev_id, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1441 | roam_info->tdls_chan_swit_prohibited, |
| 1442 | roam_info->tdls_prohibited, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1443 | adapter->vdev); |
jiad | 7b8a5e0 | 2018-11-26 16:37:57 +0800 | [diff] [blame] | 1444 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1445 | /* start timer in sta/p2p_cli */ |
Sravan Kumar Kairam | 777a7dd | 2019-08-01 21:46:30 +0530 | [diff] [blame] | 1446 | hdd_bus_bw_compute_prev_txrx_stats(adapter); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1447 | hdd_bus_bw_compute_timer_start(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1448 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1449 | sta_ctx->conn_info.conn_state) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1450 | policy_mgr_update_connection_info(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1451 | adapter->vdev_id); |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1452 | memcpy(wrqu.ap_addr.sa_data, sta_ctx->conn_info.bssid.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1453 | ETH_ALEN); |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 1454 | hdd_debug("wlan: new IBSS peer connection to BSSID " QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 1455 | QDF_MAC_ADDR_ARRAY(sta_ctx->conn_info.bssid.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1456 | } else { /* Not Associated */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1457 | hdd_debug("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1458 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1459 | policy_mgr_decr_session_set_pcl(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1460 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 1461 | hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 1462 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1463 | |
| 1464 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1465 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1466 | #endif |
| 1467 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1468 | if ((adapter->device_mode == QDF_STA_MODE) || |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1469 | (adapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1470 | qdf_copy_macaddr(&peer_macaddr, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1471 | &sta_ctx->conn_info.bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1472 | |
| 1473 | /* send peer status indication to oem app */ |
Jeff Johnson | 2d04461 | 2019-02-26 20:08:43 -0800 | [diff] [blame] | 1474 | hdd_send_peer_status_ind_to_app(&peer_macaddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1475 | ePeerDisconnected, 0, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1476 | adapter->vdev_id, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1477 | NULL, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1478 | adapter->device_mode); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1479 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1480 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1481 | hdd_lpass_notify_disconnect(adapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1482 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1483 | hdd_notify_sta_disconnect(adapter->vdev_id, |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1484 | false, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1485 | false, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1486 | adapter->vdev); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1487 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1488 | /* stop timer in sta/p2p_cli */ |
Sravan Kumar Kairam | 777a7dd | 2019-08-01 21:46:30 +0530 | [diff] [blame] | 1489 | hdd_bus_bw_compute_reset_prev_txrx_stats(adapter); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1490 | hdd_bus_bw_compute_timer_try_stop(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1491 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1492 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1493 | |
| 1494 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1495 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1496 | * driver so not sending the status of the connection to supplicant |
| 1497 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1498 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1499 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1500 | #ifdef FEATURE_WLAN_ESE |
| 1501 | if (eConnectionState_Associated == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1502 | sta_ctx->conn_info.conn_state) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1503 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1504 | eCSR_AUTH_TYPE_CCKM_RSN) || |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1505 | (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1506 | eCSR_AUTH_TYPE_CCKM_WPA)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1507 | hdd_send_new_ap_channel_info(dev, adapter, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1508 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1509 | } |
| 1510 | #endif |
| 1511 | } |
| 1512 | } |
| 1513 | |
| 1514 | /** |
| 1515 | * hdd_conn_remove_connect_info() - remove connection info |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1516 | * @sta_ctx: pointer to global HDD station context |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 1517 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1518 | * |
| 1519 | * Return: none |
| 1520 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1521 | 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] | 1522 | { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1523 | /* Remove sta_id, bssid and peer_macaddr */ |
| 1524 | sta_ctx->conn_info.sta_id[0] = HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1525 | qdf_mem_zero(&sta_ctx->conn_info.bssid, QDF_MAC_ADDR_SIZE); |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 1526 | qdf_mem_zero(&sta_ctx->conn_info.peer_macaddr[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1527 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1528 | |
| 1529 | /* Clear all security settings */ |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 1530 | sta_ctx->conn_info.auth_type = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | b195984 | 2019-02-27 13:04:04 -0800 | [diff] [blame] | 1531 | sta_ctx->conn_info.mc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE; |
| 1532 | sta_ctx->conn_info.uc_encrypt_type = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1533 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1534 | qdf_mem_zero(&sta_ctx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1535 | |
Jeff Johnson | ac5170c | 2019-02-27 10:55:24 -0800 | [diff] [blame] | 1536 | sta_ctx->conn_info.proxy_arp_service = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1537 | |
Jeff Johnson | 4aea180 | 2019-02-27 10:21:33 -0800 | [diff] [blame] | 1538 | qdf_mem_zero(&sta_ctx->conn_info.ssid, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1539 | } |
| 1540 | |
| 1541 | /** |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 1542 | * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs |
| 1543 | * @adapter: adapter who's IEs are to be cleared |
| 1544 | * |
| 1545 | * Return: None |
| 1546 | */ |
| 1547 | static void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter) |
| 1548 | { |
| 1549 | struct hdd_station_ctx *sta_ctx; |
| 1550 | struct csr_roam_profile *roam_profile; |
| 1551 | |
| 1552 | hdd_enter(); |
| 1553 | |
| 1554 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 1555 | roam_profile = hdd_roam_profile(adapter); |
| 1556 | |
| 1557 | roam_profile->nWPAReqIELength = 0; |
| 1558 | roam_profile->pWPAReqIE = NULL; |
| 1559 | roam_profile->nRSNReqIELength = 0; |
| 1560 | roam_profile->pRSNReqIE = NULL; |
| 1561 | |
| 1562 | #ifdef FEATURE_WLAN_WAPI |
| 1563 | roam_profile->nWAPIReqIELength = 0; |
| 1564 | roam_profile->pWAPIReqIE = NULL; |
| 1565 | #endif |
| 1566 | |
| 1567 | roam_profile->bWPSAssociation = false; |
| 1568 | roam_profile->bOSENAssociation = false; |
| 1569 | roam_profile->pAddIEScan = NULL; |
| 1570 | roam_profile->nAddIEScanLength = 0; |
| 1571 | roam_profile->pAddIEAssoc = NULL; |
| 1572 | roam_profile->nAddIEAssocLength = 0; |
| 1573 | |
| 1574 | roam_profile->EncryptionType.numEntries = 1; |
| 1575 | roam_profile->EncryptionType.encryptionType[0] = |
| 1576 | eCSR_ENCRYPT_TYPE_NONE; |
| 1577 | |
| 1578 | roam_profile->mcEncryptionType.numEntries = 1; |
| 1579 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 1580 | eCSR_ENCRYPT_TYPE_NONE; |
| 1581 | |
| 1582 | roam_profile->AuthType.numEntries = 1; |
| 1583 | roam_profile->AuthType.authType[0] = |
| 1584 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1585 | |
| 1586 | qdf_mem_zero(roam_profile->bssid_hint.bytes, QDF_MAC_ADDR_SIZE); |
| 1587 | |
| 1588 | #ifdef WLAN_FEATURE_11W |
| 1589 | roam_profile->MFPEnabled = false; |
| 1590 | roam_profile->MFPRequired = 0; |
| 1591 | roam_profile->MFPCapable = 0; |
| 1592 | #endif |
| 1593 | |
| 1594 | qdf_mem_zero(roam_profile->Keys.KeyLength, CSR_MAX_NUM_KEY); |
Ashish Kumar Dhanotiya | 0213793 | 2019-02-26 21:43:32 +0530 | [diff] [blame] | 1595 | qdf_mem_zero(roam_profile->Keys.KeyMaterial, |
| 1596 | sizeof(roam_profile->Keys.KeyMaterial)); |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 1597 | #ifdef FEATURE_WLAN_WAPI |
| 1598 | adapter->wapi_info.wapi_auth_mode = WAPI_AUTH_MODE_OPEN; |
| 1599 | adapter->wapi_info.wapi_mode = false; |
| 1600 | #endif |
| 1601 | |
| 1602 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1603 | sta_ctx->auth_key_mgmt = 0; |
| 1604 | qdf_zero_macaddr(&sta_ctx->requested_bssid); |
Srinivas Dasari | e3ef7c6 | 2018-12-28 13:16:09 +0530 | [diff] [blame] | 1605 | hdd_clear_fils_connection_info(adapter); |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 1606 | hdd_exit(); |
| 1607 | } |
| 1608 | |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 1609 | QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter, |
| 1610 | struct qdf_mac_addr mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1611 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1612 | QDF_STATUS qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1613 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1614 | 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] | 1615 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 1616 | mac_addr); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1617 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 1618 | hdd_err("cdp_clear_peer() failed for sta mac: " |
| 1619 | QDF_MAC_ADDR_STR ". Status(%d) [0x%08X]", |
| 1620 | QDF_MAC_ADDR_ARRAY(mac_addr.bytes), |
| 1621 | qdf_status, qdf_status); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1622 | } |
| 1623 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1624 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1625 | } |
| 1626 | |
| 1627 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1628 | * hdd_print_bss_info() - print bss info |
| 1629 | * @hdd_sta_ctx: pointer to hdd station context |
| 1630 | * |
| 1631 | * Return: None |
| 1632 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1633 | 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] | 1634 | { |
| 1635 | uint32_t *cap_info; |
| 1636 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1637 | hdd_debug("WIFI DATA LOGGER"); |
Jingxiang Ge | ae80dc6 | 2019-08-13 17:32:22 +0800 | [diff] [blame^] | 1638 | hdd_debug("chan_freq: %d", |
| 1639 | hdd_sta_ctx->conn_info.chan_freq); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1640 | hdd_debug("dot11mode: %d", |
Jeff Johnson | c52bc8b | 2019-02-27 17:49:33 -0800 | [diff] [blame] | 1641 | hdd_sta_ctx->conn_info.dot11mode); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1642 | hdd_debug("AKM: %d", |
| 1643 | hdd_sta_ctx->conn_info.last_auth_type); |
| 1644 | hdd_debug("ssid: %.*s", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1645 | hdd_sta_ctx->conn_info.last_ssid.SSID.length, |
| 1646 | hdd_sta_ctx->conn_info.last_ssid.SSID.ssId); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1647 | hdd_debug("roam count: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1648 | hdd_sta_ctx->conn_info.roam_count); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1649 | hdd_debug("ant_info: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1650 | hdd_sta_ctx->conn_info.txrate.nss); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1651 | hdd_debug("datarate legacy %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1652 | hdd_sta_ctx->conn_info.txrate.legacy); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1653 | hdd_debug("datarate mcs: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1654 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1655 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1656 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1657 | hdd_debug("ht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1658 | } |
| 1659 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1660 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1661 | hdd_debug("vht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1662 | } |
| 1663 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1664 | hdd_debug("hs20 info: %x", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1665 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1666 | hdd_debug("signal: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1667 | hdd_sta_ctx->conn_info.signal); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1668 | hdd_debug("noise: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1669 | hdd_sta_ctx->conn_info.noise); |
| 1670 | } |
| 1671 | |
| 1672 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1673 | * hdd_dis_connect_handler() - disconnect event handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1674 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1675 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1676 | * @roam_id: roam identifier |
| 1677 | * @roam_status: roam status |
| 1678 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1679 | * |
| 1680 | * This function handles disconnect event: |
| 1681 | * 1. Disable transmit queues; |
| 1682 | * 2. Clean up internal connection states and data structures; |
| 1683 | * 3. Send disconnect indication to supplicant. |
| 1684 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1685 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1686 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1687 | static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1688 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1689 | uint32_t roam_id, |
| 1690 | eRoamCmdStatus roam_status, |
| 1691 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1692 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1693 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1694 | QDF_STATUS vstatus; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1695 | struct net_device *dev = adapter->dev; |
| 1696 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1697 | 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] | 1698 | uint8_t sta_id; |
| 1699 | bool sendDisconInd = true; |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1700 | mac_handle_t mac_handle; |
Srinivas Dasari | d4e8725 | 2019-07-01 15:35:52 +0530 | [diff] [blame] | 1701 | struct wlan_ies disconnect_ies = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1702 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1703 | if (!dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1704 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1705 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1706 | } |
| 1707 | /* notify apps that we can't pass traffic anymore */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1708 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1709 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1710 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1711 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1712 | |
gaurank kathpalia | 63311d1 | 2018-04-12 14:34:26 +0530 | [diff] [blame] | 1713 | if (ucfg_ipa_is_enabled() && |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1714 | (sta_ctx->conn_info.sta_id[0] != HDD_WLAN_INVALID_STA_ID)) |
Dustin Brown | 07901ec | 2018-09-07 11:02:41 -0700 | [diff] [blame] | 1715 | ucfg_ipa_wlan_evt(hdd_ctx->pdev, adapter->dev, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 1716 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1717 | adapter->vdev_id, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 1718 | WLAN_IPA_STA_DISCONNECT, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1719 | sta_ctx->conn_info.bssid.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1720 | |
| 1721 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1722 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1723 | #endif |
| 1724 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1725 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1726 | adapter->vdev_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1727 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1728 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1729 | |
| 1730 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1731 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1732 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1733 | * to cfg80211_disconnected. |
| 1734 | */ |
| 1735 | if ((eConnectionState_Disconnecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1736 | sta_ctx->conn_info.conn_state) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1737 | (eConnectionState_NotConnected == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1738 | sta_ctx->conn_info.conn_state) || |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1739 | (eConnectionState_Connecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1740 | sta_ctx->conn_info.conn_state)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1741 | 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] | 1742 | sendDisconInd = false; |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1743 | } else { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1744 | INIT_COMPLETION(adapter->disconnect_comp_var); |
| 1745 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1746 | eConnectionState_Disconnecting); |
| 1747 | } |
| 1748 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1749 | hdd_clear_roam_profile_ie(adapter); |
| 1750 | hdd_wmm_init(adapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1751 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1752 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1753 | |
| 1754 | /* indicate 'disconnect' status to wpa_supplicant... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1755 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1756 | /* indicate disconnected event to nl80211 */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1757 | if (roam_status != eCSR_ROAM_IBSS_LEAVE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1758 | /* |
| 1759 | * Only send indication to kernel if not initiated |
| 1760 | * by kernel |
| 1761 | */ |
| 1762 | if (sendDisconInd) { |
Srinivas Dasari | d4e8725 | 2019-07-01 15:35:52 +0530 | [diff] [blame] | 1763 | if (roam_info && roam_info->disconnect_ies) { |
| 1764 | disconnect_ies.data = |
| 1765 | roam_info->disconnect_ies->data; |
| 1766 | disconnect_ies.len = |
| 1767 | roam_info->disconnect_ies->len; |
| 1768 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1769 | /* |
| 1770 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1771 | * to ICS UI. |
| 1772 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1773 | if (eCSR_ROAM_LOSTLINK == roam_status) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1774 | if (roam_info->reasonCode == |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1775 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1776 | pr_info("wlan: disconnected due to poor signal, rssi is %d dB\n", |
| 1777 | roam_info->rxRssi); |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1778 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1779 | dev, false, |
Srinivas Dasari | d4e8725 | 2019-07-01 15:35:52 +0530 | [diff] [blame] | 1780 | roam_info->reasonCode, |
| 1781 | disconnect_ies.data, |
| 1782 | disconnect_ies.len); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1783 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1784 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1785 | dev, false, |
Srinivas Dasari | d4e8725 | 2019-07-01 15:35:52 +0530 | [diff] [blame] | 1786 | WLAN_REASON_UNSPECIFIED, |
| 1787 | disconnect_ies.data, |
| 1788 | disconnect_ies.len); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1789 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1790 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1791 | hdd_debug("sent disconnected event to nl80211, reason code %d", |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1792 | (eCSR_ROAM_LOSTLINK == roam_status) ? |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1793 | roam_info->reasonCode : |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1794 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1795 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1796 | |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1797 | /* update P2P connection status */ |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 1798 | ucfg_p2p_status_disconnect(adapter->vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1799 | } |
| 1800 | |
gaurank kathpalia | 7ef7218 | 2019-05-29 19:41:25 +0530 | [diff] [blame] | 1801 | /* Inform BLM about the disconnection with the AP */ |
| 1802 | if (adapter->device_mode == QDF_STA_MODE) |
| 1803 | ucfg_blm_update_bssid_connect_params(hdd_ctx->pdev, |
| 1804 | sta_ctx->conn_info.bssid, |
| 1805 | BLM_AP_DISCONNECTED); |
| 1806 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1807 | hdd_wmm_adapter_clear(adapter); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1808 | mac_handle = hdd_ctx->mac_handle; |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1809 | sme_ft_reset(mac_handle, adapter->vdev_id); |
Ashish Kumar Dhanotiya | 0213793 | 2019-02-26 21:43:32 +0530 | [diff] [blame] | 1810 | sme_reset_key(mac_handle, adapter->vdev_id); |
Abhinav Kumar | 3922215 | 2019-05-13 23:53:40 +0530 | [diff] [blame] | 1811 | if (!hdd_remove_beacon_filter(adapter)) { |
| 1812 | if (sme_is_beacon_report_started(mac_handle, |
| 1813 | adapter->vdev_id)) { |
| 1814 | hdd_beacon_recv_pause_indication((hdd_handle_t)hdd_ctx, |
| 1815 | adapter->vdev_id, |
| 1816 | SCAN_EVENT_TYPE_MAX, |
| 1817 | true); |
| 1818 | } |
| 1819 | } |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1820 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1821 | if (eCSR_ROAM_IBSS_LEAVE == roam_status) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1822 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1823 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1824 | sta_id = sta_ctx->broadcast_sta_id; |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 1825 | vstatus = hdd_roam_deregister_sta(adapter, |
| 1826 | sta_ctx->conn_info.bssid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1827 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1828 | 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] | 1829 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1830 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1831 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1832 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1833 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
| 1834 | else |
| 1835 | hdd_debug("invalid sta id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1836 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1837 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1838 | if (HDD_WLAN_INVALID_STA_ID == |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1839 | sta_ctx->conn_info.sta_id[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1840 | continue; |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1841 | sta_id = sta_ctx->conn_info.sta_id[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1842 | hdd_debug("Deregister StaID %d", sta_id); |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 1843 | vstatus = hdd_roam_deregister_sta( |
| 1844 | adapter, |
| 1845 | sta_ctx->conn_info.peer_macaddr[i]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1846 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1847 | 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] | 1848 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1849 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1850 | } |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1851 | /* set the sta_id and peer mac as 0, all other |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1852 | * reset are done in hdd_connRemoveConnectInfo. |
| 1853 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1854 | sta_ctx->conn_info.sta_id[i] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1855 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 1856 | qdf_mem_zero(&sta_ctx->conn_info.peer_macaddr[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1857 | sizeof(struct qdf_mac_addr)); |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1858 | if (sta_id < HDD_MAX_ADAPTERS) |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1859 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1860 | else |
| 1861 | hdd_debug("invalid sta_id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1862 | } |
| 1863 | } else { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 1864 | sta_id = sta_ctx->conn_info.sta_id[0]; |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1865 | hdd_debug("roam_result: %d", roam_result); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1866 | |
| 1867 | /* clear scan cache for Link Lost */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 1868 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roam_result || |
| 1869 | eCSR_ROAM_RESULT_DISASSOC_IND == roam_result || |
| 1870 | eCSR_ROAM_LOSTLINK == roam_status) { |
Abhishek Singh | 85283ae | 2019-03-08 12:00:51 +0530 | [diff] [blame] | 1871 | wlan_hdd_cfg80211_unlink_bss(adapter, |
Ashish Kumar Dhanotiya | 3d8b0ae | 2019-07-10 20:55:56 +0530 | [diff] [blame] | 1872 | sta_ctx->conn_info.bssid.bytes, |
| 1873 | sta_ctx->conn_info.ssid.SSID.ssId, |
| 1874 | sta_ctx->conn_info.ssid.SSID.length); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1875 | sme_remove_bssid_from_scan_list(mac_handle, |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 1876 | sta_ctx->conn_info.bssid.bytes); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1877 | } |
Rajeev Kumar | 4bc998f | 2017-10-19 14:41:43 -0700 | [diff] [blame] | 1878 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1879 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1880 | else |
| 1881 | hdd_debug("invalid sta_id %d", sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1882 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1883 | /* Clear saved connection information in HDD */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1884 | hdd_conn_remove_connect_info(sta_ctx); |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1885 | /* |
| 1886 | * eConnectionState_Connecting state mean that connection is in |
| 1887 | * progress so no need to set state to eConnectionState_NotConnected |
| 1888 | */ |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 1889 | if ((eConnectionState_Connecting != sta_ctx->conn_info.conn_state)) { |
Srinivas Girigowda | 683726a | 2018-09-07 15:10:40 -0700 | [diff] [blame] | 1890 | hdd_conn_set_connection_state(adapter, |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1891 | eConnectionState_NotConnected); |
Dundi Raviteja | 04037a1 | 2018-08-31 18:41:44 +0530 | [diff] [blame] | 1892 | hdd_set_roaming_in_progress(false); |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1893 | } |
Wu Gao | d7dd6e4 | 2018-10-16 17:22:56 +0800 | [diff] [blame] | 1894 | ucfg_pmo_flush_gtk_offload_req(adapter->vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1895 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1896 | if ((QDF_STA_MODE == adapter->device_mode) || |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1897 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
| 1898 | sme_ps_disable_auto_ps_timer(mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 1899 | adapter->vdev_id); |
Yeshwanth Sriram Guntuka | 4fe30bd | 2018-06-13 11:41:42 +0530 | [diff] [blame] | 1900 | adapter->send_mode_change = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1901 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1902 | wlan_hdd_clear_link_layer_stats(adapter); |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1903 | |
Bala Venkatesh | 9f95814 | 2018-06-27 12:36:08 +0530 | [diff] [blame] | 1904 | hdd_debug("check for SAP restart"); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1905 | policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->psoc); |
Jeff Johnson | 6ced42c | 2017-10-20 12:48:11 -0700 | [diff] [blame] | 1906 | adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0; |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1907 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1908 | /* Unblock anyone waiting for disconnect to complete */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1909 | complete(&adapter->disconnect_comp_var); |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 1910 | |
Alok Kumar | b64650c | 2018-03-23 17:05:11 +0530 | [diff] [blame] | 1911 | hdd_nud_reset_tracking(adapter); |
| 1912 | |
| 1913 | hdd_set_disconnect_status(adapter, false); |
| 1914 | |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 1915 | hdd_reset_limit_off_chan(adapter); |
| 1916 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1917 | hdd_print_bss_info(sta_ctx); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1918 | |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 1919 | if (policy_mgr_is_sta_active_connection_exists(hdd_ctx->psoc)) |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1920 | sme_enable_roaming_on_connected_sta(mac_handle); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1921 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1922 | return status; |
| 1923 | } |
| 1924 | |
| 1925 | /** |
| 1926 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1927 | * @vdev_id: vdevid |
| 1928 | * |
| 1929 | * Return: None |
| 1930 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1931 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1932 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1933 | struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 1934 | struct hdd_adapter *adapter = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1935 | |
Ashish Kumar Dhanotiya | ab2a929 | 2018-06-16 15:11:27 +0530 | [diff] [blame] | 1936 | if (!hdd_ctx) { |
| 1937 | hdd_err("Invalid hdd context"); |
| 1938 | return; |
| 1939 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1940 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1941 | if (!adapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1942 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1943 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | } |
| 1945 | complete(&adapter->sta_authorized_event); |
| 1946 | } |
| 1947 | |
| 1948 | /** |
| 1949 | * hdd_change_peer_state() - change peer state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1950 | * @adapter: HDD adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1951 | * @sta_state: peer state |
| 1952 | * @roam_synch_in_progress: roam synch in progress |
| 1953 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1954 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1955 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1956 | QDF_STATUS hdd_change_peer_state(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1957 | uint8_t sta_id, |
| 1958 | enum ol_txrx_peer_state sta_state, |
| 1959 | bool roam_synch_in_progress) |
| 1960 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1961 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1962 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1963 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1964 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1965 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1966 | |
| 1967 | if (!pdev) { |
| 1968 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1969 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1970 | } |
| 1971 | |
| 1972 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1973 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1974 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1975 | } |
| 1976 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1977 | peer = cdp_peer_find_by_local_id(soc, |
| 1978 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1979 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1980 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1981 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1982 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 1983 | if (!peer_mac_addr) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1984 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1985 | return QDF_STATUS_E_FAULT; |
| 1986 | } |
| 1987 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1988 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1989 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1990 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1991 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1992 | } |
| 1993 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1994 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1995 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1996 | #endif |
| 1997 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1998 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Abhinav Kumar | 2b431b6 | 2019-03-18 20:23:58 +0530 | [diff] [blame] | 1999 | /* Reset scan reject params on successful set key */ |
| 2000 | hdd_debug("Reset scan reject params"); |
| 2001 | hdd_init_scan_reject_params(adapter->hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2002 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 2003 | /* make sure event is reset */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2004 | INIT_COMPLETION(adapter->sta_authorized_event); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2005 | #endif |
| 2006 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 2007 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2008 | hdd_set_peer_authorized_event, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2009 | adapter->vdev_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2010 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2011 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2012 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2013 | } |
| 2014 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2015 | if (adapter->device_mode == QDF_STA_MODE || |
| 2016 | adapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2017 | #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] | 2018 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2019 | unsigned long rc; |
| 2020 | |
| 2021 | /* wait for event from firmware to set the event */ |
| 2022 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2023 | &adapter->sta_authorized_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2024 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2025 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2026 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2027 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2028 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 2029 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 2030 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2031 | #endif |
| 2032 | } |
| 2033 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2034 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2035 | } |
| 2036 | |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2037 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
Sourav Mohapatra | a93de1c | 2019-08-01 14:48:10 +0530 | [diff] [blame] | 2038 | struct qdf_mac_addr *mac_addr, |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2039 | uint32_t vdev_param, |
| 2040 | bool is_link_up) |
| 2041 | { |
| 2042 | struct cdp_vdev *data_vdev; |
| 2043 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2044 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2045 | struct hdd_context *hdd_ctx; |
Yun Park | 0dad100 | 2017-07-14 14:57:01 -0700 | [diff] [blame] | 2046 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2047 | struct wlan_objmgr_psoc **psoc; |
| 2048 | |
| 2049 | if (!cbk_data) |
| 2050 | return status; |
| 2051 | |
| 2052 | psoc = cbk_data; |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2053 | |
Kabilan Kannan | c0e3d58 | 2017-09-13 00:26:33 -0700 | [diff] [blame] | 2054 | hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Sourav Mohapatra | 5febc93 | 2018-01-08 14:38:30 +0530 | [diff] [blame] | 2055 | if (!hdd_ctx) { |
| 2056 | hdd_err("Invalid HDD Context"); |
| 2057 | return QDF_STATUS_E_INVAL; |
| 2058 | } |
| 2059 | |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2060 | if (!hdd_ctx->tdls_nap_active) |
| 2061 | return status; |
| 2062 | |
Sourav Mohapatra | a93de1c | 2019-08-01 14:48:10 +0530 | [diff] [blame] | 2063 | data_vdev = cdp_peer_get_vdev_by_peer_addr(soc, pdev, *mac_addr); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2064 | if (!data_vdev) { |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2065 | status = QDF_STATUS_E_FAILURE; |
| 2066 | return status; |
| 2067 | } |
| 2068 | |
| 2069 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 2070 | |
| 2071 | return status; |
| 2072 | } |
| 2073 | |
| 2074 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2075 | * hdd_roam_register_sta() - register station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2076 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2077 | * @roam_info: pointer to roam info |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2078 | * @sta_id: station identifier |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 2079 | * @bss_desc: pointer to BSS description |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2080 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2081 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2082 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2083 | QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2084 | struct csr_roam_info *roam_info, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2085 | uint8_t sta_id, |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 2086 | struct bss_description *bss_desc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2087 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2088 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Sourav Mohapatra | 3646a85 | 2019-07-29 09:08:40 +0530 | [diff] [blame] | 2089 | struct ol_txrx_desc_type txrx_desc = {0}; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2090 | 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] | 2091 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2092 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2093 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2094 | |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 2095 | if (!bss_desc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2096 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2097 | |
| 2098 | /* Get the Station ID from the one saved during the association */ |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2099 | txrx_desc.sta_id = sta_id; |
Sourav Mohapatra | 3646a85 | 2019-07-29 09:08:40 +0530 | [diff] [blame] | 2100 | WLAN_ADDR_COPY(txrx_desc.peer_addr.bytes, roam_info->bssid.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2101 | |
| 2102 | /* set the QoS field appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2103 | if (hdd_wmm_is_active(adapter)) |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2104 | txrx_desc.is_qos_enabled = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2105 | else |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2106 | txrx_desc.is_qos_enabled = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2107 | |
| 2108 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 2109 | hdd_debug("WAPI STA Registered: %d", |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2110 | adapter->wapi_info.is_wapi_sta); |
| 2111 | if (adapter->wapi_info.is_wapi_sta) |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2112 | txrx_desc.is_wapi_supported = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2113 | else |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2114 | txrx_desc.is_wapi_supported = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | #endif /* FEATURE_WLAN_WAPI */ |
| 2116 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 2117 | /* Register the vdev transmit and receive functions */ |
| 2118 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
Mohit Khanna | 7032200 | 2018-05-15 19:21:32 -0700 | [diff] [blame] | 2119 | |
| 2120 | if (adapter->hdd_ctx->enable_dp_rx_threads) { |
| 2121 | txrx_ops.rx.rx = hdd_rx_pkt_thread_enqueue_cbk; |
| 2122 | txrx_ops.rx.rx_stack = hdd_rx_packet_cbk; |
Mohit Khanna | f0620ce | 2019-07-28 21:31:05 -0700 | [diff] [blame] | 2123 | txrx_ops.rx.rx_gro_flush = hdd_rx_thread_gro_flush_ind_cbk; |
Mohit Khanna | 7032200 | 2018-05-15 19:21:32 -0700 | [diff] [blame] | 2124 | } else { |
| 2125 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
| 2126 | txrx_ops.rx.rx_stack = NULL; |
| 2127 | } |
| 2128 | |
Poddar, Siddarth | 31797fa | 2018-01-22 17:24:15 +0530 | [diff] [blame] | 2129 | txrx_ops.rx.stats_rx = hdd_tx_rx_collect_connectivity_stats_info; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2130 | |
hqu | 28f68df | 2019-07-02 23:10:08 +0800 | [diff] [blame] | 2131 | adapter->txrx_vdev = cdp_get_vdev_from_vdev_id(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2132 | (struct cdp_pdev *)pdev, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2133 | adapter->vdev_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2134 | if (!adapter->txrx_vdev) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2135 | return QDF_STATUS_E_FAILURE; |
| 2136 | } |
| 2137 | |
| 2138 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2139 | cdp_vdev_register(soc, |
hqu | 28f68df | 2019-07-02 23:10:08 +0800 | [diff] [blame] | 2140 | adapter->txrx_vdev, adapter, |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2141 | (struct cdp_ctrl_objmgr_vdev *)adapter->vdev, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2142 | if (!txrx_ops.tx.tx) { |
| 2143 | hdd_err("%s vdev register fail", __func__); |
| 2144 | return QDF_STATUS_E_FAILURE; |
| 2145 | } |
| 2146 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2147 | adapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2148 | qdf_status = cdp_peer_register(soc, |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2149 | (struct cdp_pdev *)pdev, &txrx_desc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2150 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2151 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2152 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2153 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2154 | } |
| 2155 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2156 | if (!roam_info->fAuthRequired) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2157 | /* |
| 2158 | * Connections that do not need Upper layer auth, transition |
| 2159 | * TLSHIM directly to 'Authenticated' state |
| 2160 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2161 | qdf_status = |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2162 | hdd_change_peer_state(adapter, txrx_desc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2163 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2164 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2165 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2166 | #else |
| 2167 | false |
| 2168 | #endif |
| 2169 | ); |
| 2170 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2171 | hdd_conn_set_authenticated(adapter, true); |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2172 | hdd_objmgr_set_peer_mlme_auth_state(adapter->vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2173 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2174 | 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] | 2175 | sta_ctx->conn_info.sta_id[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2176 | qdf_status = |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 2177 | hdd_change_peer_state(adapter, txrx_desc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2178 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2179 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2180 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2181 | #else |
| 2182 | false |
| 2183 | #endif |
| 2184 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2185 | hdd_conn_set_authenticated(adapter, false); |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2186 | hdd_objmgr_set_peer_mlme_auth_state(adapter->vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2187 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2188 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2189 | } |
| 2190 | |
| 2191 | /** |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2192 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 2193 | * @dev: network device |
| 2194 | * @bss: cfg80211 roamed bss pointer |
| 2195 | * @req_ie: IEs used in reassociation request |
| 2196 | * @req_ie_len: Length of the @req_ie |
| 2197 | * @resp_ie: IEs received in successful reassociation response |
| 2198 | * @resp_ie_len: Length of @resp_ie |
| 2199 | * |
| 2200 | * Return: none |
| 2201 | */ |
| 2202 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 2203 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 2204 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 2205 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 2206 | size_t req_ie_len, const uint8_t *resp_ie, |
| 2207 | size_t resp_ie_len) |
| 2208 | { |
| 2209 | struct cfg80211_roam_info info = {0}; |
| 2210 | |
| 2211 | info.bss = bss; |
| 2212 | info.req_ie = req_ie; |
| 2213 | info.req_ie_len = req_ie_len; |
| 2214 | info.resp_ie = resp_ie; |
| 2215 | info.resp_ie_len = resp_ie_len; |
| 2216 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 2217 | } |
| 2218 | #else |
| 2219 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 2220 | struct cfg80211_bss *bss, |
| 2221 | const uint8_t *req_ie, size_t req_ie_len, |
| 2222 | const uint8_t *resp_ie, |
| 2223 | size_t resp_ie_len) |
| 2224 | { |
| 2225 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 2226 | GFP_KERNEL); |
| 2227 | } |
| 2228 | #endif |
| 2229 | |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2230 | #if defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2231 | #if defined(WLAN_FEATURE_FILS_SK) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2232 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2233 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2234 | { |
| 2235 | uint8_t *kek; |
| 2236 | uint32_t kek_len; |
| 2237 | |
| 2238 | if (is_reassoc) { |
| 2239 | kek = csr_roam_info->kek; |
| 2240 | kek_len = csr_roam_info->kek_len; |
| 2241 | } else { |
| 2242 | /* |
| 2243 | * This should come for FILS case only. |
| 2244 | * Caller should make sure fils_join_rsp is |
| 2245 | * not NULL, if there is need to use else where. |
| 2246 | */ |
| 2247 | kek = csr_roam_info->fils_join_rsp->kek; |
| 2248 | kek_len = csr_roam_info->fils_join_rsp->kek_len; |
| 2249 | } |
| 2250 | |
Pragaspathi Thilagaraj | eb36728 | 2019-02-19 00:42:28 +0530 | [diff] [blame] | 2251 | wlan_hdd_save_gtk_offload_params(adapter, NULL, 0, kek, kek_len, |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2252 | csr_roam_info->replay_ctr, true); |
| 2253 | |
| 2254 | hdd_debug("Kek len %d", kek_len); |
| 2255 | } |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2256 | #else |
| 2257 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2258 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2259 | { |
| 2260 | uint8_t *kek; |
| 2261 | uint32_t kek_len; |
| 2262 | |
| 2263 | /* |
| 2264 | * is_reassoc is set to true always for Legacy GTK offload |
| 2265 | * case, It is false only for FILS case |
| 2266 | */ |
| 2267 | kek = csr_roam_info->kek; |
| 2268 | kek_len = csr_roam_info->kek_len; |
| 2269 | |
Pragaspathi Thilagaraj | eb36728 | 2019-02-19 00:42:28 +0530 | [diff] [blame] | 2270 | wlan_hdd_save_gtk_offload_params(adapter, NULL, 0, kek, kek_len, |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2271 | csr_roam_info->replay_ctr, true); |
| 2272 | |
| 2273 | hdd_debug("Kek len %d", kek_len); |
| 2274 | } |
| 2275 | #endif |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2276 | #endif |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2277 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2278 | * hdd_send_re_assoc_event() - send reassoc event |
| 2279 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2280 | * @adapter: pointer to adapter |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2281 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2282 | * @reqRsnIe: pointer to RSN Information element |
| 2283 | * @reqRsnLength: length of RSN IE |
| 2284 | * |
| 2285 | * Return: none |
| 2286 | */ |
| 2287 | static void hdd_send_re_assoc_event(struct net_device *dev, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2288 | struct hdd_adapter *adapter, struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2289 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2290 | { |
| 2291 | unsigned int len = 0; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2292 | u8 *assoc_rsp = NULL; |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2293 | 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] | 2294 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2295 | uint32_t rsp_rsn_lemgth = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2296 | struct ieee80211_channel *chan; |
Srinivas Girigowda | b8fdc64 | 2019-03-19 15:33:03 -0700 | [diff] [blame] | 2297 | 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] | 2298 | uint8_t *buf_ptr, ssid_ie_len; |
| 2299 | struct cfg80211_bss *bss = NULL; |
| 2300 | uint8_t *final_req_ie = NULL; |
| 2301 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2302 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2303 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2304 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2305 | |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2306 | if (!rsp_rsn_ie) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2307 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2308 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2309 | } |
| 2310 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2311 | if (!assoc_req_ies) { |
| 2312 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2313 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2314 | } |
Rajeev Kumar Sirasanagandla | e5582aa | 2018-05-02 18:20:20 +0530 | [diff] [blame] | 2315 | |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 2316 | if (!roam_info || !roam_info->bss_desc) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2317 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2318 | goto done; |
| 2319 | } |
| 2320 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2321 | if (roam_info->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2322 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2323 | goto done; |
| 2324 | } |
| 2325 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2326 | assoc_rsp = |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2327 | (u8 *) (roam_info->pbFrames + roam_info->nBeaconLength + |
| 2328 | roam_info->nAssocReqLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2329 | if (!assoc_rsp) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2330 | goto done; |
| 2331 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2332 | /* assoc_rsp needs to point to the IEs */ |
| 2333 | assoc_rsp += FT_ASSOC_RSP_IES_OFFSET; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2334 | |
| 2335 | /* |
| 2336 | * Active session count is decremented upon disconnection, but during |
| 2337 | * roaming, there is no disconnect indication and hence active session |
| 2338 | * count is not decremented. |
| 2339 | * After roaming is completed, active session count is incremented |
| 2340 | * as a part of connect indication but effectively after roaming the |
| 2341 | * active session count should still be the same and hence upon |
| 2342 | * successful reassoc decrement the active session count here. |
| 2343 | */ |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2344 | if (!hdd_is_roam_sync_in_progress(roam_info)) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 2345 | policy_mgr_decr_session_set_pcl(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2346 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 2347 | hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 2348 | false); |
| 2349 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2350 | |
| 2351 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2352 | len = roam_info->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2353 | rsp_rsn_lemgth = len; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2354 | qdf_mem_copy(rsp_rsn_ie, assoc_rsp, len); |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2355 | qdf_mem_zero(rsp_rsn_ie + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2356 | |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 2357 | chan = ieee80211_get_channel(adapter->wdev.wiphy, |
| 2358 | roam_info->bss_desc->chan_freq); |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2359 | |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2360 | sme_roam_get_connect_profile(hdd_ctx->mac_handle, adapter->vdev_id, |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2361 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2362 | |
Abhishek Singh | 59cdca1 | 2019-03-08 13:48:20 +0530 | [diff] [blame] | 2363 | bss = wlan_cfg80211_get_bss(adapter->wdev.wiphy, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2364 | chan, roam_info->bssid.bytes, |
Abhishek Singh | 59cdca1 | 2019-03-08 13:48:20 +0530 | [diff] [blame] | 2365 | &roam_profile.SSID.ssId[0], |
| 2366 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2367 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2368 | if (!bss) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2369 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2370 | buf_ptr = buf_ssid_ie; |
Srinivas Girigowda | 6177126 | 2019-04-01 11:55:19 -0700 | [diff] [blame] | 2371 | *buf_ptr = WLAN_ELEMID_SSID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2372 | buf_ptr++; |
| 2373 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2374 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2375 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2376 | roam_profile.SSID.length); |
| 2377 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2378 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2379 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2380 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2381 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2382 | if (!final_req_ie) { |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2383 | if (bss) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2384 | cfg80211_put_bss(adapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2385 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2386 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2387 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2388 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2389 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2390 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2391 | qdf_mem_copy(rsp_rsn_ie, assoc_rsp, len); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2392 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2393 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2394 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2395 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2396 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2397 | hdd_send_roamed_ind(dev, bss, final_req_ie, |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2398 | (ssid_ie_len + reqRsnLength), rsp_rsn_ie, |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2399 | rsp_rsn_lemgth); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2400 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2401 | qdf_mem_copy(assoc_req_ies, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2402 | (u8 *)roam_info->pbFrames + roam_info->nBeaconLength, |
| 2403 | roam_info->nAssocReqLength); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2404 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2405 | hdd_save_gtk_params(adapter, roam_info, true); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2406 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2407 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2408 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2409 | assoc_req_ies, roam_info->nAssocReqLength); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2410 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2411 | wlan_hdd_send_roam_auth_event(adapter, roam_info->bssid.bytes, |
| 2412 | assoc_req_ies, roam_info->nAssocReqLength, |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2413 | rsp_rsn_ie, rsp_rsn_lemgth, |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2414 | roam_info); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2415 | |
Jeff Johnson | 5fc4aaa | 2019-03-10 15:03:18 -0700 | [diff] [blame] | 2416 | hdd_update_hlp_info(dev, roam_info); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2417 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2418 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2419 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2420 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2421 | qdf_mem_free(final_req_ie); |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2422 | qdf_mem_free(rsp_rsn_ie); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2423 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2424 | } |
| 2425 | |
| 2426 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2427 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2428 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2429 | * |
| 2430 | * Return: roam sync status if roaming offloaded else false |
| 2431 | */ |
| 2432 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2433 | bool hdd_is_roam_sync_in_progress(struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2434 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2435 | if (roaminfo) |
| 2436 | return roaminfo->roamSynchInProgress; |
| 2437 | else |
| 2438 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2439 | } |
| 2440 | #endif |
| 2441 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2442 | /** |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2443 | * 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] | 2444 | * @hddstactx: pointer to HDD sta context |
| 2445 | * @roaminfo: pointer to roaminfo structure |
| 2446 | * |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2447 | * This function returns sta_id for IBSS peer. If peer is broadcast |
| 2448 | * 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] | 2449 | * the peer. |
| 2450 | * |
| 2451 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2452 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2453 | static uint8_t hdd_get_ibss_peer_sta_id(struct hdd_station_ctx *hddstactx, |
| 2454 | struct csr_roam_info *roaminfo) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2455 | { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2456 | uint8_t sta_id = HDD_WLAN_INVALID_STA_ID; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2457 | QDF_STATUS status; |
| 2458 | |
| 2459 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2460 | sta_id = 0; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2461 | } else { |
| 2462 | status = hdd_get_peer_sta_id(hddstactx, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2463 | &roaminfo->peerMac, &sta_id); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2464 | if (status != QDF_STATUS_SUCCESS) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2465 | hdd_err("Unable to find station ID for " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2466 | QDF_MAC_ADDR_STR, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2467 | QDF_MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2468 | } |
| 2469 | } |
| 2470 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2471 | return sta_id; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2472 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2473 | |
| 2474 | /** |
| 2475 | * hdd_change_sta_state_authenticated()- |
| 2476 | * This function changes STA state to authenticated |
| 2477 | * @adapter: pointer to the adapter structure. |
| 2478 | * @roaminfo: pointer to the RoamInfo structure. |
| 2479 | * |
| 2480 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2481 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2482 | * |
| 2483 | * Return: 0 on success and errno on failure |
| 2484 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2485 | static int hdd_change_sta_state_authenticated(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2486 | struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2487 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2488 | QDF_STATUS status; |
Pragaspathi Thilagaraj | 784c492 | 2018-12-02 22:47:29 +0530 | [diff] [blame] | 2489 | uint32_t timeout, auto_bmps_timer_val; |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2490 | uint8_t sta_id = HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2491 | struct hdd_station_ctx *hddstactx = |
| 2492 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2493 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2494 | |
Pragaspathi Thilagaraj | 784c492 | 2018-12-02 22:47:29 +0530 | [diff] [blame] | 2495 | ucfg_mlme_get_auto_bmps_timer_value(hdd_ctx->psoc, |
| 2496 | &auto_bmps_timer_val); |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 2497 | timeout = hddstactx->hdd_reassoc_scenario ? |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2498 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Pragaspathi Thilagaraj | 784c492 | 2018-12-02 22:47:29 +0530 | [diff] [blame] | 2499 | (auto_bmps_timer_val * 1000); |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2500 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2501 | if (QDF_IBSS_MODE == adapter->device_mode) |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2502 | sta_id = hdd_get_ibss_peer_sta_id(hddstactx, roaminfo); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2503 | else |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2504 | sta_id = hddstactx->conn_info.sta_id[0]; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2505 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2506 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", |
| 2507 | sta_id); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2508 | |
| 2509 | /* Connections that do not need Upper layer authentication, |
| 2510 | * transition TL to 'Authenticated' state after the keys are set |
| 2511 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 2512 | status = hdd_change_peer_state(adapter, sta_id, OL_TXRX_PEER_STATE_AUTH, |
| 2513 | hdd_is_roam_sync_in_progress(roaminfo)); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2514 | hdd_conn_set_authenticated(adapter, true); |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 2515 | hdd_objmgr_set_peer_mlme_auth_state(adapter->vdev, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2516 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2517 | if ((QDF_STA_MODE == adapter->device_mode) || |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2518 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
| 2519 | sme_ps_enable_auto_ps_timer(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2520 | adapter->vdev_id, |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2521 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2522 | } |
| 2523 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2524 | return qdf_status_to_os_return(status); |
| 2525 | } |
| 2526 | |
| 2527 | /** |
| 2528 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2529 | * if key installation is required |
| 2530 | * @encr_type: encryption type |
| 2531 | * |
| 2532 | * Return: true if key installation is required and false otherwise. |
| 2533 | */ |
| 2534 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2535 | eCsrEncryptionType encr_type) |
| 2536 | { |
| 2537 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2538 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2539 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2540 | eCSR_ENCRYPT_TYPE_AES_GCMP == encr_type || |
| 2541 | eCSR_ENCRYPT_TYPE_AES_GCMP_256 == encr_type || |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2542 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2543 | return true; |
| 2544 | else |
| 2545 | return false; |
| 2546 | } |
| 2547 | |
| 2548 | /** |
| 2549 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2550 | * complete |
| 2551 | * @adapter: pointer to HDD adapter |
| 2552 | * @roaminfo: pointer to roam info |
| 2553 | * @roam_result: roam result |
| 2554 | * |
| 2555 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2556 | * This function checks for the successful set key completion and update |
| 2557 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2558 | * |
| 2559 | * Return: None |
| 2560 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2561 | 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] | 2562 | struct csr_roam_info *roaminfo, |
| 2563 | eCsrRoamResult roam_result) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2564 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2565 | struct hdd_station_ctx *hdd_sta_ctx = |
| 2566 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | b195984 | 2019-02-27 13:04:04 -0800 | [diff] [blame] | 2567 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.uc_encrypt_type; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2568 | |
| 2569 | /* |
| 2570 | * If the security mode is one of the following, IBSS peer will be |
| 2571 | * waiting in CONN state and we will move the peer state to AUTH |
| 2572 | * here. For non-secure connection, no need to wait for set-key complete |
| 2573 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2574 | */ |
| 2575 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2576 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2577 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2578 | |
| 2579 | return; |
| 2580 | } |
| 2581 | |
| 2582 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2583 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2584 | /* |
| 2585 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2586 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2587 | * after roaming. STA TL state moves to authenticated only if |
| 2588 | * ptk_installed is true. So, make ptk_installed to true in |
| 2589 | * case of 11R roaming. |
| 2590 | */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2591 | if (sme_neighbor_roam_is11r_assoc(adapter->hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2592 | adapter->vdev_id)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2593 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2594 | } else { |
| 2595 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2596 | } |
| 2597 | |
| 2598 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2599 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2600 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2601 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2602 | * set the unicast and broadcast key. |
| 2603 | */ |
| 2604 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2605 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2606 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2607 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2608 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2609 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2610 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2611 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2612 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2613 | } |
| 2614 | |
| 2615 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2616 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2617 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2618 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2619 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2620 | } |
| 2621 | |
| 2622 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2623 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2624 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2625 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2626 | * @roam_id: roam id |
| 2627 | * @roam_status: roam status |
| 2628 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2629 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2630 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2631 | */ |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2632 | static QDF_STATUS |
| 2633 | hdd_roam_set_key_complete_handler(struct hdd_adapter *adapter, |
| 2634 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2635 | uint32_t roam_id, |
| 2636 | eRoamCmdStatus roam_status, |
| 2637 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2638 | { |
Jeff Johnson | e16f082 | 2019-03-10 18:27:30 -0700 | [diff] [blame] | 2639 | eCsrEncryptionType algorithm; |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2640 | bool connected = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2641 | 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] | 2642 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 2643 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2644 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2645 | if (!roam_info) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2646 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2647 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2648 | } |
| 2649 | /* |
| 2650 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2651 | * then go to 'authenticated'. For all other authentication types |
| 2652 | * (those that do not require upper layer authentication) we can put TL |
| 2653 | * directly into 'authenticated' state. |
| 2654 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2655 | hdd_debug("Set Key completion roam_status =%d roam_result=%d " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 2656 | QDF_MAC_ADDR_STR, roam_status, roam_result, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 2657 | QDF_MAC_ADDR_ARRAY(roam_info->peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2658 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2659 | connected = hdd_conn_get_connected_cipher_algo(sta_ctx, |
Jeff Johnson | e16f082 | 2019-03-10 18:27:30 -0700 | [diff] [blame] | 2660 | &algorithm); |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2661 | if (connected) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2662 | hdd_change_peer_state_after_set_key(adapter, roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2663 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2664 | } |
| 2665 | |
Jianmin Zhu | 4bcf837 | 2018-12-27 19:38:55 +0800 | [diff] [blame] | 2666 | if (!adapter->hdd_ctx || !adapter->hdd_ctx->psoc) { |
| 2667 | hdd_err("hdd_ctx or psoc is NULL"); |
| 2668 | return QDF_STATUS_E_FAILURE; |
| 2669 | } |
| 2670 | policy_mgr_restart_opportunistic_timer(adapter->hdd_ctx->psoc, false); |
| 2671 | |
Dustin Brown | e74003f | 2018-03-14 12:51:58 -0700 | [diff] [blame] | 2672 | hdd_exit(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2673 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2674 | } |
| 2675 | |
| 2676 | /** |
| 2677 | * hdd_perform_roam_set_key_complete() - perform set key complete |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2678 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2679 | * |
| 2680 | * Return: none |
| 2681 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2682 | void hdd_perform_roam_set_key_complete(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2683 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2684 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2685 | 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] | 2686 | struct csr_roam_info *roam_info; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2687 | |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2688 | roam_info = qdf_mem_malloc(sizeof(*roam_info)); |
| 2689 | if (!roam_info) |
| 2690 | return; |
| 2691 | roam_info->fAuthRequired = false; |
| 2692 | qdf_mem_copy(roam_info->bssid.bytes, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2693 | sta_ctx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2694 | qdf_mem_copy(roam_info->peerMac.bytes, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2695 | sta_ctx->roam_info.peer_mac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2696 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2697 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2698 | hdd_roam_set_key_complete_handler(adapter, |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2699 | roam_info, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2700 | sta_ctx->roam_info.roam_id, |
| 2701 | sta_ctx->roam_info.roam_status, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2702 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2703 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2704 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2705 | |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2706 | sta_ctx->roam_info.defer_key_complete = false; |
Min Liu | 3621ede | 2018-11-07 18:36:00 +0800 | [diff] [blame] | 2707 | qdf_mem_free(roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2708 | } |
| 2709 | |
Vignesh Viswanathan | 3fa1d38 | 2017-08-02 19:36:43 +0530 | [diff] [blame] | 2710 | #if defined(WLAN_FEATURE_FILS_SK) && \ |
| 2711 | (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \ |
| 2712 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))) |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2713 | void hdd_clear_fils_connection_info(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2714 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2715 | struct csr_roam_profile *roam_profile; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2716 | |
| 2717 | if ((adapter->device_mode == QDF_SAP_MODE) || |
| 2718 | (adapter->device_mode == QDF_P2P_GO_MODE)) |
| 2719 | return; |
| 2720 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2721 | roam_profile = hdd_roam_profile(adapter); |
| 2722 | if (roam_profile->fils_con_info) { |
| 2723 | qdf_mem_free(roam_profile->fils_con_info); |
| 2724 | roam_profile->fils_con_info = NULL; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2725 | } |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2726 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2727 | if (roam_profile->hlp_ie) { |
| 2728 | qdf_mem_free(roam_profile->hlp_ie); |
| 2729 | roam_profile->hlp_ie = NULL; |
| 2730 | roam_profile->hlp_ie_len = 0; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2731 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2732 | } |
| 2733 | #endif |
| 2734 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2735 | /** |
| 2736 | * hdd_association_completion_handler() - association completion handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2737 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2738 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2739 | * @roam_id: roam id |
| 2740 | * @roam_status: roam status |
| 2741 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2742 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2743 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2745 | static QDF_STATUS |
| 2746 | hdd_association_completion_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2747 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2748 | uint32_t roam_id, |
| 2749 | eRoamCmdStatus roam_status, |
| 2750 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2751 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2752 | struct net_device *dev = adapter->dev; |
| 2753 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2754 | 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] | 2755 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2756 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2757 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2758 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2759 | bool hddDisconInProgress = false; |
| 2760 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2761 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2762 | bool ok; |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2763 | mac_handle_t mac_handle; |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 2764 | uint8_t conn_info_channel; |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 2765 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2766 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2767 | if (!hdd_ctx) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2768 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2769 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2770 | } |
| 2771 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2772 | /* validate config */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2773 | if (!hdd_ctx->config) { |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2774 | hdd_err("config is NULL"); |
| 2775 | return QDF_STATUS_E_NULL_VALUE; |
| 2776 | } |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 2777 | |
| 2778 | /* |
Paul Zhang | cb573e0 | 2018-11-06 10:37:16 +0800 | [diff] [blame] | 2779 | * reset scan reject params if connection is success or we received |
| 2780 | * final failure from CSR after trying with all APs. |
| 2781 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2782 | hdd_reset_scan_reject_params(hdd_ctx, roam_status, roam_result); |
Paul Zhang | cb573e0 | 2018-11-06 10:37:16 +0800 | [diff] [blame] | 2783 | |
| 2784 | /* |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 2785 | * Enable roaming on other STA iface except this one. |
| 2786 | * Firmware dosent support connection on one STA iface while |
| 2787 | * roaming on other STA iface |
| 2788 | */ |
| 2789 | wlan_hdd_enable_roaming(adapter); |
| 2790 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2791 | /* HDD has initiated disconnect, do not send connect result indication |
| 2792 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2793 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2794 | if (((eConnectionState_Disconnecting == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 2795 | sta_ctx->conn_info.conn_state) || |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2796 | (eConnectionState_NotConnected == |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 2797 | sta_ctx->conn_info.conn_state)) && |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2798 | ((eCSR_ROAM_RESULT_ASSOCIATED == roam_result) || |
| 2799 | (eCSR_ROAM_ASSOCIATION_FAILURE == roam_status))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2800 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 2801 | sta_ctx->conn_info.conn_state, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2802 | roam_result, roam_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2803 | hddDisconInProgress = true; |
| 2804 | } |
| 2805 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2806 | mac_handle = hdd_ctx->mac_handle; |
| 2807 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 2808 | if (eCSR_ROAM_RESULT_ASSOCIATED == roam_result) { |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2809 | if (!roam_info) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2810 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2811 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2812 | } |
| 2813 | if (!hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2814 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2815 | eConnectionState_Associated); |
| 2816 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2817 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2818 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2819 | hdd_conn_save_connect_info(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2820 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2821 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2822 | if (hdd_add_beacon_filter(adapter) != 0) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2823 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2824 | #ifdef FEATURE_WLAN_WAPI |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2825 | if (roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2826 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2827 | || roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2828 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2829 | adapter->wapi_info.is_wapi_sta = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2830 | } else { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2831 | adapter->wapi_info.is_wapi_sta = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2832 | } |
| 2833 | #endif /* FEATURE_WLAN_WAPI */ |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 2834 | hdd_debug("bss_descr[%d] devicemode[%d]", !!roam_info->bss_desc, |
| 2835 | adapter->device_mode); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2836 | if ((QDF_STA_MODE == adapter->device_mode) && |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 2837 | roam_info->bss_desc) { |
| 2838 | ie_len = GET_IE_LEN_IN_BSS(roam_info->bss_desc->length); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2839 | sta_ctx->ap_supports_immediate_power_save = |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2840 | wlan_hdd_is_ap_supports_immediate_power_save( |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 2841 | (uint8_t *)roam_info->bss_desc->ieFields, |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2842 | ie_len); |
| 2843 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2844 | sta_ctx->ap_supports_immediate_power_save); |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2845 | } |
| 2846 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2847 | /* Indicate 'connect' status to user space */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2848 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2849 | |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 2850 | if (policy_mgr_is_mcc_in_24G(hdd_ctx->psoc)) { |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2851 | if (hdd_ctx->miracast_value) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2852 | wlan_hdd_set_mas(adapter, |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2853 | hdd_ctx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2854 | } |
| 2855 | |
| 2856 | /* Initialize the Linkup event completion variable */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2857 | INIT_COMPLETION(adapter->linkup_event_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2858 | |
| 2859 | /* |
| 2860 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2861 | * the device properly. Before allowing any packet to go up to |
| 2862 | * the application, device activation has to be ensured for |
| 2863 | * proper queue mapping by the kernel. we have registered net |
| 2864 | * device notifier for device change notification. With this we |
| 2865 | * will come to know that the device is getting |
| 2866 | * activated properly. |
| 2867 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2868 | if (sta_ctx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2869 | /* |
| 2870 | * Enable Linkup Event Servicing which allows the net |
| 2871 | * device notifier to set the linkup event variable. |
| 2872 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2873 | adapter->is_link_up_service_needed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2874 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2875 | /* Switch on the Carrier to activate the device */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2876 | wlan_hdd_netif_queue_control(adapter, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2877 | WLAN_NETIF_CARRIER_ON, |
| 2878 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2879 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2880 | /* |
| 2881 | * Wait for the Link to up to ensure all the queues |
| 2882 | * are set properly by the kernel. |
| 2883 | */ |
| 2884 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2885 | &adapter->linkup_event_var, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2886 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2887 | ); |
| 2888 | if (!rc) |
| 2889 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2890 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2891 | /* |
| 2892 | * Disable Linkup Event Servicing - no more service |
| 2893 | * required from the net device notifier call. |
| 2894 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2895 | adapter->is_link_up_service_needed = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2896 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2897 | sta_ctx->ft_carrier_on = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2898 | ft_carrier_on = true; |
| 2899 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 2900 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2901 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2902 | else |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2903 | hdd_err("Wrong Staid: %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2904 | |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 2905 | if (ucfg_ipa_is_enabled()) |
Dustin Brown | 07901ec | 2018-09-07 11:02:41 -0700 | [diff] [blame] | 2906 | ucfg_ipa_wlan_evt(hdd_ctx->pdev, adapter->dev, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 2907 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2908 | adapter->vdev_id, |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 2909 | WLAN_IPA_STA_CONNECT, |
| 2910 | roam_info->bssid.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2911 | |
| 2912 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2913 | wlan_hdd_auto_shutdown_enable(hdd_ctx, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2914 | #endif |
| 2915 | |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 2916 | conn_info_channel = |
| 2917 | wlan_reg_freq_to_chan(hdd_ctx->pdev, |
Jingxiang Ge | ae80dc6 | 2019-08-13 17:32:22 +0800 | [diff] [blame^] | 2918 | sta_ctx->conn_info.chan_freq); |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 2919 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2920 | hdd_debug("check if STA chan ok for DNBS"); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 2921 | if (policy_mgr_is_chan_ok_for_dnbs(hdd_ctx->psoc, |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 2922 | conn_info_channel, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2923 | &ok)) { |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 2924 | hdd_err("Unable to check DNBS eligibility for chan(freq):%u", |
Jingxiang Ge | ae80dc6 | 2019-08-13 17:32:22 +0800 | [diff] [blame^] | 2925 | sta_ctx->conn_info.chan_freq); |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2926 | return QDF_STATUS_E_FAILURE; |
| 2927 | } |
| 2928 | |
| 2929 | if (!ok) { |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 2930 | hdd_err("Chan(freq):%u not suitable for DNBS", |
Jingxiang Ge | ae80dc6 | 2019-08-13 17:32:22 +0800 | [diff] [blame^] | 2931 | sta_ctx->conn_info.chan_freq); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2932 | wlan_hdd_netif_queue_control(adapter, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2933 | WLAN_NETIF_CARRIER_OFF, |
| 2934 | WLAN_CONTROL_PATH); |
| 2935 | if (!hddDisconInProgress) { |
| 2936 | hdd_err("Disconnecting..."); |
| 2937 | sme_roam_disconnect( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2938 | mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2939 | adapter->vdev_id, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2940 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2941 | } |
| 2942 | return QDF_STATUS_E_FAILURE; |
| 2943 | } |
| 2944 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2945 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2946 | adapter->vdev_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2947 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2948 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2949 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2950 | /* |
| 2951 | * For reassoc, the station is already registered, all we need |
| 2952 | * is to change the state of the STA in TL. |
| 2953 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2954 | * CONNECTED instead of AUTHENTICATED. |
| 2955 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2956 | if (!roam_info->fReassocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2957 | struct cfg80211_bss *bss; |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2958 | u8 *assoc_rsp = NULL; |
| 2959 | unsigned int assoc_rsp_len = 0; |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 2960 | u8 *assoc_req = NULL; |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 2961 | unsigned int assoc_req_len = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2962 | struct ieee80211_channel *chan; |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 2963 | uint8_t rsp_rsn_ie[DOT11F_IE_RSN_MAX_LEN]; |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 2964 | uint32_t rsp_rsn_lemgth = DOT11F_IE_RSN_MAX_LEN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2965 | |
| 2966 | /* add bss_id to cfg80211 data base */ |
| 2967 | bss = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2968 | wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2969 | roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 2970 | if (!bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2971 | hdd_err("wlan: Not able to create BSS entry"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2972 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2973 | WLAN_NETIF_CARRIER_OFF, |
| 2974 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2975 | if (!hddDisconInProgress) { |
| 2976 | /* |
| 2977 | * Here driver was not able to add bss |
| 2978 | * in cfg80211 database this can happen |
| 2979 | * if connected channel is not valid, |
| 2980 | * i.e reg domain was changed during |
| 2981 | * connection. Queue disconnect for the |
| 2982 | * session if disconnect is not in |
| 2983 | * progress. |
| 2984 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2985 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2986 | sme_roam_disconnect( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2987 | mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 2988 | adapter->vdev_id, |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2989 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2990 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2991 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2992 | } |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2993 | |
Jeff Johnson | c66d310 | 2018-02-28 11:58:26 -0800 | [diff] [blame] | 2994 | cfg80211_put_bss(hdd_ctx->wiphy, bss); |
| 2995 | |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2996 | /* Association Response */ |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 2997 | assoc_rsp = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2998 | (u8 *) (roam_info->pbFrames + |
| 2999 | roam_info->nBeaconLength + |
| 3000 | roam_info->nAssocReqLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3001 | if (assoc_rsp) { |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3002 | /* |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3003 | * assoc_rsp needs to point to the IEs |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3004 | */ |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3005 | assoc_rsp += FT_ASSOC_RSP_IES_OFFSET; |
| 3006 | assoc_rsp_len = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3007 | roam_info->nAssocRspLength - |
| 3008 | FT_ASSOC_RSP_IES_OFFSET; |
| 3009 | |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3010 | hdd_debug("assoc_rsp_len %d", assoc_rsp_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3011 | hdd_debug("Assoc Rsp IE dump"); |
| 3012 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 3013 | QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3014 | assoc_rsp, |
| 3015 | assoc_rsp_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3016 | } else { |
| 3017 | hdd_debug("AssocRsp is NULL"); |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3018 | assoc_rsp_len = 0; |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3019 | } |
| 3020 | |
| 3021 | /* Association Request */ |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3022 | assoc_req = (u8 *) (roam_info->pbFrames + |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3023 | roam_info->nBeaconLength); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3024 | if (assoc_req) { |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3025 | if (!ft_carrier_on) { |
| 3026 | /* |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3027 | * assoc_req needs to point to |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3028 | * the IEs |
| 3029 | */ |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3030 | assoc_req += |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3031 | FT_ASSOC_REQ_IES_OFFSET; |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3032 | hdd_debug("assoc_req is now at %02x%02x", |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3033 | (unsigned int) |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3034 | assoc_req[0], |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3035 | (unsigned int) |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3036 | assoc_req[1]); |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3037 | assoc_req_len = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3038 | roam_info->nAssocReqLength - |
| 3039 | FT_ASSOC_REQ_IES_OFFSET; |
| 3040 | } else { |
| 3041 | /* |
| 3042 | * This should contain only the |
| 3043 | * FTIEs |
| 3044 | */ |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3045 | assoc_req_len = |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3046 | roam_info->nAssocReqLength; |
| 3047 | } |
| 3048 | |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3049 | hdd_debug("assoc_req_len %d", assoc_req_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3050 | hdd_debug("Assoc/Reassoc Req IE dump"); |
| 3051 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 3052 | QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3053 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3054 | assoc_req_len); |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3055 | } else { |
| 3056 | hdd_debug("AssocReq is NULL"); |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3057 | assoc_req_len = 0; |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3058 | } |
| 3059 | |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 3060 | if ((roam_info->u.pConnectedProfile->AuthType == |
| 3061 | eCSR_AUTH_TYPE_FT_RSN) || |
| 3062 | (roam_info->u.pConnectedProfile->AuthType == |
| 3063 | eCSR_AUTH_TYPE_FT_RSN_PSK) || |
| 3064 | (roam_info->u.pConnectedProfile->AuthType == |
| 3065 | eCSR_AUTH_TYPE_FT_SAE) || |
| 3066 | (roam_info->u.pConnectedProfile->AuthType == |
| 3067 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3068 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 3069 | if (!hddDisconInProgress && |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 3070 | roam_info->bss_desc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 3071 | struct cfg80211_bss *roam_bss; |
| 3072 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3073 | /* |
| 3074 | * After roaming is completed, |
| 3075 | * active session count is |
| 3076 | * incremented as a part of |
| 3077 | * connect indication but |
| 3078 | * effectively the active |
| 3079 | * session count should still |
| 3080 | * be the same and hence upon |
| 3081 | * successful reassoc |
| 3082 | * decrement the active session |
| 3083 | * count here. |
| 3084 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 3085 | if (!hdd_is_roam_sync_in_progress |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3086 | (roam_info)) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3087 | policy_mgr_decr_session_set_pcl( |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3088 | hdd_ctx->psoc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3089 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3090 | adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 3091 | hdd_green_ap_start_state_mc( |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3092 | hdd_ctx, |
| 3093 | adapter->device_mode, |
| 3094 | false); |
| 3095 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3096 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3097 | ft_carrier_on); |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3098 | chan = ieee80211_get_channel( |
| 3099 | adapter->wdev.wiphy, |
| 3100 | roam_info->bss_desc->chan_freq); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 3101 | |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3102 | roam_bss = |
Abhishek Singh | 59cdca1 | 2019-03-08 13:48:20 +0530 | [diff] [blame] | 3103 | wlan_cfg80211_get_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3104 | adapter->wdev.wiphy, |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3105 | chan, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3106 | roam_info->bssid.bytes, |
| 3107 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3108 | pConnectedProfile->SSID.ssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3109 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3110 | pConnectedProfile->SSID.length); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3111 | |
| 3112 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3113 | adapter->vdev_id, |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 3114 | conn_info_channel); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3115 | |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 3116 | hdd_send_roamed_ind( |
| 3117 | dev, |
| 3118 | roam_bss, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3119 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3120 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3121 | assoc_rsp, |
| 3122 | assoc_rsp_len); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3123 | wlan_hdd_send_roam_auth_event( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3124 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3125 | roam_info->bssid.bytes, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3126 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3127 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3128 | assoc_rsp, |
| 3129 | assoc_rsp_len, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3130 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3131 | } |
| 3132 | if (sme_get_ftptk_state |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3133 | (mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3134 | adapter->vdev_id)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3135 | sme_set_ftptk_state |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3136 | (mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3137 | adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3138 | false); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3139 | roam_info->fAuthRequired = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3140 | false; |
| 3141 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3142 | qdf_mem_copy(sta_ctx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3143 | roam_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3144 | roam_info->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3145 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3146 | qdf_mem_copy(sta_ctx-> |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3147 | roam_info.peer_mac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3148 | roam_info->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3149 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3150 | sta_ctx->roam_info.roam_id = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3151 | roam_id; |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3152 | sta_ctx->roam_info.roam_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3153 | roam_status; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3154 | sta_ctx->roam_info. |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3155 | defer_key_complete = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3156 | } |
| 3157 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3158 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3159 | ft_carrier_on); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3160 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3161 | adapter->vdev_id, |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 3162 | conn_info_channel); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3163 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3164 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3165 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3166 | roam_info, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3167 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3168 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3169 | assoc_rsp, |
| 3170 | assoc_rsp_len, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3171 | WLAN_STATUS_SUCCESS, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3172 | GFP_KERNEL, false, |
| 3173 | roam_info->status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3174 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 3175 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3176 | /* |
| 3177 | * wpa supplicant expecting WPA/RSN IE in |
| 3178 | * connect result. |
| 3179 | */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3180 | sme_roam_get_wpa_rsn_req_ie(mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3181 | adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3182 | &reqRsnLength, |
| 3183 | reqRsnIe); |
| 3184 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3185 | sme_roam_get_wpa_rsn_rsp_ie(mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3186 | adapter->vdev_id, |
Jeff Johnson | 7f8d2c3 | 2019-03-09 19:53:42 -0800 | [diff] [blame] | 3187 | &rsp_rsn_lemgth, |
Jeff Johnson | 48b56b1 | 2019-03-09 19:51:48 -0800 | [diff] [blame] | 3188 | rsp_rsn_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3189 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3190 | if (ft_carrier_on) |
| 3191 | hdd_send_re_assoc_event(dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3192 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3193 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | reqRsnIe, |
| 3195 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 3196 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3197 | hdd_debug("sending connect indication to nl80211:for bssid " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3198 | QDF_MAC_ADDR_STR |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3199 | " result:%d and Status:%d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3200 | QDF_MAC_ADDR_ARRAY |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3201 | (roam_info->bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3202 | roam_result, roam_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3203 | |
| 3204 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3205 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3206 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3207 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3208 | roam_info, |
Jeff Johnson | 8152d89 | 2019-03-10 18:37:50 -0700 | [diff] [blame] | 3209 | assoc_req, |
Jeff Johnson | f40f95c | 2019-03-10 18:43:39 -0700 | [diff] [blame] | 3210 | assoc_req_len, |
Jeff Johnson | e2b360b | 2019-03-10 18:39:39 -0700 | [diff] [blame] | 3211 | assoc_rsp, |
| 3212 | assoc_rsp_len, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3213 | WLAN_STATUS_SUCCESS, |
| 3214 | GFP_KERNEL, |
| 3215 | false, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3216 | roam_info->status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3217 | } |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3218 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3219 | adapter->vdev_id, |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 3220 | conn_info_channel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | } |
| 3222 | } |
| 3223 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3224 | /* |
| 3225 | * Perform any WMM-related association |
| 3226 | * processing. |
| 3227 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3228 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3229 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3230 | |
| 3231 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 3232 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3233 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3234 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3235 | roam_info, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3236 | sta_ctx->conn_info.sta_id[0], |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 3237 | roam_info->bss_desc); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3238 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3239 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3240 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3241 | WLAN_CONTROL_PATH); |
| 3242 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3243 | } |
| 3244 | } else { |
| 3245 | /* |
| 3246 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 3247 | * in case of reassociation also need to indicate it to |
| 3248 | * supplicant. |
| 3249 | */ |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3250 | sme_roam_get_wpa_rsn_req_ie( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3251 | mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3252 | adapter->vdev_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3253 | &reqRsnLength, reqRsnIe); |
| 3254 | |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3255 | cdp_hl_fc_set_td_limit(soc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3256 | adapter->vdev_id, |
Jingxiang Ge | ce7c547 | 2019-07-23 16:19:23 +0800 | [diff] [blame] | 3257 | conn_info_channel); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3258 | hdd_send_re_assoc_event(dev, adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3259 | reqRsnIe, reqRsnLength); |
| 3260 | /* Reassoc successfully */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3261 | if (roam_info->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3262 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3263 | hdd_change_peer_state(adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3264 | sta_ctx->conn_info.sta_id[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3265 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3266 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3267 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | #else |
| 3269 | false |
| 3270 | #endif |
| 3271 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3272 | hdd_conn_set_authenticated(adapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3273 | hdd_objmgr_set_peer_mlme_auth_state( |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 3274 | adapter->vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3275 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3276 | } else { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3277 | hdd_debug("sta_id: %d Changing TL state to AUTHENTICATED", |
| 3278 | sta_ctx->conn_info.sta_id[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3279 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3280 | hdd_change_peer_state(adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3281 | sta_ctx->conn_info.sta_id[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3282 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3284 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3285 | #else |
| 3286 | false |
| 3287 | #endif |
| 3288 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3289 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3290 | hdd_objmgr_set_peer_mlme_auth_state( |
Dustin Brown | 89fa06e | 2018-09-07 10:47:27 -0700 | [diff] [blame] | 3291 | adapter->vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3292 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3293 | } |
| 3294 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3295 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3296 | /* |
| 3297 | * Perform any WMM-related association |
| 3298 | * processing |
| 3299 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3300 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3301 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3302 | } |
| 3303 | |
| 3304 | /* Start the tx queues */ |
| 3305 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3306 | if (roam_info->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3307 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | #endif |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3309 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3310 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3311 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3312 | WLAN_CONTROL_PATH); |
| 3313 | } |
| 3314 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3315 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3316 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3317 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3318 | } |
| 3319 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 3320 | qdf_mem_zero(&adapter->hdd_stats.hdd_pmf_stats, |
| 3321 | sizeof(adapter->hdd_stats.hdd_pmf_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3322 | #endif |
gaurank kathpalia | 7ef7218 | 2019-05-29 19:41:25 +0530 | [diff] [blame] | 3323 | if (adapter->device_mode == QDF_STA_MODE) |
| 3324 | ucfg_blm_update_bssid_connect_params(hdd_ctx->pdev, |
| 3325 | roam_info->bssid, |
| 3326 | BLM_AP_CONNECTED); |
| 3327 | |
Abhishek Singh | bfaebe3 | 2019-03-19 13:37:55 +0530 | [diff] [blame] | 3328 | policy_mgr_check_n_start_opportunistic_timer(hdd_ctx->psoc); |
Frank Liu | 064ebd4 | 2018-05-03 14:22:39 +0800 | [diff] [blame] | 3329 | hdd_debug("check for SAP restart"); |
| 3330 | policy_mgr_check_concurrent_intf_and_restart_sap( |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3331 | hdd_ctx->psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3332 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3333 | bool connect_timeout = false; |
Tushnim Bhattacharyya | 3f78053 | 2018-08-01 19:11:40 -0700 | [diff] [blame] | 3334 | /* do we need to change the HW mode */ |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3335 | policy_mgr_check_n_start_opportunistic_timer(hdd_ctx->psoc); |
Vignesh Viswanathan | 014096a | 2017-12-07 01:24:44 +0530 | [diff] [blame] | 3336 | if (roam_info && roam_info->is_fils_connection && |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3337 | eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roam_result) |
Vignesh Viswanathan | 014096a | 2017-12-07 01:24:44 +0530 | [diff] [blame] | 3338 | qdf_copy_macaddr(&roam_info->bssid, |
| 3339 | &sta_ctx->requested_bssid); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3340 | if (roam_info) |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3341 | hdd_err("wlan: connection failed with " QDF_MAC_ADDR_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3342 | " result: %d and Status: %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3343 | QDF_MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3344 | roam_result, roam_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3345 | else |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3346 | hdd_err("wlan: connection failed with " QDF_MAC_ADDR_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3347 | " result: %d and Status: %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3348 | QDF_MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3349 | roam_result, roam_status); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3350 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3351 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roam_result) || |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3352 | (roam_info && |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3353 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3354 | roam_info->status_code) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3355 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3356 | roam_info->status_code) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3357 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3358 | roam_info->status_code)))) { |
Ashish Kumar Dhanotiya | 3d8b0ae | 2019-07-10 20:55:56 +0530 | [diff] [blame] | 3359 | uint8_t *ssid; |
| 3360 | uint8_t ssid_len; |
| 3361 | |
| 3362 | if (roam_info && roam_info->pProfile && |
| 3363 | roam_info->pProfile->SSIDs.SSIDList) { |
| 3364 | ssid_len = |
| 3365 | roam_info->pProfile->SSIDs. |
| 3366 | SSIDList[0].SSID.length; |
| 3367 | ssid = roam_info->pProfile->SSIDs. |
| 3368 | SSIDList[0].SSID.ssId; |
| 3369 | } else { |
| 3370 | ssid_len = sta_ctx->conn_info.ssid.SSID.length; |
| 3371 | ssid = sta_ctx->conn_info.ssid.SSID.ssId; |
| 3372 | } |
Abhishek Singh | 85283ae | 2019-03-08 12:00:51 +0530 | [diff] [blame] | 3373 | wlan_hdd_cfg80211_unlink_bss(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3374 | roam_info ? |
| 3375 | roam_info->bssid.bytes : |
Ashish Kumar Dhanotiya | 3d8b0ae | 2019-07-10 20:55:56 +0530 | [diff] [blame] | 3376 | sta_ctx->requested_bssid.bytes, ssid, ssid_len); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3377 | sme_remove_bssid_from_scan_list(mac_handle, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3378 | roam_info ? |
| 3379 | roam_info->bssid.bytes : |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3380 | sta_ctx->requested_bssid.bytes); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3381 | if (roam_result != |
Arun Kumar Khandavalli | 34f69cf | 2019-02-25 16:46:52 +0530 | [diff] [blame] | 3382 | eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE) |
| 3383 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3384 | } |
| 3385 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3386 | /* |
| 3387 | * CR465478: Only send up a connection failure result when CSR |
| 3388 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3389 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3390 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roam_status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3391 | && !hddDisconInProgress) { |
gaurank kathpalia | efb20a8 | 2019-04-18 19:17:23 +0530 | [diff] [blame] | 3392 | u8 *assoc_rsp = NULL; |
| 3393 | u8 *assoc_req = NULL; |
| 3394 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3395 | if (roam_info) { |
gaurank kathpalia | efb20a8 | 2019-04-18 19:17:23 +0530 | [diff] [blame] | 3396 | if (roam_info->pbFrames) { |
| 3397 | /* Association Request */ |
| 3398 | assoc_req = |
| 3399 | (u8 *)(roam_info->pbFrames + |
| 3400 | roam_info->nBeaconLength); |
| 3401 | /* Association Response */ |
| 3402 | assoc_rsp = |
| 3403 | (u8 *)(roam_info->pbFrames + |
| 3404 | roam_info->nBeaconLength + |
| 3405 | roam_info->nAssocReqLength); |
| 3406 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3407 | hdd_err("send connect failure to nl80211: for bssid " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3408 | QDF_MAC_ADDR_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3409 | " result: %d and Status: %d reasoncode: %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3410 | QDF_MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3411 | roam_result, roam_status, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3412 | roam_info->reasonCode); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3413 | sta_ctx->conn_info.assoc_status_code = |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3414 | roam_info->status_code; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3415 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3416 | hdd_err("connect failed: for bssid " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3417 | QDF_MAC_ADDR_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3418 | " result: %d and status: %d ", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3419 | QDF_MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3420 | roam_result, roam_status); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3421 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3422 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3423 | wlan_deregister_txrx_packetdump(); |
| 3424 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3425 | /* inform association failure event to nl80211 */ |
| 3426 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3427 | roam_result) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3428 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3429 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3430 | roam_info->bssid.bytes, |
gaurank kathpalia | efb20a8 | 2019-04-18 19:17:23 +0530 | [diff] [blame] | 3431 | roam_info, assoc_req, |
| 3432 | roam_info->nAssocReqLength, |
| 3433 | assoc_rsp, |
| 3434 | roam_info->nAssocRspLength, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3435 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3436 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3437 | connect_timeout, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3438 | roam_info->status_code); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3440 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3441 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3442 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3443 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3444 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3445 | connect_timeout, |
| 3446 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3447 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3448 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3449 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3450 | roam_info->bssid.bytes, |
gaurank kathpalia | efb20a8 | 2019-04-18 19:17:23 +0530 | [diff] [blame] | 3451 | roam_info, assoc_req, |
| 3452 | roam_info->nAssocReqLength, |
| 3453 | assoc_rsp, |
| 3454 | roam_info->nAssocRspLength, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3455 | roam_info->reasonCode ? |
| 3456 | roam_info->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3457 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3458 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3459 | connect_timeout, |
Pragaspathi Thilagaraj | d48e6cd | 2019-05-30 00:52:43 +0530 | [diff] [blame] | 3460 | roam_info->status_code); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3461 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3462 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3463 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3464 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3465 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3466 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3467 | connect_timeout, |
| 3468 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3469 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3470 | hdd_clear_roam_profile_ie(adapter); |
Ashish Kumar Dhanotiya | 0213793 | 2019-02-26 21:43:32 +0530 | [diff] [blame] | 3471 | sme_reset_key(hdd_ctx->mac_handle, |
| 3472 | adapter->vdev_id); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3473 | } else if ((eCSR_ROAM_CANCELLED == roam_status |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3474 | && !hddDisconInProgress)) { |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3475 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3476 | sta_ctx->requested_bssid.bytes, |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3477 | NULL, NULL, 0, NULL, 0, |
| 3478 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
| 3479 | GFP_KERNEL, |
| 3480 | connect_timeout, |
| 3481 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3482 | } |
| 3483 | |
Bala Venkatesh | 444588c | 2019-05-06 15:29:35 +0530 | [diff] [blame] | 3484 | /* Check to change TDLS state in FW |
| 3485 | * as connection failed. |
| 3486 | */ |
| 3487 | if (roam_status == eCSR_ROAM_ASSOCIATION_FAILURE || |
| 3488 | roam_status == eCSR_ROAM_CANCELLED) { |
| 3489 | ucfg_tdls_notify_connect_failure(hdd_ctx->psoc); |
| 3490 | } |
| 3491 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3492 | /* |
| 3493 | * Set connection state to eConnectionState_NotConnected only |
| 3494 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3495 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3496 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3497 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roam_status) || |
| 3498 | (eCSR_ROAM_CANCELLED == roam_status)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3499 | && !hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3500 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3501 | eConnectionState_NotConnected); |
| 3502 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3503 | hdd_wmm_init(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3504 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3505 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3506 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3507 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | WLAN_CONTROL_PATH); |
Abhishek Singh | 0edeba0 | 2018-06-05 10:04:08 +0530 | [diff] [blame] | 3509 | /* |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3510 | * if hddDisconInProgress is set and roam_result is |
Abhishek Singh | 0edeba0 | 2018-06-05 10:04:08 +0530 | [diff] [blame] | 3511 | * eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE that mean HDD is |
| 3512 | * waiting on disconnect_comp_var so unblock anyone waiting for |
| 3513 | * disconnect to complete. |
| 3514 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3515 | if ((roam_result == eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE) && |
Abhishek Singh | 0edeba0 | 2018-06-05 10:04:08 +0530 | [diff] [blame] | 3516 | hddDisconInProgress) |
| 3517 | complete(&adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3518 | } |
| 3519 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3520 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | } |
| 3522 | |
| 3523 | /** |
| 3524 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3525 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3526 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3527 | * @roam_id: roam id |
| 3528 | * @roam_status: roam status |
| 3529 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3530 | * |
| 3531 | * Here we update the status of the Ibss when we receive information that we |
| 3532 | * have started/joined an ibss session. |
| 3533 | * |
| 3534 | * Return: none |
| 3535 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3536 | static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3537 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3538 | uint32_t roam_id, |
| 3539 | eRoamCmdStatus roam_status, |
| 3540 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3541 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3542 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3543 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3544 | hdd_debug("%s: id %d, status %d, result %d", |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3545 | adapter->dev->name, roam_id, |
| 3546 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3547 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3548 | switch (roam_result) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3549 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3550 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3551 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3552 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3553 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3554 | struct hdd_station_ctx *hdd_sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3555 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3556 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3557 | if (!roam_info) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3558 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3559 | return; |
| 3560 | } |
| 3561 | |
| 3562 | /* When IBSS Started comes from CSR, we need to move |
| 3563 | * connection state to IBSS Disconnected (meaning no peers |
| 3564 | * are in the IBSS). |
| 3565 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3566 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3567 | eConnectionState_IbssDisconnected); |
| 3568 | /* notify wmm */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3569 | hdd_wmm_connect(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3570 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3571 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3572 | hdd_sta_ctx->broadcast_sta_id = roam_info->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3573 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3574 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3575 | hdd_ctx->sta_to_adapter[roam_info->staId] = |
| 3576 | adapter; |
| 3577 | else |
| 3578 | hdd_debug("invalid sta id %d", roam_info->staId); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3579 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3580 | hdd_roam_register_sta(adapter, roam_info, |
| 3581 | roam_info->staId, |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 3582 | roam_info->bss_desc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3583 | |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 3584 | if (roam_info->bss_desc) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3585 | struct cfg80211_bss *bss; |
| 3586 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3587 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3588 | #endif |
| 3589 | /* we created the IBSS, notify supplicant */ |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3590 | hdd_debug("%s: created ibss " QDF_MAC_ADDR_STR, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3591 | adapter->dev->name, |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3592 | QDF_MAC_ADDR_ARRAY( |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 3593 | roam_info->bss_desc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3594 | |
| 3595 | /* we must first give cfg80211 the BSS information */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3596 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3597 | roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3598 | if (!bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3599 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3600 | adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3601 | return; |
| 3602 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3603 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3604 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3605 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3606 | WLAN_CONTROL_PATH); |
| 3607 | |
| 3608 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3609 | chan = ieee80211_get_channel( |
| 3610 | adapter->wdev.wiphy, |
| 3611 | roam_info->bss_desc->chan_freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3612 | |
| 3613 | if (chan) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3614 | cfg80211_ibss_joined(adapter->dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3615 | bss->bssid, chan, |
| 3616 | GFP_KERNEL); |
| 3617 | else |
Will Huang | 65d6425 | 2019-07-16 17:57:42 +0800 | [diff] [blame] | 3618 | hdd_warn("%s: freq: %d, can't find channel", |
| 3619 | adapter->dev->name, |
| 3620 | roam_info->bss_desc->chan_freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3621 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3622 | cfg80211_ibss_joined(adapter->dev, bss->bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3623 | GFP_KERNEL); |
| 3624 | #endif |
| 3625 | cfg80211_put_bss( |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 3626 | hdd_ctx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3627 | bss); |
| 3628 | } |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3629 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roam_result) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3630 | policy_mgr_incr_active_session(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3631 | adapter->device_mode, adapter->vdev_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 3632 | hdd_green_ap_start_state_mc(hdd_ctx, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3633 | adapter->device_mode, true); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3634 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roam_result || |
| 3635 | eCSR_ROAM_RESULT_IBSS_COALESCED == roam_result) { |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 3636 | policy_mgr_update_connection_info(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3637 | adapter->vdev_id); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3638 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | break; |
| 3640 | } |
| 3641 | |
| 3642 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3643 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3644 | hdd_err("%s: unable to create IBSS", adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3645 | break; |
| 3646 | } |
| 3647 | |
| 3648 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3649 | hdd_err("%s: unexpected result %d", |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3650 | adapter->dev->name, (int)roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3651 | break; |
| 3652 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3653 | } |
| 3654 | |
| 3655 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3656 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3657 | * @sta_ctx: pointer to hdd station context |
| 3658 | * @sta_id: station ID |
| 3659 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3660 | * |
| 3661 | * This information is passed to iwconfig later. The peer that joined |
| 3662 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3663 | |
| 3664 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3665 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3666 | 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] | 3667 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3669 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3670 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3671 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3672 | 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] | 3673 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3674 | peer_mac_addr, sta_id, idx); |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3675 | sta_ctx->conn_info.sta_id[idx] = sta_id; |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3676 | qdf_copy_macaddr( |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3677 | &sta_ctx->conn_info.peer_macaddr[idx], |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3678 | peer_mac_addr); |
| 3679 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3680 | } |
| 3681 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3682 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3683 | } |
| 3684 | |
| 3685 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3686 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3687 | * @sta_ctx: pointer to hdd station context |
| 3688 | * @sta_id: station ID |
| 3689 | * |
| 3690 | * Return: None |
| 3691 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3692 | 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] | 3693 | { |
| 3694 | int i; |
| 3695 | |
| 3696 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3697 | if (sta_id == sta_ctx->conn_info.sta_id[i]) { |
| 3698 | sta_ctx->conn_info.sta_id[i] = HDD_WLAN_INVALID_STA_ID; |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3699 | return; |
| 3700 | } |
| 3701 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3702 | } |
| 3703 | |
| 3704 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3705 | * 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] | 3706 | * @adapter: pointer to adapter |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3707 | * @sta_id: station id |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3708 | * |
| 3709 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3710 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3711 | * false otherwise. |
| 3712 | */ |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3713 | static bool roam_remove_ibss_station(struct hdd_adapter *adapter, |
| 3714 | uint8_t sta_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3715 | { |
Jeff Johnson | 24c26fd | 2019-03-10 00:29:29 -0800 | [diff] [blame] | 3716 | bool successful = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3717 | int idx = 0; |
| 3718 | uint8_t valid_idx = 0; |
| 3719 | uint8_t del_idx = 0; |
| 3720 | uint8_t empty_slots = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3721 | 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] | 3722 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3723 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3724 | if (sta_id == sta_ctx->conn_info.sta_id[idx]) { |
| 3725 | sta_ctx->conn_info.sta_id[idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3726 | HDD_WLAN_INVALID_STA_ID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3727 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3728 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3729 | peer_macaddr[idx]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3730 | |
Jeff Johnson | 24c26fd | 2019-03-10 00:29:29 -0800 | [diff] [blame] | 3731 | successful = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3732 | |
| 3733 | /* |
| 3734 | * Note the deleted Index, if its 0 we need special |
| 3735 | * handling. |
| 3736 | */ |
| 3737 | del_idx = idx; |
| 3738 | |
| 3739 | empty_slots++; |
| 3740 | } else { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3741 | if (sta_ctx->conn_info.sta_id[idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3742 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3743 | valid_idx = idx; |
| 3744 | } else { |
| 3745 | /* Found an empty slot */ |
| 3746 | empty_slots++; |
| 3747 | } |
| 3748 | } |
| 3749 | } |
| 3750 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3751 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3752 | /* Last peer departed, set the IBSS state appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3753 | hdd_conn_set_connection_state(adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3754 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3755 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3756 | } |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3757 | /* 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] | 3758 | if (successful) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3759 | if (del_idx == 0) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3760 | if (sta_ctx->conn_info.sta_id[valid_idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3761 | HDD_WLAN_INVALID_STA_ID) { |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3762 | sta_ctx->conn_info.sta_id[0] = |
| 3763 | sta_ctx->conn_info.sta_id[valid_idx]; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3764 | qdf_copy_macaddr(&sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3765 | peer_macaddr[0], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3766 | &sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3767 | peer_macaddr[valid_idx]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3768 | |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 3769 | sta_ctx->conn_info.sta_id[valid_idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3770 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3771 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Jeff Johnson | 5ec1abf | 2019-02-27 14:48:24 -0800 | [diff] [blame] | 3772 | peer_macaddr[valid_idx]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3773 | } |
| 3774 | } |
| 3775 | } |
Jeff Johnson | 24c26fd | 2019-03-10 00:29:29 -0800 | [diff] [blame] | 3776 | return successful; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3777 | } |
| 3778 | |
| 3779 | /** |
| 3780 | * roam_ibss_connect_handler() - IBSS connection handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3781 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3782 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3783 | * |
| 3784 | * We update the status of the IBSS to connected in this function. |
| 3785 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3786 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3787 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3788 | static QDF_STATUS roam_ibss_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3789 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3790 | { |
| 3791 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3792 | /* |
| 3793 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3794 | * a partner stations). |
| 3795 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3796 | hdd_conn_set_connection_state(adapter, eConnectionState_IbssConnected); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3797 | |
| 3798 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3799 | hdd_conn_save_connect_info(adapter, roam_info, eCSR_BSS_TYPE_IBSS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | |
| 3801 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3802 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3803 | /* add bss_id to cfg80211 data base */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3804 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 3805 | if (!bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3806 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3807 | adapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3808 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3809 | } |
| 3810 | cfg80211_put_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3811 | WLAN_HDD_GET_CTX(adapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3812 | bss); |
| 3813 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3814 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3815 | } |
| 3816 | |
| 3817 | /** |
| 3818 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3819 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3820 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3821 | * @roam_id: roam id |
| 3822 | * @roam_status: roam status |
| 3823 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3824 | * |
| 3825 | * This function indicates the Mic failure to the supplicant |
| 3826 | * |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3827 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3828 | */ |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3829 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3830 | hdd_roam_mic_error_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3831 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3832 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3833 | 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] | 3834 | tSirMicFailureInfo *mic_failure_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3835 | |
Jeff Johnson | e795151 | 2019-02-27 10:02:51 -0800 | [diff] [blame] | 3836 | if (eConnectionState_Associated != sta_ctx->conn_info.conn_state) |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3837 | return; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3838 | |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3839 | mic_failure_info = roam_info->u.pMICFailureInfo; |
| 3840 | cfg80211_michael_mic_failure(adapter->dev, |
| 3841 | mic_failure_info->taMacAddr, |
| 3842 | mic_failure_info->multicast ? |
| 3843 | NL80211_KEYTYPE_GROUP : |
| 3844 | NL80211_KEYTYPE_PAIRWISE, |
| 3845 | mic_failure_info->keyId, |
| 3846 | mic_failure_info->TSC, |
| 3847 | GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | } |
| 3849 | |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3850 | #ifdef CRYPTO_SET_KEY_CONVERGED |
| 3851 | static QDF_STATUS wlan_hdd_set_key_helper(struct hdd_adapter *adapter, |
| 3852 | uint32_t *roam_id) |
| 3853 | { |
| 3854 | int ret; |
| 3855 | struct wlan_objmgr_vdev *vdev; |
| 3856 | |
| 3857 | vdev = hdd_objmgr_get_vdev(adapter); |
| 3858 | if (!vdev) |
| 3859 | return QDF_STATUS_E_FAILURE; |
Kiran Kumar Lokere | 47d0dac | 2019-01-24 18:38:33 -0800 | [diff] [blame] | 3860 | ret = wlan_cfg80211_crypto_add_key(vdev, |
| 3861 | WLAN_CRYPTO_KEY_TYPE_UNICAST, 0); |
Rajeev Kumar Sirasanagandla | 25bdfad | 2019-02-15 19:15:49 +0530 | [diff] [blame] | 3862 | hdd_objmgr_put_vdev(vdev); |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3863 | if (ret != 0) { |
| 3864 | hdd_err("crypto add key fail, status: %d", ret); |
| 3865 | return QDF_STATUS_E_FAILURE; |
| 3866 | } |
| 3867 | |
| 3868 | return QDF_STATUS_SUCCESS; |
| 3869 | } |
| 3870 | #else |
| 3871 | static QDF_STATUS wlan_hdd_set_key_helper(struct hdd_adapter *adapter, |
| 3872 | uint32_t *roam_id) |
| 3873 | { |
| 3874 | struct hdd_station_ctx *sta_ctx = |
| 3875 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 3876 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3877 | |
| 3878 | return sme_roam_set_key(hdd_ctx->mac_handle, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 3879 | adapter->vdev_id, |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3880 | &sta_ctx->ibss_enc_key, |
| 3881 | roam_id); |
| 3882 | } |
| 3883 | #endif |
| 3884 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3885 | /** |
| 3886 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3887 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3888 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3889 | * @roam_id: roam id |
| 3890 | * @roam_status: roam status |
| 3891 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3892 | * |
| 3893 | * The Ibss connection status is updated regularly here in this function. |
| 3894 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3895 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3896 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3897 | static QDF_STATUS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3898 | roam_roam_connect_status_update_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3899 | struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3900 | uint32_t roam_id, |
| 3901 | eRoamCmdStatus roam_status, |
| 3902 | eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3903 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3904 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3905 | struct wlan_objmgr_vdev *vdev; |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3906 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3907 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3908 | switch (roam_result) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3909 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3910 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3911 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3912 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3913 | struct station_info *stainfo; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3914 | eCsrEncryptionType encr_type = sta_ctx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3915 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3916 | hdd_debug("IBSS New Peer indication from SME " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 3917 | "with peerMac " QDF_MAC_ADDR_STR " BSSID: " |
| 3918 | QDF_MAC_ADDR_STR " and stationID= %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 3919 | QDF_MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3920 | QDF_MAC_ADDR_ARRAY(sta_ctx->conn_info.bssid.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3921 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3922 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3923 | if (!hdd_save_peer |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3924 | (WLAN_HDD_GET_STATION_CTX_PTR(adapter), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3925 | roam_info->staId, |
| 3926 | &roam_info->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3927 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3928 | break; |
| 3929 | } |
| 3930 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3931 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3932 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
| 3933 | else |
| 3934 | hdd_debug("invalid sta id %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3935 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3936 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3937 | roam_info->fAuthRequired = true; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3938 | |
Jeff Johnson | 71a1d5c | 2018-12-30 11:31:04 -0800 | [diff] [blame] | 3939 | /* Register the Station with datapath for the new peer. */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3940 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3941 | roam_info, |
| 3942 | roam_info->staId, |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 3943 | roam_info->bss_desc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3944 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Jeff Johnson | 71a1d5c | 2018-12-30 11:31:04 -0800 | [diff] [blame] | 3945 | hdd_err("Cannot register STA for IBSS. qdf_status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3946 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3947 | } |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3948 | sta_ctx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3949 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 3950 | if (!stainfo) |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3951 | return QDF_STATUS_E_NOMEM; |
Min Liu | 74a1a50 | 2018-10-10 19:59:07 +0800 | [diff] [blame] | 3952 | |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3953 | stainfo->filled = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3954 | stainfo->generation = sta_ctx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3955 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3956 | cfg80211_new_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3957 | (const u8 *)roam_info->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3958 | stainfo, GFP_KERNEL); |
| 3959 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3960 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3961 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3962 | sta_ctx->ibss_enc_key.keyDirection = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3963 | eSIR_TX_RX; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3964 | qdf_copy_macaddr(&sta_ctx->ibss_enc_key.peerMac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3965 | &roam_info->peerMac); |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3966 | vdev = hdd_objmgr_get_vdev(adapter); |
| 3967 | if (!vdev) |
| 3968 | return QDF_STATUS_E_FAILURE; |
| 3969 | wlan_crypto_update_set_key_peer(vdev, true, 0, |
| 3970 | &roam_info->peerMac); |
Rajeev Kumar Sirasanagandla | 25bdfad | 2019-02-15 19:15:49 +0530 | [diff] [blame] | 3971 | hdd_objmgr_put_vdev(vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3972 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3973 | hdd_debug("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3974 | encr_type); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 3975 | qdf_status = wlan_hdd_set_key_helper(adapter, &roam_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3976 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Kiran Kumar Lokere | 7d6e4c9 | 2018-09-19 13:45:47 -0700 | [diff] [blame] | 3977 | hdd_err("sme set_key fail status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3978 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3979 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3980 | } |
| 3981 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3982 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3983 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3984 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3985 | WLAN_CONTROL_PATH); |
| 3986 | break; |
| 3987 | } |
| 3988 | |
| 3989 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3990 | { |
| 3991 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3992 | roam_ibss_connect_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | |
| 3994 | break; |
| 3995 | } |
| 3996 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3997 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3998 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3999 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4000 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4001 | if (!roam_remove_ibss_station(adapter, roam_info->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4002 | 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] | 4003 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4004 | hdd_debug("IBSS Peer Departed from SME " |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 4005 | "with peerMac " QDF_MAC_ADDR_STR " BSSID: " |
| 4006 | QDF_MAC_ADDR_STR " and stationID= %d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 4007 | QDF_MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 4008 | QDF_MAC_ADDR_ARRAY(sta_ctx->conn_info.bssid.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4009 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4010 | |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 4011 | hdd_roam_deregister_sta(adapter, roam_info->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4012 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 4013 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 4014 | hdd_ctx->sta_to_adapter[roam_info->staId] = NULL; |
| 4015 | else |
| 4016 | hdd_debug("invalid sta id %d", roam_info->staId); |
| 4017 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4018 | sta_ctx->ibss_sta_generation++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4019 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4020 | cfg80211_del_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4021 | (const u8 *)&roam_info->peerMac.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4022 | GFP_KERNEL); |
| 4023 | break; |
| 4024 | } |
| 4025 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 4026 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4027 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4028 | /* Stop only when we are inactive */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4029 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4030 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4031 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4032 | WLAN_CONTROL_PATH); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4033 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4034 | eConnectionState_NotConnected); |
| 4035 | |
| 4036 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4037 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | break; |
| 4039 | } |
| 4040 | default: |
| 4041 | break; |
| 4042 | |
| 4043 | } |
| 4044 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4045 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4046 | } |
| 4047 | |
| 4048 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4049 | QDF_STATUS hdd_roam_register_tdlssta(struct hdd_adapter *adapter, |
Jeff Johnson | 0a082d9 | 2019-03-04 12:25:49 -0800 | [diff] [blame] | 4050 | const uint8_t *peerMac, uint16_t sta_id, |
Jeff Johnson | a8ce127 | 2018-03-01 14:39:10 -0800 | [diff] [blame] | 4051 | uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4052 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4053 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 4054 | struct ol_txrx_desc_type txrx_desc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 4055 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 4056 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 4057 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Mohit Khanna | e1b8602 | 2019-04-12 10:04:57 -0700 | [diff] [blame] | 4058 | struct cdp_vdev *txrx_vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4059 | |
| 4060 | /* |
| 4061 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 4062 | * be peer MAC, here we are working on direct Link |
| 4063 | */ |
Sourav Mohapatra | 3646a85 | 2019-07-29 09:08:40 +0530 | [diff] [blame] | 4064 | WLAN_ADDR_COPY(txrx_desc.peer_addr.bytes, peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4065 | |
| 4066 | /* set the QoS field appropriately .. */ |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 4067 | txrx_desc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4068 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 4069 | /* Register the vdev transmit and receive functions */ |
| 4070 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
Jinwei Chen | e614397 | 2019-03-25 19:38:05 +0800 | [diff] [blame] | 4071 | if (adapter->hdd_ctx->enable_dp_rx_threads) { |
| 4072 | txrx_ops.rx.rx = hdd_rx_pkt_thread_enqueue_cbk; |
| 4073 | txrx_ops.rx.rx_stack = hdd_rx_packet_cbk; |
Mohit Khanna | f0620ce | 2019-07-28 21:31:05 -0700 | [diff] [blame] | 4074 | txrx_ops.rx.rx_gro_flush = hdd_rx_thread_gro_flush_ind_cbk; |
Jinwei Chen | e614397 | 2019-03-25 19:38:05 +0800 | [diff] [blame] | 4075 | } else { |
| 4076 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
| 4077 | txrx_ops.rx.rx_stack = NULL; |
| 4078 | } |
Mohit Khanna | e1b8602 | 2019-04-12 10:04:57 -0700 | [diff] [blame] | 4079 | txrx_vdev = cdp_get_vdev_from_vdev_id(soc, |
| 4080 | (struct cdp_pdev *)pdev, |
| 4081 | adapter->vdev_id); |
| 4082 | if (!txrx_vdev) |
| 4083 | return QDF_STATUS_E_FAILURE; |
Jinwei Chen | e614397 | 2019-03-25 19:38:05 +0800 | [diff] [blame] | 4084 | |
Mohit Khanna | e1b8602 | 2019-04-12 10:04:57 -0700 | [diff] [blame] | 4085 | cdp_vdev_register(soc, txrx_vdev, |
| 4086 | adapter, |
| 4087 | (struct cdp_ctrl_objmgr_vdev *)adapter->vdev, |
| 4088 | &txrx_ops); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4089 | adapter->tx_fn = txrx_ops.tx.tx; |
Poddar, Siddarth | 31797fa | 2018-01-22 17:24:15 +0530 | [diff] [blame] | 4090 | txrx_ops.rx.stats_rx = hdd_tx_rx_collect_connectivity_stats_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4091 | |
| 4092 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 4093 | qdf_status = cdp_peer_register(soc, |
Jeff Johnson | c419c17 | 2019-03-05 10:59:32 -0800 | [diff] [blame] | 4094 | (struct cdp_pdev *)pdev, &txrx_desc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4095 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4096 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4097 | qdf_status, qdf_status); |
| 4098 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4099 | } |
| 4100 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4101 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4102 | } |
| 4103 | |
Jeff Johnson | 5336784 | 2017-10-03 11:10:34 -0700 | [diff] [blame] | 4104 | QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter, |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 4105 | struct qdf_mac_addr *peer_mac) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4107 | QDF_STATUS qdf_status; |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 4108 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 4109 | 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] | 4110 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 4111 | *peer_mac); |
Kabilan Kannan | b4e0137 | 2018-01-15 13:33:10 -0800 | [diff] [blame] | 4112 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4113 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4114 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4115 | #endif |
| 4116 | |
| 4117 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4118 | |
| 4119 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4120 | |
| 4121 | static void hdd_rx_unprot_disassoc(struct net_device *dev, |
| 4122 | const u8 *buf, size_t len) |
| 4123 | { |
| 4124 | cfg80211_rx_unprot_mlme_mgmt(dev, buf, len); |
| 4125 | } |
| 4126 | |
| 4127 | static void hdd_rx_unprot_deauth(struct net_device *dev, |
| 4128 | const u8 *buf, size_t len) |
| 4129 | { |
| 4130 | cfg80211_rx_unprot_mlme_mgmt(dev, buf, len); |
| 4131 | } |
| 4132 | |
| 4133 | #else |
| 4134 | |
| 4135 | static void hdd_rx_unprot_disassoc(struct net_device *dev, |
| 4136 | const u8 *buf, size_t len) |
| 4137 | { |
| 4138 | cfg80211_send_unprot_disassoc(dev, buf, len); |
| 4139 | } |
| 4140 | |
| 4141 | static void hdd_rx_unprot_deauth(struct net_device *dev, |
| 4142 | const u8 *buf, size_t len) |
| 4143 | { |
| 4144 | cfg80211_send_unprot_deauth(dev, buf, len); |
| 4145 | } |
| 4146 | |
| 4147 | #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) */ |
| 4148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4149 | /** |
| 4150 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4151 | * @adapter: pointer to the adapter |
| 4152 | * @frame_length: Length of the unprotected frame being passed |
| 4153 | * @frame: Pointer to the frame buffer |
| 4154 | * @frame_type: 802.11 frame type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4155 | * |
| 4156 | * This function forwards the unprotected management frame to the supplicant. |
| 4157 | * |
| 4158 | * Return: nothing |
| 4159 | */ |
| 4160 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4161 | hdd_indicate_unprot_mgmt_frame(struct hdd_adapter *adapter, |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4162 | uint32_t frame_length, |
| 4163 | uint8_t *frame, uint8_t frame_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4164 | { |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4165 | uint8_t type, subtype; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4166 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4167 | hdd_debug("Frame Type = %d Frame Length = %d", |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4168 | frame_type, frame_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4169 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4170 | if (hdd_validate_adapter(adapter)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4171 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4172 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4173 | if (!frame_length) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4174 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4175 | return; |
| 4176 | } |
| 4177 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4178 | if (!frame) { |
| 4179 | hdd_err("frame is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | return; |
| 4181 | } |
| 4182 | |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4183 | type = WLAN_HDD_GET_TYPE_FRM_FC(frame[0]); |
| 4184 | if (type != SIR_MAC_MGMT_FRAME) { |
| 4185 | hdd_warn("Unexpected frame type %d", type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4186 | return; |
| 4187 | } |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4188 | |
| 4189 | subtype = WLAN_HDD_GET_SUBTYPE_FRM_FC(frame[0]); |
| 4190 | switch (subtype) { |
| 4191 | case SIR_MAC_MGMT_DISASSOC: |
| 4192 | hdd_rx_unprot_disassoc(adapter->dev, frame, frame_length); |
| 4193 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_disassoc_rx++; |
| 4194 | break; |
| 4195 | case SIR_MAC_MGMT_DEAUTH: |
| 4196 | hdd_rx_unprot_deauth(adapter->dev, frame, frame_length); |
| 4197 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_deauth_rx++; |
| 4198 | break; |
| 4199 | default: |
| 4200 | hdd_warn("Unexpected frame subtype %d", subtype); |
| 4201 | break; |
| 4202 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4203 | } |
Jeff Johnson | 72afbf8 | 2019-03-10 11:32:52 -0700 | [diff] [blame] | 4204 | #endif /* WLAN_FEATURE_11W */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4205 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4206 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4207 | /** |
| 4208 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4209 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4210 | * @tid: traffic identifier |
| 4211 | * @state: state |
| 4212 | * @measInterval: measurement interval |
| 4213 | * |
| 4214 | * This function sends traffic stream metrics IE information to |
| 4215 | * the supplicant via wireless event. |
| 4216 | * |
| 4217 | * Return: none |
| 4218 | */ |
| 4219 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4220 | hdd_indicate_tsm_ie(struct hdd_adapter *adapter, uint8_t tid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4221 | uint8_t state, uint16_t measInterval) |
| 4222 | { |
| 4223 | union iwreq_data wrqu; |
| 4224 | char buf[IW_CUSTOM_MAX + 1]; |
| 4225 | int nBytes = 0; |
| 4226 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4227 | if (!adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4228 | return; |
| 4229 | |
| 4230 | /* create the event */ |
| 4231 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4232 | memset(buf, '\0', sizeof(buf)); |
| 4233 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4234 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4235 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4236 | |
| 4237 | nBytes = |
| 4238 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4239 | measInterval); |
| 4240 | |
| 4241 | wrqu.data.pointer = buf; |
| 4242 | wrqu.data.length = nBytes; |
| 4243 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4244 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4245 | } |
| 4246 | |
| 4247 | /** |
| 4248 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4249 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4250 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4251 | * |
| 4252 | * This function sends cckm preauth indication to the supplicant |
| 4253 | * via wireless custom event. |
| 4254 | * |
| 4255 | * Return: none |
| 4256 | */ |
| 4257 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4258 | hdd_indicate_cckm_pre_auth(struct hdd_adapter *adapter, |
| 4259 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4260 | { |
| 4261 | union iwreq_data wrqu; |
| 4262 | char buf[IW_CUSTOM_MAX + 1]; |
| 4263 | char *pos = buf; |
| 4264 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4265 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4266 | if ((!adapter) || (!roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4267 | return; |
| 4268 | |
| 4269 | /* create the event */ |
| 4270 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4271 | memset(buf, '\0', sizeof(buf)); |
| 4272 | |
| 4273 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | cb7b8b8 | 2019-04-10 14:27:47 -0700 | [diff] [blame] | 4274 | hdd_debug("CCXPREAUTHNOTIFY=" QDF_MAC_ADDR_STR " %d:%d", |
Srinivas Girigowda | 34fbba0 | 2019-04-08 12:07:44 -0700 | [diff] [blame] | 4275 | QDF_MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4276 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4277 | |
| 4278 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4279 | pos += nBytes; |
| 4280 | freeBytes -= nBytes; |
| 4281 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4282 | qdf_mem_copy(pos, roam_info->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4283 | pos += QDF_MAC_ADDR_SIZE; |
| 4284 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4285 | |
| 4286 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4287 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4288 | freeBytes -= nBytes; |
| 4289 | |
| 4290 | wrqu.data.pointer = buf; |
| 4291 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4292 | |
| 4293 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4294 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4295 | } |
| 4296 | |
| 4297 | /** |
| 4298 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4299 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4300 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4301 | * |
| 4302 | * Return: none |
| 4303 | */ |
| 4304 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4305 | hdd_indicate_ese_adj_ap_rep_ind(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4306 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4307 | { |
| 4308 | union iwreq_data wrqu; |
| 4309 | char buf[IW_CUSTOM_MAX + 1]; |
| 4310 | int nBytes = 0; |
| 4311 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4312 | if ((!adapter) || (!roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4313 | return; |
| 4314 | |
| 4315 | /* create the event */ |
| 4316 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4317 | memset(buf, '\0', sizeof(buf)); |
| 4318 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4319 | hdd_debug("CCXADJAPREP=%u", roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4320 | |
| 4321 | nBytes = |
| 4322 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4323 | roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4324 | |
| 4325 | wrqu.data.pointer = buf; |
| 4326 | wrqu.data.length = nBytes; |
| 4327 | |
| 4328 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4329 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4330 | } |
| 4331 | |
| 4332 | /** |
| 4333 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4334 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4335 | * @measurementToken: measurement token |
| 4336 | * @flag: flag |
| 4337 | * @numBss: number of bss |
| 4338 | * |
| 4339 | * If the measurement is none and no scan results found, |
| 4340 | * indicate the supplicant about measurement done. |
| 4341 | * |
| 4342 | * Return: none |
| 4343 | */ |
| 4344 | void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4345 | hdd_indicate_ese_bcn_report_no_results(const struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4346 | const uint16_t measurementToken, |
| 4347 | const bool flag, const uint8_t numBss) |
| 4348 | { |
| 4349 | union iwreq_data wrqu; |
| 4350 | char buf[IW_CUSTOM_MAX]; |
| 4351 | char *pos = buf; |
| 4352 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4353 | |
| 4354 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4355 | memset(buf, '\0', sizeof(buf)); |
| 4356 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4357 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4358 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | |
| 4360 | nBytes = |
| 4361 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4362 | flag, numBss); |
| 4363 | |
| 4364 | wrqu.data.pointer = buf; |
| 4365 | wrqu.data.length = nBytes; |
| 4366 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4367 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4368 | } |
| 4369 | |
| 4370 | /** |
| 4371 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4372 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4373 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4374 | * |
| 4375 | * If the measurement is none and no scan results found, |
| 4376 | * indicate the supplicant about measurement done. |
| 4377 | * |
| 4378 | * Return: none |
| 4379 | */ |
| 4380 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4381 | hdd_indicate_ese_bcn_report_ind(const struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4382 | const struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4383 | { |
| 4384 | union iwreq_data wrqu; |
| 4385 | char buf[IW_CUSTOM_MAX]; |
| 4386 | char *pos = buf; |
| 4387 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4388 | uint8_t i = 0, len = 0; |
| 4389 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4390 | uint8_t lastSent = 0, sendBss = 0; |
| 4391 | int bcnRepFieldSize = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4392 | sizeof(roam_info->pEseBcnReportRsp->bcnRepBssInfo[0]. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4393 | bcnReportFields); |
| 4394 | uint8_t ieLenByte = 1; |
| 4395 | /* |
| 4396 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4397 | */ |
| 4398 | #define ESEBCNREPHEADER_LEN (18) |
| 4399 | |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4400 | if ((!adapter) || (!roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4401 | return; |
| 4402 | |
| 4403 | /* |
| 4404 | * Custom event can pass maximum of 256 bytes of data, |
| 4405 | * based on the IE len we need to identify how many BSS info can |
| 4406 | * be filled in to custom event data. |
| 4407 | */ |
| 4408 | /* |
| 4409 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4410 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4411 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4412 | */ |
| 4413 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4414 | if ((roam_info->pEseBcnReportRsp->flag >> 1) |
| 4415 | && (!roam_info->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4416 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4417 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4418 | * indicate the supplicant about measurement done |
| 4419 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4420 | hdd_indicate_ese_bcn_report_no_results( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4421 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4422 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4423 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4424 | roam_info->pEseBcnReportRsp->flag, |
| 4425 | roam_info->pEseBcnReportRsp->numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4426 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4427 | while (lastSent < roam_info->pEseBcnReportRsp->numBss) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4428 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4429 | memset(buf, '\0', sizeof(buf)); |
| 4430 | tot_bcn_ieLen = 0; |
| 4431 | sendBss = 0; |
| 4432 | pos = buf; |
| 4433 | freeBytes = IW_CUSTOM_MAX; |
| 4434 | |
| 4435 | for (i = lastSent; |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4436 | i < roam_info->pEseBcnReportRsp->numBss; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4437 | len = |
| 4438 | bcnRepFieldSize + ieLenByte + |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4439 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4440 | bcnRepBssInfo[i].ieLen; |
| 4441 | if ((len + tot_bcn_ieLen) > |
| 4442 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4443 | break; |
| 4444 | } |
| 4445 | tot_bcn_ieLen += len; |
| 4446 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4447 | 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] | 4448 | i, bcnRepFieldSize, 1, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4449 | roam_info->pEseBcnReportRsp-> |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4450 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4451 | } |
| 4452 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4453 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4454 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4455 | roam_info->pEseBcnReportRsp->measurementToken, |
| 4456 | roam_info->pEseBcnReportRsp->flag, sendBss, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4457 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4458 | |
| 4459 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
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 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4462 | roam_info->pEseBcnReportRsp->flag, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4463 | sendBss); |
| 4464 | pos += nBytes; |
| 4465 | freeBytes -= nBytes; |
| 4466 | |
| 4467 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4468 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4469 | sizeof(tot_bcn_ieLen)); |
| 4470 | pos += sizeof(tot_bcn_ieLen); |
| 4471 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4472 | |
| 4473 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4474 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4476 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4477 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4478 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4479 | bcnRepBssInfo[i + |
| 4480 | lastSent].bcnReportFields. |
| 4481 | ChanNum, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4482 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4483 | bcnRepBssInfo[i + |
| 4484 | lastSent].bcnReportFields. |
| 4485 | Spare, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4486 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4487 | bcnRepBssInfo[i + |
| 4488 | lastSent].bcnReportFields. |
| 4489 | MeasDuration, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4490 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4491 | bcnRepBssInfo[i + |
| 4492 | lastSent].bcnReportFields. |
| 4493 | PhyType, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4494 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4495 | bcnRepBssInfo[i + |
| 4496 | lastSent].bcnReportFields. |
| 4497 | RecvSigPower, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4498 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4499 | bcnRepBssInfo[i + |
| 4500 | lastSent].bcnReportFields. |
| 4501 | ParentTsf, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4502 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4503 | bcnRepBssInfo[i + |
| 4504 | lastSent].bcnReportFields. |
| 4505 | TargetTsf[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4506 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4507 | bcnRepBssInfo[i + |
| 4508 | lastSent].bcnReportFields. |
| 4509 | TargetTsf[1], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4510 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4511 | bcnRepBssInfo[i + |
| 4512 | lastSent].bcnReportFields. |
| 4513 | BcnInterval, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4514 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4515 | bcnRepBssInfo[i + |
| 4516 | lastSent].bcnReportFields. |
| 4517 | CapabilityInfo, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4518 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4519 | bcnRepBssInfo[i + |
| 4520 | lastSent].bcnReportFields. |
| 4521 | Bssid[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4522 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4523 | bcnRepBssInfo[i + |
| 4524 | lastSent].bcnReportFields. |
| 4525 | Bssid[1], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4526 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4527 | bcnRepBssInfo[i + |
| 4528 | lastSent].bcnReportFields. |
| 4529 | Bssid[2], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4530 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4531 | bcnRepBssInfo[i + |
| 4532 | lastSent].bcnReportFields. |
| 4533 | Bssid[3], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4534 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4535 | bcnRepBssInfo[i + |
| 4536 | lastSent].bcnReportFields. |
| 4537 | Bssid[4], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4538 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4539 | bcnRepBssInfo[i + |
| 4540 | lastSent].bcnReportFields. |
| 4541 | Bssid[5]); |
| 4542 | |
| 4543 | /* bcn report fields are copied */ |
| 4544 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4545 | sizeof(roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4546 | bcnRepBssInfo[i + |
| 4547 | lastSent]. |
| 4548 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4549 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4550 | (char *)&roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4551 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4552 | lastSent]. |
| 4553 | bcnReportFields, len); |
| 4554 | pos += len; |
| 4555 | freeBytes -= len; |
| 4556 | |
| 4557 | /* Add 1 byte of ie len */ |
| 4558 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4559 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4560 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4561 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4562 | pos += sizeof(len); |
| 4563 | freeBytes -= sizeof(len); |
| 4564 | |
| 4565 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4566 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4567 | (char *)roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4568 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4569 | lastSent]. |
| 4570 | pBuf, len); |
| 4571 | pos += len; |
| 4572 | freeBytes -= len; |
| 4573 | } |
| 4574 | |
| 4575 | wrqu.data.pointer = buf; |
| 4576 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4577 | |
| 4578 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4579 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4580 | buf); |
| 4581 | lastSent += sendBss; |
| 4582 | } |
| 4583 | } |
| 4584 | } |
| 4585 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4586 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4587 | |
| 4588 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4589 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4590 | * @sta_ctx: Station Context |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4591 | * |
| 4592 | * API to check if the connection authentication type is 8021x_sha256. |
| 4593 | * |
| 4594 | * Return: bool |
| 4595 | */ |
| 4596 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4597 | static inline bool |
| 4598 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4599 | { |
| 4600 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4601 | sta_ctx->conn_info.auth_type; |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4602 | } |
| 4603 | #else |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4604 | static inline bool |
| 4605 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4606 | { |
| 4607 | return false; |
| 4608 | } |
| 4609 | #endif |
| 4610 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4611 | /* |
| 4612 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4613 | * @adapter: Pointer to adapter context |
| 4614 | * @roam_info: Pointer to roam info |
| 4615 | * |
| 4616 | * Return: None |
| 4617 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 4618 | static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4619 | struct csr_roam_info *roam_info) |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4620 | { |
| 4621 | struct hdd_chan_change_params chan_change; |
| 4622 | struct cfg80211_bss *bss; |
| 4623 | struct net_device *dev = adapter->dev; |
| 4624 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4625 | struct wiphy *wiphy = wdev->wiphy; |
| 4626 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4627 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4628 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4629 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4630 | hdd_debug("channel switch for session:%d to channel:%d", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4631 | adapter->vdev_id, roam_info->chan_info.chan_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4632 | |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4633 | /* Enable Roaming on STA interface which was disabled before CSA */ |
| 4634 | if (adapter->device_mode == QDF_STA_MODE) |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4635 | sme_start_roaming(mac_handle, adapter->vdev_id, |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4636 | REASON_DRIVER_ENABLED); |
| 4637 | |
Paul Zhang | 427962d | 2019-07-25 15:22:55 +0800 | [diff] [blame] | 4638 | chan_change.chan_freq = |
| 4639 | wlan_reg_chan_to_freq(hdd_ctx->pdev, |
| 4640 | roam_info->chan_info.chan_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4641 | chan_change.chan_params.ch_width = |
| 4642 | roam_info->chan_info.ch_width; |
| 4643 | chan_change.chan_params.sec_ch_offset = |
| 4644 | roam_info->chan_info.sec_ch_offset; |
| 4645 | chan_change.chan_params.center_freq_seg0 = |
| 4646 | roam_info->chan_info.band_center_freq1; |
| 4647 | chan_change.chan_params.center_freq_seg1 = |
| 4648 | roam_info->chan_info.band_center_freq2; |
| 4649 | |
| 4650 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4651 | if (!bss) |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4652 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4653 | else |
| 4654 | cfg80211_put_bss(wiphy, bss); |
| 4655 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4656 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4657 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4658 | if (QDF_IS_STATUS_ERROR(status)) |
| 4659 | hdd_err("channel change notification failed"); |
| 4660 | |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 4661 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->psoc, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4662 | adapter->vdev_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4663 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4664 | hdd_debug("set hw mode change not done"); |
Abhishek Singh | bfaebe3 | 2019-03-19 13:37:55 +0530 | [diff] [blame] | 4665 | |
| 4666 | hdd_debug("check for SAP restart"); |
| 4667 | policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->psoc); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4668 | } |
| 4669 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4670 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4671 | * hdd_sme_roam_callback() - hdd sme roam callback |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4672 | * @context: pointer to adapter context |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4673 | * @roam_info: pointer to roam info |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4674 | * @roam_id: roam id |
| 4675 | * @roam_status: roam status |
| 4676 | * @roam_result: roam result |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4677 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4678 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4679 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4680 | QDF_STATUS |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4681 | hdd_sme_roam_callback(void *context, struct csr_roam_info *roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4682 | uint32_t roam_id, |
| 4683 | eRoamCmdStatus roam_status, eCsrRoamResult roam_result) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4684 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4685 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4686 | struct hdd_adapter *adapter = context; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4687 | struct hdd_station_ctx *sta_ctx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4688 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4689 | struct cfg80211_bss *bss_status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4690 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4691 | |
Jeff Johnson | 8d4621b | 2019-03-08 15:45:38 -0800 | [diff] [blame] | 4692 | hdd_debug("CSR Callback: status=%d result=%d roamID=%d", |
| 4693 | roam_status, roam_result, roam_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4694 | |
| 4695 | /* Sanity check */ |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4696 | if ((!adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4697 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4698 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4699 | } |
| 4700 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4701 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4702 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | |
Abhishek Singh | f723e3d | 2018-02-20 18:02:37 +0530 | [diff] [blame] | 4704 | 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] | 4705 | adapter->vdev_id, roam_status)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4706 | |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4707 | switch (roam_status) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4708 | /* |
| 4709 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4710 | * reassoc failed due to failure, timeout, reject from ap |
| 4711 | * in any case tell the OS, our carrier is off and mark |
| 4712 | * interface down. |
| 4713 | */ |
| 4714 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4715 | hdd_err("Reassoc Failed with roam_status: %d roam_result: %d SessionID: %d", |
| 4716 | roam_status, roam_result, adapter->vdev_id); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4717 | qdf_ret_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4718 | hdd_dis_connect_handler(adapter, roam_info, roam_id, |
| 4719 | roam_status, roam_result); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4720 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4721 | sta_ctx->hdd_reassoc_scenario = false; |
| 4722 | hdd_debug("hdd_reassoc_scenario set to: %d, ReAssoc Failed, session: %d", |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4723 | sta_ctx->hdd_reassoc_scenario, adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4724 | break; |
| 4725 | |
| 4726 | case eCSR_ROAM_FT_START: |
| 4727 | /* |
| 4728 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4729 | * informed that the link is down. So mark the link ready for |
| 4730 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4731 | * be received. Where in we will not mark the link down |
| 4732 | * Also we want to stop tx at this point when we will be |
| 4733 | * doing disassoc at this time. This saves 30-60 msec |
| 4734 | * after reassoc. |
| 4735 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4736 | hdd_debug("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4737 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4738 | hdd_napi_serialize(1); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4739 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4740 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4741 | WLAN_CONTROL_PATH); |
Sourav Mohapatra | ffbd027 | 2019-07-31 14:18:25 +0530 | [diff] [blame] | 4742 | status = hdd_roam_deregister_sta( |
| 4743 | adapter, |
| 4744 | sta_ctx->conn_info.peer_macaddr[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4745 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4746 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4747 | sta_ctx->ft_carrier_on = true; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4748 | sta_ctx->hdd_reassoc_scenario = true; |
| 4749 | 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] | 4750 | sta_ctx->hdd_reassoc_scenario, adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4751 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4752 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4753 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4754 | hdd_napi_serialize(0); |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4755 | if (roam_result == eCSR_ROAM_RESULT_FAILURE) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4756 | adapter->roam_ho_fail = true; |
Pragaspathi Thilagaraj | 8ea625d | 2019-02-14 16:11:45 +0530 | [diff] [blame] | 4757 | hdd_set_roaming_in_progress(false); |
| 4758 | } else { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4759 | adapter->roam_ho_fail = false; |
Pragaspathi Thilagaraj | 8ea625d | 2019-02-14 16:11:45 +0530 | [diff] [blame] | 4760 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4761 | complete(&adapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4762 | break; |
Pragaspathi Thilagaraj | 8ea625d | 2019-02-14 16:11:45 +0530 | [diff] [blame] | 4763 | case eCSR_ROAM_SYNCH_COMPLETE: |
| 4764 | hdd_debug("LFR3: Roam synch complete"); |
| 4765 | hdd_set_roaming_in_progress(false); |
| 4766 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4767 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4768 | /* notify apps that we can't pass traffic anymore */ |
Dustin Brown | a7bb6ae | 2018-08-16 16:51:50 -0700 | [diff] [blame] | 4769 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4770 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4771 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4772 | WLAN_CONTROL_PATH); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4773 | if (sta_ctx->ft_carrier_on == false) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4774 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4775 | WLAN_NETIF_CARRIER_OFF, |
| 4776 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4777 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4778 | break; |
| 4779 | case eCSR_ROAM_LOSTLINK: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4780 | if (roam_result == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4781 | hdd_debug("Roaming started due to connection lost"); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4782 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4783 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4784 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4785 | WLAN_CONTROL_PATH); |
| 4786 | break; |
| 4787 | } |
| 4788 | case eCSR_ROAM_DISASSOCIATED: |
| 4789 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4790 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4791 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 4792 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4793 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4794 | adapter->roam_ho_fail = false; |
| 4795 | complete(&adapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4796 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4797 | /* Call to clear any MC Addr List filter applied after |
| 4798 | * successful connection. |
| 4799 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4800 | hdd_disable_and_flush_mc_addr_list(adapter, |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4801 | pmo_peer_disconnect); |
| 4802 | qdf_ret_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4803 | hdd_dis_connect_handler(adapter, roam_info, roam_id, |
| 4804 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4805 | } |
| 4806 | break; |
| 4807 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4808 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4809 | qdf_ret_status = |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4810 | hdd_dis_connect_handler(adapter, roam_info, roam_id, |
| 4811 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4812 | break; |
| 4813 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4814 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4815 | /* |
| 4816 | * To Do - address probable memory leak with WEP encryption upon |
| 4817 | * successful association. |
| 4818 | */ |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4819 | if (eCSR_ROAM_RESULT_ASSOCIATED != roam_result) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4820 | /* Clear saved connection information in HDD */ |
| 4821 | hdd_conn_remove_connect_info( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4822 | WLAN_HDD_GET_STATION_CTX_PTR(adapter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4823 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4824 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4825 | hdd_association_completion_handler(adapter, roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4826 | roam_id, roam_status, |
| 4827 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4828 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4829 | if (roam_info) |
| 4830 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4831 | #endif |
| 4832 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 4833 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4834 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Jeff Johnson | 48c05c7 | 2018-04-29 19:47:12 -0700 | [diff] [blame] | 4835 | /* fallthrough */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4836 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4837 | qdf_ret_status = hdd_association_completion_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4838 | roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4839 | roam_id, |
| 4840 | roam_status, |
| 4841 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4842 | break; |
| 4843 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4844 | hdd_roam_ibss_indication_handler(adapter, roam_info, roam_id, |
| 4845 | roam_status, roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4846 | break; |
| 4847 | |
| 4848 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4849 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4850 | roam_roam_connect_status_update_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4851 | roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4852 | roam_id, |
| 4853 | roam_status, |
| 4854 | roam_result); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4855 | break; |
| 4856 | |
| 4857 | case eCSR_ROAM_MIC_ERROR_IND: |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 4858 | hdd_roam_mic_error_indication_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4859 | break; |
| 4860 | |
| 4861 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 4862 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4863 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4864 | hdd_roam_set_key_complete_handler(adapter, roam_info, |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4865 | roam_id, roam_status, |
| 4866 | roam_result); |
| 4867 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4868 | sta_ctx->hdd_reassoc_scenario = false; |
| 4869 | hdd_debug("hdd_reassoc_scenario set to: %d, set key complete, session: %d", |
| 4870 | sta_ctx->hdd_reassoc_scenario, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 4871 | adapter->vdev_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4872 | } |
| 4873 | } |
| 4874 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4875 | if (roam_info) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4876 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4877 | #endif |
| 4878 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4879 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4880 | case eCSR_ROAM_FT_RESPONSE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4881 | hdd_send_ft_event(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4882 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4883 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4884 | case eCSR_ROAM_PMK_NOTIFY: |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4885 | if (eCSR_AUTH_TYPE_RSN == sta_ctx->conn_info.auth_type |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4886 | || hdd_is_8021x_sha256_auth_type(sta_ctx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4887 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4888 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4889 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4890 | adapter, roam_info, 1, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4891 | } |
| 4892 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4893 | |
| 4894 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4895 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4896 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4897 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4898 | wlan_hdd_cfg80211_roam_metrics_preauth(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4899 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4900 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4901 | } |
| 4902 | break; |
| 4903 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4904 | /* |
| 4905 | * This event will notify pre-auth completion in case of success |
| 4906 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4907 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4908 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4909 | roam_info, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4910 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4911 | } |
| 4912 | break; |
| 4913 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4914 | /* |
| 4915 | * This event will notify pre-auth completion incase of failure. |
| 4916 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4917 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4918 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4919 | roam_info, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4920 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4921 | } |
| 4922 | break; |
| 4923 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4924 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4925 | * It will be only invoked on success |
| 4926 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4927 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4928 | wlan_hdd_cfg80211_roam_metrics_handover(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4929 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4930 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4931 | } |
| 4932 | break; |
| 4933 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4934 | #ifdef WLAN_FEATURE_11W |
| 4935 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
gaurank kathpalia | ea6b5e6 | 2018-07-05 20:41:28 +0530 | [diff] [blame] | 4936 | if (roam_info) |
| 4937 | hdd_indicate_unprot_mgmt_frame(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4938 | roam_info->nFrameLength, |
| 4939 | roam_info->pbFrames, |
| 4940 | roam_info->frameType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4941 | break; |
| 4942 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4943 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4944 | case eCSR_ROAM_TSM_IE_IND: |
gaurank kathpalia | ea6b5e6 | 2018-07-05 20:41:28 +0530 | [diff] [blame] | 4945 | if (roam_info) |
Jeff Johnson | 85ddb77 | 2019-02-02 19:01:52 -0800 | [diff] [blame] | 4946 | hdd_indicate_tsm_ie(adapter, roam_info->tsm_ie.tsid, |
| 4947 | roam_info->tsm_ie.state, |
| 4948 | roam_info->tsm_ie.msmt_interval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4949 | break; |
| 4950 | |
| 4951 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4952 | { |
| 4953 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4954 | sta_ctx->conn_info.auth_type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4955 | || eCSR_AUTH_TYPE_CCKM_RSN == |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 4956 | sta_ctx->conn_info.auth_type) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4957 | hdd_indicate_cckm_pre_auth(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4958 | } |
| 4959 | break; |
| 4960 | } |
| 4961 | |
| 4962 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 4963 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4964 | hdd_indicate_ese_adj_ap_rep_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4965 | break; |
| 4966 | } |
| 4967 | |
| 4968 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 4969 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4970 | hdd_indicate_ese_bcn_report_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4971 | break; |
| 4972 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4973 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4974 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4975 | hdd_roam_channel_switch_handler(adapter, roam_info); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4976 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4977 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4978 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 4979 | if ((roam_info) && (roam_info->bss_desc)) { |
Abhishek Singh | f05b0cb6 | 2018-02-20 18:06:13 +0530 | [diff] [blame] | 4980 | bss_status = wlan_hdd_inform_bss_frame(adapter, |
Pragaspathi Thilagaraj | 96742ae | 2019-05-29 00:49:33 +0530 | [diff] [blame] | 4981 | roam_info->bss_desc); |
Jeff Johnson | d36fa33 | 2019-03-18 13:42:25 -0700 | [diff] [blame] | 4982 | if (!bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4983 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4984 | else |
| 4985 | cfg80211_put_bss( |
| 4986 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4987 | (WLAN_HDD_GET_CTX(adapter))->wiphy, |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4988 | #endif |
| 4989 | bss_status); |
| 4990 | } |
| 4991 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4992 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 4993 | hdd_ndp_event_handler(adapter, roam_info, roam_id, roam_status, |
| 4994 | roam_result); |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4995 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4996 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4997 | hdd_debug("Process ROAM_START from firmware"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4998 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4999 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5000 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5001 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5002 | hdd_set_roaming_in_progress(true); |
Dustin Brown | 76cd293 | 2018-09-11 16:03:05 -0700 | [diff] [blame] | 5003 | policy_mgr_restart_opportunistic_timer(hdd_ctx->psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5004 | break; |
| 5005 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5006 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5007 | hdd_napi_serialize(0); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5008 | wlan_hdd_netif_queue_control(adapter, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5009 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 5010 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5011 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5012 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5013 | adapter->roam_ho_fail = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5014 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5015 | complete(&adapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5016 | break; |
| 5017 | |
Padma, Santhosh Kumar | eb90a55 | 2018-01-16 19:41:58 +0530 | [diff] [blame] | 5018 | case eCSR_ROAM_SAE_COMPUTE: |
| 5019 | if (roam_info) |
| 5020 | wlan_hdd_sae_callback(adapter, roam_info); |
| 5021 | break; |
| 5022 | |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 5023 | case eCSR_ROAM_ROAMING_START: |
| 5024 | /* |
| 5025 | * For LFR2, Handle roaming start to remove disassociated |
| 5026 | * session |
| 5027 | */ |
| 5028 | if (roaming_offload_enabled(hdd_ctx)) |
| 5029 | break; |
Jeff Johnson | 29c7867 | 2019-02-26 21:05:53 -0800 | [diff] [blame] | 5030 | if (roam_result == eCSR_ROAM_RESULT_NOT_ASSOCIATED) { |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 5031 | hdd_debug("Decrement session of disassociated AP device_mode %d sessionId %d", |
| 5032 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 5033 | adapter->vdev_id); |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 5034 | policy_mgr_decr_session_set_pcl(hdd_ctx->psoc, |
| 5035 | adapter->device_mode, |
Jeff Johnson | 1abc566 | 2019-02-04 14:27:02 -0800 | [diff] [blame] | 5036 | adapter->vdev_id); |
Rajasekaran Kalidoss | 54a07c9 | 2018-10-31 02:57:38 +0530 | [diff] [blame] | 5037 | } |
| 5038 | break; |
| 5039 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5040 | default: |
| 5041 | break; |
| 5042 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5043 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5044 | } |
| 5045 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5046 | #ifdef WLAN_FEATURE_FILS_SK |
| 5047 | /** |
| 5048 | * hdd_translate_fils_rsn_to_csr_auth() - Translate FILS RSN to CSR auth type |
| 5049 | * @auth_suite: auth suite |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5050 | * @auth_type: pointer to enum csr_akm_type |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5051 | * |
| 5052 | * Return: None |
| 5053 | */ |
| 5054 | static void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5055 | enum csr_akm_type *auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5056 | { |
| 5057 | if (!memcmp(auth_suite, ccp_rsn_oui_0e, 4)) |
| 5058 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA256; |
| 5059 | else if (!memcmp(auth_suite, ccp_rsn_oui_0f, 4)) |
| 5060 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA384; |
| 5061 | else if (!memcmp(auth_suite, ccp_rsn_oui_10, 4)) |
| 5062 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA256; |
| 5063 | else if (!memcmp(auth_suite, ccp_rsn_oui_11, 4)) |
| 5064 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA384; |
| 5065 | } |
| 5066 | #else |
| 5067 | static inline void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5068 | enum csr_akm_type *auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5069 | { |
| 5070 | } |
| 5071 | #endif |
| 5072 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5073 | #ifdef WLAN_FEATURE_SAE |
| 5074 | /** |
| 5075 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 5076 | * @auth_suite: auth suite |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5077 | * @auth_type: pointer to enum csr_akm_type |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5078 | * |
| 5079 | * Return: None |
| 5080 | */ |
| 5081 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5082 | enum csr_akm_type *auth_type) |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5083 | { |
| 5084 | if (qdf_mem_cmp(auth_suite, ccp_rsn_oui_80, 4) == 0) |
| 5085 | *auth_type = eCSR_AUTH_TYPE_SAE; |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5086 | else if (qdf_mem_cmp(auth_suite, ccp_rsn_oui_90, 4) == 0) |
| 5087 | *auth_type = eCSR_AUTH_TYPE_FT_SAE; |
| 5088 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5089 | } |
| 5090 | #else |
| 5091 | static inline void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5092 | enum csr_akm_type *auth_type) |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5093 | { |
| 5094 | } |
| 5095 | #endif |
| 5096 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5097 | /** |
| 5098 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5099 | * @auth_suite: auth suite |
| 5100 | * |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5101 | * Return: enum csr_akm_type enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5102 | */ |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5103 | enum csr_akm_type hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5104 | { |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5105 | enum csr_akm_type auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5106 | /* is the auth type supported? */ |
| 5107 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5108 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5109 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5110 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5111 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5112 | /* Check for 11r FT Authentication with PSK */ |
| 5113 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5114 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5115 | /* Check for 11R FT Authentication with 802.1X */ |
| 5116 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5117 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5118 | #ifdef FEATURE_WLAN_ESE |
| 5119 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5120 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5121 | } else |
| 5122 | #endif /* FEATURE_WLAN_ESE */ |
| 5123 | #ifdef WLAN_FEATURE_11W |
| 5124 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5125 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5126 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5127 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5128 | } else if (memcmp(auth_suite, ccp_rsn_oui_18, 4) == 0) { |
| 5129 | auth_type = eCSR_AUTH_TYPE_OWE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5130 | } else |
| 5131 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 5132 | if (memcmp(auth_suite, ccp_rsn_oui_12, 4) == 0) { |
| 5133 | auth_type = eCSR_AUTH_TYPE_DPP_RSN; |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5134 | } else if (memcmp(auth_suite, ccp_rsn_oui_0b, 4) == 0) { |
| 5135 | /* Check for Suite B EAP 256 */ |
| 5136 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
| 5137 | } else if (memcmp(auth_suite, ccp_rsn_oui_0c, 4) == 0) { |
| 5138 | /* Check for Suite B EAP 384 */ |
| 5139 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5140 | } else if (memcmp(auth_suite, ccp_rsn_oui_0d, 4) == 0) { |
| 5141 | /* Check for FT Suite B EAP 384 */ |
| 5142 | auth_type = eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384; |
Srinivas Dasari | b328f1a | 2018-12-18 17:45:06 +0530 | [diff] [blame] | 5143 | } else if (memcmp(auth_suite, ccp_rsn_oui_13, 4) == 0) { |
| 5144 | auth_type = eCSR_AUTH_TYPE_OSEN; |
Jeff Johnson | 109e79d | 2018-02-27 15:10:04 -0800 | [diff] [blame] | 5145 | } else { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5146 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5147 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5148 | } |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5149 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5150 | return auth_type; |
| 5151 | } |
| 5152 | |
| 5153 | /** |
| 5154 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5155 | * @auth_suite: auth suite |
| 5156 | * |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5157 | * Return: enum csr_akm_type enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5158 | */ |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5159 | enum csr_akm_type hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5160 | { |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5161 | enum csr_akm_type auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5162 | /* is the auth type supported? */ |
| 5163 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5164 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5165 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5166 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5167 | } else |
| 5168 | #ifdef FEATURE_WLAN_ESE |
| 5169 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5170 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5171 | } else |
| 5172 | #endif /* FEATURE_WLAN_ESE */ |
| 5173 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5174 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5175 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5176 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5177 | return auth_type; |
| 5178 | } |
| 5179 | |
| 5180 | /** |
| 5181 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5182 | * Translate RSN to CSR encryption type |
| 5183 | * @cipher_suite: cipher suite |
| 5184 | * |
| 5185 | * Return: eCsrEncryptionType enumeration |
| 5186 | */ |
| 5187 | eCsrEncryptionType |
| 5188 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5189 | { |
| 5190 | eCsrEncryptionType cipher_type; |
| 5191 | |
| 5192 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5193 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5194 | else if (memcmp(cipher_suite, ccp_rsn_oui09, 4) == 0) |
| 5195 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP; |
| 5196 | else if (memcmp(cipher_suite, ccp_rsn_oui0a, 4) == 0) |
| 5197 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5198 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5199 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5200 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5201 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5202 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5203 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5204 | else if (memcmp(cipher_suite, ccp_rsn_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 | |
| 5213 | /** |
| 5214 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5215 | * Translate WPA to CSR encryption type |
| 5216 | * @cipher_suite: cipher suite |
| 5217 | * |
| 5218 | * Return: eCsrEncryptionType enumeration |
| 5219 | */ |
| 5220 | eCsrEncryptionType |
| 5221 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5222 | { |
| 5223 | eCsrEncryptionType cipher_type; |
| 5224 | |
| 5225 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5226 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5227 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5228 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5229 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5230 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5231 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5232 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5233 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5234 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5235 | else |
| 5236 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5237 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5238 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5239 | return cipher_type; |
| 5240 | } |
| 5241 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5242 | #ifdef WLAN_FEATURE_FILS_SK |
gaurank kathpalia | 82a1b2b | 2018-07-10 16:49:10 +0530 | [diff] [blame] | 5243 | bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5244 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5245 | struct csr_roam_profile *roam_profile; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5246 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5247 | roam_profile = hdd_roam_profile(adapter); |
| 5248 | if (roam_profile->fils_con_info) |
| 5249 | return roam_profile->fils_con_info->is_fils_connection; |
Min Liu | ab6ed4f | 2018-01-09 13:13:57 +0800 | [diff] [blame] | 5250 | |
| 5251 | return false; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5252 | } |
| 5253 | #else |
gaurank kathpalia | 82a1b2b | 2018-07-10 16:49:10 +0530 | [diff] [blame] | 5254 | bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5255 | { |
| 5256 | return false; |
| 5257 | } |
| 5258 | #endif |
| 5259 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5260 | /** |
| 5261 | * hdd_process_genie() - process gen ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5262 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5263 | * @bssid: pointer to mac address |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5264 | * @encrypt_type: pointer to encryption type |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5265 | * @mc_encrypt_type: pointer to multicast encryption type |
Jeff Johnson | 4f1be2d | 2019-03-09 22:52:04 -0800 | [diff] [blame] | 5266 | * @auth_type: pointer to auth type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5267 | * |
| 5268 | * Return: 0 on success, error number otherwise |
| 5269 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5270 | static int32_t hdd_process_genie(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5271 | u8 *bssid, |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5272 | eCsrEncryptionType *encrypt_type, |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5273 | eCsrEncryptionType *mc_encrypt_type, |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5274 | enum csr_akm_type *auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5275 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 78cbade | 2019-03-10 21:59:35 -0700 | [diff] [blame] | 5276 | uint8_t *mfp_required, uint8_t *mfp_capable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5277 | #endif |
| 5278 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5279 | { |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 5280 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5281 | tDot11fIERSN dot11_rsn_ie = {0}; |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5282 | tDot11fIEWPA dot11_wpa_ie = {0}; |
Jeff Johnson | d062b8d | 2019-03-09 20:31:13 -0800 | [diff] [blame] | 5283 | uint8_t *rsn_ie; |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5284 | uint16_t rsn_ie_len; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5285 | uint32_t parse_status; |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 5286 | #ifdef WLAN_CONV_CRYPTO_SUPPORTED |
| 5287 | uint16_t rsn_cap = 0; |
| 5288 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5289 | |
| 5290 | /* |
| 5291 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5292 | * setting present flag to 0. |
| 5293 | */ |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5294 | memset(&dot11_wpa_ie, 0, sizeof(tDot11fIEWPA)); |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5295 | memset(&dot11_rsn_ie, 0, sizeof(tDot11fIERSN)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5296 | |
| 5297 | /* Type check */ |
| 5298 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5299 | /* Validity checks */ |
| 5300 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5301 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5302 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5303 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5304 | return -EINVAL; |
| 5305 | } |
| 5306 | /* Skip past the EID byte and length byte */ |
Jeff Johnson | d062b8d | 2019-03-09 20:31:13 -0800 | [diff] [blame] | 5307 | rsn_ie = gen_ie + 2; |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5308 | rsn_ie_len = gen_ie_len - 2; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5309 | /* Unpack the RSN IE */ |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5310 | 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] | 5311 | &dot11_rsn_ie, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5312 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5313 | hdd_err("Invalid RSN IE: parse status %d", |
| 5314 | parse_status); |
| 5315 | return -EINVAL; |
| 5316 | } |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5317 | hdd_debug("gp_cipher_suite_present: %d", |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5318 | dot11_rsn_ie.gp_cipher_suite_present); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5319 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5320 | hdd_debug("pairwise cipher suite count: %d", |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5321 | dot11_rsn_ie.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5322 | hdd_debug("authentication suite count: %d", |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5323 | dot11_rsn_ie.akm_suite_cnt); |
| 5324 | /* dot11_rsn_ie.akm_suite_cnt */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5325 | /* Just translate the FIRST one */ |
Jeff Johnson | 4f1be2d | 2019-03-09 22:52:04 -0800 | [diff] [blame] | 5326 | *auth_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5327 | hdd_translate_rsn_to_csr_auth_type( |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5328 | dot11_rsn_ie.akm_suite[0]); |
| 5329 | /* dot11_rsn_ie.pwise_cipher_suite_count */ |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5330 | *encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5331 | hdd_translate_rsn_to_csr_encryption_type( |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5332 | dot11_rsn_ie.pwise_cipher_suites[0]); |
| 5333 | /* dot11_rsn_ie.gp_cipher_suite_count */ |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5334 | *mc_encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5335 | hdd_translate_rsn_to_csr_encryption_type( |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5336 | dot11_rsn_ie.gp_cipher_suite); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5337 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 9bf800e | 2019-03-10 21:58:34 -0700 | [diff] [blame] | 5338 | *mfp_required = (dot11_rsn_ie.RSN_Cap[0] >> 6) & 0x1; |
Jeff Johnson | 78cbade | 2019-03-10 21:59:35 -0700 | [diff] [blame] | 5339 | *mfp_capable = csr_is_mfpc_capable(&dot11_rsn_ie); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5340 | #endif |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 5341 | #ifdef WLAN_CONV_CRYPTO_SUPPORTED |
Jeff Johnson | b94e649 | 2019-03-09 22:24:42 -0800 | [diff] [blame] | 5342 | 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] | 5343 | wlan_crypto_set_vdev_param(adapter->vdev, |
| 5344 | WLAN_CRYPTO_PARAM_RSN_CAP, rsn_cap); |
| 5345 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5346 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5347 | /* Validity checks */ |
| 5348 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5349 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5350 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5351 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5352 | return -EINVAL; |
| 5353 | } |
| 5354 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
Jeff Johnson | d062b8d | 2019-03-09 20:31:13 -0800 | [diff] [blame] | 5355 | rsn_ie = gen_ie + 2 + 4; |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5356 | rsn_ie_len = gen_ie_len - (2 + 4); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5357 | /* Unpack the WPA IE */ |
Jeff Johnson | 034f3c9 | 2018-11-09 10:46:21 -0800 | [diff] [blame] | 5358 | parse_status = dot11f_unpack_ie_wpa(MAC_CONTEXT(mac_handle), |
Jeff Johnson | ddd05cf | 2019-03-09 20:43:43 -0800 | [diff] [blame] | 5359 | rsn_ie, rsn_ie_len, |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5360 | &dot11_wpa_ie, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5361 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5362 | hdd_err("Invalid WPA IE: parse status %d", |
| 5363 | parse_status); |
| 5364 | return -EINVAL; |
| 5365 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5366 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5367 | hdd_debug("WPA unicast cipher suite count: %d", |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5368 | dot11_wpa_ie.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5369 | hdd_debug("WPA authentication suite count: %d", |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5370 | dot11_wpa_ie.auth_suite_count); |
| 5371 | /* dot11_wpa_ie.auth_suite_count */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5372 | /* Just translate the FIRST one */ |
Jeff Johnson | 4f1be2d | 2019-03-09 22:52:04 -0800 | [diff] [blame] | 5373 | *auth_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5374 | hdd_translate_wpa_to_csr_auth_type( |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5375 | dot11_wpa_ie.auth_suites[0]); |
| 5376 | /* dot11_wpa_ie.unicast_cipher_count */ |
Jeff Johnson | a376a03 | 2019-03-09 22:39:27 -0800 | [diff] [blame] | 5377 | *encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5378 | hdd_translate_wpa_to_csr_encryption_type( |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5379 | dot11_wpa_ie.unicast_ciphers[0]); |
| 5380 | /* dot11_wpa_ie.unicast_cipher_count */ |
Jeff Johnson | cdde6c3 | 2019-03-09 23:03:49 -0800 | [diff] [blame] | 5381 | *mc_encrypt_type = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5382 | hdd_translate_wpa_to_csr_encryption_type( |
Jeff Johnson | 6a2c0ca | 2019-03-09 22:08:45 -0800 | [diff] [blame] | 5383 | dot11_wpa_ie.multicast_cipher); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5384 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5385 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5386 | return -EINVAL; |
| 5387 | } |
| 5388 | return 0; |
| 5389 | } |
| 5390 | |
| 5391 | /** |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5392 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 5393 | * in profile. |
| 5394 | * @roam_profile: pointer to adapter |
| 5395 | * @auth_type: pointer to auth type |
| 5396 | * |
| 5397 | * Set default value of encryption type and auth type in profile to |
| 5398 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 5399 | * currupt and we might not get the proper encryption type and auth type |
| 5400 | * while parsing the RSNIE. |
| 5401 | * |
| 5402 | * Return: void |
| 5403 | */ |
| 5404 | static void hdd_set_def_rsne_override( |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5405 | struct csr_roam_profile *roam_profile, enum csr_akm_type *auth_type) |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5406 | { |
| 5407 | |
| 5408 | hdd_debug("Set def values in roam profile"); |
| 5409 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 5410 | roam_profile->EncryptionType.numEntries = 2; |
| 5411 | roam_profile->mcEncryptionType.numEntries = 2; |
| 5412 | /* Use the cipher type in the RSN IE */ |
| 5413 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 5414 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 5415 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 5416 | eCSR_ENCRYPT_TYPE_AES; |
| 5417 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 5418 | eCSR_ENCRYPT_TYPE_TKIP; |
| 5419 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 5420 | } |
| 5421 | |
| 5422 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5423 | * hdd_set_genie_to_csr() - set genie to csr |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5424 | * @adapter: pointer to adapter |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5425 | * @rsn_auth_type: pointer to auth type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5426 | * |
| 5427 | * Return: 0 on success, error number otherwise |
| 5428 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5429 | int hdd_set_genie_to_csr(struct hdd_adapter *adapter, |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5430 | enum csr_akm_type *rsn_auth_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5431 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5432 | struct csr_roam_profile *roam_profile; |
| 5433 | uint8_t *security_ie; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5434 | uint32_t status = 0; |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5435 | eCsrEncryptionType rsn_encrypt_type; |
| 5436 | eCsrEncryptionType mc_rsn_encrypt_type; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5437 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5438 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 5abc32d | 2019-03-10 22:01:17 -0700 | [diff] [blame] | 5439 | uint8_t mfp_required = 0; |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5440 | uint8_t mfp_capable = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5441 | #endif |
| 5442 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5443 | |
| 5444 | roam_profile = hdd_roam_profile(adapter); |
| 5445 | security_ie = hdd_security_ie(adapter); |
| 5446 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5447 | /* MAC address of assoc peer */ |
| 5448 | /* But, this routine is only called when we are NOT associated. */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5449 | qdf_mem_copy(bssid, roam_profile->BSSIDs.bssid, sizeof(bssid)); |
| 5450 | if (security_ie[0] == DOT11F_EID_RSN || |
| 5451 | security_ie[0] == DOT11F_EID_WPA) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5452 | /* continue */ |
| 5453 | } else { |
| 5454 | return 0; |
| 5455 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5456 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5457 | /* The actual processing may eventually be more extensive than this. */ |
| 5458 | /* 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] | 5459 | status = hdd_process_genie(adapter, bssid, |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5460 | &rsn_encrypt_type, |
| 5461 | &mc_rsn_encrypt_type, rsn_auth_type, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5462 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5463 | &mfp_required, &mfp_capable, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5464 | #endif |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5465 | security_ie[1] + 2, |
| 5466 | security_ie); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5467 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5468 | if (status == 0) { |
| 5469 | /* |
| 5470 | * Now copy over all the security attributes |
| 5471 | * you have parsed out. |
| 5472 | */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5473 | roam_profile->EncryptionType.numEntries = 1; |
| 5474 | roam_profile->mcEncryptionType.numEntries = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5475 | |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 5476 | /* Use the cipher type in the RSN IE */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5477 | roam_profile->EncryptionType.encryptionType[0] = |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5478 | rsn_encrypt_type; |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5479 | roam_profile->mcEncryptionType.encryptionType[0] = |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5480 | mc_rsn_encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5481 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5482 | if ((QDF_IBSS_MODE == adapter->device_mode) && |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5483 | ((eCSR_ENCRYPT_TYPE_AES == mc_rsn_encrypt_type) || |
| 5484 | (eCSR_ENCRYPT_TYPE_AES_GCMP == mc_rsn_encrypt_type) || |
| 5485 | (eCSR_ENCRYPT_TYPE_AES_GCMP_256 == mc_rsn_encrypt_type) || |
| 5486 | (eCSR_ENCRYPT_TYPE_TKIP == mc_rsn_encrypt_type))) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5487 | /* |
| 5488 | * For wpa none supplicant sends the WPA IE with unicast |
| 5489 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5490 | * multicast cipher as either AES/TKIP based on group |
| 5491 | * cipher configuration mentioned in the |
| 5492 | * wpa_supplicant.conf. |
| 5493 | */ |
| 5494 | |
| 5495 | /* Set the unicast cipher same as multicast cipher */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5496 | roam_profile->EncryptionType.encryptionType[0] |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5497 | = mc_rsn_encrypt_type; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5498 | } |
| 5499 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5500 | hdd_debug("mfp_required = %d, mfp_capable = %d", |
| 5501 | mfp_required, mfp_capable); |
Jeff Johnson | 5abc32d | 2019-03-10 22:01:17 -0700 | [diff] [blame] | 5502 | roam_profile->MFPRequired = mfp_required; |
Jeff Johnson | de8f768 | 2019-03-10 22:02:29 -0700 | [diff] [blame] | 5503 | roam_profile->MFPCapable = mfp_capable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5504 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5505 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Jeff Johnson | 51203af | 2019-03-09 18:38:09 -0800 | [diff] [blame] | 5506 | *rsn_auth_type, rsn_encrypt_type, mc_rsn_encrypt_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5507 | } |
Kiran Kumar Lokere | e0ec563 | 2019-01-08 17:50:04 -0800 | [diff] [blame] | 5508 | #ifdef WLAN_CONV_CRYPTO_SUPPORTED |
| 5509 | if (QDF_STATUS_SUCCESS != wlan_set_vdev_crypto_prarams_from_ie( |
| 5510 | adapter->vdev, security_ie, |
| 5511 | (security_ie[1] + 2))) |
| 5512 | hdd_err("Failed to set the crypto params from IE"); |
| 5513 | #endif |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5514 | |
| 5515 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5516 | if (hdd_ctx->force_rsne_override && |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5517 | (security_ie[0] == DOT11F_EID_RSN)) { |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5518 | hdd_warn("Test mode enabled set def Auth and enc type. RSN IE passed in connect req: "); |
| 5519 | qdf_trace_hex_dump(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5520 | roam_profile->pRSNReqIE, |
| 5521 | roam_profile->nRSNReqIELength); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5522 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5523 | roam_profile->force_rsne_override = true; |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5524 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5525 | hdd_debug("MFPEnabled %d", roam_profile->MFPEnabled); |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5526 | /* |
Jeff Johnson | 33142e6 | 2018-05-06 17:58:36 -0700 | [diff] [blame] | 5527 | * Reset MFPEnabled if testmode RSNE passed doesn't have MFPR |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5528 | * or MFPC bit set |
| 5529 | */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5530 | if (roam_profile->MFPEnabled && |
| 5531 | !(roam_profile->MFPRequired || |
| 5532 | roam_profile->MFPCapable)) { |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5533 | hdd_debug("Reset MFPEnabled"); |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5534 | roam_profile->MFPEnabled = 0; |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5535 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5536 | /* If parsing failed set the def value for the roam profile */ |
| 5537 | if (status) |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5538 | hdd_set_def_rsne_override(roam_profile, rsn_auth_type); |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5539 | return 0; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5540 | } |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5541 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5542 | } |
| 5543 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5544 | #ifdef WLAN_FEATURE_FILS_SK |
| 5545 | /** |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5546 | * hdd_check_fils_rsn_n_set_auth_type() - This API checks whether a give |
| 5547 | * auth type is fils if yes, sets it in profile. |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5548 | * @rsn_auth_type: auth type |
| 5549 | * |
| 5550 | * Return: true if FILS auth else false |
| 5551 | */ |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5552 | static |
| 5553 | bool hdd_check_fils_rsn_n_set_auth_type(struct csr_roam_profile *roam_profile, |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5554 | enum csr_akm_type rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5555 | { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5556 | bool is_fils_rsn = false; |
| 5557 | |
| 5558 | if (!roam_profile->fils_con_info) |
| 5559 | return false; |
| 5560 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5561 | if ((rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA256) || |
| 5562 | (rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA384) || |
| 5563 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA256) || |
| 5564 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA384)) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5565 | is_fils_rsn = true; |
| 5566 | if (is_fils_rsn) |
| 5567 | roam_profile->fils_con_info->akm_type = rsn_auth_type; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5568 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5569 | return is_fils_rsn; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5570 | } |
| 5571 | #else |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5572 | static |
| 5573 | bool hdd_check_fils_rsn_n_set_auth_type(struct csr_roam_profile *roam_profile, |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5574 | enum csr_akm_type rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5575 | { |
| 5576 | return false; |
| 5577 | } |
| 5578 | #endif |
| 5579 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5580 | /** |
| 5581 | * hdd_set_csr_auth_type() - set csr auth type |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5582 | * @adapter: pointer to adapter |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5583 | * @rsn_auth_type: auth type |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5584 | * |
| 5585 | * Return: 0 on success, error number otherwise |
| 5586 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5587 | int hdd_set_csr_auth_type(struct hdd_adapter *adapter, |
Pragaspathi Thilagaraj | 7a1a08e | 2019-05-29 01:20:29 +0530 | [diff] [blame] | 5588 | enum csr_akm_type rsn_auth_type) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5589 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5590 | struct csr_roam_profile *roam_profile; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5591 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5592 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5593 | enum hdd_auth_key_mgmt key_mgmt = sta_ctx->auth_key_mgmt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5594 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5595 | roam_profile = hdd_roam_profile(adapter); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5596 | roam_profile->AuthType.numEntries = 1; |
Srinivas Dasari | 4bf1c93 | 2019-06-17 15:21:44 +0530 | [diff] [blame] | 5597 | hdd_debug("auth_type = %d rsn_auth_type %d wpa_versions %d key_mgmt : 0x%x", |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5598 | sta_ctx->conn_info.auth_type, rsn_auth_type, |
Srinivas Dasari | 4bf1c93 | 2019-06-17 15:21:44 +0530 | [diff] [blame] | 5599 | sta_ctx->wpa_versions, key_mgmt); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5600 | |
Jeff Johnson | 96e3351 | 2019-02-27 15:10:21 -0800 | [diff] [blame] | 5601 | switch (sta_ctx->conn_info.auth_type) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5602 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
Abhinav Kumar | bd41baa | 2018-10-12 17:46:04 +0530 | [diff] [blame] | 5603 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5604 | #ifdef FEATURE_WLAN_ESE |
| 5605 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5606 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5607 | #endif |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5608 | if (!sta_ctx->wpa_versions) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5609 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5610 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5611 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5612 | } else if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_1) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5613 | |
| 5614 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5615 | if ((rsn_auth_type == eCSR_AUTH_TYPE_CCKM_WPA) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5616 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5617 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5618 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5619 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5620 | eCSR_AUTH_TYPE_CCKM_WPA; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5621 | } else if (rsn_auth_type == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5622 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5623 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5624 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5625 | } else |
| 5626 | #endif |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5627 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5628 | == HDD_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5629 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5630 | eCSR_AUTH_TYPE_WPA; |
| 5631 | } else |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5632 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5633 | == HDD_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5634 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5635 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5636 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5637 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5638 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5639 | } |
| 5640 | } |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5641 | if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_2) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5642 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5643 | if ((rsn_auth_type == eCSR_AUTH_TYPE_CCKM_RSN) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5644 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5645 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5646 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
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_CCKM_RSN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5649 | } else if (rsn_auth_type == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5650 | hdd_debug("Last chance to set authType to CCKM RSN."); |
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_CCKM_RSN; |
| 5653 | } else |
| 5654 | #endif |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5655 | if (rsn_auth_type == eCSR_AUTH_TYPE_DPP_RSN) { |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 5656 | roam_profile->AuthType.authType[0] = |
| 5657 | eCSR_AUTH_TYPE_DPP_RSN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5658 | } else if (rsn_auth_type == eCSR_AUTH_TYPE_OSEN) { |
Srinivas Dasari | b328f1a | 2018-12-18 17:45:06 +0530 | [diff] [blame] | 5659 | roam_profile->AuthType.authType[0] = |
| 5660 | eCSR_AUTH_TYPE_OSEN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5661 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_FT_RSN) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5662 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5663 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5664 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5665 | eCSR_AUTH_TYPE_FT_RSN; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5666 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_FT_RSN_PSK) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5667 | && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5668 | ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5669 | == HDD_AUTH_KEY_MGMT_PSK)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5670 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5671 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5672 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5673 | |
| 5674 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5675 | if (rsn_auth_type == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5676 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5677 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5678 | } else if (rsn_auth_type == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5679 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5680 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5681 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5682 | } else |
| 5683 | #endif |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5684 | if (hdd_check_fils_rsn_n_set_auth_type(roam_profile, |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5685 | rsn_auth_type)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5686 | roam_profile->AuthType.authType[0] = |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5687 | rsn_auth_type; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 5688 | hdd_debug("updated profile authtype as %d", |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5689 | rsn_auth_type); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5690 | |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5691 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_OWE) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5692 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5693 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5694 | /* OWE case */ |
| 5695 | roam_profile->AuthType.authType[0] = |
| 5696 | eCSR_AUTH_TYPE_OWE; |
Srinivas Dasari | 4bf1c93 | 2019-06-17 15:21:44 +0530 | [diff] [blame] | 5697 | } else if (rsn_auth_type == eCSR_AUTH_TYPE_SAE) { |
| 5698 | /* SAE with open authentication case */ |
| 5699 | roam_profile->AuthType.authType[0] = |
| 5700 | eCSR_AUTH_TYPE_SAE; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5701 | } else if ((rsn_auth_type == |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5702 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5703 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5704 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5705 | /* Suite B EAP SHA 256 */ |
| 5706 | roam_profile->AuthType.authType[0] = |
| 5707 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5708 | } else if ((rsn_auth_type == |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5709 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5710 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5711 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5712 | /* Suite B EAP SHA 384 */ |
| 5713 | roam_profile->AuthType.authType[0] = |
| 5714 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5715 | } else if ((rsn_auth_type == eCSR_AUTH_TYPE_FT_SAE) && |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5716 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) == |
| 5717 | HDD_AUTH_KEY_MGMT_802_1X)) { |
| 5718 | roam_profile->AuthType.authType[0] = |
| 5719 | eCSR_AUTH_TYPE_FT_SAE; |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5720 | } else if ((rsn_auth_type == |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5721 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384) && |
| 5722 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5723 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
| 5724 | /* FT Suite-B EAP SHA 384 */ |
| 5725 | roam_profile->AuthType.authType[0] = |
| 5726 | eCSR_AUTH_TYPE_FT_SUITEB_EAP_SHA384; |
| 5727 | |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5728 | } else if ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5729 | == HDD_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5730 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5731 | eCSR_AUTH_TYPE_RSN; |
| 5732 | } else |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5733 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5734 | == HDD_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5735 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5736 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5737 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5738 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5739 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5740 | } |
| 5741 | } |
| 5742 | break; |
| 5743 | |
| 5744 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5745 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5746 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5747 | break; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5748 | |
| 5749 | case eCSR_AUTH_TYPE_SAE: |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5750 | |
Jeff Johnson | 784efe2 | 2019-03-09 18:31:13 -0800 | [diff] [blame] | 5751 | if (rsn_auth_type == eCSR_AUTH_TYPE_FT_SAE) |
Pragaspathi Thilagaraj | 96259b2 | 2019-02-15 01:08:27 +0530 | [diff] [blame] | 5752 | roam_profile->AuthType.authType[0] = |
| 5753 | eCSR_AUTH_TYPE_FT_SAE; |
| 5754 | else |
| 5755 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5756 | break; |
| 5757 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5758 | default: |
| 5759 | |
| 5760 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5761 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5762 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5763 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5764 | break; |
| 5765 | } |
| 5766 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5767 | hdd_debug("Set roam Authtype to %d", |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5768 | roam_profile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5769 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5770 | return 0; |
| 5771 | } |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5772 | |
| 5773 | #ifdef WLAN_FEATURE_FILS_SK |
| 5774 | static void hdd_initialize_fils_info(struct hdd_adapter *adapter) |
| 5775 | { |
| 5776 | struct csr_roam_profile *roam_profile; |
| 5777 | |
| 5778 | roam_profile = hdd_roam_profile(adapter); |
| 5779 | roam_profile->fils_con_info = NULL; |
| 5780 | roam_profile->hlp_ie = NULL; |
| 5781 | roam_profile->hlp_ie_len = 0; |
| 5782 | } |
| 5783 | #else |
| 5784 | static void hdd_initialize_fils_info(struct hdd_adapter *adapter) |
| 5785 | { } |
| 5786 | #endif |
| 5787 | |
| 5788 | void hdd_roam_profile_init(struct hdd_adapter *adapter) |
| 5789 | { |
| 5790 | struct csr_roam_profile *roam_profile; |
| 5791 | uint8_t *security_ie; |
| 5792 | tSirAddie *assoc_additional_ie; |
| 5793 | struct hdd_station_ctx *sta_ctx; |
| 5794 | |
| 5795 | hdd_enter(); |
| 5796 | |
| 5797 | roam_profile = hdd_roam_profile(adapter); |
| 5798 | qdf_mem_zero(roam_profile, sizeof(*roam_profile)); |
| 5799 | |
| 5800 | security_ie = hdd_security_ie(adapter); |
Srinivas Girigowda | cf16140 | 2019-03-14 11:37:33 -0700 | [diff] [blame] | 5801 | qdf_mem_zero(security_ie, WLAN_MAX_IE_LEN); |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5802 | |
| 5803 | assoc_additional_ie = hdd_assoc_additional_ie(adapter); |
| 5804 | qdf_mem_zero(assoc_additional_ie, sizeof(*assoc_additional_ie)); |
| 5805 | |
| 5806 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 5807 | |
| 5808 | /* Configure the roaming profile links to SSID and bssid. */ |
| 5809 | roam_profile->SSIDs.numOfSSIDs = 0; |
Jeff Johnson | 4aea180 | 2019-02-27 10:21:33 -0800 | [diff] [blame] | 5810 | roam_profile->SSIDs.SSIDList = &sta_ctx->conn_info.ssid; |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5811 | |
| 5812 | roam_profile->BSSIDs.numOfBSSIDs = 0; |
Jeff Johnson | e04b699 | 2019-02-27 14:06:55 -0800 | [diff] [blame] | 5813 | roam_profile->BSSIDs.bssid = &sta_ctx->conn_info.bssid; |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5814 | |
| 5815 | /* Set the numOfChannels to zero to scan all the channels */ |
| 5816 | roam_profile->ChannelInfo.numOfChannels = 0; |
wadesong | 24c869a | 2019-07-19 17:38:59 +0800 | [diff] [blame] | 5817 | roam_profile->ChannelInfo.freq_list = NULL; |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5818 | |
| 5819 | roam_profile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 5820 | |
| 5821 | roam_profile->phyMode = eCSR_DOT11_MODE_AUTO; |
| 5822 | sta_ctx->wpa_versions = 0; |
| 5823 | |
| 5824 | /* Set the default scan mode */ |
| 5825 | adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
| 5826 | |
| 5827 | hdd_clear_roam_profile_ie(adapter); |
| 5828 | |
| 5829 | hdd_initialize_fils_info(adapter); |
| 5830 | |
| 5831 | hdd_exit(); |
| 5832 | } |