Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3 | * |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4 | * Permission to use, copy, modify, and/or distribute this software for |
| 5 | * any purpose with or without fee is hereby granted, provided that the |
| 6 | * above copyright notice and this permission notice appear in all |
| 7 | * copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 10 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 11 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 12 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 13 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 14 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 15 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 16 | * PERFORMANCE OF THIS SOFTWARE. |
| 17 | */ |
| 18 | |
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" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 64 | |
Alok Kumar | b64650c | 2018-03-23 17:05:11 +0530 | [diff] [blame] | 65 | #include "wlan_hdd_nud_tracking.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 66 | /* These are needed to recognize WPA and RSN suite types */ |
| 67 | #define HDD_WPA_OUI_SIZE 4 |
| 68 | #define HDD_RSN_OUI_SIZE 4 |
| 69 | uint8_t ccp_wpa_oui00[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 70 | uint8_t ccp_wpa_oui01[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 71 | uint8_t ccp_wpa_oui02[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 72 | uint8_t ccp_wpa_oui03[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 73 | uint8_t ccp_wpa_oui04[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 74 | uint8_t ccp_wpa_oui05[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 75 | |
| 76 | #ifdef FEATURE_WLAN_ESE |
| 77 | /* CCKM */ |
| 78 | uint8_t ccp_wpa_oui06[HDD_WPA_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 79 | /* CCKM */ |
| 80 | uint8_t ccp_rsn_oui06[HDD_RSN_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 81 | #endif /* FEATURE_WLAN_ESE */ |
| 82 | |
| 83 | /* group cipher */ |
| 84 | uint8_t ccp_rsn_oui00[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x00 }; |
| 85 | |
| 86 | /* WEP-40 or RSN */ |
| 87 | uint8_t ccp_rsn_oui01[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x01 }; |
| 88 | |
| 89 | /* TKIP or RSN-PSK */ |
| 90 | uint8_t ccp_rsn_oui02[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x02 }; |
| 91 | |
| 92 | /* Reserved */ |
| 93 | uint8_t ccp_rsn_oui03[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x03 }; |
| 94 | |
| 95 | /* AES-CCMP */ |
| 96 | uint8_t ccp_rsn_oui04[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x04 }; |
| 97 | |
| 98 | /* WEP-104 */ |
| 99 | uint8_t ccp_rsn_oui05[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 100 | |
| 101 | #ifdef WLAN_FEATURE_11W |
| 102 | /* RSN-PSK-SHA256 */ |
| 103 | uint8_t ccp_rsn_oui07[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x06 }; |
| 104 | |
| 105 | /* RSN-8021X-SHA256 */ |
| 106 | uint8_t ccp_rsn_oui08[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 107 | #endif |
| 108 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 109 | /* AES-GCMP-128 */ |
| 110 | uint8_t ccp_rsn_oui09[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x08 }; |
| 111 | |
| 112 | /* AES-GCMP-256 */ |
| 113 | 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] | 114 | #ifdef WLAN_FEATURE_FILS_SK |
| 115 | uint8_t ccp_rsn_oui_0e[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0E}; |
| 116 | uint8_t ccp_rsn_oui_0f[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0F}; |
| 117 | uint8_t ccp_rsn_oui_10[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x10}; |
| 118 | uint8_t ccp_rsn_oui_11[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x11}; |
| 119 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 120 | 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] | 121 | uint8_t ccp_rsn_oui_0b[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0B}; |
| 122 | uint8_t ccp_rsn_oui_0c[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0C}; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 123 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 124 | /* OWE https://tools.ietf.org/html/rfc8110 */ |
| 125 | uint8_t ccp_rsn_oui_18[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x12}; |
| 126 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 127 | #ifdef WLAN_FEATURE_SAE |
| 128 | uint8_t ccp_rsn_oui_80[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x08}; |
| 129 | uint8_t ccp_rsn_oui_90[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x09}; |
| 130 | #endif |
| 131 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 132 | /* Offset where the EID-Len-IE, start. */ |
| 133 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 134 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 135 | |
| 136 | #define BEACON_FRAME_IES_OFFSET 12 |
| 137 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 138 | |
| 139 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 140 | * beacon_filter_table - table of IEs used for beacon filtering |
| 141 | */ |
| 142 | static const int beacon_filter_table[] = { |
| 143 | SIR_MAC_DS_PARAM_SET_EID, |
| 144 | SIR_MAC_ERP_INFO_EID, |
| 145 | SIR_MAC_EDCA_PARAM_SET_EID, |
| 146 | SIR_MAC_QOS_CAPABILITY_EID, |
| 147 | SIR_MAC_HT_INFO_EID, |
| 148 | SIR_MAC_VHT_OPMODE_EID, |
| 149 | SIR_MAC_VHT_OPERATION_EID, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 150 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 151 | /* |
| 152 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 153 | * bss-color-change IE till it gets any fixed number. This |
| 154 | * vendor EID needs to be replaced with bss-color-change IE |
| 155 | * number. |
| 156 | */ |
| 157 | SIR_MAC_EID_VENDOR, |
| 158 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 159 | }; |
| 160 | |
Padma, Santhosh Kumar | eb90a55 | 2018-01-16 19:41:58 +0530 | [diff] [blame] | 161 | #if defined(WLAN_FEATURE_SAE) && \ |
| 162 | defined(CFG80211_EXTERNAL_AUTH_SUPPORT) |
| 163 | /** |
| 164 | * wlan_hdd_sae_callback() - Sends SAE info to supplicant |
| 165 | * @adapter: pointer adapter context |
| 166 | * @roam_info: pointer to roam info |
| 167 | * |
| 168 | * This API is used to send required SAE info to trigger SAE in supplicant. |
| 169 | * |
| 170 | * Return: None |
| 171 | */ |
| 172 | static void wlan_hdd_sae_callback(struct hdd_adapter *adapter, |
| 173 | struct csr_roam_info *roam_info) |
| 174 | { |
| 175 | struct hdd_context *hdd_ctx = adapter->hdd_ctx; |
| 176 | int flags; |
| 177 | struct sir_sae_info *sae_info = roam_info->sae_info; |
| 178 | struct cfg80211_external_auth_params params = {0}; |
| 179 | |
| 180 | if (wlan_hdd_validate_context(hdd_ctx)) |
| 181 | return; |
| 182 | |
| 183 | if (!sae_info) { |
| 184 | hdd_err("SAE info in NULL"); |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | flags = cds_get_gfp_flags(); |
| 189 | |
| 190 | params.key_mgmt_suite = 0x00; |
| 191 | params.key_mgmt_suite |= 0x0F << 8; |
| 192 | params.key_mgmt_suite |= 0xAC << 16; |
| 193 | params.key_mgmt_suite |= 0x8 << 24; |
| 194 | |
| 195 | params.action = NL80211_EXTERNAL_AUTH_START; |
| 196 | qdf_mem_copy(params.bssid, sae_info->peer_mac_addr.bytes, |
| 197 | QDF_MAC_ADDR_SIZE); |
| 198 | qdf_mem_copy(params.ssid.ssid, sae_info->ssid.ssId, |
| 199 | sae_info->ssid.length); |
| 200 | params.ssid.ssid_len = sae_info->ssid.length; |
| 201 | |
| 202 | cfg80211_external_auth_request(adapter->dev, ¶ms, flags); |
| 203 | hdd_debug("SAE: sent cmd"); |
| 204 | } |
| 205 | #else |
| 206 | static inline void wlan_hdd_sae_callback(struct hdd_adapter *adapter, |
| 207 | struct csr_roam_info *roam_info) |
| 208 | { } |
| 209 | #endif |
| 210 | |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 211 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 212 | * hdd_conn_set_authenticated() - set authentication state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 213 | * @adapter: pointer to the adapter |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame^] | 214 | * @auth_state: authentication state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 215 | * |
| 216 | * This function updates the global HDD station context |
| 217 | * authentication state. |
| 218 | * |
| 219 | * Return: none |
| 220 | */ |
| 221 | static void |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame^] | 222 | hdd_conn_set_authenticated(struct hdd_adapter *adapter, uint8_t auth_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 223 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 224 | 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^] | 225 | char *auth_time; |
| 226 | uint32_t time_buffer_size; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | |
| 228 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 229 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame^] | 230 | sta_ctx->conn_info.uIsAuthenticated, auth_state); |
| 231 | sta_ctx->conn_info.uIsAuthenticated = auth_state; |
| 232 | |
| 233 | auth_time = sta_ctx->conn_info.auth_time; |
| 234 | time_buffer_size = sizeof(sta_ctx->conn_info.auth_time); |
| 235 | |
| 236 | if (auth_state) |
| 237 | qdf_get_time_of_the_day_in_hr_min_sec_usec(auth_time, |
| 238 | time_buffer_size); |
| 239 | else |
| 240 | qdf_mem_set(auth_time, 0x00, time_buffer_size); |
| 241 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | /** |
| 245 | * hdd_conn_set_connection_state() - set connection state |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 246 | * @adapter: pointer to the adapter |
| 247 | * @conn_state: connection state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 248 | * |
| 249 | * This function updates the global HDD station context connection state. |
| 250 | * |
| 251 | * Return: none |
| 252 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 253 | void hdd_conn_set_connection_state(struct hdd_adapter *adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 254 | eConnectionState conn_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 255 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 256 | struct hdd_station_ctx *hdd_sta_ctx = |
| 257 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame^] | 258 | char *connect_time; |
| 259 | uint32_t time_buffer_size; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 260 | |
| 261 | /* save the new connection state */ |
Jun Wang | 92cd836 | 2018-07-27 16:52:47 +0800 | [diff] [blame] | 262 | hdd_debug("Changed conn state from old:%d to new:%d for dev %s", |
| 263 | hdd_sta_ctx->conn_info.connState, conn_state, |
| 264 | adapter->dev->name); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 265 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 266 | hdd_tsf_notify_wlan_state_change(adapter, |
| 267 | hdd_sta_ctx->conn_info.connState, |
| 268 | conn_state); |
| 269 | hdd_sta_ctx->conn_info.connState = conn_state; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame^] | 270 | |
| 271 | connect_time = hdd_sta_ctx->conn_info.connect_time; |
| 272 | time_buffer_size = sizeof(hdd_sta_ctx->conn_info.connect_time); |
| 273 | if (conn_state == eConnectionState_Associated) |
| 274 | qdf_get_time_of_the_day_in_hr_min_sec_usec(connect_time, |
| 275 | time_buffer_size); |
| 276 | else |
| 277 | qdf_mem_set(connect_time, 0x00, time_buffer_size); |
| 278 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 279 | } |
| 280 | |
| 281 | /** |
| 282 | * hdd_conn_get_connection_state() - get connection state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 283 | * @adapter: pointer to the adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 284 | * @pConnState: pointer to connection state |
| 285 | * |
| 286 | * This function updates the global HDD station context connection state. |
| 287 | * |
| 288 | * Return: true if (Infra Associated or IBSS Connected) |
| 289 | * and sets output parameter pConnState; |
| 290 | * false otherwise |
| 291 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 292 | static inline bool |
| 293 | hdd_conn_get_connection_state(struct hdd_station_ctx *sta_ctx, |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 294 | eConnectionState *out_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 295 | { |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 296 | eConnectionState state = sta_ctx->conn_info.connState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 297 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 298 | if (out_state) |
| 299 | *out_state = state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 301 | switch (state) { |
| 302 | case eConnectionState_Associated: |
| 303 | case eConnectionState_IbssConnected: |
| 304 | case eConnectionState_IbssDisconnected: |
| 305 | case eConnectionState_NdiConnected: |
| 306 | return true; |
| 307 | default: |
| 308 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 310 | } |
| 311 | |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 312 | bool hdd_is_connecting(struct hdd_station_ctx *hdd_sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 313 | { |
| 314 | return hdd_sta_ctx->conn_info.connState == |
| 315 | eConnectionState_Connecting; |
| 316 | } |
| 317 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 318 | bool hdd_conn_is_connected(struct hdd_station_ctx *sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 319 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 320 | return hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 321 | } |
| 322 | |
Dustin Brown | 0127a73 | 2018-07-19 14:06:34 -0700 | [diff] [blame] | 323 | bool hdd_adapter_is_connected_sta(struct hdd_adapter *adapter) |
| 324 | { |
| 325 | switch (adapter->device_mode) { |
| 326 | case QDF_STA_MODE: |
| 327 | case QDF_P2P_CLIENT_MODE: |
| 328 | case QDF_NDI_MODE: |
| 329 | return hdd_conn_is_connected(&adapter->session.station); |
| 330 | default: |
| 331 | return false; |
| 332 | } |
| 333 | } |
| 334 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 335 | enum band_info hdd_conn_get_connected_band(struct hdd_station_ctx *sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 336 | { |
| 337 | uint8_t staChannel = 0; |
| 338 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 339 | if (eConnectionState_Associated == sta_ctx->conn_info.connState) |
| 340 | staChannel = sta_ctx->conn_info.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 341 | |
| 342 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 343 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 344 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 345 | return BAND_5G; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 346 | else /* If station is not connected return as BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 347 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | /** |
| 351 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 352 | * @sta_ctx: pointer to global HDD Station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 353 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 354 | * |
| 355 | * Return: false if any errors encountered, true otherwise |
| 356 | */ |
| 357 | static inline bool |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 358 | hdd_conn_get_connected_cipher_algo(struct hdd_station_ctx *sta_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 359 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 360 | { |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 361 | bool connected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 362 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 363 | connected = hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 364 | |
| 365 | if (pConnectedCipherAlgo) |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 366 | *pConnectedCipherAlgo = sta_ctx->conn_info.ucEncryptionType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 367 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 368 | return connected; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 369 | } |
| 370 | |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 371 | struct hdd_adapter *hdd_get_sta_connection_in_progress( |
| 372 | struct hdd_context *hdd_ctx) |
| 373 | { |
| 374 | struct hdd_adapter *adapter = NULL; |
| 375 | struct hdd_station_ctx *hdd_sta_ctx; |
| 376 | |
| 377 | if (!hdd_ctx) { |
| 378 | hdd_err("HDD context is NULL"); |
| 379 | return NULL; |
| 380 | } |
| 381 | |
| 382 | hdd_for_each_adapter(hdd_ctx, adapter) { |
| 383 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 384 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 385 | (QDF_P2P_CLIENT_MODE == adapter->device_mode) || |
| 386 | (QDF_P2P_DEVICE_MODE == adapter->device_mode)) { |
| 387 | if (eConnectionState_Connecting == |
| 388 | hdd_sta_ctx->conn_info.connState) { |
| 389 | hdd_debug("session_id %d: Connection is in progress", |
| 390 | adapter->session_id); |
| 391 | return adapter; |
| 392 | } else if ((eConnectionState_Associated == |
| 393 | hdd_sta_ctx->conn_info.connState) && |
Vignesh Viswanathan | 0a56929 | 2018-02-14 15:34:47 +0530 | [diff] [blame] | 394 | sme_is_sta_key_exchange_in_progress( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 395 | hdd_ctx->mac_handle, |
| 396 | adapter->session_id)) { |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 397 | hdd_debug("session_id %d: Key exchange is in progress", |
| 398 | adapter->session_id); |
| 399 | return adapter; |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | return NULL; |
| 404 | } |
| 405 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 406 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 407 | * hdd_remove_beacon_filter() - remove beacon filter |
| 408 | * @adapter: Pointer to the hdd adapter |
| 409 | * |
| 410 | * Return: 0 on success and errno on failure |
| 411 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 412 | static int hdd_remove_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 413 | { |
| 414 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 415 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 416 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 417 | status = sme_remove_beacon_filter(hdd_ctx->mac_handle, |
| 418 | adapter->session_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 419 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 420 | hdd_err("sme_remove_beacon_filter() failed"); |
| 421 | return -EFAULT; |
| 422 | } |
| 423 | |
| 424 | return 0; |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * hdd_add_beacon_filter() - add 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_add_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 434 | { |
| 435 | int i; |
| 436 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 437 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 438 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 439 | |
| 440 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 441 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 442 | (unsigned long int *)ie_map); |
| 443 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 444 | status = sme_add_beacon_filter(hdd_ctx->mac_handle, |
| 445 | adapter->session_id, ie_map); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 446 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 447 | hdd_err("sme_add_beacon_filter() failed"); |
| 448 | return -EFAULT; |
| 449 | } |
| 450 | return 0; |
| 451 | } |
| 452 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 453 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 454 | tDot11fIEHTCaps *roam_ht_cap) |
| 455 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 456 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 457 | uint32_t i, temp_ht_cap; |
| 458 | |
| 459 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 460 | |
| 461 | if (roam_ht_cap->advCodingCap) |
| 462 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 463 | if (roam_ht_cap->supportedChannelWidthSet) |
| 464 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 465 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 466 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 467 | if (temp_ht_cap) |
| 468 | hdd_ht_cap->cap_info |= |
| 469 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 470 | if (roam_ht_cap->greenField) |
| 471 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 472 | if (roam_ht_cap->shortGI20MHz) |
| 473 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 474 | if (roam_ht_cap->shortGI40MHz) |
| 475 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 476 | if (roam_ht_cap->txSTBC) |
| 477 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 478 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 479 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 480 | if (temp_ht_cap) |
| 481 | hdd_ht_cap->cap_info |= |
| 482 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 483 | if (roam_ht_cap->delayedBA) |
| 484 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 485 | if (roam_ht_cap->maximalAMSDUsize) |
| 486 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 487 | if (roam_ht_cap->dsssCckMode40MHz) |
| 488 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 489 | if (roam_ht_cap->psmp) |
| 490 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 491 | if (roam_ht_cap->stbcControlFrame) |
| 492 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 493 | if (roam_ht_cap->lsigTXOPProtection) |
| 494 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 495 | |
| 496 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 497 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 498 | hdd_ht_cap->ampdu_params_info |= |
| 499 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 500 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 501 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 502 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 503 | if (temp_ht_cap) |
| 504 | hdd_ht_cap->ampdu_params_info |= |
| 505 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 506 | |
| 507 | /* 802.11n HT extended capabilities masks */ |
| 508 | if (roam_ht_cap->pco) |
| 509 | hdd_ht_cap->extended_ht_cap_info |= |
| 510 | IEEE80211_HT_EXT_CAP_PCO; |
| 511 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 512 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 513 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 514 | if (temp_ht_cap) |
| 515 | hdd_ht_cap->extended_ht_cap_info |= |
| 516 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 517 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 518 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 519 | if (temp_ht_cap) |
| 520 | hdd_ht_cap->extended_ht_cap_info |= |
| 521 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 522 | |
| 523 | /* tx_bf_cap_info capabilities */ |
| 524 | if (roam_ht_cap->txBF) |
| 525 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 526 | if (roam_ht_cap->rxStaggeredSounding) |
| 527 | hdd_ht_cap->tx_BF_cap_info |= |
| 528 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 529 | if (roam_ht_cap->txStaggeredSounding) |
| 530 | hdd_ht_cap->tx_BF_cap_info |= |
| 531 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 532 | if (roam_ht_cap->rxZLF) |
| 533 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 534 | if (roam_ht_cap->txZLF) |
| 535 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 536 | if (roam_ht_cap->implicitTxBF) |
| 537 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 538 | temp_ht_cap = roam_ht_cap->calibration & |
| 539 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 540 | if (temp_ht_cap) |
| 541 | hdd_ht_cap->tx_BF_cap_info |= |
| 542 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 543 | if (roam_ht_cap->explicitCSITxBF) |
| 544 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 545 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 546 | hdd_ht_cap->tx_BF_cap_info |= |
| 547 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 548 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 549 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 550 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 551 | if (temp_ht_cap) |
| 552 | hdd_ht_cap->tx_BF_cap_info |= |
| 553 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 554 | temp_ht_cap = |
| 555 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 556 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 557 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 558 | if (temp_ht_cap) |
| 559 | hdd_ht_cap->tx_BF_cap_info |= |
| 560 | temp_ht_cap << |
| 561 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 562 | temp_ht_cap = |
| 563 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 564 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 565 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 566 | if (temp_ht_cap) |
| 567 | hdd_ht_cap->tx_BF_cap_info |= |
| 568 | temp_ht_cap << |
| 569 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 570 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 571 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 572 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 573 | if (temp_ht_cap) |
| 574 | hdd_ht_cap->tx_BF_cap_info |= |
| 575 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 576 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 577 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 578 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 579 | if (temp_ht_cap) |
| 580 | hdd_ht_cap->tx_BF_cap_info |= |
| 581 | temp_ht_cap << |
| 582 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 583 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 584 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 585 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 586 | if (temp_ht_cap) |
| 587 | hdd_ht_cap->tx_BF_cap_info |= |
| 588 | temp_ht_cap << |
| 589 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 590 | |
| 591 | /* antenna selection */ |
| 592 | if (roam_ht_cap->antennaSelection) |
| 593 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 594 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 595 | hdd_ht_cap->antenna_selection_info |= |
| 596 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 597 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 598 | hdd_ht_cap->antenna_selection_info |= |
| 599 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 600 | if (roam_ht_cap->explicitCSIFeedback) |
| 601 | hdd_ht_cap->antenna_selection_info |= |
| 602 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 603 | if (roam_ht_cap->antennaIndicesFeedback) |
| 604 | hdd_ht_cap->antenna_selection_info |= |
| 605 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 606 | if (roam_ht_cap->rxAS) |
| 607 | hdd_ht_cap->antenna_selection_info |= |
| 608 | ANTENNA_SEL_INFO_RX_AS; |
| 609 | if (roam_ht_cap->txSoundingPPDUs) |
| 610 | hdd_ht_cap->antenna_selection_info |= |
| 611 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 612 | |
| 613 | /* mcs data rate */ |
| 614 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 615 | hdd_ht_cap->mcs.rx_mask[i] = |
| 616 | roam_ht_cap->supportedMCSSet[i]; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 617 | hdd_ht_cap->mcs.rx_highest = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 618 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 619 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 620 | hdd_ht_cap->mcs.tx_params = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 621 | roam_ht_cap->supportedMCSSet[12]; |
| 622 | } |
| 623 | |
| 624 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 625 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 626 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 627 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 628 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 629 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 630 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 631 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 632 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 633 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 634 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 635 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 636 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 637 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 638 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 639 | tDot11fIEVHTCaps *roam_vht_cap) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 640 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 641 | uint32_t temp_vht_cap; |
| 642 | |
| 643 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 644 | |
| 645 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 646 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 647 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 648 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 649 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 650 | if (temp_vht_cap) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 651 | if (roam_vht_cap->supportedChannelWidthSet & |
| 652 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 653 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 654 | hdd_vht_cap->vht_cap_info |= |
| 655 | temp_vht_cap << |
| 656 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 657 | if (roam_vht_cap->supportedChannelWidthSet & |
| 658 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 659 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 660 | hdd_vht_cap->vht_cap_info |= |
| 661 | temp_vht_cap << |
| 662 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 663 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 664 | if (roam_vht_cap->ldpcCodingCap) |
| 665 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 666 | if (roam_vht_cap->shortGI80MHz) |
| 667 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 668 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 669 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 670 | if (roam_vht_cap->txSTBC) |
| 671 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 672 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 673 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 674 | if (temp_vht_cap) |
| 675 | hdd_vht_cap->vht_cap_info |= |
| 676 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 677 | if (roam_vht_cap->suBeamFormerCap) |
| 678 | hdd_vht_cap->vht_cap_info |= |
| 679 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 680 | if (roam_vht_cap->suBeamformeeCap) |
| 681 | hdd_vht_cap->vht_cap_info |= |
| 682 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 683 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 684 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 685 | if (temp_vht_cap) |
| 686 | hdd_vht_cap->vht_cap_info |= |
| 687 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 688 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 689 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 690 | if (temp_vht_cap) |
| 691 | hdd_vht_cap->vht_cap_info |= |
| 692 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 693 | if (roam_vht_cap->muBeamformerCap) |
| 694 | hdd_vht_cap->vht_cap_info |= |
| 695 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 696 | if (roam_vht_cap->muBeamformeeCap) |
| 697 | hdd_vht_cap->vht_cap_info |= |
| 698 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 699 | if (roam_vht_cap->vhtTXOPPS) |
| 700 | hdd_vht_cap->vht_cap_info |= |
| 701 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 702 | if (roam_vht_cap->htcVHTCap) |
| 703 | hdd_vht_cap->vht_cap_info |= |
| 704 | IEEE80211_VHT_CAP_HTC_VHT; |
| 705 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 706 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 707 | if (temp_vht_cap) |
| 708 | hdd_vht_cap->vht_cap_info |= |
| 709 | temp_vht_cap << |
| 710 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 711 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 712 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 713 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 714 | if (temp_vht_cap) |
| 715 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 716 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 717 | if (roam_vht_cap->rxAntPattern) |
| 718 | hdd_vht_cap->vht_cap_info |= |
| 719 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 720 | if (roam_vht_cap->txAntPattern) |
| 721 | hdd_vht_cap->vht_cap_info |= |
| 722 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 723 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 724 | hdd_vht_cap->supp_mcs.rx_highest = |
| 725 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 726 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 727 | hdd_vht_cap->supp_mcs.tx_highest = |
| 728 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 729 | } |
| 730 | |
| 731 | /* ht param */ |
| 732 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 733 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 734 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 735 | |
| 736 | /* operatinon mode */ |
| 737 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 738 | |
| 739 | /* stbc_param */ |
| 740 | #define HT_STBC_PARAM_MCS 0x007f |
| 741 | |
| 742 | /** |
| 743 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 744 | * hdd station context. |
| 745 | * @hdd_sta_ctx: pointer to hdd station context |
| 746 | * @roam_info: pointer to roam info |
| 747 | * |
| 748 | * Return: None |
| 749 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 750 | 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] | 751 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 752 | { |
| 753 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 754 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 755 | &hdd_sta_ctx->conn_info.ht_operation; |
| 756 | uint32_t i, temp_ht_ops; |
| 757 | |
| 758 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 759 | |
| 760 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 761 | |
| 762 | /* HT_PARAMS */ |
| 763 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 764 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 765 | if (temp_ht_ops) |
| 766 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 767 | else |
| 768 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 769 | if (roam_ht_ops->recommendedTxWidthSet) |
| 770 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 771 | if (roam_ht_ops->rifsMode) |
| 772 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 773 | if (roam_ht_ops->controlledAccessOnly) |
| 774 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 775 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 776 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 777 | if (temp_ht_ops) |
| 778 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 779 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 780 | |
| 781 | /* operation mode */ |
| 782 | temp_ht_ops = roam_ht_ops->opMode & |
| 783 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 784 | switch (temp_ht_ops) { |
| 785 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 786 | hdd_ht_ops->operation_mode |= |
| 787 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 788 | break; |
| 789 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 790 | hdd_ht_ops->operation_mode |= |
| 791 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 792 | break; |
| 793 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 794 | hdd_ht_ops->operation_mode |= |
| 795 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 796 | break; |
| 797 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 798 | default: |
| 799 | hdd_ht_ops->operation_mode |= |
| 800 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 801 | } |
| 802 | if (roam_ht_ops->nonGFDevicesPresent) |
| 803 | hdd_ht_ops->operation_mode |= |
| 804 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 805 | if (roam_ht_ops->transmitBurstLimit) |
| 806 | hdd_ht_ops->operation_mode |= |
| 807 | HT_OP_MODE_TX_BURST_LIMIT; |
| 808 | if (roam_ht_ops->obssNonHTStaPresent) |
| 809 | hdd_ht_ops->operation_mode |= |
| 810 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 811 | |
| 812 | /* stbc_param */ |
| 813 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 814 | HT_STBC_PARAM_MCS; |
| 815 | if (temp_ht_ops) |
| 816 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 817 | if (roam_ht_ops->dualCTSProtection) |
| 818 | hdd_ht_ops->stbc_param |= |
| 819 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 820 | if (roam_ht_ops->secondaryBeacon) |
| 821 | hdd_ht_ops->stbc_param |= |
| 822 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 823 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 824 | hdd_ht_ops->stbc_param |= |
| 825 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 826 | if (roam_ht_ops->pcoActive) |
| 827 | hdd_ht_ops->stbc_param |= |
| 828 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 829 | if (roam_ht_ops->pcoPhase) |
| 830 | hdd_ht_ops->stbc_param |= |
| 831 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 832 | |
| 833 | /* basic MCs set */ |
| 834 | for (i = 0; i < 16; ++i) |
| 835 | hdd_ht_ops->basic_set[i] = |
| 836 | roam_ht_ops->basicMCSSet[i]; |
| 837 | } |
| 838 | |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 839 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) |
| 840 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 841 | tDot11fIEVHTOperation *roam_ops) |
| 842 | { |
| 843 | ieee_ops->center_freq_seg0_idx = roam_ops->chanCenterFreqSeg1; |
| 844 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg2; |
| 845 | } |
| 846 | #else |
| 847 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 848 | tDot11fIEVHTOperation *roam_ops) |
| 849 | { |
| 850 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg1; |
| 851 | ieee_ops->center_freq_seg2_idx = roam_ops->chanCenterFreqSeg2; |
| 852 | } |
| 853 | #endif /* KERNEL_VERSION(4, 12, 0) */ |
| 854 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 855 | /** |
| 856 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 857 | * hdd station context. |
| 858 | * @hdd_sta_ctx: pointer to hdd station context |
| 859 | * @roam_info: pointer to roam info |
| 860 | * |
| 861 | * Return: None |
| 862 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 863 | 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] | 864 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 865 | { |
| 866 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 867 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 868 | &hdd_sta_ctx->conn_info.vht_operation; |
| 869 | |
| 870 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 871 | |
| 872 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 873 | hdd_copy_vht_center_freq(hdd_vht_ops, roam_vht_ops); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 874 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 875 | } |
| 876 | |
| 877 | |
| 878 | /** |
| 879 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 880 | * @adapter: Pointer to adapter |
| 881 | * @roam_info: pointer to roam info |
| 882 | * |
| 883 | * Return: None |
| 884 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 885 | static void hdd_save_bss_info(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 886 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 887 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 888 | struct hdd_station_ctx *hdd_sta_ctx = |
| 889 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 890 | |
| 891 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 892 | hdd_sta_ctx->conn_info.operationChannel); |
| 893 | if (roam_info->vht_caps.present) { |
| 894 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 895 | hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps, |
| 896 | &roam_info->vht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 897 | } else { |
| 898 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 899 | } |
| 900 | if (roam_info->ht_caps.present) { |
| 901 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 902 | hdd_copy_ht_caps(&hdd_sta_ctx->conn_info.ht_caps, |
| 903 | &roam_info->ht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 904 | } else { |
| 905 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 906 | } |
| 907 | if (roam_info->reassoc) |
| 908 | hdd_sta_ctx->conn_info.roam_count++; |
| 909 | if (roam_info->hs20vendor_ie.present) { |
| 910 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 911 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 912 | &roam_info->hs20vendor_ie, |
| 913 | sizeof(roam_info->hs20vendor_ie)); |
| 914 | } else { |
| 915 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 916 | } |
| 917 | if (roam_info->ht_operation.present) { |
| 918 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 919 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 920 | } else { |
| 921 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 922 | } |
| 923 | if (roam_info->vht_operation.present) { |
| 924 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 925 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 926 | } else { |
| 927 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 928 | } |
Ashish Kumar Dhanotiya | 36d19b0 | 2018-02-22 00:59:49 +0530 | [diff] [blame] | 929 | /* Cache last connection info */ |
| 930 | qdf_mem_copy(&hdd_sta_ctx->cache_conn_info, &hdd_sta_ctx->conn_info, |
| 931 | sizeof(struct connection_info)); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 932 | } |
| 933 | |
| 934 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 935 | * hdd_conn_save_connect_info() - save current connection information |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 936 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 937 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 938 | * @eBssType: bss type |
| 939 | * |
| 940 | * Return: none |
| 941 | */ |
| 942 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 943 | hdd_conn_save_connect_info(struct hdd_adapter *adapter, |
| 944 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 945 | eCsrRoamBssType eBssType) |
| 946 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 947 | 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] | 948 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 949 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 950 | QDF_ASSERT(roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 951 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 952 | if (roam_info) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 953 | /* Save the BSSID for the connection */ |
| 954 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 955 | QDF_ASSERT(roam_info->pBssDesc); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 956 | qdf_copy_macaddr(&sta_ctx->conn_info.bssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 957 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 958 | |
| 959 | /* |
| 960 | * Save the Station ID for this station from |
| 961 | * the 'Roam Info'. For IBSS mode, staId is |
| 962 | * assigned in NEW_PEER_IND. For reassoc, |
| 963 | * the staID doesn't change and it may be invalid |
| 964 | * in this structure so no change here. |
| 965 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 966 | if (!roam_info->fReassocReq) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 967 | sta_ctx->conn_info.staId[0] = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 968 | roam_info->staId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 969 | } |
| 970 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 971 | qdf_copy_macaddr(&sta_ctx->conn_info.bssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 972 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 973 | } else { |
| 974 | /* |
| 975 | * can't happen. We need a valid IBSS or Infra setting |
| 976 | * in the BSSDescription or we can't function. |
| 977 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 978 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 979 | } |
| 980 | |
| 981 | /* notify WMM */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 982 | hdd_wmm_connect(adapter, roam_info, eBssType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 983 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 984 | if (!roam_info->u.pConnectedProfile) { |
| 985 | QDF_ASSERT(roam_info->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 986 | } else { |
| 987 | /* Get Multicast Encryption Type */ |
| 988 | encryptType = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 989 | roam_info->u.pConnectedProfile->mcEncryptionType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 990 | sta_ctx->conn_info.mcEncryptionType = encryptType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 991 | /* Get Unicast Encryption Type */ |
| 992 | encryptType = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 993 | roam_info->u.pConnectedProfile->EncryptionType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 994 | sta_ctx->conn_info.ucEncryptionType = encryptType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 995 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 996 | sta_ctx->conn_info.authType = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 997 | roam_info->u.pConnectedProfile->AuthType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 998 | sta_ctx->conn_info.last_auth_type = |
| 999 | sta_ctx->conn_info.authType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1000 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1001 | sta_ctx->conn_info.operationChannel = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1002 | roam_info->u.pConnectedProfile->operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1003 | |
| 1004 | /* Save the ssid for the connection */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1005 | qdf_mem_copy(&sta_ctx->conn_info.SSID.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1006 | &roam_info->u.pConnectedProfile->SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1007 | sizeof(tSirMacSSid)); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1008 | qdf_mem_copy(&sta_ctx->conn_info.last_ssid.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1009 | &roam_info->u.pConnectedProfile->SSID, |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1010 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1011 | |
| 1012 | /* Save dot11mode in which STA associated to AP */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1013 | sta_ctx->conn_info.dot11Mode = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1014 | roam_info->u.pConnectedProfile->dot11Mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1015 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1016 | sta_ctx->conn_info.proxyARPService = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1017 | roam_info->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1018 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1019 | sta_ctx->conn_info.nss = roam_info->chan_info.nss; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 1020 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1021 | sta_ctx->conn_info.rate_flags = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1022 | roam_info->chan_info.rate_flags; |
Rajeev Kumar Sirasanagandla | 4c8edc0 | 2018-03-12 08:44:51 +0530 | [diff] [blame^] | 1023 | |
| 1024 | sta_ctx->conn_info.ch_width = |
| 1025 | roam_info->chan_info.ch_width; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1026 | } |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1027 | hdd_save_bss_info(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1028 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1029 | } |
| 1030 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1031 | /** |
| 1032 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 1033 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1034 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1035 | * @pCsrRoamInfo: pointer to roam info |
| 1036 | * |
| 1037 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 1038 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 1039 | * for the same purpose.) |
| 1040 | * |
| 1041 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 1042 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 1043 | * This is the Assoc Response. |
| 1044 | * |
| 1045 | * Return: none |
| 1046 | */ |
| 1047 | static void |
| 1048 | hdd_send_ft_assoc_response(struct net_device *dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1049 | struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1050 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1051 | { |
| 1052 | union iwreq_data wrqu; |
| 1053 | char *buff; |
| 1054 | unsigned int len = 0; |
| 1055 | u8 *pFTAssocRsp = NULL; |
| 1056 | |
| 1057 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1058 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1059 | return; |
| 1060 | } |
| 1061 | |
| 1062 | pFTAssocRsp = |
| 1063 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 1064 | pCsrRoamInfo->nAssocReqLength); |
| 1065 | if (pFTAssocRsp == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1066 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | return; |
| 1068 | } |
| 1069 | /* pFTAssocRsp needs to point to the IEs */ |
| 1070 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1071 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1072 | (unsigned int)pFTAssocRsp[0], |
| 1073 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1074 | |
| 1075 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1076 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1077 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1078 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1079 | return; |
| 1080 | } |
| 1081 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 1082 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 1083 | wrqu.data.length = len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1084 | memcpy(buff, pFTAssocRsp, len); |
| 1085 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 1086 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1087 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1088 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1089 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | /** |
| 1091 | * hdd_send_ft_event() - send fast transition event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1092 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1093 | * |
| 1094 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 1095 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 1096 | * followed by the auth response IEs to the supplicant. |
| 1097 | * Once both are received in the supplicant, an FT event is generated |
| 1098 | * to the supplicant. |
| 1099 | * |
| 1100 | * Return: none |
| 1101 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1102 | static void hdd_send_ft_event(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1103 | { |
| 1104 | uint16_t auth_resp_len = 0; |
| 1105 | uint32_t ric_ies_length = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1106 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1107 | mac_handle_t mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1108 | |
| 1109 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 1110 | struct cfg80211_ft_event_params ftEvent; |
| 1111 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1112 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1113 | struct net_device *dev = adapter->dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1114 | #else |
| 1115 | char *buff; |
| 1116 | union iwreq_data wrqu; |
| 1117 | uint16_t str_len; |
| 1118 | #endif |
| 1119 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1120 | mac_handle = hdd_ctx->mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1121 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1122 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1123 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1124 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1125 | sme_get_rici_es(mac_handle, adapter->session_id, (u8 *) ricIe, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1126 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1127 | if (ric_ies_length == 0) |
| 1128 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1129 | |
| 1130 | ftEvent.ric_ies = ricIe; |
| 1131 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1132 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1133 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1134 | sme_get_ft_pre_auth_response(mac_handle, adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1135 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1136 | &auth_resp_len); |
| 1137 | |
| 1138 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1139 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1140 | return; |
| 1141 | } |
| 1142 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1143 | sme_set_ft_pre_auth_state(mac_handle, adapter->session_id, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1144 | |
| 1145 | ftEvent.target_ap = ftIe; |
| 1146 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1147 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1148 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1149 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1150 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1151 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1152 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1153 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1154 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1155 | ftEvent.target_ap[5]); |
| 1156 | |
| 1157 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1158 | |
| 1159 | #else |
| 1160 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1161 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1162 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1163 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1164 | return; |
| 1165 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1166 | |
| 1167 | /* Sme needs to send the RIC IEs first */ |
| 1168 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1169 | sme_get_rici_es(mac_handle, adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1170 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1171 | &ric_ies_length); |
| 1172 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1173 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1174 | } else { |
| 1175 | wrqu.data.length = str_len + ric_ies_length; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1176 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1177 | } |
| 1178 | |
| 1179 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1180 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1181 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1182 | sme_get_ft_pre_auth_response(mac_handle, adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1183 | (u8 *) &buff[str_len], |
| 1184 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1185 | |
| 1186 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1187 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1188 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1189 | return; |
| 1190 | } |
| 1191 | |
| 1192 | wrqu.data.length = str_len + auth_resp_len; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1193 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1194 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1195 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1196 | #endif |
| 1197 | } |
| 1198 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1199 | #ifdef FEATURE_WLAN_ESE |
| 1200 | /** |
| 1201 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1202 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1203 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1204 | * @pCsrRoamInfo: pointer to roam info |
| 1205 | * |
| 1206 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1207 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1208 | * |
| 1209 | * The current (new AP) channel information is passed in. |
| 1210 | * |
| 1211 | * Return: none |
| 1212 | */ |
| 1213 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1214 | hdd_send_new_ap_channel_info(struct net_device *dev, |
| 1215 | struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1216 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1217 | { |
| 1218 | union iwreq_data wrqu; |
Jeff Johnson | 4ba73cb | 2017-10-06 11:12:33 -0700 | [diff] [blame] | 1219 | struct bss_description *descriptor = pCsrRoamInfo->pBssDesc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1220 | |
| 1221 | if (descriptor == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1222 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1223 | return; |
| 1224 | } |
| 1225 | /* |
| 1226 | * Send the Channel event, the supplicant needs this to generate |
| 1227 | * the Adjacent AP report. |
| 1228 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1229 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1230 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1231 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1232 | wrqu.freq.m = descriptor->channelId; |
| 1233 | wrqu.freq.e = 0; |
| 1234 | wrqu.freq.i = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1235 | wireless_send_event(adapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1236 | } |
| 1237 | |
| 1238 | #endif /* FEATURE_WLAN_ESE */ |
| 1239 | |
| 1240 | /** |
| 1241 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1242 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1243 | * @pCsrRoamInfo: pointer to roam info |
| 1244 | * |
| 1245 | * Return: none |
| 1246 | */ |
| 1247 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1248 | hdd_send_update_beacon_ies_event(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1249 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1250 | { |
| 1251 | union iwreq_data wrqu; |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1252 | u8 *beacon_ies; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1253 | u8 currentLen = 0; |
| 1254 | char *buff; |
| 1255 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1256 | |
| 1257 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1258 | |
| 1259 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1260 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1261 | return; |
| 1262 | } |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1263 | beacon_ies = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1264 | if (beacon_ies == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1265 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1266 | return; |
| 1267 | } |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1268 | /* beacon_ies needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1269 | hdd_debug("Beacon IEs is now at %02x%02x", |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1270 | (unsigned int)beacon_ies[0], |
| 1271 | (unsigned int)beacon_ies[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1272 | hdd_debug("Beacon IEs length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1273 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1274 | |
| 1275 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1276 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1277 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1278 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1279 | return; |
| 1280 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1281 | |
| 1282 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1283 | currentLen = strLen + 1; |
| 1284 | |
| 1285 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1286 | do { |
| 1287 | /* |
| 1288 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1289 | * into chunks of CUSTOM event max size and send it to |
| 1290 | * supplicant. Changes are done in supplicant to handle this. |
| 1291 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1292 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1293 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1294 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1295 | qdf_mem_copy(&buff[strLen + 1], beacon_ies + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1296 | currentLen); |
| 1297 | currentOffset += currentLen; |
| 1298 | totalIeLen -= currentLen; |
| 1299 | wrqu.data.length = strLen + 1 + currentLen; |
| 1300 | if (totalIeLen) |
| 1301 | buff[strLen] = 1; /* more chunks pending */ |
| 1302 | else |
| 1303 | buff[strLen] = 0; /* last chunk */ |
| 1304 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1305 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1306 | currentLen); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1307 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1308 | } while (totalIeLen > 0); |
| 1309 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1310 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1311 | } |
| 1312 | |
| 1313 | /** |
| 1314 | * hdd_send_association_event() - send association event |
| 1315 | * @dev: pointer to net device |
| 1316 | * @pCsrRoamInfo: pointer to roam info |
| 1317 | * |
| 1318 | * Return: none |
| 1319 | */ |
| 1320 | static void hdd_send_association_event(struct net_device *dev, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1321 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1322 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1323 | int ret; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1324 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1325 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1326 | 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] | 1327 | union iwreq_data wrqu; |
| 1328 | int we_event; |
| 1329 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1330 | struct qdf_mac_addr peerMacAddr; |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1331 | struct csr_roam_profile *roam_profile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1332 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1333 | roam_profile = hdd_roam_profile(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1334 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1335 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1336 | we_event = SIOCGIWAP; |
| 1337 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1338 | if (NULL != pCsrRoamInfo) |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1339 | if (pCsrRoamInfo->roamSynchInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1340 | /* change logging before release */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1341 | hdd_debug("LFR3:hdd_send_association_event"); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1342 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1343 | hdd_notify_sta_disconnect(adapter->session_id, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1344 | true, false, |
| 1345 | adapter->hdd_vdev); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1346 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1347 | #endif |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1348 | if (eConnectionState_Associated == sta_ctx->conn_info.connState) { |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1349 | tSirSmeChanInfo chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1350 | |
Rajeev Kumar Sirasanagandla | e5582aa | 2018-05-02 18:20:20 +0530 | [diff] [blame] | 1351 | if (!pCsrRoamInfo || !pCsrRoamInfo->pBssDesc) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1352 | hdd_warn("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1353 | return; |
| 1354 | } |
| 1355 | |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 1356 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) { |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1357 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1358 | adapter->device_mode, adapter->session_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 1359 | hdd_green_ap_start_state_mc(hdd_ctx, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 1360 | adapter->device_mode, true); |
| 1361 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1362 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1363 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1364 | |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1365 | ucfg_p2p_status_connect(adapter->hdd_vdev); |
| 1366 | |
Abhinav Kumar | 50d4dc7 | 2018-06-15 16:35:50 +0530 | [diff] [blame] | 1367 | hdd_info("wlan: " MAC_ADDRESS_STR " connected to " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1368 | MAC_ADDRESS_STR "\n", |
Jeff Johnson | 1e851a1 | 2017-10-28 14:36:12 -0700 | [diff] [blame] | 1369 | MAC_ADDR_ARRAY(adapter->mac_addr.bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1370 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1371 | hdd_send_update_beacon_ies_event(adapter, pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1372 | |
| 1373 | /* |
| 1374 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1375 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1376 | * fFTEnable is true. |
| 1377 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1378 | */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1379 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1380 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1381 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1382 | eCSR_AUTH_TYPE_FT_RSN) |
| 1383 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1384 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1385 | eCSR_AUTH_TYPE_CCKM_RSN) |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1386 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1387 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1388 | #endif |
| 1389 | ) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1390 | hdd_send_ft_assoc_response(dev, adapter, pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1391 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1392 | qdf_copy_macaddr(&peerMacAddr, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1393 | &sta_ctx->conn_info.bssId); |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1394 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1395 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1396 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1397 | chan_info.band_center_freq1 = |
| 1398 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1399 | chan_info.band_center_freq2 = |
| 1400 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1401 | chan_info.reg_info_1 = |
| 1402 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1403 | chan_info.reg_info_2 = |
| 1404 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1405 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1406 | ret = hdd_objmgr_set_peer_mlme_state(adapter->hdd_vdev, |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1407 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1408 | if (ret) |
| 1409 | hdd_err("Peer object %pM fail to set associated state", |
| 1410 | peerMacAddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1411 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1412 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1413 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
| 1414 | ePeerConnected, |
| 1415 | pCsrRoamInfo->timingMeasCap, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1416 | adapter->session_id, &chan_info, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1417 | adapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1418 | /* Update tdls module about connection event */ |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1419 | hdd_notify_sta_connect(adapter->session_id, |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1420 | pCsrRoamInfo->tdls_chan_swit_prohibited, |
| 1421 | pCsrRoamInfo->tdls_prohibited, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1422 | adapter->hdd_vdev); |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1423 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1424 | #ifdef MSM_PLATFORM |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1425 | /* start timer in sta/p2p_cli */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1426 | spin_lock_bh(&hdd_ctx->bus_bw_lock); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1427 | adapter->prev_tx_packets = adapter->stats.tx_packets; |
| 1428 | adapter->prev_rx_packets = adapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1429 | cdp_get_intra_bss_fwd_pkts_count( |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1430 | cds_get_context(QDF_MODULE_ID_SOC), adapter->session_id, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1431 | &adapter->prev_fwd_tx_packets, |
| 1432 | &adapter->prev_fwd_rx_packets); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1433 | spin_unlock_bh(&hdd_ctx->bus_bw_lock); |
| 1434 | hdd_bus_bw_compute_timer_start(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1435 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1436 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1437 | sta_ctx->conn_info.connState) { |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1438 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1439 | adapter->session_id); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1440 | memcpy(wrqu.ap_addr.sa_data, sta_ctx->conn_info.bssId.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1441 | ETH_ALEN); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1442 | hdd_debug("wlan: new IBSS peer connection to BSSID " MAC_ADDRESS_STR, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1443 | MAC_ADDR_ARRAY(sta_ctx->conn_info.bssId.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1444 | } else { /* Not Associated */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1445 | hdd_debug("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1446 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1447 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1448 | adapter->device_mode, adapter->session_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 1449 | hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 1450 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1451 | |
| 1452 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1453 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1454 | #endif |
| 1455 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1456 | if ((adapter->device_mode == QDF_STA_MODE) || |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 1457 | (adapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1458 | qdf_copy_macaddr(&peerMacAddr, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1459 | &sta_ctx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1460 | |
| 1461 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1462 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1463 | ePeerDisconnected, 0, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1464 | adapter->session_id, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1465 | NULL, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1466 | adapter->device_mode); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1467 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1468 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1469 | hdd_lpass_notify_disconnect(adapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1470 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1471 | hdd_notify_sta_disconnect(adapter->session_id, |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1472 | false, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1473 | false, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1474 | adapter->hdd_vdev); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1475 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1476 | #ifdef MSM_PLATFORM |
| 1477 | /* stop timer in sta/p2p_cli */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1478 | spin_lock_bh(&hdd_ctx->bus_bw_lock); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1479 | adapter->prev_tx_packets = 0; |
| 1480 | adapter->prev_rx_packets = 0; |
| 1481 | adapter->prev_fwd_tx_packets = 0; |
| 1482 | adapter->prev_fwd_rx_packets = 0; |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1483 | spin_unlock_bh(&hdd_ctx->bus_bw_lock); |
| 1484 | hdd_bus_bw_compute_timer_try_stop(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1485 | #endif |
| 1486 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1487 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1488 | |
| 1489 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1490 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1491 | * driver so not sending the status of the connection to supplicant |
| 1492 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1493 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1494 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1495 | #ifdef FEATURE_WLAN_ESE |
| 1496 | if (eConnectionState_Associated == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1497 | sta_ctx->conn_info.connState) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1498 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1499 | eCSR_AUTH_TYPE_CCKM_RSN) || |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1500 | (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1501 | eCSR_AUTH_TYPE_CCKM_WPA)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1502 | hdd_send_new_ap_channel_info(dev, adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1503 | pCsrRoamInfo); |
| 1504 | } |
| 1505 | #endif |
| 1506 | } |
| 1507 | } |
| 1508 | |
| 1509 | /** |
| 1510 | * hdd_conn_remove_connect_info() - remove connection info |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1511 | * @sta_ctx: pointer to global HDD station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1512 | * @pCsrRoamInfo: pointer to roam info |
| 1513 | * |
| 1514 | * Return: none |
| 1515 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1516 | 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] | 1517 | { |
| 1518 | /* Remove staId, bssId and peerMacAddress */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1519 | sta_ctx->conn_info.staId[0] = HDD_WLAN_INVALID_STA_ID; |
| 1520 | qdf_mem_zero(&sta_ctx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1521 | qdf_mem_zero(&sta_ctx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1522 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1523 | |
| 1524 | /* Clear all security settings */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1525 | sta_ctx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1526 | sta_ctx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1527 | sta_ctx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1528 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1529 | qdf_mem_zero(&sta_ctx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1530 | qdf_mem_zero(&sta_ctx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1531 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1532 | sta_ctx->conn_info.proxyARPService = 0; |
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->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1535 | } |
| 1536 | |
| 1537 | /** |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 1538 | * hdd_clear_roam_profile_ie() - Clear Roam Profile IEs |
| 1539 | * @adapter: adapter who's IEs are to be cleared |
| 1540 | * |
| 1541 | * Return: None |
| 1542 | */ |
| 1543 | static void hdd_clear_roam_profile_ie(struct hdd_adapter *adapter) |
| 1544 | { |
| 1545 | struct hdd_station_ctx *sta_ctx; |
| 1546 | struct csr_roam_profile *roam_profile; |
| 1547 | |
| 1548 | hdd_enter(); |
| 1549 | |
| 1550 | /* clear WPA/RSN/WSC IE information in the profile */ |
| 1551 | roam_profile = hdd_roam_profile(adapter); |
| 1552 | |
| 1553 | roam_profile->nWPAReqIELength = 0; |
| 1554 | roam_profile->pWPAReqIE = NULL; |
| 1555 | roam_profile->nRSNReqIELength = 0; |
| 1556 | roam_profile->pRSNReqIE = NULL; |
| 1557 | |
| 1558 | #ifdef FEATURE_WLAN_WAPI |
| 1559 | roam_profile->nWAPIReqIELength = 0; |
| 1560 | roam_profile->pWAPIReqIE = NULL; |
| 1561 | #endif |
| 1562 | |
| 1563 | roam_profile->bWPSAssociation = false; |
| 1564 | roam_profile->bOSENAssociation = false; |
| 1565 | roam_profile->pAddIEScan = NULL; |
| 1566 | roam_profile->nAddIEScanLength = 0; |
| 1567 | roam_profile->pAddIEAssoc = NULL; |
| 1568 | roam_profile->nAddIEAssocLength = 0; |
| 1569 | |
| 1570 | roam_profile->EncryptionType.numEntries = 1; |
| 1571 | roam_profile->EncryptionType.encryptionType[0] = |
| 1572 | eCSR_ENCRYPT_TYPE_NONE; |
| 1573 | |
| 1574 | roam_profile->mcEncryptionType.numEntries = 1; |
| 1575 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 1576 | eCSR_ENCRYPT_TYPE_NONE; |
| 1577 | |
| 1578 | roam_profile->AuthType.numEntries = 1; |
| 1579 | roam_profile->AuthType.authType[0] = |
| 1580 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1581 | |
| 1582 | qdf_mem_zero(roam_profile->bssid_hint.bytes, QDF_MAC_ADDR_SIZE); |
| 1583 | |
| 1584 | #ifdef WLAN_FEATURE_11W |
| 1585 | roam_profile->MFPEnabled = false; |
| 1586 | roam_profile->MFPRequired = 0; |
| 1587 | roam_profile->MFPCapable = 0; |
| 1588 | #endif |
| 1589 | |
| 1590 | qdf_mem_zero(roam_profile->Keys.KeyLength, CSR_MAX_NUM_KEY); |
| 1591 | |
| 1592 | #ifdef FEATURE_WLAN_WAPI |
| 1593 | adapter->wapi_info.wapi_auth_mode = WAPI_AUTH_MODE_OPEN; |
| 1594 | adapter->wapi_info.wapi_mode = false; |
| 1595 | #endif |
| 1596 | |
| 1597 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1598 | sta_ctx->auth_key_mgmt = 0; |
| 1599 | qdf_zero_macaddr(&sta_ctx->requested_bssid); |
| 1600 | hdd_exit(); |
| 1601 | } |
| 1602 | |
| 1603 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1604 | * hdd_roam_deregister_sta() - deregister station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1605 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1606 | * @staId: station identifier |
| 1607 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1608 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1609 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 1610 | QDF_STATUS hdd_roam_deregister_sta(struct hdd_adapter *adapter, uint8_t staid) |
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), |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1616 | staid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1617 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1618 | hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]", |
| 1619 | staid, qdf_status, qdf_status); |
| 1620 | } |
| 1621 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1622 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1623 | } |
| 1624 | |
| 1625 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1626 | * hdd_print_bss_info() - print bss info |
| 1627 | * @hdd_sta_ctx: pointer to hdd station context |
| 1628 | * |
| 1629 | * Return: None |
| 1630 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1631 | 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] | 1632 | { |
| 1633 | uint32_t *cap_info; |
| 1634 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1635 | hdd_debug("WIFI DATA LOGGER"); |
| 1636 | hdd_debug("channel: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1637 | hdd_sta_ctx->conn_info.freq); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1638 | hdd_debug("dot11mode: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1639 | hdd_sta_ctx->conn_info.dot11Mode); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1640 | hdd_debug("AKM: %d", |
| 1641 | hdd_sta_ctx->conn_info.last_auth_type); |
| 1642 | hdd_debug("ssid: %.*s", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1643 | hdd_sta_ctx->conn_info.last_ssid.SSID.length, |
| 1644 | hdd_sta_ctx->conn_info.last_ssid.SSID.ssId); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1645 | hdd_debug("roam count: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1646 | hdd_sta_ctx->conn_info.roam_count); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1647 | hdd_debug("ant_info: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1648 | hdd_sta_ctx->conn_info.txrate.nss); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1649 | hdd_debug("datarate legacy %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1650 | hdd_sta_ctx->conn_info.txrate.legacy); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1651 | hdd_debug("datarate mcs: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1652 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1653 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1654 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1655 | hdd_debug("ht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1656 | } |
| 1657 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1658 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1659 | hdd_debug("vht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1660 | } |
| 1661 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1662 | hdd_debug("hs20 info: %x", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1663 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1664 | hdd_debug("signal: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1665 | hdd_sta_ctx->conn_info.signal); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1666 | hdd_debug("noise: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1667 | hdd_sta_ctx->conn_info.noise); |
| 1668 | } |
| 1669 | |
| 1670 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1671 | * hdd_dis_connect_handler() - disconnect event handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1672 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1673 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1674 | * @roamId: roam identifier |
| 1675 | * @roamStatus: roam status |
| 1676 | * @roamResult: roam result |
| 1677 | * |
| 1678 | * This function handles disconnect event: |
| 1679 | * 1. Disable transmit queues; |
| 1680 | * 2. Clean up internal connection states and data structures; |
| 1681 | * 3. Send disconnect indication to supplicant. |
| 1682 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1683 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1684 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1685 | static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1686 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1687 | uint32_t roamId, |
| 1688 | eRoamCmdStatus roamStatus, |
| 1689 | eCsrRoamResult roamResult) |
| 1690 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1691 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1692 | QDF_STATUS vstatus; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1693 | struct net_device *dev = adapter->dev; |
| 1694 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1695 | 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] | 1696 | uint8_t sta_id; |
| 1697 | bool sendDisconInd = true; |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1698 | mac_handle_t mac_handle; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1699 | |
| 1700 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1701 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1702 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1703 | } |
| 1704 | /* notify apps that we can't pass traffic anymore */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1705 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1706 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1707 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1708 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1709 | |
gaurank kathpalia | 63311d1 | 2018-04-12 14:34:26 +0530 | [diff] [blame] | 1710 | if (ucfg_ipa_is_enabled() && |
| 1711 | (sta_ctx->conn_info.staId[0] != HDD_WLAN_INVALID_STA_ID)) |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 1712 | ucfg_ipa_wlan_evt(hdd_ctx->hdd_pdev, adapter->dev, |
| 1713 | adapter->device_mode, |
| 1714 | sta_ctx->conn_info.staId[0], |
| 1715 | adapter->session_id, |
| 1716 | WLAN_IPA_STA_DISCONNECT, |
| 1717 | sta_ctx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1718 | |
| 1719 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1720 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1721 | #endif |
| 1722 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1723 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1724 | adapter->session_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1725 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1726 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1727 | |
| 1728 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1729 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1730 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1731 | * to cfg80211_disconnected. |
| 1732 | */ |
| 1733 | if ((eConnectionState_Disconnecting == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1734 | sta_ctx->conn_info.connState) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1735 | (eConnectionState_NotConnected == |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1736 | sta_ctx->conn_info.connState) || |
| 1737 | (eConnectionState_Connecting == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1738 | sta_ctx->conn_info.connState)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1739 | 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] | 1740 | sendDisconInd = false; |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1741 | } else { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1742 | INIT_COMPLETION(adapter->disconnect_comp_var); |
| 1743 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1744 | eConnectionState_Disconnecting); |
| 1745 | } |
| 1746 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1747 | hdd_clear_roam_profile_ie(adapter); |
| 1748 | hdd_wmm_init(adapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1749 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1750 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1751 | |
| 1752 | /* indicate 'disconnect' status to wpa_supplicant... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1753 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1754 | /* indicate disconnected event to nl80211 */ |
| 1755 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1756 | /* |
| 1757 | * Only send indication to kernel if not initiated |
| 1758 | * by kernel |
| 1759 | */ |
| 1760 | if (sendDisconInd) { |
| 1761 | /* |
| 1762 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1763 | * to ICS UI. |
| 1764 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1765 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1766 | if (roam_info->reasonCode == |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1767 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1768 | pr_info("wlan: disconnected due to poor signal, rssi is %d dB\n", |
| 1769 | roam_info->rxRssi); |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1770 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1771 | dev, false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1772 | roam_info->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1773 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1774 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1775 | dev, false, |
| 1776 | WLAN_REASON_UNSPECIFIED |
| 1777 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1778 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1779 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1780 | hdd_debug("sent disconnected event to nl80211, reason code %d", |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1781 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1782 | roam_info->reasonCode : |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1783 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1784 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1785 | |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1786 | /* update P2P connection status */ |
| 1787 | ucfg_p2p_status_disconnect(adapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1788 | } |
| 1789 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1790 | hdd_wmm_adapter_clear(adapter); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1791 | mac_handle = hdd_ctx->mac_handle; |
| 1792 | sme_ft_reset(mac_handle, adapter->session_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1793 | if (hdd_remove_beacon_filter(adapter) != 0) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1794 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1795 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1796 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1797 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1798 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1799 | sta_id = sta_ctx->broadcast_staid; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1800 | vstatus = hdd_roam_deregister_sta(adapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1801 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1802 | 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] | 1803 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1804 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1805 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1806 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1807 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
| 1808 | else |
| 1809 | hdd_debug("invalid sta id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1810 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1811 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1812 | if (HDD_WLAN_INVALID_STA_ID == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1813 | sta_ctx->conn_info.staId[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1814 | continue; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1815 | sta_id = sta_ctx->conn_info.staId[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1816 | hdd_debug("Deregister StaID %d", sta_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1817 | vstatus = hdd_roam_deregister_sta(adapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1818 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1819 | hdd_err("hdd_roam_deregister_sta() failed to for staID %d Status: %d [0x%x]", |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1820 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1821 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1822 | } |
| 1823 | /* set the staid and peer mac as 0, all other |
| 1824 | * reset are done in hdd_connRemoveConnectInfo. |
| 1825 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1826 | sta_ctx->conn_info.staId[i] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1827 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1828 | qdf_mem_zero(&sta_ctx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1829 | sizeof(struct qdf_mac_addr)); |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1830 | if (sta_id < HDD_MAX_ADAPTERS) |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1831 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1832 | else |
| 1833 | hdd_debug("invalid sta_id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1834 | } |
| 1835 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1836 | sta_id = sta_ctx->conn_info.staId[0]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1837 | hdd_debug("roamResult: %d", roamResult); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1838 | |
| 1839 | /* clear scan cache for Link Lost */ |
Sandeep Puligilla | f0b3058 | 2017-01-12 08:39:41 -0800 | [diff] [blame] | 1840 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult || |
| 1841 | eCSR_ROAM_RESULT_DISASSOC_IND == roamResult || |
yeshwanth sriram guntuka | 951725a | 2017-03-15 19:33:04 +0530 | [diff] [blame] | 1842 | eCSR_ROAM_LOSTLINK == roamStatus) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1843 | wlan_hdd_cfg80211_update_bss_list(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1844 | sta_ctx->conn_info.bssId.bytes); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1845 | sme_remove_bssid_from_scan_list(mac_handle, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1846 | sta_ctx->conn_info.bssId.bytes); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1847 | } |
Rajeev Kumar | 4bc998f | 2017-10-19 14:41:43 -0700 | [diff] [blame] | 1848 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1849 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1850 | else |
| 1851 | hdd_debug("invalid sta_id %d", sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1852 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1853 | /* Clear saved connection information in HDD */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1854 | hdd_conn_remove_connect_info(sta_ctx); |
Abhinav Kumar | 7494819 | 2018-05-09 17:17:50 +0530 | [diff] [blame] | 1855 | /* |
| 1856 | * eConnectionState_Connecting state mean that connection is in |
| 1857 | * progress so no need to set state to eConnectionState_NotConnected |
| 1858 | */ |
| 1859 | if ((eConnectionState_Connecting != sta_ctx->conn_info.connState)) { |
| 1860 | hdd_conn_set_connection_state(adapter, |
| 1861 | eConnectionState_NotConnected); |
| 1862 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1863 | pmo_ucfg_flush_gtk_offload_req(adapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1864 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1865 | if ((QDF_STA_MODE == adapter->device_mode) || |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1866 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
| 1867 | sme_ps_disable_auto_ps_timer(mac_handle, |
| 1868 | adapter->session_id); |
Yeshwanth Sriram Guntuka | 4fe30bd | 2018-06-13 11:41:42 +0530 | [diff] [blame] | 1869 | adapter->send_mode_change = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1870 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1871 | wlan_hdd_clear_link_layer_stats(adapter); |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1872 | |
Bala Venkatesh | 9f95814 | 2018-06-27 12:36:08 +0530 | [diff] [blame] | 1873 | hdd_debug("check for SAP restart"); |
| 1874 | policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->hdd_psoc); |
Jeff Johnson | 6ced42c | 2017-10-20 12:48:11 -0700 | [diff] [blame] | 1875 | adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0; |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1876 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1877 | /* Unblock anyone waiting for disconnect to complete */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1878 | complete(&adapter->disconnect_comp_var); |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 1879 | |
Alok Kumar | b64650c | 2018-03-23 17:05:11 +0530 | [diff] [blame] | 1880 | hdd_nud_reset_tracking(adapter); |
| 1881 | |
| 1882 | hdd_set_disconnect_status(adapter, false); |
| 1883 | |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 1884 | hdd_reset_limit_off_chan(adapter); |
| 1885 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1886 | hdd_print_bss_info(sta_ctx); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1887 | |
| 1888 | if (policy_mgr_is_sta_active_connection_exists(hdd_ctx->hdd_psoc)) |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 1889 | sme_enable_roaming_on_connected_sta(mac_handle); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1890 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1891 | return status; |
| 1892 | } |
| 1893 | |
| 1894 | /** |
| 1895 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1896 | * @vdev_id: vdevid |
| 1897 | * |
| 1898 | * Return: None |
| 1899 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1900 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1901 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1902 | struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 1903 | struct hdd_adapter *adapter = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1904 | |
Ashish Kumar Dhanotiya | ab2a929 | 2018-06-16 15:11:27 +0530 | [diff] [blame] | 1905 | if (!hdd_ctx) { |
| 1906 | hdd_err("Invalid hdd context"); |
| 1907 | return; |
| 1908 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1909 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1910 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1911 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1912 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1913 | } |
| 1914 | complete(&adapter->sta_authorized_event); |
| 1915 | } |
| 1916 | |
| 1917 | /** |
| 1918 | * hdd_change_peer_state() - change peer state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1919 | * @adapter: HDD adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1920 | * @sta_state: peer state |
| 1921 | * @roam_synch_in_progress: roam synch in progress |
| 1922 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1923 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1924 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1925 | QDF_STATUS hdd_change_peer_state(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1926 | uint8_t sta_id, |
| 1927 | enum ol_txrx_peer_state sta_state, |
| 1928 | bool roam_synch_in_progress) |
| 1929 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1930 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1931 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1932 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1933 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1934 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1935 | |
| 1936 | if (!pdev) { |
| 1937 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1938 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1939 | } |
| 1940 | |
| 1941 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1942 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1943 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | } |
| 1945 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1946 | peer = cdp_peer_find_by_local_id(soc, |
| 1947 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1948 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1949 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1950 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1951 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1952 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1953 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1954 | return QDF_STATUS_E_FAULT; |
| 1955 | } |
| 1956 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1957 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1958 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1959 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1960 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1961 | } |
| 1962 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1963 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1964 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1965 | #endif |
| 1966 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1967 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1968 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1969 | /* make sure event is reset */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1970 | INIT_COMPLETION(adapter->sta_authorized_event); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1971 | #endif |
| 1972 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1973 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1974 | hdd_set_peer_authorized_event, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1975 | adapter->session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1976 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1977 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1978 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1979 | } |
| 1980 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1981 | if (adapter->device_mode == QDF_STA_MODE || |
| 1982 | adapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1983 | #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] | 1984 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1985 | unsigned long rc; |
| 1986 | |
| 1987 | /* wait for event from firmware to set the event */ |
| 1988 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1989 | &adapter->sta_authorized_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1990 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1991 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1992 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1993 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1994 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 1995 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1996 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1997 | #endif |
| 1998 | } |
| 1999 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2000 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2001 | } |
| 2002 | |
| 2003 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2004 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 2005 | * @cbk_data: callback data |
| 2006 | * @sta_id: station id |
| 2007 | * @vdev_param: vdev parameter |
| 2008 | * @is_link_up: link state up or down |
| 2009 | * |
| 2010 | * Return: QDF status |
| 2011 | */ |
| 2012 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 2013 | uint8_t sta_id, |
| 2014 | uint32_t vdev_param, |
| 2015 | bool is_link_up) |
| 2016 | { |
| 2017 | struct cdp_vdev *data_vdev; |
| 2018 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 2019 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2020 | struct hdd_context *hdd_ctx; |
Yun Park | 0dad100 | 2017-07-14 14:57:01 -0700 | [diff] [blame] | 2021 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2022 | struct wlan_objmgr_psoc **psoc; |
| 2023 | |
| 2024 | if (!cbk_data) |
| 2025 | return status; |
| 2026 | |
| 2027 | psoc = cbk_data; |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2028 | |
Kabilan Kannan | c0e3d58 | 2017-09-13 00:26:33 -0700 | [diff] [blame] | 2029 | hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Sourav Mohapatra | 5febc93 | 2018-01-08 14:38:30 +0530 | [diff] [blame] | 2030 | if (!hdd_ctx) { |
| 2031 | hdd_err("Invalid HDD Context"); |
| 2032 | return QDF_STATUS_E_INVAL; |
| 2033 | } |
| 2034 | |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2035 | if (!hdd_ctx->tdls_nap_active) |
| 2036 | return status; |
| 2037 | |
Yun Park | 0dad100 | 2017-07-14 14:57:01 -0700 | [diff] [blame] | 2038 | data_vdev = cdp_peer_get_vdev_by_sta_id(soc, pdev, sta_id); |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 2039 | if (NULL == data_vdev) { |
| 2040 | status = QDF_STATUS_E_FAILURE; |
| 2041 | return status; |
| 2042 | } |
| 2043 | |
| 2044 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 2045 | |
| 2046 | return status; |
| 2047 | } |
| 2048 | |
| 2049 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2050 | * hdd_roam_register_sta() - register station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2051 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2052 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2053 | * @staId: station identifier |
| 2054 | * @pPeerMacAddress: peer MAC address |
| 2055 | * @pBssDesc: pointer to BSS description |
| 2056 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2057 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2058 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2059 | QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2060 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2061 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2062 | struct qdf_mac_addr *pPeerMacAddress, |
Jeff Johnson | 4ba73cb | 2017-10-06 11:12:33 -0700 | [diff] [blame] | 2063 | struct bss_description *pBssDesc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2064 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2065 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2066 | struct ol_txrx_desc_type staDesc = { 0 }; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2067 | 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] | 2068 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2069 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 2070 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2071 | |
| 2072 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2073 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2074 | |
| 2075 | /* Get the Station ID from the one saved during the association */ |
| 2076 | staDesc.sta_id = staId; |
| 2077 | |
| 2078 | /* set the QoS field appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2079 | if (hdd_wmm_is_active(adapter)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2080 | staDesc.is_qos_enabled = 1; |
| 2081 | else |
| 2082 | staDesc.is_qos_enabled = 0; |
| 2083 | |
| 2084 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 2085 | hdd_debug("WAPI STA Registered: %d", |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2086 | adapter->wapi_info.is_wapi_sta); |
| 2087 | if (adapter->wapi_info.is_wapi_sta) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2088 | staDesc.is_wapi_supported = 1; |
| 2089 | else |
| 2090 | staDesc.is_wapi_supported = 0; |
| 2091 | #endif /* FEATURE_WLAN_WAPI */ |
| 2092 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 2093 | /* Register the vdev transmit and receive functions */ |
| 2094 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
Mohit Khanna | 7032200 | 2018-05-15 19:21:32 -0700 | [diff] [blame] | 2095 | |
| 2096 | if (adapter->hdd_ctx->enable_dp_rx_threads) { |
| 2097 | txrx_ops.rx.rx = hdd_rx_pkt_thread_enqueue_cbk; |
| 2098 | txrx_ops.rx.rx_stack = hdd_rx_packet_cbk; |
| 2099 | } else { |
| 2100 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
| 2101 | txrx_ops.rx.rx_stack = NULL; |
| 2102 | } |
| 2103 | |
Poddar, Siddarth | 31797fa | 2018-01-22 17:24:15 +0530 | [diff] [blame] | 2104 | txrx_ops.rx.stats_rx = hdd_tx_rx_collect_connectivity_stats_info; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2105 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2106 | adapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2107 | (struct cdp_pdev *)pdev, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2108 | adapter->session_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2109 | if (!adapter->txrx_vdev) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2110 | hdd_err("%s find vdev fail", __func__); |
| 2111 | return QDF_STATUS_E_FAILURE; |
| 2112 | } |
| 2113 | |
| 2114 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2115 | cdp_vdev_register(soc, |
Sravan Kumar Kairam | 43f191b | 2018-05-04 17:00:39 +0530 | [diff] [blame] | 2116 | (struct cdp_vdev *)adapter->txrx_vdev, adapter, |
| 2117 | (struct cdp_ctrl_objmgr_vdev *)adapter->hdd_vdev, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 2118 | if (!txrx_ops.tx.tx) { |
| 2119 | hdd_err("%s vdev register fail", __func__); |
| 2120 | return QDF_STATUS_E_FAILURE; |
| 2121 | } |
| 2122 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2123 | adapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2124 | qdf_status = cdp_peer_register(soc, |
| 2125 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2126 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2127 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2128 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2129 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2130 | } |
| 2131 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2132 | if (!roam_info->fAuthRequired) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2133 | /* |
| 2134 | * Connections that do not need Upper layer auth, transition |
| 2135 | * TLSHIM directly to 'Authenticated' state |
| 2136 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2137 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2138 | hdd_change_peer_state(adapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2139 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2140 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2141 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2142 | #else |
| 2143 | false |
| 2144 | #endif |
| 2145 | ); |
| 2146 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2147 | hdd_conn_set_authenticated(adapter, true); |
| 2148 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2149 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2150 | hdd_debug("ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2151 | sta_ctx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2152 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2153 | hdd_change_peer_state(adapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2154 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2155 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2156 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2157 | #else |
| 2158 | false |
| 2159 | #endif |
| 2160 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2161 | hdd_conn_set_authenticated(adapter, false); |
| 2162 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2163 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2164 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2165 | } |
| 2166 | |
| 2167 | /** |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2168 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 2169 | * @dev: network device |
| 2170 | * @bss: cfg80211 roamed bss pointer |
| 2171 | * @req_ie: IEs used in reassociation request |
| 2172 | * @req_ie_len: Length of the @req_ie |
| 2173 | * @resp_ie: IEs received in successful reassociation response |
| 2174 | * @resp_ie_len: Length of @resp_ie |
| 2175 | * |
| 2176 | * Return: none |
| 2177 | */ |
| 2178 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 2179 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 2180 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 2181 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 2182 | size_t req_ie_len, const uint8_t *resp_ie, |
| 2183 | size_t resp_ie_len) |
| 2184 | { |
| 2185 | struct cfg80211_roam_info info = {0}; |
| 2186 | |
| 2187 | info.bss = bss; |
| 2188 | info.req_ie = req_ie; |
| 2189 | info.req_ie_len = req_ie_len; |
| 2190 | info.resp_ie = resp_ie; |
| 2191 | info.resp_ie_len = resp_ie_len; |
| 2192 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 2193 | } |
| 2194 | #else |
| 2195 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 2196 | struct cfg80211_bss *bss, |
| 2197 | const uint8_t *req_ie, size_t req_ie_len, |
| 2198 | const uint8_t *resp_ie, |
| 2199 | size_t resp_ie_len) |
| 2200 | { |
| 2201 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 2202 | GFP_KERNEL); |
| 2203 | } |
| 2204 | #endif |
| 2205 | |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2206 | #if defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2207 | #if defined(WLAN_FEATURE_FILS_SK) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2208 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2209 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2210 | { |
| 2211 | uint8_t *kek; |
| 2212 | uint32_t kek_len; |
| 2213 | |
| 2214 | if (is_reassoc) { |
| 2215 | kek = csr_roam_info->kek; |
| 2216 | kek_len = csr_roam_info->kek_len; |
| 2217 | } else { |
| 2218 | /* |
| 2219 | * This should come for FILS case only. |
| 2220 | * Caller should make sure fils_join_rsp is |
| 2221 | * not NULL, if there is need to use else where. |
| 2222 | */ |
| 2223 | kek = csr_roam_info->fils_join_rsp->kek; |
| 2224 | kek_len = csr_roam_info->fils_join_rsp->kek_len; |
| 2225 | } |
| 2226 | |
| 2227 | wlan_hdd_save_gtk_offload_params(adapter, NULL, kek, kek_len, |
| 2228 | csr_roam_info->replay_ctr, true); |
| 2229 | |
| 2230 | hdd_debug("Kek len %d", kek_len); |
| 2231 | } |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2232 | #else |
| 2233 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2234 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2235 | { |
| 2236 | uint8_t *kek; |
| 2237 | uint32_t kek_len; |
| 2238 | |
| 2239 | /* |
| 2240 | * is_reassoc is set to true always for Legacy GTK offload |
| 2241 | * case, It is false only for FILS case |
| 2242 | */ |
| 2243 | kek = csr_roam_info->kek; |
| 2244 | kek_len = csr_roam_info->kek_len; |
| 2245 | |
| 2246 | wlan_hdd_save_gtk_offload_params(adapter, NULL, kek, kek_len, |
| 2247 | csr_roam_info->replay_ctr, true); |
| 2248 | |
| 2249 | hdd_debug("Kek len %d", kek_len); |
| 2250 | } |
| 2251 | #endif |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2252 | #endif |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2253 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2254 | * hdd_send_re_assoc_event() - send reassoc event |
| 2255 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2256 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2257 | * @pCsrRoamInfo: pointer to roam info |
| 2258 | * @reqRsnIe: pointer to RSN Information element |
| 2259 | * @reqRsnLength: length of RSN IE |
| 2260 | * |
| 2261 | * Return: none |
| 2262 | */ |
| 2263 | static void hdd_send_re_assoc_event(struct net_device *dev, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2264 | struct hdd_adapter *adapter, struct csr_roam_info *pCsrRoamInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2265 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2266 | { |
| 2267 | unsigned int len = 0; |
| 2268 | u8 *pFTAssocRsp = NULL; |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2269 | uint8_t *rspRsnIe = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
| 2270 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2271 | uint32_t rspRsnLength = 0; |
| 2272 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2273 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 2274 | uint8_t *buf_ptr, ssid_ie_len; |
| 2275 | struct cfg80211_bss *bss = NULL; |
| 2276 | uint8_t *final_req_ie = NULL; |
| 2277 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2278 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2279 | int chan_no; |
| 2280 | int freq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2281 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2282 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2283 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2284 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2285 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2286 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2287 | } |
| 2288 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2289 | if (!assoc_req_ies) { |
| 2290 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2291 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2292 | } |
Rajeev Kumar Sirasanagandla | e5582aa | 2018-05-02 18:20:20 +0530 | [diff] [blame] | 2293 | |
| 2294 | if (!pCsrRoamInfo || !pCsrRoamInfo->pBssDesc) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2295 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2296 | goto done; |
| 2297 | } |
| 2298 | |
| 2299 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2300 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2301 | goto done; |
| 2302 | } |
| 2303 | |
| 2304 | pFTAssocRsp = |
| 2305 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2306 | pCsrRoamInfo->nAssocReqLength); |
| 2307 | if (pFTAssocRsp == NULL) |
| 2308 | goto done; |
| 2309 | |
| 2310 | /* pFTAssocRsp needs to point to the IEs */ |
| 2311 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2312 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2313 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2314 | |
| 2315 | /* |
| 2316 | * Active session count is decremented upon disconnection, but during |
| 2317 | * roaming, there is no disconnect indication and hence active session |
| 2318 | * count is not decremented. |
| 2319 | * After roaming is completed, active session count is incremented |
| 2320 | * as a part of connect indication but effectively after roaming the |
| 2321 | * active session count should still be the same and hence upon |
| 2322 | * successful reassoc decrement the active session count here. |
| 2323 | */ |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 2324 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2325 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2326 | adapter->device_mode, adapter->session_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 2327 | hdd_green_ap_start_state_mc(hdd_ctx, adapter->device_mode, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 2328 | false); |
| 2329 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2330 | |
| 2331 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 2332 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2333 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2334 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2335 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2336 | |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2337 | chan_no = pCsrRoamInfo->pBssDesc->channelId; |
| 2338 | if (chan_no <= 14) |
| 2339 | freq = ieee80211_channel_to_frequency(chan_no, |
| 2340 | NL80211_BAND_2GHZ); |
| 2341 | else |
| 2342 | freq = ieee80211_channel_to_frequency(chan_no, |
| 2343 | NL80211_BAND_5GHZ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2344 | chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2345 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2346 | sme_roam_get_connect_profile(hdd_ctx->mac_handle, adapter->session_id, |
| 2347 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2348 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2349 | bss = hdd_cfg80211_get_bss(adapter->wdev.wiphy, |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2350 | chan, pCsrRoamInfo->bssid.bytes, |
| 2351 | &roam_profile.SSID.ssId[0], |
| 2352 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2353 | |
| 2354 | if (bss == NULL) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2355 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2356 | buf_ptr = buf_ssid_ie; |
| 2357 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2358 | buf_ptr++; |
| 2359 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2360 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2361 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2362 | roam_profile.SSID.length); |
| 2363 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2364 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2365 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2366 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2367 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2368 | if (final_req_ie == NULL) { |
| 2369 | if (bss) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2370 | cfg80211_put_bss(adapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2371 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2372 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2373 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2374 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2375 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2376 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2377 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2378 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2379 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2380 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2381 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2382 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2383 | hdd_send_roamed_ind(dev, bss, final_req_ie, |
| 2384 | (ssid_ie_len + reqRsnLength), rspRsnIe, |
| 2385 | rspRsnLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2386 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2387 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2388 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2389 | pCsrRoamInfo->nAssocReqLength); |
| 2390 | |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2391 | hdd_save_gtk_params(adapter, pCsrRoamInfo, true); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2392 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2393 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2394 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2395 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2396 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2397 | wlan_hdd_send_roam_auth_event(adapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2398 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2399 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2400 | pCsrRoamInfo); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2401 | |
| 2402 | hdd_update_hlp_info(dev, pCsrRoamInfo); |
| 2403 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2404 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2405 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2406 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2407 | qdf_mem_free(final_req_ie); |
| 2408 | qdf_mem_free(rspRsnIe); |
| 2409 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2410 | } |
| 2411 | |
| 2412 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2413 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2414 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2415 | * |
| 2416 | * Return: roam sync status if roaming offloaded else false |
| 2417 | */ |
| 2418 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2419 | bool hdd_is_roam_sync_in_progress(struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2420 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2421 | if (roaminfo) |
| 2422 | return roaminfo->roamSynchInProgress; |
| 2423 | else |
| 2424 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2425 | } |
| 2426 | #endif |
| 2427 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2428 | /** |
| 2429 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2430 | * @hddstactx: pointer to HDD sta context |
| 2431 | * @roaminfo: pointer to roaminfo structure |
| 2432 | * |
| 2433 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2434 | * MAC address return self staid(0) else find the peer sta id of |
| 2435 | * the peer. |
| 2436 | * |
| 2437 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2438 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2439 | static uint8_t hdd_get_ibss_peer_staid(struct hdd_station_ctx *hddstactx, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2440 | struct csr_roam_info *roaminfo) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2441 | { |
| 2442 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2443 | QDF_STATUS status; |
| 2444 | |
| 2445 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2446 | staid = 0; |
| 2447 | } else { |
| 2448 | status = hdd_get_peer_sta_id(hddstactx, |
| 2449 | &roaminfo->peerMac, &staid); |
| 2450 | if (status != QDF_STATUS_SUCCESS) { |
| 2451 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2452 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2453 | } |
| 2454 | } |
| 2455 | |
| 2456 | return staid; |
| 2457 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2458 | |
| 2459 | /** |
| 2460 | * hdd_change_sta_state_authenticated()- |
| 2461 | * This function changes STA state to authenticated |
| 2462 | * @adapter: pointer to the adapter structure. |
| 2463 | * @roaminfo: pointer to the RoamInfo structure. |
| 2464 | * |
| 2465 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2466 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2467 | * |
| 2468 | * Return: 0 on success and errno on failure |
| 2469 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2470 | static int hdd_change_sta_state_authenticated(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2471 | struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2472 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2473 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2474 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2475 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2476 | struct hdd_station_ctx *hddstactx = |
| 2477 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2478 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2479 | |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 2480 | timeout = hddstactx->hdd_reassoc_scenario ? |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2481 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2482 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2483 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2484 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2485 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2486 | else |
| 2487 | staid = hddstactx->conn_info.staId[0]; |
| 2488 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2489 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2490 | |
| 2491 | /* Connections that do not need Upper layer authentication, |
| 2492 | * transition TL to 'Authenticated' state after the keys are set |
| 2493 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2494 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2495 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2496 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2497 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2498 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2499 | if ((QDF_STA_MODE == adapter->device_mode) || |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2500 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
| 2501 | sme_ps_enable_auto_ps_timer(hdd_ctx->mac_handle, |
| 2502 | adapter->session_id, |
| 2503 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2504 | } |
| 2505 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2506 | return qdf_status_to_os_return(status); |
| 2507 | } |
| 2508 | |
| 2509 | /** |
| 2510 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2511 | * if key installation is required |
| 2512 | * @encr_type: encryption type |
| 2513 | * |
| 2514 | * Return: true if key installation is required and false otherwise. |
| 2515 | */ |
| 2516 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2517 | eCsrEncryptionType encr_type) |
| 2518 | { |
| 2519 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2520 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2521 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2522 | eCSR_ENCRYPT_TYPE_AES_GCMP == encr_type || |
| 2523 | eCSR_ENCRYPT_TYPE_AES_GCMP_256 == encr_type || |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2524 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2525 | return true; |
| 2526 | else |
| 2527 | return false; |
| 2528 | } |
| 2529 | |
| 2530 | /** |
| 2531 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2532 | * complete |
| 2533 | * @adapter: pointer to HDD adapter |
| 2534 | * @roaminfo: pointer to roam info |
| 2535 | * @roam_result: roam result |
| 2536 | * |
| 2537 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2538 | * This function checks for the successful set key completion and update |
| 2539 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2540 | * |
| 2541 | * Return: None |
| 2542 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2543 | 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] | 2544 | struct csr_roam_info *roaminfo, |
| 2545 | eCsrRoamResult roam_result) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2546 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2547 | struct hdd_station_ctx *hdd_sta_ctx = |
| 2548 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2549 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2550 | |
| 2551 | /* |
| 2552 | * If the security mode is one of the following, IBSS peer will be |
| 2553 | * waiting in CONN state and we will move the peer state to AUTH |
| 2554 | * here. For non-secure connection, no need to wait for set-key complete |
| 2555 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2556 | */ |
| 2557 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2558 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2559 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2560 | |
| 2561 | return; |
| 2562 | } |
| 2563 | |
| 2564 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2565 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2566 | /* |
| 2567 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2568 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2569 | * after roaming. STA TL state moves to authenticated only if |
| 2570 | * ptk_installed is true. So, make ptk_installed to true in |
| 2571 | * case of 11R roaming. |
| 2572 | */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2573 | if (sme_neighbor_roam_is11r_assoc(adapter->hdd_ctx->mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2574 | adapter->session_id)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2575 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2576 | } else { |
| 2577 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2578 | } |
| 2579 | |
| 2580 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2581 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2582 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2583 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2584 | * set the unicast and broadcast key. |
| 2585 | */ |
| 2586 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2587 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2588 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2589 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2590 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2591 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2592 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2593 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2594 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2595 | } |
| 2596 | |
| 2597 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2598 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2599 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2600 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2601 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2602 | } |
| 2603 | |
| 2604 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2605 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2606 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2607 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2608 | * @roamId: roam id |
| 2609 | * @roamStatus: roam status |
| 2610 | * @roamResult: roam result |
| 2611 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2612 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2613 | */ |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2614 | static QDF_STATUS |
| 2615 | hdd_roam_set_key_complete_handler(struct hdd_adapter *adapter, |
| 2616 | struct csr_roam_info *roam_info, |
| 2617 | uint32_t roamId, |
| 2618 | eRoamCmdStatus roamStatus, |
| 2619 | eCsrRoamResult roamResult) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2620 | { |
| 2621 | eCsrEncryptionType connectedCipherAlgo; |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2622 | bool connected = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2623 | 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] | 2624 | |
Dustin Brown | 491d54b | 2018-03-14 12:39:11 -0700 | [diff] [blame] | 2625 | hdd_enter(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2626 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2627 | if (NULL == roam_info) { |
| 2628 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2629 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2630 | } |
| 2631 | /* |
| 2632 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2633 | * then go to 'authenticated'. For all other authentication types |
| 2634 | * (those that do not require upper layer authentication) we can put TL |
| 2635 | * directly into 'authenticated' state. |
| 2636 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 2637 | hdd_debug("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2638 | MAC_ADDRESS_STR, roamStatus, roamResult, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2639 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2640 | |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2641 | connected = hdd_conn_get_connected_cipher_algo(sta_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2642 | &connectedCipherAlgo); |
Jeff Johnson | 389e16b | 2018-05-05 23:32:55 -0700 | [diff] [blame] | 2643 | if (connected) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2644 | hdd_change_peer_state_after_set_key(adapter, roam_info, |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2645 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2646 | } |
| 2647 | |
Dustin Brown | e74003f | 2018-03-14 12:51:58 -0700 | [diff] [blame] | 2648 | hdd_exit(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2649 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2650 | } |
| 2651 | |
| 2652 | /** |
| 2653 | * hdd_perform_roam_set_key_complete() - perform set key complete |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2654 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2655 | * |
| 2656 | * Return: none |
| 2657 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2658 | void hdd_perform_roam_set_key_complete(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2659 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2660 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2661 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2662 | struct csr_roam_info roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2663 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2664 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2665 | qdf_mem_copy(roamInfo.bssid.bytes, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2666 | sta_ctx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2667 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2668 | sta_ctx->roam_info.peer_mac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2669 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2670 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2671 | hdd_roam_set_key_complete_handler(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2672 | &roamInfo, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2673 | sta_ctx->roam_info.roam_id, |
| 2674 | sta_ctx->roam_info.roam_status, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2676 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2677 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2678 | |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2679 | sta_ctx->roam_info.defer_key_complete = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2680 | } |
| 2681 | |
Vignesh Viswanathan | 3fa1d38 | 2017-08-02 19:36:43 +0530 | [diff] [blame] | 2682 | #if defined(WLAN_FEATURE_FILS_SK) && \ |
| 2683 | (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \ |
| 2684 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))) |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2685 | void hdd_clear_fils_connection_info(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2686 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2687 | struct csr_roam_profile *roam_profile; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2688 | |
| 2689 | if ((adapter->device_mode == QDF_SAP_MODE) || |
| 2690 | (adapter->device_mode == QDF_P2P_GO_MODE)) |
| 2691 | return; |
| 2692 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2693 | roam_profile = hdd_roam_profile(adapter); |
| 2694 | if (roam_profile->fils_con_info) { |
| 2695 | qdf_mem_free(roam_profile->fils_con_info); |
| 2696 | roam_profile->fils_con_info = NULL; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2697 | } |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2698 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 2699 | if (roam_profile->hlp_ie) { |
| 2700 | qdf_mem_free(roam_profile->hlp_ie); |
| 2701 | roam_profile->hlp_ie = NULL; |
| 2702 | roam_profile->hlp_ie_len = 0; |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2703 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2704 | } |
| 2705 | #endif |
| 2706 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2707 | /** |
| 2708 | * hdd_association_completion_handler() - association completion handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2709 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2710 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2711 | * @roamId: roam id |
| 2712 | * @roamStatus: roam status |
| 2713 | * @roamResult: roam result |
| 2714 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2715 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2716 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2717 | static QDF_STATUS |
| 2718 | hdd_association_completion_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2719 | struct csr_roam_info *roam_info, |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2720 | uint32_t roamId, |
| 2721 | eRoamCmdStatus roamStatus, |
| 2722 | eCsrRoamResult roamResult) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2723 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2724 | struct net_device *dev = adapter->dev; |
| 2725 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2726 | 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] | 2727 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2728 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2729 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2730 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2731 | bool hddDisconInProgress = false; |
| 2732 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2733 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2734 | bool ok; |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2735 | mac_handle_t mac_handle; |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 2736 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2737 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2738 | if (!hdd_ctx) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2739 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2740 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2741 | } |
| 2742 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2743 | /* validate config */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2744 | if (!hdd_ctx->config) { |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2745 | hdd_err("config is NULL"); |
| 2746 | return QDF_STATUS_E_NULL_VALUE; |
| 2747 | } |
Padma, Santhosh Kumar | 86747ec | 2018-05-29 18:28:29 +0530 | [diff] [blame] | 2748 | |
| 2749 | /* |
| 2750 | * Enable roaming on other STA iface except this one. |
| 2751 | * Firmware dosent support connection on one STA iface while |
| 2752 | * roaming on other STA iface |
| 2753 | */ |
| 2754 | wlan_hdd_enable_roaming(adapter); |
| 2755 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2756 | /* HDD has initiated disconnect, do not send connect result indication |
| 2757 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2758 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2759 | if (((eConnectionState_Disconnecting == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2760 | sta_ctx->conn_info.connState) || |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2761 | (eConnectionState_NotConnected == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2762 | sta_ctx->conn_info.connState)) && |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2763 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2764 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2765 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2766 | sta_ctx->conn_info.connState, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2767 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2768 | hddDisconInProgress = true; |
| 2769 | } |
| 2770 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2771 | mac_handle = hdd_ctx->mac_handle; |
| 2772 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2773 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2774 | if (NULL == roam_info) { |
| 2775 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2776 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2777 | } |
| 2778 | if (!hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2779 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2780 | eConnectionState_Associated); |
| 2781 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2782 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2783 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2784 | hdd_conn_save_connect_info(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2785 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2786 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2787 | if (hdd_add_beacon_filter(adapter) != 0) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2788 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2789 | #ifdef FEATURE_WLAN_WAPI |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2790 | if (roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2791 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2792 | || roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2793 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2794 | adapter->wapi_info.is_wapi_sta = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2795 | } else { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2796 | adapter->wapi_info.is_wapi_sta = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2797 | } |
| 2798 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2799 | hdd_debug("bss_descr[%d] devicemode[%d]", !!roam_info->pBssDesc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2800 | adapter->device_mode); |
| 2801 | if ((QDF_STA_MODE == adapter->device_mode) && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2802 | roam_info->pBssDesc) { |
| 2803 | ie_len = GET_IE_LEN_IN_BSS(roam_info->pBssDesc->length); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2804 | sta_ctx->ap_supports_immediate_power_save = |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2805 | wlan_hdd_is_ap_supports_immediate_power_save( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2806 | (uint8_t *) roam_info->pBssDesc->ieFields, |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2807 | ie_len); |
| 2808 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2809 | sta_ctx->ap_supports_immediate_power_save); |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2810 | } |
| 2811 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2812 | /* Indicate 'connect' status to user space */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2813 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2814 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2815 | if (policy_mgr_is_mcc_in_24G(hdd_ctx->hdd_psoc)) { |
| 2816 | if (hdd_ctx->miracast_value) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2817 | wlan_hdd_set_mas(adapter, |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2818 | hdd_ctx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2819 | } |
| 2820 | |
| 2821 | /* Initialize the Linkup event completion variable */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2822 | INIT_COMPLETION(adapter->linkup_event_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2823 | |
| 2824 | /* |
| 2825 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2826 | * the device properly. Before allowing any packet to go up to |
| 2827 | * the application, device activation has to be ensured for |
| 2828 | * proper queue mapping by the kernel. we have registered net |
| 2829 | * device notifier for device change notification. With this we |
| 2830 | * will come to know that the device is getting |
| 2831 | * activated properly. |
| 2832 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2833 | if (sta_ctx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2834 | /* |
| 2835 | * Enable Linkup Event Servicing which allows the net |
| 2836 | * device notifier to set the linkup event variable. |
| 2837 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2838 | adapter->is_link_up_service_needed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2839 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2840 | /* Switch on the Carrier to activate the device */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2841 | wlan_hdd_netif_queue_control(adapter, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2842 | WLAN_NETIF_CARRIER_ON, |
| 2843 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2844 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2845 | /* |
| 2846 | * Wait for the Link to up to ensure all the queues |
| 2847 | * are set properly by the kernel. |
| 2848 | */ |
| 2849 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2850 | &adapter->linkup_event_var, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2851 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2852 | ); |
| 2853 | if (!rc) |
| 2854 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2855 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2856 | /* |
| 2857 | * Disable Linkup Event Servicing - no more service |
| 2858 | * required from the net device notifier call. |
| 2859 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2860 | adapter->is_link_up_service_needed = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2861 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2862 | sta_ctx->ft_carrier_on = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2863 | ft_carrier_on = true; |
| 2864 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 2865 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2866 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2867 | else |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2868 | hdd_err("Wrong Staid: %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2869 | |
Sravan Kumar Kairam | 5214f65 | 2018-03-13 09:52:31 +0530 | [diff] [blame] | 2870 | if (ucfg_ipa_is_enabled()) |
| 2871 | ucfg_ipa_wlan_evt(hdd_ctx->hdd_pdev, adapter->dev, |
| 2872 | adapter->device_mode, |
| 2873 | roam_info->staId, |
| 2874 | adapter->session_id, |
| 2875 | WLAN_IPA_STA_CONNECT, |
| 2876 | roam_info->bssid.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2877 | |
| 2878 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2879 | wlan_hdd_auto_shutdown_enable(hdd_ctx, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2880 | #endif |
| 2881 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2882 | hdd_debug("check if STA chan ok for DNBS"); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2883 | if (policy_mgr_is_chan_ok_for_dnbs(hdd_ctx->hdd_psoc, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2884 | sta_ctx->conn_info.operationChannel, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2885 | &ok)) { |
| 2886 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2887 | sta_ctx->conn_info.operationChannel); |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2888 | return QDF_STATUS_E_FAILURE; |
| 2889 | } |
| 2890 | |
| 2891 | if (!ok) { |
| 2892 | hdd_err("Chan:%d not suitable for DNBS", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2893 | sta_ctx->conn_info.operationChannel); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2894 | wlan_hdd_netif_queue_control(adapter, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2895 | WLAN_NETIF_CARRIER_OFF, |
| 2896 | WLAN_CONTROL_PATH); |
| 2897 | if (!hddDisconInProgress) { |
| 2898 | hdd_err("Disconnecting..."); |
| 2899 | sme_roam_disconnect( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2900 | mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2901 | adapter->session_id, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2902 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2903 | } |
| 2904 | return QDF_STATUS_E_FAILURE; |
| 2905 | } |
| 2906 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2907 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2908 | adapter->session_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2909 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2910 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2911 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2912 | /* |
| 2913 | * For reassoc, the station is already registered, all we need |
| 2914 | * is to change the state of the STA in TL. |
| 2915 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2916 | * CONNECTED instead of AUTHENTICATED. |
| 2917 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2918 | if (!roam_info->fReassocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2919 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2920 | u8 *pFTAssocRsp = NULL; |
| 2921 | unsigned int assocRsplen = 0; |
| 2922 | u8 *pFTAssocReq = NULL; |
| 2923 | unsigned int assocReqlen = 0; |
| 2924 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2925 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2926 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2927 | |
| 2928 | /* add bss_id to cfg80211 data base */ |
| 2929 | bss = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2930 | wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2931 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2932 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2933 | hdd_err("wlan: Not able to create BSS entry"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2934 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2935 | WLAN_NETIF_CARRIER_OFF, |
| 2936 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2937 | if (!hddDisconInProgress) { |
| 2938 | /* |
| 2939 | * Here driver was not able to add bss |
| 2940 | * in cfg80211 database this can happen |
| 2941 | * if connected channel is not valid, |
| 2942 | * i.e reg domain was changed during |
| 2943 | * connection. Queue disconnect for the |
| 2944 | * session if disconnect is not in |
| 2945 | * progress. |
| 2946 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2947 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2948 | sme_roam_disconnect( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 2949 | mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2950 | adapter->session_id, |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2951 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2952 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2953 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2954 | } |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2955 | |
Jeff Johnson | c66d310 | 2018-02-28 11:58:26 -0800 | [diff] [blame] | 2956 | cfg80211_put_bss(hdd_ctx->wiphy, bss); |
| 2957 | |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2958 | /* Association Response */ |
| 2959 | pFTAssocRsp = |
| 2960 | (u8 *) (roam_info->pbFrames + |
| 2961 | roam_info->nBeaconLength + |
| 2962 | roam_info->nAssocReqLength); |
| 2963 | if (pFTAssocRsp != NULL) { |
| 2964 | /* |
| 2965 | * pFTAssocRsp needs to point to the IEs |
| 2966 | */ |
| 2967 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 2968 | hdd_debug("AssocRsp is now at %02x%02x", |
| 2969 | (unsigned int)pFTAssocRsp[0], |
| 2970 | (unsigned int)pFTAssocRsp[1]); |
| 2971 | assocRsplen = |
| 2972 | roam_info->nAssocRspLength - |
| 2973 | FT_ASSOC_RSP_IES_OFFSET; |
| 2974 | |
| 2975 | hdd_debug("assocRsplen %d", assocRsplen); |
| 2976 | hdd_debug("Assoc Rsp IE dump"); |
| 2977 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 2978 | QDF_TRACE_LEVEL_DEBUG, |
| 2979 | pFTAssocRsp, |
| 2980 | assocRsplen); |
| 2981 | } else { |
| 2982 | hdd_debug("AssocRsp is NULL"); |
| 2983 | assocRsplen = 0; |
| 2984 | } |
| 2985 | |
| 2986 | /* Association Request */ |
| 2987 | pFTAssocReq = (u8 *) (roam_info->pbFrames + |
| 2988 | roam_info->nBeaconLength); |
| 2989 | if (pFTAssocReq != NULL) { |
| 2990 | if (!ft_carrier_on) { |
| 2991 | /* |
| 2992 | * pFTAssocReq needs to point to |
| 2993 | * the IEs |
| 2994 | */ |
| 2995 | pFTAssocReq += |
| 2996 | FT_ASSOC_REQ_IES_OFFSET; |
| 2997 | hdd_debug("pFTAssocReq is now at %02x%02x", |
| 2998 | (unsigned int) |
| 2999 | pFTAssocReq[0], |
| 3000 | (unsigned int) |
| 3001 | pFTAssocReq[1]); |
| 3002 | assocReqlen = |
| 3003 | roam_info->nAssocReqLength - |
| 3004 | FT_ASSOC_REQ_IES_OFFSET; |
| 3005 | } else { |
| 3006 | /* |
| 3007 | * This should contain only the |
| 3008 | * FTIEs |
| 3009 | */ |
| 3010 | assocReqlen = |
| 3011 | roam_info->nAssocReqLength; |
| 3012 | } |
| 3013 | |
| 3014 | hdd_debug("assocReqlen %d", assocReqlen); |
| 3015 | hdd_debug("Assoc/Reassoc Req IE dump"); |
| 3016 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 3017 | QDF_TRACE_LEVEL_DEBUG, |
| 3018 | pFTAssocReq, |
| 3019 | assocReqlen); |
| 3020 | } else { |
| 3021 | hdd_debug("AssocReq is NULL"); |
| 3022 | assocReqlen = 0; |
| 3023 | } |
| 3024 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3025 | if (roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3026 | eCSR_AUTH_TYPE_FT_RSN |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3027 | || roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3028 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3029 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 3030 | if (!hddDisconInProgress && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3031 | roam_info->pBssDesc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 3032 | struct cfg80211_bss *roam_bss; |
| 3033 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3034 | /* |
| 3035 | * After roaming is completed, |
| 3036 | * active session count is |
| 3037 | * incremented as a part of |
| 3038 | * connect indication but |
| 3039 | * effectively the active |
| 3040 | * session count should still |
| 3041 | * be the same and hence upon |
| 3042 | * successful reassoc |
| 3043 | * decrement the active session |
| 3044 | * count here. |
| 3045 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 3046 | if (!hdd_is_roam_sync_in_progress |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3047 | (roam_info)) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3048 | policy_mgr_decr_session_set_pcl( |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 3049 | hdd_ctx->hdd_psoc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3050 | adapter->device_mode, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3051 | adapter->session_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 3052 | hdd_green_ap_start_state_mc( |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3053 | hdd_ctx, |
| 3054 | adapter->device_mode, |
| 3055 | false); |
| 3056 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3057 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3058 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3059 | chan = |
| 3060 | ieee80211_get_channel |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3061 | (adapter->wdev.wiphy, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3062 | (int)roam_info->pBssDesc-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3063 | channelId); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 3064 | |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3065 | roam_bss = |
| 3066 | hdd_cfg80211_get_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3067 | adapter->wdev.wiphy, |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3068 | chan, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3069 | roam_info->bssid.bytes, |
| 3070 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3071 | pConnectedProfile->SSID.ssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3072 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3073 | pConnectedProfile->SSID.length); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3074 | |
| 3075 | cdp_hl_fc_set_td_limit(soc, |
| 3076 | adapter->session_id, |
| 3077 | sta_ctx-> |
| 3078 | conn_info.operationChannel); |
| 3079 | |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 3080 | hdd_send_roamed_ind( |
| 3081 | dev, |
| 3082 | roam_bss, |
| 3083 | pFTAssocReq, |
| 3084 | assocReqlen, |
| 3085 | pFTAssocRsp, |
| 3086 | assocRsplen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3087 | wlan_hdd_send_roam_auth_event( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3088 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3089 | roam_info->bssid.bytes, |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 3090 | pFTAssocReq, |
| 3091 | assocReqlen, |
| 3092 | pFTAssocRsp, |
| 3093 | assocRsplen, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3094 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3095 | } |
| 3096 | if (sme_get_ftptk_state |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3097 | (mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3098 | adapter->session_id)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3099 | sme_set_ftptk_state |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3100 | (mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3101 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3102 | false); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3103 | roam_info->fAuthRequired = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3104 | false; |
| 3105 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3106 | qdf_mem_copy(sta_ctx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3107 | roam_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3108 | roam_info->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3109 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3110 | qdf_mem_copy(sta_ctx-> |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3111 | roam_info.peer_mac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3112 | roam_info->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3113 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3114 | sta_ctx->roam_info.roam_id = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3115 | roamId; |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3116 | sta_ctx->roam_info.roam_status = |
| 3117 | roamStatus; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3118 | sta_ctx->roam_info. |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 3119 | defer_key_complete = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3120 | } |
| 3121 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3122 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3123 | ft_carrier_on); |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3124 | cdp_hl_fc_set_td_limit(soc, |
| 3125 | adapter->session_id, |
| 3126 | sta_ctx->conn_info.operationChannel); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3127 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3128 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3129 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3130 | roam_info, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3131 | pFTAssocReq, |
| 3132 | assocReqlen, |
| 3133 | pFTAssocRsp, |
| 3134 | assocRsplen, |
| 3135 | WLAN_STATUS_SUCCESS, |
| 3136 | GFP_KERNEL, |
| 3137 | false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3138 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3139 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 3140 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3141 | /* |
| 3142 | * wpa supplicant expecting WPA/RSN IE in |
| 3143 | * connect result. |
| 3144 | */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3145 | sme_roam_get_wpa_rsn_req_ie(mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3146 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | &reqRsnLength, |
| 3148 | reqRsnIe); |
| 3149 | |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3150 | sme_roam_get_wpa_rsn_rsp_ie(mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3151 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3152 | &rspRsnLength, |
| 3153 | rspRsnIe); |
| 3154 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3155 | if (ft_carrier_on) |
| 3156 | hdd_send_re_assoc_event(dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3157 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3158 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3159 | reqRsnIe, |
| 3160 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 3161 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3162 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3163 | MAC_ADDRESS_STR |
| 3164 | " result:%d and Status:%d", |
| 3165 | MAC_ADDR_ARRAY |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3166 | (roam_info->bssid.bytes), |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3167 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3168 | |
| 3169 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3170 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3171 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3172 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3173 | roam_info, |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3174 | pFTAssocReq, |
| 3175 | assocReqlen, |
| 3176 | pFTAssocRsp, |
| 3177 | assocRsplen, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3178 | WLAN_STATUS_SUCCESS, |
| 3179 | GFP_KERNEL, |
| 3180 | false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3181 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3182 | } |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3183 | cdp_hl_fc_set_td_limit(soc, |
| 3184 | adapter->session_id, |
| 3185 | sta_ctx->conn_info.operationChannel); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3186 | } |
| 3187 | } |
| 3188 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3189 | /* |
| 3190 | * Perform any WMM-related association |
| 3191 | * processing. |
| 3192 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3193 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3195 | |
| 3196 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 3197 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3198 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3199 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3200 | roam_info, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3201 | sta_ctx->conn_info.staId[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3202 | NULL, roam_info->pBssDesc); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3203 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3204 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3205 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3206 | WLAN_CONTROL_PATH); |
| 3207 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3208 | } |
| 3209 | } else { |
| 3210 | /* |
| 3211 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 3212 | * in case of reassociation also need to indicate it to |
| 3213 | * supplicant. |
| 3214 | */ |
Jeff Johnson | 0a078b5 | 2018-06-01 16:15:54 -0700 | [diff] [blame] | 3215 | sme_roam_get_wpa_rsn_req_ie( |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3216 | mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3217 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3218 | &reqRsnLength, reqRsnIe); |
| 3219 | |
Ajit Pal Singh | d6c08f2 | 2018-04-25 16:55:26 +0530 | [diff] [blame] | 3220 | cdp_hl_fc_set_td_limit(soc, |
| 3221 | adapter->session_id, |
| 3222 | sta_ctx->conn_info.operationChannel); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3223 | hdd_send_re_assoc_event(dev, adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3224 | reqRsnIe, reqRsnLength); |
| 3225 | /* Reassoc successfully */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3226 | if (roam_info->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3227 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3228 | hdd_change_peer_state(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3229 | sta_ctx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3230 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3232 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3233 | #else |
| 3234 | false |
| 3235 | #endif |
| 3236 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3237 | hdd_conn_set_authenticated(adapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3238 | hdd_objmgr_set_peer_mlme_auth_state( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3239 | adapter->hdd_vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3240 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3241 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3242 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3243 | sta_ctx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3244 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3245 | hdd_change_peer_state(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3246 | sta_ctx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3247 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3248 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3249 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3250 | #else |
| 3251 | false |
| 3252 | #endif |
| 3253 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3254 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3255 | hdd_objmgr_set_peer_mlme_auth_state( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3256 | adapter->hdd_vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3257 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3258 | } |
| 3259 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3260 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3261 | /* |
| 3262 | * Perform any WMM-related association |
| 3263 | * processing |
| 3264 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3265 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3266 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3267 | } |
| 3268 | |
| 3269 | /* Start the tx queues */ |
| 3270 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3271 | if (roam_info->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3272 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3273 | #endif |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3274 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3275 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3276 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3277 | WLAN_CONTROL_PATH); |
| 3278 | } |
| 3279 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3280 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3281 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3282 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | } |
| 3284 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 3285 | qdf_mem_zero(&adapter->hdd_stats.hdd_pmf_stats, |
| 3286 | sizeof(adapter->hdd_stats.hdd_pmf_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3287 | #endif |
Frank Liu | 064ebd4 | 2018-05-03 14:22:39 +0800 | [diff] [blame] | 3288 | hdd_debug("check for SAP restart"); |
| 3289 | policy_mgr_check_concurrent_intf_and_restart_sap( |
| 3290 | hdd_ctx->hdd_psoc); |
Dundi Raviteja | ffa9bf4 | 2018-08-21 19:40:36 +0530 | [diff] [blame] | 3291 | if (roam_info->pBssDesc) |
| 3292 | policy_mgr_checkn_update_hw_mode_single_mac_mode |
| 3293 | (hdd_ctx->hdd_psoc, |
| 3294 | roam_info->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3296 | bool connect_timeout = false; |
Tushnim Bhattacharyya | 3f78053 | 2018-08-01 19:11:40 -0700 | [diff] [blame] | 3297 | /* do we need to change the HW mode */ |
| 3298 | policy_mgr_check_n_start_opportunistic_timer(hdd_ctx->hdd_psoc); |
Vignesh Viswanathan | 014096a | 2017-12-07 01:24:44 +0530 | [diff] [blame] | 3299 | if (roam_info && roam_info->is_fils_connection && |
| 3300 | eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) |
| 3301 | qdf_copy_macaddr(&roam_info->bssid, |
| 3302 | &sta_ctx->requested_bssid); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3303 | if (roam_info) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3304 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3305 | " result: %d and Status: %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3306 | MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3307 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3309 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3310 | " result: %d and Status: %d", |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3311 | MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3312 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3313 | |
| 3314 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3315 | (roam_info && |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3316 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3317 | roam_info->statusCode) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3318 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3319 | roam_info->statusCode) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3320 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3321 | roam_info->statusCode)))) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3322 | wlan_hdd_cfg80211_update_bss_list(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3323 | roam_info ? |
| 3324 | roam_info->bssid.bytes : |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3325 | sta_ctx->requested_bssid.bytes); |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3326 | sme_remove_bssid_from_scan_list(mac_handle, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3327 | roam_info ? |
| 3328 | roam_info->bssid.bytes : |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3329 | sta_ctx->requested_bssid.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3330 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3331 | } |
| 3332 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3333 | /* |
| 3334 | * CR465478: Only send up a connection failure result when CSR |
| 3335 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3336 | */ |
| 3337 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3338 | && !hddDisconInProgress) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3339 | if (roam_info) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3340 | hdd_err("send connect failure to nl80211: for bssid " |
| 3341 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3342 | " result: %d and Status: %d reasoncode: %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3343 | MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3344 | roamResult, roamStatus, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3345 | roam_info->reasonCode); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3346 | sta_ctx->conn_info.assoc_status_code = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3347 | roam_info->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3348 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3349 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3350 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3351 | " result: %d and status: %d ", |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3352 | MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3353 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3354 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3355 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3356 | wlan_deregister_txrx_packetdump(); |
| 3357 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3358 | /* inform association failure event to nl80211 */ |
| 3359 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3360 | roamResult) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3361 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3362 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3363 | roam_info->bssid.bytes, |
| 3364 | roam_info, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3365 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3366 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3367 | connect_timeout, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3368 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3369 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3370 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3371 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3372 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3373 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3374 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3375 | connect_timeout, |
| 3376 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3377 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3378 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3379 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3380 | roam_info->bssid.bytes, |
| 3381 | roam_info, NULL, 0, NULL, 0, |
| 3382 | roam_info->reasonCode ? |
| 3383 | roam_info->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3385 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3386 | connect_timeout, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3387 | roam_info->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3388 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3389 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3390 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3391 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3392 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3393 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3394 | connect_timeout, |
| 3395 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3396 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3397 | hdd_clear_roam_profile_ie(adapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3398 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3399 | && !hddDisconInProgress)) { |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3400 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3401 | sta_ctx->requested_bssid.bytes, |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3402 | NULL, NULL, 0, NULL, 0, |
| 3403 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
| 3404 | GFP_KERNEL, |
| 3405 | connect_timeout, |
| 3406 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3407 | } |
| 3408 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3409 | /* |
| 3410 | * Set connection state to eConnectionState_NotConnected only |
| 3411 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3412 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3413 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3414 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3415 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3416 | && !hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3417 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3418 | eConnectionState_NotConnected); |
| 3419 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3420 | hdd_wmm_init(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3421 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3422 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3423 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3424 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3425 | WLAN_CONTROL_PATH); |
Abhishek Singh | 0edeba0 | 2018-06-05 10:04:08 +0530 | [diff] [blame] | 3426 | /* |
| 3427 | * if hddDisconInProgress is set and roamResult is |
| 3428 | * eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE that mean HDD is |
| 3429 | * waiting on disconnect_comp_var so unblock anyone waiting for |
| 3430 | * disconnect to complete. |
| 3431 | */ |
| 3432 | if ((roamResult == eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE) && |
| 3433 | hddDisconInProgress) |
| 3434 | complete(&adapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3435 | } |
| 3436 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3437 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3438 | } |
| 3439 | |
| 3440 | /** |
| 3441 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3442 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3443 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | * @roamId: roam id |
| 3445 | * @roamStatus: roam status |
| 3446 | * @roamResult: roam result |
| 3447 | * |
| 3448 | * Here we update the status of the Ibss when we receive information that we |
| 3449 | * have started/joined an ibss session. |
| 3450 | * |
| 3451 | * Return: none |
| 3452 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3453 | static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3454 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3455 | uint32_t roamId, |
| 3456 | eRoamCmdStatus roamStatus, |
| 3457 | eCsrRoamResult roamResult) |
| 3458 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3459 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3460 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3461 | hdd_debug("%s: id %d, status %d, result %d", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3462 | adapter->dev->name, roamId, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3463 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3464 | |
| 3465 | switch (roamResult) { |
| 3466 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3467 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3468 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3469 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3470 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3471 | struct hdd_station_ctx *hdd_sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3472 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Dustin Brown | ce5b3d3 | 2018-01-17 15:07:38 -0800 | [diff] [blame] | 3473 | struct qdf_mac_addr broadcastMacAddr = QDF_MAC_ADDR_BCAST_INIT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3474 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3475 | if (NULL == roam_info) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3476 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3477 | return; |
| 3478 | } |
| 3479 | |
| 3480 | /* When IBSS Started comes from CSR, we need to move |
| 3481 | * connection state to IBSS Disconnected (meaning no peers |
| 3482 | * are in the IBSS). |
| 3483 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3484 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3485 | eConnectionState_IbssDisconnected); |
| 3486 | /* notify wmm */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3487 | hdd_wmm_connect(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3488 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3489 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3490 | hdd_sta_ctx->broadcast_staid = roam_info->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3491 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3492 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3493 | hdd_ctx->sta_to_adapter[roam_info->staId] = |
| 3494 | adapter; |
| 3495 | else |
| 3496 | hdd_debug("invalid sta id %d", roam_info->staId); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3497 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3498 | hdd_roam_register_sta(adapter, roam_info, |
| 3499 | roam_info->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3500 | &broadcastMacAddr, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3501 | roam_info->pBssDesc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3502 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3503 | if (roam_info->pBssDesc) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3504 | struct cfg80211_bss *bss; |
| 3505 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3506 | struct ieee80211_channel *chan; |
| 3507 | int chan_no; |
| 3508 | unsigned int freq; |
| 3509 | #endif |
| 3510 | /* we created the IBSS, notify supplicant */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3511 | hdd_debug("%s: created ibss " MAC_ADDRESS_STR, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3512 | adapter->dev->name, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3513 | MAC_ADDR_ARRAY( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3514 | roam_info->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3515 | |
| 3516 | /* we must first give cfg80211 the BSS information */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3517 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3518 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3519 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3520 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3521 | adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3522 | return; |
| 3523 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3524 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3525 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3526 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3527 | WLAN_CONTROL_PATH); |
| 3528 | |
| 3529 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3530 | chan_no = roam_info->pBssDesc->channelId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3531 | |
| 3532 | if (chan_no <= 14) |
| 3533 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3534 | HDD_NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | else |
| 3536 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3537 | HDD_NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3538 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3539 | chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3540 | |
| 3541 | if (chan) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3542 | cfg80211_ibss_joined(adapter->dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3543 | bss->bssid, chan, |
| 3544 | GFP_KERNEL); |
| 3545 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3546 | hdd_warn("%s: chanId: %d, can't find channel", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3547 | adapter->dev->name, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3548 | (int)roam_info->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3549 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3550 | cfg80211_ibss_joined(adapter->dev, bss->bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3551 | GFP_KERNEL); |
| 3552 | #endif |
| 3553 | cfg80211_put_bss( |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 3554 | hdd_ctx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3555 | bss); |
| 3556 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3557 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3558 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3559 | adapter->device_mode, adapter->session_id); |
Jeff Johnson | e8846ab | 2018-03-31 11:54:45 -0700 | [diff] [blame] | 3560 | hdd_green_ap_start_state_mc(hdd_ctx, |
Himanshu Agarwal | 813b2bf | 2018-01-22 16:32:15 +0530 | [diff] [blame] | 3561 | adapter->device_mode, true); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3562 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3563 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3564 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3565 | adapter->session_id); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3566 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3567 | break; |
| 3568 | } |
| 3569 | |
| 3570 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3571 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3572 | hdd_err("%s: unable to create IBSS", adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3573 | break; |
| 3574 | } |
| 3575 | |
| 3576 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3577 | hdd_err("%s: unexpected result %d", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3578 | adapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3579 | break; |
| 3580 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3581 | } |
| 3582 | |
| 3583 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3584 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3585 | * @sta_ctx: pointer to hdd station context |
| 3586 | * @sta_id: station ID |
| 3587 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3588 | * |
| 3589 | * This information is passed to iwconfig later. The peer that joined |
| 3590 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3591 | |
| 3592 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3593 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3594 | 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] | 3595 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3596 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3597 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3598 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3599 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3600 | if (HDD_WLAN_INVALID_STA_ID == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3601 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3602 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3603 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3604 | qdf_copy_macaddr( |
| 3605 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3606 | peer_mac_addr); |
| 3607 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3608 | } |
| 3609 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3610 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3611 | } |
| 3612 | |
| 3613 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3614 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3615 | * @sta_ctx: pointer to hdd station context |
| 3616 | * @sta_id: station ID |
| 3617 | * |
| 3618 | * Return: None |
| 3619 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3620 | 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] | 3621 | { |
| 3622 | int i; |
| 3623 | |
| 3624 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3625 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3626 | sta_ctx->conn_info.staId[i] = HDD_WLAN_INVALID_STA_ID; |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3627 | return; |
| 3628 | } |
| 3629 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3630 | } |
| 3631 | |
| 3632 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3633 | * 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] | 3634 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3635 | * @staId: station id |
| 3636 | * |
| 3637 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3638 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | * false otherwise. |
| 3640 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3641 | static bool roam_remove_ibss_station(struct hdd_adapter *adapter, uint8_t staId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3642 | { |
| 3643 | bool fSuccess = false; |
| 3644 | int idx = 0; |
| 3645 | uint8_t valid_idx = 0; |
| 3646 | uint8_t del_idx = 0; |
| 3647 | uint8_t empty_slots = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3648 | 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] | 3649 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3650 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3651 | if (staId == sta_ctx->conn_info.staId[idx]) { |
| 3652 | sta_ctx->conn_info.staId[idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3653 | HDD_WLAN_INVALID_STA_ID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3654 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3655 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3656 | peerMacAddress[idx]); |
| 3657 | |
| 3658 | fSuccess = true; |
| 3659 | |
| 3660 | /* |
| 3661 | * Note the deleted Index, if its 0 we need special |
| 3662 | * handling. |
| 3663 | */ |
| 3664 | del_idx = idx; |
| 3665 | |
| 3666 | empty_slots++; |
| 3667 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3668 | if (sta_ctx->conn_info.staId[idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3669 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3670 | valid_idx = idx; |
| 3671 | } else { |
| 3672 | /* Found an empty slot */ |
| 3673 | empty_slots++; |
| 3674 | } |
| 3675 | } |
| 3676 | } |
| 3677 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3678 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3679 | /* Last peer departed, set the IBSS state appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3680 | hdd_conn_set_connection_state(adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3681 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3682 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3683 | } |
| 3684 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3685 | if (fSuccess == true) { |
| 3686 | if (del_idx == 0) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3687 | if (sta_ctx->conn_info.staId[valid_idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3688 | HDD_WLAN_INVALID_STA_ID) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3689 | sta_ctx->conn_info.staId[0] = |
| 3690 | sta_ctx->conn_info.staId[valid_idx]; |
| 3691 | qdf_copy_macaddr(&sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3692 | peerMacAddress[0], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3693 | &sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3694 | peerMacAddress[valid_idx]); |
| 3695 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3696 | sta_ctx->conn_info.staId[valid_idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3697 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3698 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3699 | peerMacAddress[valid_idx]); |
| 3700 | } |
| 3701 | } |
| 3702 | } |
| 3703 | return fSuccess; |
| 3704 | } |
| 3705 | |
| 3706 | /** |
| 3707 | * roam_ibss_connect_handler() - IBSS connection handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3708 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3709 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3710 | * |
| 3711 | * We update the status of the IBSS to connected in this function. |
| 3712 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3713 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3714 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3715 | static QDF_STATUS roam_ibss_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3716 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3717 | { |
| 3718 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3719 | /* |
| 3720 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3721 | * a partner stations). |
| 3722 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3723 | hdd_conn_set_connection_state(adapter, eConnectionState_IbssConnected); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3724 | |
| 3725 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3726 | hdd_conn_save_connect_info(adapter, roam_info, eCSR_BSS_TYPE_IBSS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3727 | |
| 3728 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3729 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3730 | /* add bss_id to cfg80211 data base */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3731 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3732 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3733 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3734 | adapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3735 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3736 | } |
| 3737 | cfg80211_put_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3738 | WLAN_HDD_GET_CTX(adapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3739 | bss); |
| 3740 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3741 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3742 | } |
| 3743 | |
| 3744 | /** |
| 3745 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3746 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3747 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3748 | * @roamId: roam id |
| 3749 | * @roamStatus: roam status |
| 3750 | * @roamResult: roam result |
| 3751 | * |
| 3752 | * This function indicates the Mic failure to the supplicant |
| 3753 | * |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3754 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | */ |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3756 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3757 | hdd_roam_mic_error_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3758 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3759 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3760 | 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] | 3761 | tSirMicFailureInfo *mic_failure_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3762 | |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3763 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) |
| 3764 | return; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3765 | |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3766 | mic_failure_info = roam_info->u.pMICFailureInfo; |
| 3767 | cfg80211_michael_mic_failure(adapter->dev, |
| 3768 | mic_failure_info->taMacAddr, |
| 3769 | mic_failure_info->multicast ? |
| 3770 | NL80211_KEYTYPE_GROUP : |
| 3771 | NL80211_KEYTYPE_PAIRWISE, |
| 3772 | mic_failure_info->keyId, |
| 3773 | mic_failure_info->TSC, |
| 3774 | GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3775 | } |
| 3776 | |
| 3777 | /** |
| 3778 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3779 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3780 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3781 | * @roamId: roam id |
| 3782 | * @roamStatus: roam status |
| 3783 | * @roamResult: roam result |
| 3784 | * |
| 3785 | * The Ibss connection status is updated regularly here in this function. |
| 3786 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3787 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3788 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3789 | static QDF_STATUS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3790 | roam_roam_connect_status_update_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3791 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3792 | uint32_t roamId, |
| 3793 | eRoamCmdStatus roamStatus, |
| 3794 | eCsrRoamResult roamResult) |
| 3795 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3796 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3797 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3798 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3799 | switch (roamResult) { |
| 3800 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3801 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3802 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3803 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3804 | struct station_info *stainfo; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3805 | eCsrEncryptionType encr_type = sta_ctx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3806 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3807 | hdd_debug("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3808 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3809 | MAC_ADDRESS_STR " and stationID= %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3810 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3811 | MAC_ADDR_ARRAY(sta_ctx->conn_info.bssId.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3812 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3813 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3814 | if (!hdd_save_peer |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3815 | (WLAN_HDD_GET_STATION_CTX_PTR(adapter), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3816 | roam_info->staId, |
| 3817 | &roam_info->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3818 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3819 | break; |
| 3820 | } |
| 3821 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3822 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3823 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
| 3824 | else |
| 3825 | hdd_debug("invalid sta id %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3826 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3827 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3828 | roam_info->fAuthRequired = true; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3829 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3830 | /* Register the Station with TL for the new peer. */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3831 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3832 | roam_info, |
| 3833 | roam_info->staId, |
| 3834 | &roam_info->peerMac, |
| 3835 | roam_info->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3836 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3837 | hdd_err("Cannot register STA with TL for IBSS. qdf_status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3838 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3839 | } |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3840 | sta_ctx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3841 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3842 | if (stainfo == NULL) { |
| 3843 | hdd_err("memory allocation for station_info failed"); |
| 3844 | return QDF_STATUS_E_NOMEM; |
| 3845 | } |
| 3846 | stainfo->filled = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3847 | stainfo->generation = sta_ctx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3849 | cfg80211_new_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3850 | (const u8 *)roam_info->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3851 | stainfo, GFP_KERNEL); |
| 3852 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3853 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3854 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3855 | sta_ctx->ibss_enc_key.keyDirection = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3856 | eSIR_TX_RX; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3857 | qdf_copy_macaddr(&sta_ctx->ibss_enc_key.peerMac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3858 | &roam_info->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3859 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3860 | hdd_debug("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3861 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3862 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3863 | qdf_status = |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 3864 | sme_roam_set_key(hdd_ctx->mac_handle, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3865 | adapter->session_id, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3866 | &sta_ctx->ibss_enc_key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3867 | &roamId); |
| 3868 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3869 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3870 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3871 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3872 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3873 | } |
| 3874 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3875 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3876 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3877 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3878 | WLAN_CONTROL_PATH); |
| 3879 | break; |
| 3880 | } |
| 3881 | |
| 3882 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3883 | { |
| 3884 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3885 | roam_ibss_connect_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3886 | |
| 3887 | break; |
| 3888 | } |
| 3889 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3890 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3891 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3892 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3893 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3894 | if (!roam_remove_ibss_station(adapter, roam_info->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3895 | 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] | 3896 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3897 | hdd_debug("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3898 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3899 | MAC_ADDRESS_STR " and stationID= %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3900 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3901 | MAC_ADDR_ARRAY(sta_ctx->conn_info.bssId.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3902 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3903 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3904 | hdd_roam_deregister_sta(adapter, roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3905 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3906 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3907 | hdd_ctx->sta_to_adapter[roam_info->staId] = NULL; |
| 3908 | else |
| 3909 | hdd_debug("invalid sta id %d", roam_info->staId); |
| 3910 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3911 | sta_ctx->ibss_sta_generation++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3912 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3913 | cfg80211_del_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3914 | (const u8 *)&roam_info->peerMac.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3915 | GFP_KERNEL); |
| 3916 | break; |
| 3917 | } |
| 3918 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3919 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3920 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3921 | /* Stop only when we are inactive */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3922 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3923 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3924 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3925 | WLAN_CONTROL_PATH); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3926 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3927 | eConnectionState_NotConnected); |
| 3928 | |
| 3929 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3930 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3931 | break; |
| 3932 | } |
| 3933 | default: |
| 3934 | break; |
| 3935 | |
| 3936 | } |
| 3937 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3938 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3939 | } |
| 3940 | |
| 3941 | #ifdef FEATURE_WLAN_TDLS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3942 | QDF_STATUS hdd_roam_register_tdlssta(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3943 | const uint8_t *peerMac, uint16_t staId, |
Jeff Johnson | a8ce127 | 2018-03-01 14:39:10 -0800 | [diff] [blame] | 3944 | uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3945 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3946 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3947 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3948 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3949 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3950 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3951 | |
| 3952 | /* |
| 3953 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3954 | * be peer MAC, here we are working on direct Link |
| 3955 | */ |
| 3956 | staDesc.sta_id = staId; |
| 3957 | |
| 3958 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3959 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3960 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3961 | /* Register the vdev transmit and receive functions */ |
| 3962 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3963 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3964 | cdp_vdev_register(soc, |
Sravan Kumar Kairam | 43f191b | 2018-05-04 17:00:39 +0530 | [diff] [blame] | 3965 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
| 3966 | (struct cdp_pdev *)pdev, adapter->session_id), |
| 3967 | adapter, (struct cdp_ctrl_objmgr_vdev *)adapter->hdd_vdev, |
| 3968 | &txrx_ops); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3969 | adapter->tx_fn = txrx_ops.tx.tx; |
Poddar, Siddarth | 31797fa | 2018-01-22 17:24:15 +0530 | [diff] [blame] | 3970 | txrx_ops.rx.stats_rx = hdd_tx_rx_collect_connectivity_stats_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3971 | |
| 3972 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3973 | qdf_status = cdp_peer_register(soc, |
| 3974 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3975 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3976 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3977 | qdf_status, qdf_status); |
| 3978 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3979 | } |
| 3980 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3981 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3982 | } |
| 3983 | |
| 3984 | /** |
| 3985 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3986 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3987 | * @staId: station identifier |
| 3988 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3989 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3990 | */ |
Jeff Johnson | 5336784 | 2017-10-03 11:10:34 -0700 | [diff] [blame] | 3991 | QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter, |
| 3992 | uint8_t staId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3994 | QDF_STATUS qdf_status; |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 3995 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3996 | 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] | 3997 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3998 | staId); |
Kabilan Kannan | b4e0137 | 2018-01-15 13:33:10 -0800 | [diff] [blame] | 3999 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4000 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4001 | } |
| 4002 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4003 | #else |
| 4004 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4005 | inline QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4006 | uint8_t staId) |
| 4007 | { |
| 4008 | return QDF_STATUS_SUCCESS; |
| 4009 | } |
| 4010 | |
| 4011 | static inline QDF_STATUS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4012 | hdd_roam_tdls_status_update_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4013 | struct csr_roam_info *roam_info, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4014 | uint32_t roamId, |
| 4015 | eRoamCmdStatus roamStatus, |
| 4016 | eCsrRoamResult roamResult) |
| 4017 | { |
| 4018 | return QDF_STATUS_SUCCESS; |
| 4019 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4020 | #endif |
| 4021 | |
| 4022 | #ifdef WLAN_FEATURE_11W |
| 4023 | /** |
| 4024 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4025 | * @adapter: pointer to the adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4026 | * @nFrameLength: Length of the unprotected frame being passed |
| 4027 | * @pbFrames: Pointer to the frame buffer |
| 4028 | * @frameType: 802.11 frame type |
| 4029 | * |
| 4030 | * This function forwards the unprotected management frame to the supplicant. |
| 4031 | * |
| 4032 | * Return: nothing |
| 4033 | */ |
| 4034 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4035 | hdd_indicate_unprot_mgmt_frame(struct hdd_adapter *adapter, |
| 4036 | uint32_t nFrameLength, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4037 | uint8_t *pbFrames, uint8_t frameType) |
| 4038 | { |
| 4039 | uint8_t type = 0; |
| 4040 | uint8_t subType = 0; |
| 4041 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4042 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4043 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4044 | |
| 4045 | /* Sanity Checks */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4046 | if (NULL == adapter) { |
| 4047 | hdd_err("adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4048 | return; |
| 4049 | } |
| 4050 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4051 | if (NULL == adapter->dev) { |
| 4052 | hdd_err("adapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4053 | return; |
| 4054 | } |
| 4055 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4056 | if (WLAN_HDD_ADAPTER_MAGIC != adapter->magic) { |
| 4057 | hdd_err("adapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4058 | return; |
| 4059 | } |
| 4060 | |
| 4061 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4062 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4063 | return; |
| 4064 | } |
| 4065 | |
| 4066 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4067 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4068 | return; |
| 4069 | } |
| 4070 | |
| 4071 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4072 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4073 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4074 | /* Get adapter from Destination mac address of the frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4075 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4076 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4077 | cfg80211_rx_unprot_mlme_mgmt(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4078 | nFrameLength); |
| 4079 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4080 | cfg80211_send_unprot_disassoc(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4081 | nFrameLength); |
| 4082 | #endif |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 4083 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_disassoc_rx++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4084 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4085 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4086 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4087 | cfg80211_rx_unprot_mlme_mgmt(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4088 | nFrameLength); |
| 4089 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4090 | cfg80211_send_unprot_deauth(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4091 | nFrameLength); |
| 4092 | #endif |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 4093 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_deauth_rx++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4094 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4095 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4096 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4097 | return; |
| 4098 | } |
| 4099 | } |
| 4100 | #endif |
| 4101 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4102 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4103 | /** |
| 4104 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4105 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | * @tid: traffic identifier |
| 4107 | * @state: state |
| 4108 | * @measInterval: measurement interval |
| 4109 | * |
| 4110 | * This function sends traffic stream metrics IE information to |
| 4111 | * the supplicant via wireless event. |
| 4112 | * |
| 4113 | * Return: none |
| 4114 | */ |
| 4115 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4116 | hdd_indicate_tsm_ie(struct hdd_adapter *adapter, uint8_t tid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4117 | uint8_t state, uint16_t measInterval) |
| 4118 | { |
| 4119 | union iwreq_data wrqu; |
| 4120 | char buf[IW_CUSTOM_MAX + 1]; |
| 4121 | int nBytes = 0; |
| 4122 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4123 | if (NULL == adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4124 | return; |
| 4125 | |
| 4126 | /* create the event */ |
| 4127 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4128 | memset(buf, '\0', sizeof(buf)); |
| 4129 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4130 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4131 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4132 | |
| 4133 | nBytes = |
| 4134 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4135 | measInterval); |
| 4136 | |
| 4137 | wrqu.data.pointer = buf; |
| 4138 | wrqu.data.length = nBytes; |
| 4139 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4140 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4141 | } |
| 4142 | |
| 4143 | /** |
| 4144 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4145 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4146 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4147 | * |
| 4148 | * This function sends cckm preauth indication to the supplicant |
| 4149 | * via wireless custom event. |
| 4150 | * |
| 4151 | * Return: none |
| 4152 | */ |
| 4153 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4154 | hdd_indicate_cckm_pre_auth(struct hdd_adapter *adapter, |
| 4155 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4156 | { |
| 4157 | union iwreq_data wrqu; |
| 4158 | char buf[IW_CUSTOM_MAX + 1]; |
| 4159 | char *pos = buf; |
| 4160 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4161 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4162 | if ((NULL == adapter) || (NULL == roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4163 | return; |
| 4164 | |
| 4165 | /* create the event */ |
| 4166 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4167 | memset(buf, '\0', sizeof(buf)); |
| 4168 | |
| 4169 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4170 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4171 | MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
| 4172 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4173 | |
| 4174 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4175 | pos += nBytes; |
| 4176 | freeBytes -= nBytes; |
| 4177 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4178 | qdf_mem_copy(pos, roam_info->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4179 | pos += QDF_MAC_ADDR_SIZE; |
| 4180 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4181 | |
| 4182 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4183 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4184 | freeBytes -= nBytes; |
| 4185 | |
| 4186 | wrqu.data.pointer = buf; |
| 4187 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4188 | |
| 4189 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4190 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4191 | } |
| 4192 | |
| 4193 | /** |
| 4194 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4195 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4196 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4197 | * |
| 4198 | * Return: none |
| 4199 | */ |
| 4200 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4201 | hdd_indicate_ese_adj_ap_rep_ind(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4202 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4203 | { |
| 4204 | union iwreq_data wrqu; |
| 4205 | char buf[IW_CUSTOM_MAX + 1]; |
| 4206 | int nBytes = 0; |
| 4207 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4208 | if ((NULL == adapter) || (NULL == roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4209 | return; |
| 4210 | |
| 4211 | /* create the event */ |
| 4212 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4213 | memset(buf, '\0', sizeof(buf)); |
| 4214 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4215 | hdd_debug("CCXADJAPREP=%u", roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4216 | |
| 4217 | nBytes = |
| 4218 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4219 | roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4220 | |
| 4221 | wrqu.data.pointer = buf; |
| 4222 | wrqu.data.length = nBytes; |
| 4223 | |
| 4224 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4225 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4226 | } |
| 4227 | |
| 4228 | /** |
| 4229 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4230 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4231 | * @measurementToken: measurement token |
| 4232 | * @flag: flag |
| 4233 | * @numBss: number of bss |
| 4234 | * |
| 4235 | * If the measurement is none and no scan results found, |
| 4236 | * indicate the supplicant about measurement done. |
| 4237 | * |
| 4238 | * Return: none |
| 4239 | */ |
| 4240 | void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4241 | hdd_indicate_ese_bcn_report_no_results(const struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4242 | const uint16_t measurementToken, |
| 4243 | const bool flag, const uint8_t numBss) |
| 4244 | { |
| 4245 | union iwreq_data wrqu; |
| 4246 | char buf[IW_CUSTOM_MAX]; |
| 4247 | char *pos = buf; |
| 4248 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4249 | |
| 4250 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4251 | memset(buf, '\0', sizeof(buf)); |
| 4252 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4253 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4254 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4255 | |
| 4256 | nBytes = |
| 4257 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4258 | flag, numBss); |
| 4259 | |
| 4260 | wrqu.data.pointer = buf; |
| 4261 | wrqu.data.length = nBytes; |
| 4262 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4263 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4264 | } |
| 4265 | |
| 4266 | /** |
| 4267 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4268 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4269 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4270 | * |
| 4271 | * If the measurement is none and no scan results found, |
| 4272 | * indicate the supplicant about measurement done. |
| 4273 | * |
| 4274 | * Return: none |
| 4275 | */ |
| 4276 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4277 | hdd_indicate_ese_bcn_report_ind(const struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4278 | const struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4279 | { |
| 4280 | union iwreq_data wrqu; |
| 4281 | char buf[IW_CUSTOM_MAX]; |
| 4282 | char *pos = buf; |
| 4283 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4284 | uint8_t i = 0, len = 0; |
| 4285 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4286 | uint8_t lastSent = 0, sendBss = 0; |
| 4287 | int bcnRepFieldSize = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4288 | sizeof(roam_info->pEseBcnReportRsp->bcnRepBssInfo[0]. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4289 | bcnReportFields); |
| 4290 | uint8_t ieLenByte = 1; |
| 4291 | /* |
| 4292 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4293 | */ |
| 4294 | #define ESEBCNREPHEADER_LEN (18) |
| 4295 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4296 | if ((NULL == adapter) || (NULL == roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4297 | return; |
| 4298 | |
| 4299 | /* |
| 4300 | * Custom event can pass maximum of 256 bytes of data, |
| 4301 | * based on the IE len we need to identify how many BSS info can |
| 4302 | * be filled in to custom event data. |
| 4303 | */ |
| 4304 | /* |
| 4305 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4306 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4307 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4308 | */ |
| 4309 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4310 | if ((roam_info->pEseBcnReportRsp->flag >> 1) |
| 4311 | && (!roam_info->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4312 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4313 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4314 | * indicate the supplicant about measurement done |
| 4315 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4316 | hdd_indicate_ese_bcn_report_no_results( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4317 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4318 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4319 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4320 | roam_info->pEseBcnReportRsp->flag, |
| 4321 | roam_info->pEseBcnReportRsp->numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4322 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4323 | while (lastSent < roam_info->pEseBcnReportRsp->numBss) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4324 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4325 | memset(buf, '\0', sizeof(buf)); |
| 4326 | tot_bcn_ieLen = 0; |
| 4327 | sendBss = 0; |
| 4328 | pos = buf; |
| 4329 | freeBytes = IW_CUSTOM_MAX; |
| 4330 | |
| 4331 | for (i = lastSent; |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4332 | i < roam_info->pEseBcnReportRsp->numBss; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4333 | len = |
| 4334 | bcnRepFieldSize + ieLenByte + |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4335 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4336 | bcnRepBssInfo[i].ieLen; |
| 4337 | if ((len + tot_bcn_ieLen) > |
| 4338 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4339 | break; |
| 4340 | } |
| 4341 | tot_bcn_ieLen += len; |
| 4342 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4343 | 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] | 4344 | i, bcnRepFieldSize, 1, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4345 | roam_info->pEseBcnReportRsp-> |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4346 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4347 | } |
| 4348 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4349 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4350 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4351 | roam_info->pEseBcnReportRsp->measurementToken, |
| 4352 | roam_info->pEseBcnReportRsp->flag, sendBss, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4353 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4354 | |
| 4355 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4356 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4357 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4358 | roam_info->pEseBcnReportRsp->flag, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | sendBss); |
| 4360 | pos += nBytes; |
| 4361 | freeBytes -= nBytes; |
| 4362 | |
| 4363 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4364 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4365 | sizeof(tot_bcn_ieLen)); |
| 4366 | pos += sizeof(tot_bcn_ieLen); |
| 4367 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4368 | |
| 4369 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4370 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4371 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4372 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4373 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4374 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4375 | bcnRepBssInfo[i + |
| 4376 | lastSent].bcnReportFields. |
| 4377 | ChanNum, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4378 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4379 | bcnRepBssInfo[i + |
| 4380 | lastSent].bcnReportFields. |
| 4381 | Spare, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4382 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4383 | bcnRepBssInfo[i + |
| 4384 | lastSent].bcnReportFields. |
| 4385 | MeasDuration, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4386 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4387 | bcnRepBssInfo[i + |
| 4388 | lastSent].bcnReportFields. |
| 4389 | PhyType, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4390 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4391 | bcnRepBssInfo[i + |
| 4392 | lastSent].bcnReportFields. |
| 4393 | RecvSigPower, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4394 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4395 | bcnRepBssInfo[i + |
| 4396 | lastSent].bcnReportFields. |
| 4397 | ParentTsf, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4398 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4399 | bcnRepBssInfo[i + |
| 4400 | lastSent].bcnReportFields. |
| 4401 | TargetTsf[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4402 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4403 | bcnRepBssInfo[i + |
| 4404 | lastSent].bcnReportFields. |
| 4405 | TargetTsf[1], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4406 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4407 | bcnRepBssInfo[i + |
| 4408 | lastSent].bcnReportFields. |
| 4409 | BcnInterval, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4410 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4411 | bcnRepBssInfo[i + |
| 4412 | lastSent].bcnReportFields. |
| 4413 | CapabilityInfo, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4414 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4415 | bcnRepBssInfo[i + |
| 4416 | lastSent].bcnReportFields. |
| 4417 | Bssid[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4418 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4419 | bcnRepBssInfo[i + |
| 4420 | lastSent].bcnReportFields. |
| 4421 | Bssid[1], |
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 | bcnRepBssInfo[i + |
| 4424 | lastSent].bcnReportFields. |
| 4425 | Bssid[2], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4426 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4427 | bcnRepBssInfo[i + |
| 4428 | lastSent].bcnReportFields. |
| 4429 | Bssid[3], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4430 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4431 | bcnRepBssInfo[i + |
| 4432 | lastSent].bcnReportFields. |
| 4433 | Bssid[4], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4434 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4435 | bcnRepBssInfo[i + |
| 4436 | lastSent].bcnReportFields. |
| 4437 | Bssid[5]); |
| 4438 | |
| 4439 | /* bcn report fields are copied */ |
| 4440 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4441 | sizeof(roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4442 | bcnRepBssInfo[i + |
| 4443 | lastSent]. |
| 4444 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4445 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4446 | (char *)&roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4447 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4448 | lastSent]. |
| 4449 | bcnReportFields, len); |
| 4450 | pos += len; |
| 4451 | freeBytes -= len; |
| 4452 | |
| 4453 | /* Add 1 byte of ie len */ |
| 4454 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4455 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4456 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4457 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4458 | pos += sizeof(len); |
| 4459 | freeBytes -= sizeof(len); |
| 4460 | |
| 4461 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4462 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4463 | (char *)roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4464 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4465 | lastSent]. |
| 4466 | pBuf, len); |
| 4467 | pos += len; |
| 4468 | freeBytes -= len; |
| 4469 | } |
| 4470 | |
| 4471 | wrqu.data.pointer = buf; |
| 4472 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4473 | |
| 4474 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4475 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4476 | buf); |
| 4477 | lastSent += sendBss; |
| 4478 | } |
| 4479 | } |
| 4480 | } |
| 4481 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4482 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4483 | |
| 4484 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4485 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4486 | * @sta_ctx: Station Context |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4487 | * |
| 4488 | * API to check if the connection authentication type is 8021x_sha256. |
| 4489 | * |
| 4490 | * Return: bool |
| 4491 | */ |
| 4492 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4493 | static inline bool |
| 4494 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4495 | { |
| 4496 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4497 | sta_ctx->conn_info.authType; |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4498 | } |
| 4499 | #else |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4500 | static inline bool |
| 4501 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4502 | { |
| 4503 | return false; |
| 4504 | } |
| 4505 | #endif |
| 4506 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4507 | /* |
| 4508 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4509 | * @adapter: Pointer to adapter context |
| 4510 | * @roam_info: Pointer to roam info |
| 4511 | * |
| 4512 | * Return: None |
| 4513 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 4514 | static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4515 | struct csr_roam_info *roam_info) |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4516 | { |
| 4517 | struct hdd_chan_change_params chan_change; |
| 4518 | struct cfg80211_bss *bss; |
| 4519 | struct net_device *dev = adapter->dev; |
| 4520 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4521 | struct wiphy *wiphy = wdev->wiphy; |
| 4522 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4523 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4524 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4525 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4526 | hdd_debug("channel switch for session:%d to channel:%d", |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4527 | adapter->session_id, roam_info->chan_info.chan_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4528 | |
Vignesh Viswanathan | 3d47803 | 2018-08-02 20:18:53 +0530 | [diff] [blame] | 4529 | /* Enable Roaming on STA interface which was disabled before CSA */ |
| 4530 | if (adapter->device_mode == QDF_STA_MODE) |
| 4531 | sme_start_roaming(mac_handle, adapter->session_id, |
| 4532 | REASON_DRIVER_ENABLED); |
| 4533 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4534 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4535 | chan_change.chan_params.ch_width = |
| 4536 | roam_info->chan_info.ch_width; |
| 4537 | chan_change.chan_params.sec_ch_offset = |
| 4538 | roam_info->chan_info.sec_ch_offset; |
| 4539 | chan_change.chan_params.center_freq_seg0 = |
| 4540 | roam_info->chan_info.band_center_freq1; |
| 4541 | chan_change.chan_params.center_freq_seg1 = |
| 4542 | roam_info->chan_info.band_center_freq2; |
| 4543 | |
| 4544 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4545 | if (NULL == bss) |
| 4546 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4547 | else |
| 4548 | cfg80211_put_bss(wiphy, bss); |
| 4549 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4550 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4551 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4552 | if (QDF_IS_STATUS_ERROR(status)) |
| 4553 | hdd_err("channel change notification failed"); |
| 4554 | |
Ganesh Kondabattini | 41f3478 | 2017-09-14 21:14:29 +0530 | [diff] [blame] | 4555 | hdd_debug("check for SAP restart"); |
| 4556 | policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->hdd_psoc); |
| 4557 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4558 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4559 | adapter->session_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4560 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4561 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4562 | } |
| 4563 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4564 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4565 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4566 | * @pContext: pointer to adapter context |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4567 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4568 | * @roamId: roam id |
| 4569 | * @roamStatus: roam status |
| 4570 | * @roamResult: roam result |
| 4571 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4572 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4573 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4574 | QDF_STATUS |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4575 | hdd_sme_roam_callback(void *pContext, struct csr_roam_info *roam_info, |
| 4576 | uint32_t roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4577 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4578 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4579 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4580 | struct hdd_adapter *adapter = (struct hdd_adapter *) pContext; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4581 | struct hdd_station_ctx *sta_ctx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4582 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4583 | struct cfg80211_bss *bss_status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4584 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4585 | |
Abhishek Singh | f723e3d | 2018-02-20 18:02:37 +0530 | [diff] [blame] | 4586 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
Abhinav Kumar | 5670d36 | 2018-01-16 17:31:54 +0530 | [diff] [blame] | 4587 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4588 | |
| 4589 | /* Sanity check */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4590 | if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4591 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4592 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4593 | } |
| 4594 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4595 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4596 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4597 | |
Abhishek Singh | f723e3d | 2018-02-20 18:02:37 +0530 | [diff] [blame] | 4598 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4599 | adapter->session_id, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4600 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4601 | switch (roamStatus) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4602 | /* |
| 4603 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4604 | * reassoc failed due to failure, timeout, reject from ap |
| 4605 | * in any case tell the OS, our carrier is off and mark |
| 4606 | * interface down. |
| 4607 | */ |
| 4608 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4609 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4610 | roamStatus, roamResult, adapter->session_id); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4611 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4612 | hdd_dis_connect_handler(adapter, roam_info, roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4613 | roamStatus, roamResult); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4614 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4615 | sta_ctx->hdd_reassoc_scenario = false; |
| 4616 | hdd_debug("hdd_reassoc_scenario set to: %d, ReAssoc Failed, session: %d", |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4617 | sta_ctx->hdd_reassoc_scenario, adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4618 | break; |
| 4619 | |
| 4620 | case eCSR_ROAM_FT_START: |
| 4621 | /* |
| 4622 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4623 | * informed that the link is down. So mark the link ready for |
| 4624 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4625 | * be received. Where in we will not mark the link down |
| 4626 | * Also we want to stop tx at this point when we will be |
| 4627 | * doing disassoc at this time. This saves 30-60 msec |
| 4628 | * after reassoc. |
| 4629 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4630 | hdd_debug("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4631 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4632 | hdd_napi_serialize(1); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4633 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4634 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4635 | WLAN_CONTROL_PATH); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4636 | status = hdd_roam_deregister_sta(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4637 | sta_ctx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4638 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4639 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4640 | sta_ctx->ft_carrier_on = true; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4641 | sta_ctx->hdd_reassoc_scenario = true; |
| 4642 | hdd_debug("hdd_reassoc_scenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4643 | sta_ctx->hdd_reassoc_scenario, adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4644 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4645 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4646 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4647 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4648 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4649 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4650 | adapter->roam_ho_fail = true; |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4651 | else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4652 | adapter->roam_ho_fail = false; |
| 4653 | complete(&adapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4654 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4655 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4656 | /* notify apps that we can't pass traffic anymore */ |
Dustin Brown | a7bb6ae | 2018-08-16 16:51:50 -0700 | [diff] [blame] | 4657 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4658 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4659 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4660 | WLAN_CONTROL_PATH); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4661 | if (sta_ctx->ft_carrier_on == false) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4662 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4663 | WLAN_NETIF_CARRIER_OFF, |
| 4664 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4665 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4666 | break; |
| 4667 | case eCSR_ROAM_LOSTLINK: |
| 4668 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4669 | hdd_debug("Roaming started due to connection lost"); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4670 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4671 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4672 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4673 | WLAN_CONTROL_PATH); |
| 4674 | break; |
| 4675 | } |
| 4676 | case eCSR_ROAM_DISASSOCIATED: |
| 4677 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4678 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4679 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 4680 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4681 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4682 | adapter->roam_ho_fail = false; |
| 4683 | complete(&adapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4684 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4685 | /* Call to clear any MC Addr List filter applied after |
| 4686 | * successful connection. |
| 4687 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4688 | hdd_disable_and_flush_mc_addr_list(adapter, |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4689 | pmo_peer_disconnect); |
| 4690 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4691 | hdd_dis_connect_handler(adapter, roam_info, roamId, |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4692 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4693 | } |
| 4694 | break; |
| 4695 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4696 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4697 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4698 | hdd_dis_connect_handler(adapter, roam_info, roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4699 | roamStatus, roamResult); |
| 4700 | break; |
| 4701 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4702 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | /* |
| 4704 | * To Do - address probable memory leak with WEP encryption upon |
| 4705 | * successful association. |
| 4706 | */ |
| 4707 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 4708 | /* Clear saved connection information in HDD */ |
| 4709 | hdd_conn_remove_connect_info( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4710 | WLAN_HDD_GET_STATION_CTX_PTR(adapter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4711 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4712 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4713 | hdd_association_completion_handler(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4714 | roamId, roamStatus, |
| 4715 | roamResult); |
| 4716 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4717 | if (roam_info) |
| 4718 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4719 | #endif |
| 4720 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 4721 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4722 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Jeff Johnson | 48c05c7 | 2018-04-29 19:47:12 -0700 | [diff] [blame] | 4723 | /* fallthrough */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4724 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4725 | qdf_ret_status = hdd_association_completion_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4726 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4727 | roamId, |
| 4728 | roamStatus, |
| 4729 | roamResult); |
| 4730 | break; |
| 4731 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4732 | hdd_roam_ibss_indication_handler(adapter, roam_info, roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4733 | roamStatus, roamResult); |
| 4734 | break; |
| 4735 | |
| 4736 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4737 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4738 | roam_roam_connect_status_update_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4739 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4740 | roamId, |
| 4741 | roamStatus, |
| 4742 | roamResult); |
| 4743 | break; |
| 4744 | |
| 4745 | case eCSR_ROAM_MIC_ERROR_IND: |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 4746 | hdd_roam_mic_error_indication_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4747 | break; |
| 4748 | |
| 4749 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 4750 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4751 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4752 | hdd_roam_set_key_complete_handler(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4753 | roamId, roamStatus, |
| 4754 | roamResult); |
| 4755 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4756 | sta_ctx->hdd_reassoc_scenario = false; |
| 4757 | hdd_debug("hdd_reassoc_scenario set to: %d, set key complete, session: %d", |
| 4758 | sta_ctx->hdd_reassoc_scenario, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4759 | adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4760 | } |
| 4761 | } |
| 4762 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4763 | if (roam_info != NULL) |
| 4764 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4765 | #endif |
| 4766 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4767 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4768 | case eCSR_ROAM_FT_RESPONSE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4769 | hdd_send_ft_event(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4770 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4771 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4772 | case eCSR_ROAM_PMK_NOTIFY: |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4773 | if (eCSR_AUTH_TYPE_RSN == sta_ctx->conn_info.authType |
| 4774 | || hdd_is_8021x_sha256_auth_type(sta_ctx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4775 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4776 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4777 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4778 | adapter, roam_info, 1, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4779 | } |
| 4780 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4781 | |
| 4782 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4783 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4784 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4785 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4786 | wlan_hdd_cfg80211_roam_metrics_preauth(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4787 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4788 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4789 | } |
| 4790 | break; |
| 4791 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4792 | /* |
| 4793 | * This event will notify pre-auth completion in case of success |
| 4794 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4795 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4796 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4797 | roam_info, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4798 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4799 | } |
| 4800 | break; |
| 4801 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4802 | /* |
| 4803 | * This event will notify pre-auth completion incase of failure. |
| 4804 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4805 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4806 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4807 | roam_info, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4808 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4809 | } |
| 4810 | break; |
| 4811 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4812 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4813 | * It will be only invoked on success |
| 4814 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4815 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4816 | wlan_hdd_cfg80211_roam_metrics_handover(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4817 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4818 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4819 | } |
| 4820 | break; |
| 4821 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4822 | #ifdef WLAN_FEATURE_11W |
| 4823 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
gaurank kathpalia | ea6b5e6 | 2018-07-05 20:41:28 +0530 | [diff] [blame] | 4824 | if (roam_info) |
| 4825 | hdd_indicate_unprot_mgmt_frame(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4826 | roam_info->nFrameLength, |
| 4827 | roam_info->pbFrames, |
| 4828 | roam_info->frameType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4829 | break; |
| 4830 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4831 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4832 | case eCSR_ROAM_TSM_IE_IND: |
gaurank kathpalia | ea6b5e6 | 2018-07-05 20:41:28 +0530 | [diff] [blame] | 4833 | if (roam_info) |
| 4834 | hdd_indicate_tsm_ie(adapter, roam_info->tsmIe.tsid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4835 | roam_info->tsmIe.state, |
| 4836 | roam_info->tsmIe.msmt_interval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4837 | break; |
| 4838 | |
| 4839 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4840 | { |
| 4841 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4842 | sta_ctx->conn_info.authType |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4843 | || eCSR_AUTH_TYPE_CCKM_RSN == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4844 | sta_ctx->conn_info.authType) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4845 | hdd_indicate_cckm_pre_auth(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4846 | } |
| 4847 | break; |
| 4848 | } |
| 4849 | |
| 4850 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 4851 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4852 | hdd_indicate_ese_adj_ap_rep_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4853 | break; |
| 4854 | } |
| 4855 | |
| 4856 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 4857 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4858 | hdd_indicate_ese_bcn_report_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4859 | break; |
| 4860 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4861 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4862 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4863 | hdd_roam_channel_switch_handler(adapter, roam_info); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4864 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4865 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4866 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4867 | if ((NULL != roam_info) && (NULL != roam_info->pBssDesc)) { |
Abhishek Singh | f05b0cb6 | 2018-02-20 18:06:13 +0530 | [diff] [blame] | 4868 | bss_status = wlan_hdd_inform_bss_frame(adapter, |
| 4869 | roam_info->pBssDesc); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4870 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4871 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4872 | else |
| 4873 | cfg80211_put_bss( |
| 4874 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4875 | (WLAN_HDD_GET_CTX(adapter))->wiphy, |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4876 | #endif |
| 4877 | bss_status); |
| 4878 | } |
| 4879 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4880 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4881 | hdd_ndp_event_handler(adapter, roam_info, roamId, roamStatus, |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4882 | roamResult); |
| 4883 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4884 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4885 | hdd_debug("Process ROAM_START from firmware"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4886 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4887 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4888 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4889 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 4890 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4891 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4892 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4893 | break; |
| 4894 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4895 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4896 | hdd_napi_serialize(0); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4897 | wlan_hdd_netif_queue_control(adapter, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4898 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 4899 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 4900 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4901 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4902 | adapter->roam_ho_fail = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4903 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4904 | complete(&adapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4905 | break; |
| 4906 | |
Padma, Santhosh Kumar | eb90a55 | 2018-01-16 19:41:58 +0530 | [diff] [blame] | 4907 | case eCSR_ROAM_SAE_COMPUTE: |
| 4908 | if (roam_info) |
| 4909 | wlan_hdd_sae_callback(adapter, roam_info); |
| 4910 | break; |
| 4911 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4912 | default: |
| 4913 | break; |
| 4914 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4915 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4916 | } |
| 4917 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4918 | #ifdef WLAN_FEATURE_FILS_SK |
| 4919 | /** |
| 4920 | * hdd_translate_fils_rsn_to_csr_auth() - Translate FILS RSN to CSR auth type |
| 4921 | * @auth_suite: auth suite |
| 4922 | * @auth_type: pointer to eCsrAuthType |
| 4923 | * |
| 4924 | * Return: None |
| 4925 | */ |
| 4926 | static void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4927 | eCsrAuthType *auth_type) |
| 4928 | { |
| 4929 | if (!memcmp(auth_suite, ccp_rsn_oui_0e, 4)) |
| 4930 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA256; |
| 4931 | else if (!memcmp(auth_suite, ccp_rsn_oui_0f, 4)) |
| 4932 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA384; |
| 4933 | else if (!memcmp(auth_suite, ccp_rsn_oui_10, 4)) |
| 4934 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA256; |
| 4935 | else if (!memcmp(auth_suite, ccp_rsn_oui_11, 4)) |
| 4936 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA384; |
| 4937 | } |
| 4938 | #else |
| 4939 | static inline void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4940 | eCsrAuthType *auth_type) |
| 4941 | { |
| 4942 | } |
| 4943 | #endif |
| 4944 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 4945 | #ifdef WLAN_FEATURE_SAE |
| 4946 | /** |
| 4947 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 4948 | * @auth_suite: auth suite |
| 4949 | * @auth_type: pointer to eCsrAuthType |
| 4950 | * |
| 4951 | * Return: None |
| 4952 | */ |
| 4953 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4954 | eCsrAuthType *auth_type) |
| 4955 | { |
| 4956 | if (qdf_mem_cmp(auth_suite, ccp_rsn_oui_80, 4) == 0) |
| 4957 | *auth_type = eCSR_AUTH_TYPE_SAE; |
| 4958 | } |
| 4959 | #else |
| 4960 | static inline void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4961 | eCsrAuthType *auth_type) |
| 4962 | { |
| 4963 | } |
| 4964 | #endif |
| 4965 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4966 | /** |
| 4967 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 4968 | * @auth_suite: auth suite |
| 4969 | * |
| 4970 | * Return: eCsrAuthType enumeration |
| 4971 | */ |
| 4972 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 4973 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4974 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4975 | /* is the auth type supported? */ |
| 4976 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 4977 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 4978 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 4979 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4980 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4981 | /* Check for 11r FT Authentication with PSK */ |
| 4982 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 4983 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 4984 | /* Check for 11R FT Authentication with 802.1X */ |
| 4985 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 4986 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4987 | #ifdef FEATURE_WLAN_ESE |
| 4988 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 4989 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 4990 | } else |
| 4991 | #endif /* FEATURE_WLAN_ESE */ |
| 4992 | #ifdef WLAN_FEATURE_11W |
| 4993 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 4994 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4995 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 4996 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 4997 | } else if (memcmp(auth_suite, ccp_rsn_oui_18, 4) == 0) { |
| 4998 | auth_type = eCSR_AUTH_TYPE_OWE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4999 | } else |
| 5000 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 5001 | if (memcmp(auth_suite, ccp_rsn_oui_12, 4) == 0) { |
| 5002 | auth_type = eCSR_AUTH_TYPE_DPP_RSN; |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5003 | } else if (memcmp(auth_suite, ccp_rsn_oui_0b, 4) == 0) { |
| 5004 | /* Check for Suite B EAP 256 */ |
| 5005 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
| 5006 | } else if (memcmp(auth_suite, ccp_rsn_oui_0c, 4) == 0) { |
| 5007 | /* Check for Suite B EAP 384 */ |
| 5008 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Jeff Johnson | 109e79d | 2018-02-27 15:10:04 -0800 | [diff] [blame] | 5009 | } else { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5010 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5011 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5012 | } |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5013 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5014 | return auth_type; |
| 5015 | } |
| 5016 | |
| 5017 | /** |
| 5018 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5019 | * @auth_suite: auth suite |
| 5020 | * |
| 5021 | * Return: eCsrAuthType enumeration |
| 5022 | */ |
| 5023 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5024 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5025 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5026 | /* is the auth type supported? */ |
| 5027 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5028 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5029 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5030 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5031 | } else |
| 5032 | #ifdef FEATURE_WLAN_ESE |
| 5033 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5034 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5035 | } else |
| 5036 | #endif /* FEATURE_WLAN_ESE */ |
| 5037 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5038 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5039 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5040 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5041 | return auth_type; |
| 5042 | } |
| 5043 | |
| 5044 | /** |
| 5045 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5046 | * Translate RSN to CSR encryption type |
| 5047 | * @cipher_suite: cipher suite |
| 5048 | * |
| 5049 | * Return: eCsrEncryptionType enumeration |
| 5050 | */ |
| 5051 | eCsrEncryptionType |
| 5052 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5053 | { |
| 5054 | eCsrEncryptionType cipher_type; |
| 5055 | |
| 5056 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5057 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5058 | else if (memcmp(cipher_suite, ccp_rsn_oui09, 4) == 0) |
| 5059 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP; |
| 5060 | else if (memcmp(cipher_suite, ccp_rsn_oui0a, 4) == 0) |
| 5061 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5062 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5063 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5064 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5065 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5066 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5067 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5068 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5069 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5070 | else |
| 5071 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5072 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5073 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5074 | return cipher_type; |
| 5075 | } |
| 5076 | |
| 5077 | /** |
| 5078 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5079 | * Translate WPA to CSR encryption type |
| 5080 | * @cipher_suite: cipher suite |
| 5081 | * |
| 5082 | * Return: eCsrEncryptionType enumeration |
| 5083 | */ |
| 5084 | eCsrEncryptionType |
| 5085 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5086 | { |
| 5087 | eCsrEncryptionType cipher_type; |
| 5088 | |
| 5089 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5090 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5091 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5092 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5093 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5094 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5095 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5096 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5097 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5098 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5099 | else |
| 5100 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5101 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5102 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5103 | return cipher_type; |
| 5104 | } |
| 5105 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5106 | #ifdef WLAN_FEATURE_FILS_SK |
gaurank kathpalia | 82a1b2b | 2018-07-10 16:49:10 +0530 | [diff] [blame] | 5107 | bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5108 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5109 | struct csr_roam_profile *roam_profile; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5110 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5111 | roam_profile = hdd_roam_profile(adapter); |
| 5112 | if (roam_profile->fils_con_info) |
| 5113 | return roam_profile->fils_con_info->is_fils_connection; |
Min Liu | ab6ed4f | 2018-01-09 13:13:57 +0800 | [diff] [blame] | 5114 | |
| 5115 | return false; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5116 | } |
| 5117 | #else |
gaurank kathpalia | 82a1b2b | 2018-07-10 16:49:10 +0530 | [diff] [blame] | 5118 | bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5119 | { |
| 5120 | return false; |
| 5121 | } |
| 5122 | #endif |
| 5123 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5124 | /** |
| 5125 | * hdd_process_genie() - process gen ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5126 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5127 | * @bssid: pointer to mac address |
| 5128 | * @pEncryptType: pointer to encryption type |
| 5129 | * @mcEncryptType: pointer to multicast encryption type |
| 5130 | * @pAuthType: pointer to auth type |
| 5131 | * |
| 5132 | * Return: 0 on success, error number otherwise |
| 5133 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5134 | static int32_t hdd_process_genie(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5135 | u8 *bssid, |
| 5136 | eCsrEncryptionType *pEncryptType, |
| 5137 | eCsrEncryptionType *mcEncryptType, |
| 5138 | eCsrAuthType *pAuthType, |
| 5139 | #ifdef WLAN_FEATURE_11W |
| 5140 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5141 | #endif |
| 5142 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5143 | { |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 5144 | mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5145 | tDot11fIERSN dot11RSNIE = {0}; |
| 5146 | tDot11fIEWPA dot11WPAIE = {0}; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5147 | uint8_t *pRsnIe; |
| 5148 | uint16_t RSNIeLen; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5149 | uint32_t parse_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5150 | |
| 5151 | /* |
| 5152 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5153 | * setting present flag to 0. |
| 5154 | */ |
| 5155 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5156 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5157 | |
| 5158 | /* Type check */ |
| 5159 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5160 | /* Validity checks */ |
| 5161 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5162 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5163 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5164 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5165 | return -EINVAL; |
| 5166 | } |
| 5167 | /* Skip past the EID byte and length byte */ |
| 5168 | pRsnIe = gen_ie + 2; |
| 5169 | RSNIeLen = gen_ie_len - 2; |
| 5170 | /* Unpack the RSN IE */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 5171 | parse_status = sme_unpack_rsn_ie(mac_handle, pRsnIe, RSNIeLen, |
| 5172 | &dot11RSNIE, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5173 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5174 | hdd_err("Invalid RSN IE: parse status %d", |
| 5175 | parse_status); |
| 5176 | return -EINVAL; |
| 5177 | } |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5178 | hdd_debug("gp_cipher_suite_present: %d", |
| 5179 | dot11RSNIE.gp_cipher_suite_present); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5180 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5181 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5182 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5183 | hdd_debug("authentication suite count: %d", |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5184 | dot11RSNIE.akm_suite_cnt); |
| 5185 | /* dot11RSNIE.akm_suite_cnt */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5186 | /* Just translate the FIRST one */ |
| 5187 | *pAuthType = |
| 5188 | hdd_translate_rsn_to_csr_auth_type( |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5189 | dot11RSNIE.akm_suite[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5190 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5191 | *pEncryptType = |
| 5192 | hdd_translate_rsn_to_csr_encryption_type( |
| 5193 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5194 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5195 | *mcEncryptType = |
| 5196 | hdd_translate_rsn_to_csr_encryption_type( |
| 5197 | dot11RSNIE.gp_cipher_suite); |
| 5198 | #ifdef WLAN_FEATURE_11W |
| 5199 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 5200 | *pMfpCapable = csr_is_mfpc_capable(&dot11RSNIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5201 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5202 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5203 | /* Validity checks */ |
| 5204 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5205 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5206 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5207 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5208 | return -EINVAL; |
| 5209 | } |
| 5210 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5211 | pRsnIe = gen_ie + 2 + 4; |
| 5212 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5213 | /* Unpack the WPA IE */ |
Jeff Johnson | f7187f2 | 2018-06-13 22:02:19 -0700 | [diff] [blame] | 5214 | parse_status = dot11f_unpack_ie_wpa((tpAniSirGlobal)mac_handle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5215 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5216 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5217 | hdd_err("Invalid WPA IE: parse status %d", |
| 5218 | parse_status); |
| 5219 | return -EINVAL; |
| 5220 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5221 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5222 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5223 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5224 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5225 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5226 | /* dot11WPAIE.auth_suite_count */ |
| 5227 | /* Just translate the FIRST one */ |
| 5228 | *pAuthType = |
| 5229 | hdd_translate_wpa_to_csr_auth_type( |
| 5230 | dot11WPAIE.auth_suites[0]); |
| 5231 | /* dot11WPAIE.unicast_cipher_count */ |
| 5232 | *pEncryptType = |
| 5233 | hdd_translate_wpa_to_csr_encryption_type( |
| 5234 | dot11WPAIE.unicast_ciphers[0]); |
| 5235 | /* dot11WPAIE.unicast_cipher_count */ |
| 5236 | *mcEncryptType = |
| 5237 | hdd_translate_wpa_to_csr_encryption_type( |
| 5238 | dot11WPAIE.multicast_cipher); |
| 5239 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5240 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5241 | return -EINVAL; |
| 5242 | } |
| 5243 | return 0; |
| 5244 | } |
| 5245 | |
| 5246 | /** |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5247 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 5248 | * in profile. |
| 5249 | * @roam_profile: pointer to adapter |
| 5250 | * @auth_type: pointer to auth type |
| 5251 | * |
| 5252 | * Set default value of encryption type and auth type in profile to |
| 5253 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 5254 | * currupt and we might not get the proper encryption type and auth type |
| 5255 | * while parsing the RSNIE. |
| 5256 | * |
| 5257 | * Return: void |
| 5258 | */ |
| 5259 | static void hdd_set_def_rsne_override( |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5260 | struct csr_roam_profile *roam_profile, eCsrAuthType *auth_type) |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5261 | { |
| 5262 | |
| 5263 | hdd_debug("Set def values in roam profile"); |
| 5264 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 5265 | roam_profile->EncryptionType.numEntries = 2; |
| 5266 | roam_profile->mcEncryptionType.numEntries = 2; |
| 5267 | /* Use the cipher type in the RSN IE */ |
| 5268 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 5269 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 5270 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 5271 | eCSR_ENCRYPT_TYPE_AES; |
| 5272 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 5273 | eCSR_ENCRYPT_TYPE_TKIP; |
| 5274 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 5275 | } |
| 5276 | |
| 5277 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5278 | * hdd_set_genie_to_csr() - set genie to csr |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5279 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5280 | * @RSNAuthType: pointer to auth type |
| 5281 | * |
| 5282 | * Return: 0 on success, error number otherwise |
| 5283 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5284 | int hdd_set_genie_to_csr(struct hdd_adapter *adapter, |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5285 | eCsrAuthType *RSNAuthType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5286 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5287 | struct csr_roam_profile *roam_profile; |
| 5288 | uint8_t *security_ie; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5289 | uint32_t status = 0; |
| 5290 | eCsrEncryptionType RSNEncryptType; |
| 5291 | eCsrEncryptionType mcRSNEncryptType; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5292 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5293 | #ifdef WLAN_FEATURE_11W |
| 5294 | uint8_t RSNMfpRequired = 0; |
| 5295 | uint8_t RSNMfpCapable = 0; |
| 5296 | #endif |
| 5297 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5298 | |
| 5299 | roam_profile = hdd_roam_profile(adapter); |
| 5300 | security_ie = hdd_security_ie(adapter); |
| 5301 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5302 | /* MAC address of assoc peer */ |
| 5303 | /* But, this routine is only called when we are NOT associated. */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5304 | qdf_mem_copy(bssid, roam_profile->BSSIDs.bssid, sizeof(bssid)); |
| 5305 | if (security_ie[0] == DOT11F_EID_RSN || |
| 5306 | security_ie[0] == DOT11F_EID_WPA) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5307 | /* continue */ |
| 5308 | } else { |
| 5309 | return 0; |
| 5310 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5311 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5312 | /* The actual processing may eventually be more extensive than this. */ |
| 5313 | /* 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] | 5314 | status = hdd_process_genie(adapter, bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5315 | &RSNEncryptType, |
| 5316 | &mcRSNEncryptType, RSNAuthType, |
| 5317 | #ifdef WLAN_FEATURE_11W |
| 5318 | &RSNMfpRequired, &RSNMfpCapable, |
| 5319 | #endif |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5320 | security_ie[1] + 2, |
| 5321 | security_ie); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5322 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5323 | if (status == 0) { |
| 5324 | /* |
| 5325 | * Now copy over all the security attributes |
| 5326 | * you have parsed out. |
| 5327 | */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5328 | roam_profile->EncryptionType.numEntries = 1; |
| 5329 | roam_profile->mcEncryptionType.numEntries = 1; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5330 | |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 5331 | /* Use the cipher type in the RSN IE */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5332 | roam_profile->EncryptionType.encryptionType[0] = |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 5333 | RSNEncryptType; |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5334 | roam_profile->mcEncryptionType.encryptionType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5335 | mcRSNEncryptType; |
| 5336 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5337 | if ((QDF_IBSS_MODE == adapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5338 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5339 | (eCSR_ENCRYPT_TYPE_AES_GCMP == mcRSNEncryptType) || |
| 5340 | (eCSR_ENCRYPT_TYPE_AES_GCMP_256 == mcRSNEncryptType) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5341 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5342 | /* |
| 5343 | * For wpa none supplicant sends the WPA IE with unicast |
| 5344 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5345 | * multicast cipher as either AES/TKIP based on group |
| 5346 | * cipher configuration mentioned in the |
| 5347 | * wpa_supplicant.conf. |
| 5348 | */ |
| 5349 | |
| 5350 | /* Set the unicast cipher same as multicast cipher */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5351 | roam_profile->EncryptionType.encryptionType[0] |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5352 | = mcRSNEncryptType; |
| 5353 | } |
| 5354 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5355 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5356 | RSNMfpRequired, RSNMfpCapable); |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5357 | roam_profile->MFPRequired = RSNMfpRequired; |
| 5358 | roam_profile->MFPCapable = RSNMfpCapable; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5359 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5360 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5361 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5362 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5363 | |
| 5364 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5365 | if (hdd_ctx->force_rsne_override && |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5366 | (security_ie[0] == DOT11F_EID_RSN)) { |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5367 | hdd_warn("Test mode enabled set def Auth and enc type. RSN IE passed in connect req: "); |
| 5368 | qdf_trace_hex_dump(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5369 | roam_profile->pRSNReqIE, |
| 5370 | roam_profile->nRSNReqIELength); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5371 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5372 | roam_profile->force_rsne_override = true; |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5373 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5374 | hdd_debug("MFPEnabled %d", roam_profile->MFPEnabled); |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5375 | /* |
Jeff Johnson | 33142e6 | 2018-05-06 17:58:36 -0700 | [diff] [blame] | 5376 | * Reset MFPEnabled if testmode RSNE passed doesn't have MFPR |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5377 | * or MFPC bit set |
| 5378 | */ |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5379 | if (roam_profile->MFPEnabled && |
| 5380 | !(roam_profile->MFPRequired || |
| 5381 | roam_profile->MFPCapable)) { |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5382 | hdd_debug("Reset MFPEnabled"); |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5383 | roam_profile->MFPEnabled = 0; |
Abhishek Singh | 6378103 | 2018-02-23 14:59:22 +0530 | [diff] [blame] | 5384 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5385 | /* If parsing failed set the def value for the roam profile */ |
| 5386 | if (status) |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5387 | hdd_set_def_rsne_override(roam_profile, RSNAuthType); |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5388 | return 0; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5389 | } |
Abhishek Singh | 3f13a81 | 2018-01-16 14:24:44 +0530 | [diff] [blame] | 5390 | return status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5391 | } |
| 5392 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5393 | #ifdef WLAN_FEATURE_FILS_SK |
| 5394 | /** |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5395 | * hdd_check_fils_rsn_n_set_auth_type() - This API checks whether a give |
| 5396 | * auth type is fils if yes, sets it in profile. |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5397 | * @rsn_auth_type: auth type |
| 5398 | * |
| 5399 | * Return: true if FILS auth else false |
| 5400 | */ |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5401 | static |
| 5402 | bool hdd_check_fils_rsn_n_set_auth_type(struct csr_roam_profile *roam_profile, |
| 5403 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5404 | { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5405 | bool is_fils_rsn = false; |
| 5406 | |
| 5407 | if (!roam_profile->fils_con_info) |
| 5408 | return false; |
| 5409 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5410 | if ((rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA256) || |
| 5411 | (rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA384) || |
| 5412 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA256) || |
| 5413 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA384)) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5414 | is_fils_rsn = true; |
| 5415 | if (is_fils_rsn) |
| 5416 | roam_profile->fils_con_info->akm_type = rsn_auth_type; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5417 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5418 | return is_fils_rsn; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5419 | } |
| 5420 | #else |
Jeff Johnson | 61b5e98 | 2018-03-15 11:33:31 -0700 | [diff] [blame] | 5421 | static |
| 5422 | bool hdd_check_fils_rsn_n_set_auth_type(struct csr_roam_profile *roam_profile, |
| 5423 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5424 | { |
| 5425 | return false; |
| 5426 | } |
| 5427 | #endif |
| 5428 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5429 | /** |
| 5430 | * hdd_set_csr_auth_type() - set csr auth type |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5431 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5432 | * @RSNAuthType: auth type |
| 5433 | * |
| 5434 | * Return: 0 on success, error number otherwise |
| 5435 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5436 | int hdd_set_csr_auth_type(struct hdd_adapter *adapter, |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5437 | eCsrAuthType RSNAuthType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5438 | { |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5439 | struct csr_roam_profile *roam_profile; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5440 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5441 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5442 | enum hdd_auth_key_mgmt key_mgmt = sta_ctx->auth_key_mgmt; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5443 | |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5444 | roam_profile = hdd_roam_profile(adapter); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5445 | roam_profile->AuthType.numEntries = 1; |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5446 | hdd_debug("authType = %d RSNAuthType %d wpa_versions %d", |
| 5447 | sta_ctx->conn_info.authType, RSNAuthType, |
| 5448 | sta_ctx->wpa_versions); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5449 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5450 | switch (sta_ctx->conn_info.authType) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5451 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5452 | #ifdef FEATURE_WLAN_ESE |
| 5453 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5454 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5455 | #endif |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5456 | if (!sta_ctx->wpa_versions) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5457 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5458 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5459 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5460 | } else if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_1) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5461 | |
| 5462 | #ifdef FEATURE_WLAN_ESE |
| 5463 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5464 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5465 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5466 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5467 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5468 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5469 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5470 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5471 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5472 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5473 | } else |
| 5474 | #endif |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5475 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5476 | == HDD_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5477 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5478 | eCSR_AUTH_TYPE_WPA; |
| 5479 | } else |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5480 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5481 | == HDD_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5482 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5483 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5484 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5485 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5486 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5487 | } |
| 5488 | } |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5489 | if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_2) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5490 | #ifdef FEATURE_WLAN_ESE |
| 5491 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5492 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5493 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5494 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5495 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5496 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5497 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5498 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5499 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5500 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5501 | } else |
| 5502 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 5503 | if (RSNAuthType == eCSR_AUTH_TYPE_DPP_RSN) { |
| 5504 | roam_profile->AuthType.authType[0] = |
| 5505 | eCSR_AUTH_TYPE_DPP_RSN; |
| 5506 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5507 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5508 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5509 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5510 | eCSR_AUTH_TYPE_FT_RSN; |
| 5511 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5512 | && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5513 | ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5514 | == HDD_AUTH_KEY_MGMT_PSK)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5515 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5516 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5517 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5518 | |
| 5519 | #ifdef WLAN_FEATURE_11W |
| 5520 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5521 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5522 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5523 | } else if (RSNAuthType == |
| 5524 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5525 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5526 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5527 | } else |
| 5528 | #endif |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5529 | if (hdd_check_fils_rsn_n_set_auth_type(roam_profile, |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5530 | RSNAuthType)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5531 | roam_profile->AuthType.authType[0] = |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5532 | RSNAuthType; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 5533 | hdd_debug("updated profile authtype as %d", |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5534 | RSNAuthType); |
| 5535 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5536 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_OWE) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5537 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5538 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5539 | /* OWE case */ |
| 5540 | roam_profile->AuthType.authType[0] = |
| 5541 | eCSR_AUTH_TYPE_OWE; |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5542 | } else if ((RSNAuthType == |
| 5543 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5544 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5545 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5546 | /* Suite B EAP SHA 256 */ |
| 5547 | roam_profile->AuthType.authType[0] = |
| 5548 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
| 5549 | } else if ((RSNAuthType == |
| 5550 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384) && |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5551 | ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5552 | == HDD_AUTH_KEY_MGMT_802_1X)) { |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5553 | /* Suite B EAP SHA 384 */ |
| 5554 | roam_profile->AuthType.authType[0] = |
| 5555 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5556 | } else if ((key_mgmt & HDD_AUTH_KEY_MGMT_802_1X) |
| 5557 | == HDD_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5558 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5559 | eCSR_AUTH_TYPE_RSN; |
| 5560 | } else |
Jeff Johnson | 37ecea4 | 2018-03-18 17:54:40 -0700 | [diff] [blame] | 5561 | if ((key_mgmt & HDD_AUTH_KEY_MGMT_PSK) |
| 5562 | == HDD_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5563 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5564 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5565 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5566 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5567 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5568 | } |
| 5569 | } |
| 5570 | break; |
| 5571 | |
| 5572 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5573 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5574 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5575 | break; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5576 | |
| 5577 | case eCSR_AUTH_TYPE_SAE: |
| 5578 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5579 | break; |
| 5580 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5581 | default: |
| 5582 | |
| 5583 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5584 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5585 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5586 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5587 | break; |
| 5588 | } |
| 5589 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5590 | hdd_debug("Set roam Authtype to %d", |
Jeff Johnson | 844eec7 | 2018-03-13 11:48:18 -0700 | [diff] [blame] | 5591 | roam_profile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5592 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5593 | return 0; |
| 5594 | } |
Jeff Johnson | 7f2c591 | 2018-03-23 11:42:28 -0700 | [diff] [blame] | 5595 | |
| 5596 | #ifdef WLAN_FEATURE_FILS_SK |
| 5597 | static void hdd_initialize_fils_info(struct hdd_adapter *adapter) |
| 5598 | { |
| 5599 | struct csr_roam_profile *roam_profile; |
| 5600 | |
| 5601 | roam_profile = hdd_roam_profile(adapter); |
| 5602 | roam_profile->fils_con_info = NULL; |
| 5603 | roam_profile->hlp_ie = NULL; |
| 5604 | roam_profile->hlp_ie_len = 0; |
| 5605 | } |
| 5606 | #else |
| 5607 | static void hdd_initialize_fils_info(struct hdd_adapter *adapter) |
| 5608 | { } |
| 5609 | #endif |
| 5610 | |
| 5611 | void hdd_roam_profile_init(struct hdd_adapter *adapter) |
| 5612 | { |
| 5613 | struct csr_roam_profile *roam_profile; |
| 5614 | uint8_t *security_ie; |
| 5615 | tSirAddie *assoc_additional_ie; |
| 5616 | struct hdd_station_ctx *sta_ctx; |
| 5617 | |
| 5618 | hdd_enter(); |
| 5619 | |
| 5620 | roam_profile = hdd_roam_profile(adapter); |
| 5621 | qdf_mem_zero(roam_profile, sizeof(*roam_profile)); |
| 5622 | |
| 5623 | security_ie = hdd_security_ie(adapter); |
| 5624 | qdf_mem_zero(security_ie, MAX_WPA_RSN_IE_LEN); |
| 5625 | |
| 5626 | assoc_additional_ie = hdd_assoc_additional_ie(adapter); |
| 5627 | qdf_mem_zero(assoc_additional_ie, sizeof(*assoc_additional_ie)); |
| 5628 | |
| 5629 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 5630 | |
| 5631 | /* Configure the roaming profile links to SSID and bssid. */ |
| 5632 | roam_profile->SSIDs.numOfSSIDs = 0; |
| 5633 | roam_profile->SSIDs.SSIDList = &sta_ctx->conn_info.SSID; |
| 5634 | |
| 5635 | roam_profile->BSSIDs.numOfBSSIDs = 0; |
| 5636 | roam_profile->BSSIDs.bssid = &sta_ctx->conn_info.bssId; |
| 5637 | |
| 5638 | /* Set the numOfChannels to zero to scan all the channels */ |
| 5639 | roam_profile->ChannelInfo.numOfChannels = 0; |
| 5640 | roam_profile->ChannelInfo.ChannelList = NULL; |
| 5641 | |
| 5642 | roam_profile->BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 5643 | |
| 5644 | roam_profile->phyMode = eCSR_DOT11_MODE_AUTO; |
| 5645 | sta_ctx->wpa_versions = 0; |
| 5646 | |
| 5647 | /* Set the default scan mode */ |
| 5648 | adapter->scan_info.scan_mode = eSIR_ACTIVE_SCAN; |
| 5649 | |
| 5650 | hdd_clear_roam_profile_ie(adapter); |
| 5651 | |
| 5652 | hdd_initialize_fils_info(adapter); |
| 5653 | |
| 5654 | hdd_exit(); |
| 5655 | } |