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 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /** |
| 29 | * DOC: wlan_hdd_assoc.c |
| 30 | * |
| 31 | * WLAN Host Device Driver implementation |
| 32 | * |
| 33 | */ |
| 34 | |
| 35 | #include "wlan_hdd_includes.h" |
| 36 | #include <ani_global.h> |
| 37 | #include "dot11f.h" |
| 38 | #include "wlan_hdd_power.h" |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 39 | #include "wlan_hdd_trace.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 40 | #include <linux/ieee80211.h> |
| 41 | #include <linux/wireless.h> |
| 42 | #include <linux/etherdevice.h> |
| 43 | #include <net/cfg80211.h> |
| 44 | #include "wlan_hdd_cfg80211.h" |
| 45 | #include "csr_inside_api.h" |
| 46 | #include "wlan_hdd_p2p.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 47 | #include "wlan_hdd_tdls.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 48 | #include "sme_api.h" |
| 49 | #include "wlan_hdd_hostapd.h" |
| 50 | #include <wlan_hdd_ipa.h> |
Jeff Johnson | 2b0a7b8 | 2016-05-18 15:08:02 -0700 | [diff] [blame] | 51 | #include "wlan_hdd_lpass.h" |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 52 | #include <wlan_logging_sock_svc.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | #include <cds_sched.h> |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 54 | #include "wlan_policy_mgr_api.h" |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 55 | #include <cds_utils.h> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 56 | #include "sme_power_save_api.h" |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 57 | #include "wlan_hdd_napi.h" |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 58 | #include <cdp_txrx_cmn.h> |
| 59 | #include <cdp_txrx_flow_ctrl_legacy.h> |
| 60 | #include <cdp_txrx_peer_ops.h> |
| 61 | #include <cdp_txrx_misc.h> |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 62 | #include <cdp_txrx_ctrl.h> |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 63 | #include <wlan_logging_sock_svc.h> |
Rajeev Kumar | 59e011b | 2017-01-13 11:42:20 -0800 | [diff] [blame] | 64 | #include <wlan_hdd_object_manager.h> |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 65 | #include <cdp_txrx_handle.h> |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 66 | #include "wlan_pmo_ucfg_api.h" |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 67 | #include "wlan_hdd_tsf.h" |
Naveen Rawat | 08db88f | 2017-09-08 15:07:48 -0700 | [diff] [blame] | 68 | #include "wlan_utility.h" |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 69 | #include "wlan_p2p_ucfg_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 70 | |
| 71 | /* These are needed to recognize WPA and RSN suite types */ |
| 72 | #define HDD_WPA_OUI_SIZE 4 |
| 73 | #define HDD_RSN_OUI_SIZE 4 |
| 74 | uint8_t ccp_wpa_oui00[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 75 | uint8_t ccp_wpa_oui01[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 76 | uint8_t ccp_wpa_oui02[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 77 | uint8_t ccp_wpa_oui03[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 78 | uint8_t ccp_wpa_oui04[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 79 | uint8_t ccp_wpa_oui05[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 80 | |
| 81 | #ifdef FEATURE_WLAN_ESE |
| 82 | /* CCKM */ |
| 83 | uint8_t ccp_wpa_oui06[HDD_WPA_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 84 | /* CCKM */ |
| 85 | uint8_t ccp_rsn_oui06[HDD_RSN_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 86 | #endif /* FEATURE_WLAN_ESE */ |
| 87 | |
| 88 | /* group cipher */ |
| 89 | uint8_t ccp_rsn_oui00[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x00 }; |
| 90 | |
| 91 | /* WEP-40 or RSN */ |
| 92 | uint8_t ccp_rsn_oui01[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x01 }; |
| 93 | |
| 94 | /* TKIP or RSN-PSK */ |
| 95 | uint8_t ccp_rsn_oui02[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x02 }; |
| 96 | |
| 97 | /* Reserved */ |
| 98 | uint8_t ccp_rsn_oui03[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x03 }; |
| 99 | |
| 100 | /* AES-CCMP */ |
| 101 | uint8_t ccp_rsn_oui04[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x04 }; |
| 102 | |
| 103 | /* WEP-104 */ |
| 104 | uint8_t ccp_rsn_oui05[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 105 | |
| 106 | #ifdef WLAN_FEATURE_11W |
| 107 | /* RSN-PSK-SHA256 */ |
| 108 | uint8_t ccp_rsn_oui07[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x06 }; |
| 109 | |
| 110 | /* RSN-8021X-SHA256 */ |
| 111 | uint8_t ccp_rsn_oui08[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 112 | #endif |
| 113 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 114 | /* AES-GCMP-128 */ |
| 115 | uint8_t ccp_rsn_oui09[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x08 }; |
| 116 | |
| 117 | /* AES-GCMP-256 */ |
| 118 | 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] | 119 | #ifdef WLAN_FEATURE_FILS_SK |
| 120 | uint8_t ccp_rsn_oui_0e[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0E}; |
| 121 | uint8_t ccp_rsn_oui_0f[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0F}; |
| 122 | uint8_t ccp_rsn_oui_10[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x10}; |
| 123 | uint8_t ccp_rsn_oui_11[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x11}; |
| 124 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 125 | 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] | 126 | uint8_t ccp_rsn_oui_0b[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0B}; |
| 127 | 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] | 128 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 129 | /* OWE https://tools.ietf.org/html/rfc8110 */ |
| 130 | uint8_t ccp_rsn_oui_18[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x12}; |
| 131 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 132 | #ifdef WLAN_FEATURE_SAE |
| 133 | uint8_t ccp_rsn_oui_80[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x08}; |
| 134 | uint8_t ccp_rsn_oui_90[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x09}; |
| 135 | #endif |
| 136 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 137 | /* Offset where the EID-Len-IE, start. */ |
| 138 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 139 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 140 | |
| 141 | #define BEACON_FRAME_IES_OFFSET 12 |
| 142 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 143 | |
| 144 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 145 | * beacon_filter_table - table of IEs used for beacon filtering |
| 146 | */ |
| 147 | static const int beacon_filter_table[] = { |
| 148 | SIR_MAC_DS_PARAM_SET_EID, |
| 149 | SIR_MAC_ERP_INFO_EID, |
| 150 | SIR_MAC_EDCA_PARAM_SET_EID, |
| 151 | SIR_MAC_QOS_CAPABILITY_EID, |
| 152 | SIR_MAC_HT_INFO_EID, |
| 153 | SIR_MAC_VHT_OPMODE_EID, |
| 154 | SIR_MAC_VHT_OPERATION_EID, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 155 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 156 | /* |
| 157 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 158 | * bss-color-change IE till it gets any fixed number. This |
| 159 | * vendor EID needs to be replaced with bss-color-change IE |
| 160 | * number. |
| 161 | */ |
| 162 | SIR_MAC_EID_VENDOR, |
| 163 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 164 | }; |
| 165 | |
| 166 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 167 | * hdd_conn_set_authenticated() - set authentication state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 168 | * @adapter: pointer to the adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 169 | * @authState: authentication state |
| 170 | * |
| 171 | * This function updates the global HDD station context |
| 172 | * authentication state. |
| 173 | * |
| 174 | * Return: none |
| 175 | */ |
| 176 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 177 | hdd_conn_set_authenticated(struct hdd_adapter *adapter, uint8_t authState) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 178 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 179 | 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] | 180 | |
| 181 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 182 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 183 | sta_ctx->conn_info.uIsAuthenticated, authState); |
| 184 | sta_ctx->conn_info.uIsAuthenticated = authState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | /** |
| 188 | * hdd_conn_set_connection_state() - set connection state |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 189 | * @adapter: pointer to the adapter |
| 190 | * @conn_state: connection state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 191 | * |
| 192 | * This function updates the global HDD station context connection state. |
| 193 | * |
| 194 | * Return: none |
| 195 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 196 | void hdd_conn_set_connection_state(struct hdd_adapter *adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 197 | eConnectionState conn_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 198 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 199 | struct hdd_station_ctx *hdd_sta_ctx = |
| 200 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 201 | |
| 202 | /* save the new connection state */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 203 | hdd_debug("%pS Changed conn state from old:%d to new:%d for dev %s", |
| 204 | (void *)_RET_IP_, hdd_sta_ctx->conn_info.connState, |
| 205 | conn_state, adapter->dev->name); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 206 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 207 | hdd_tsf_notify_wlan_state_change(adapter, |
| 208 | hdd_sta_ctx->conn_info.connState, |
| 209 | conn_state); |
| 210 | hdd_sta_ctx->conn_info.connState = conn_state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | /** |
| 214 | * hdd_conn_get_connection_state() - get connection state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 215 | * @adapter: pointer to the adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 216 | * @pConnState: pointer to connection state |
| 217 | * |
| 218 | * This function updates the global HDD station context connection state. |
| 219 | * |
| 220 | * Return: true if (Infra Associated or IBSS Connected) |
| 221 | * and sets output parameter pConnState; |
| 222 | * false otherwise |
| 223 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 224 | static inline bool |
| 225 | hdd_conn_get_connection_state(struct hdd_station_ctx *sta_ctx, |
| 226 | eConnectionState *pConnState) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 227 | { |
| 228 | bool fConnected = false; |
| 229 | eConnectionState connState; |
| 230 | |
| 231 | /* get the connection state. */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 232 | connState = sta_ctx->conn_info.connState; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 233 | |
| 234 | if (eConnectionState_Associated == connState || |
| 235 | eConnectionState_IbssConnected == connState || |
| 236 | eConnectionState_IbssDisconnected == connState) { |
| 237 | fConnected = true; |
| 238 | } |
| 239 | |
| 240 | if (pConnState) |
| 241 | *pConnState = connState; |
| 242 | |
| 243 | return fConnected; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * hdd_is_connecting() - Function to check connection progress |
| 248 | * @hdd_sta_ctx: pointer to global HDD Station context |
| 249 | * |
| 250 | * Return: true if connecting, false otherwise |
| 251 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 252 | bool hdd_is_connecting(struct hdd_station_ctx *hdd_sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 253 | { |
| 254 | return hdd_sta_ctx->conn_info.connState == |
| 255 | eConnectionState_Connecting; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * hdd_conn_is_connected() - Function to check connection status |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 260 | * @sta_ctx: pointer to global HDD Station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 261 | * |
| 262 | * Return: false if any errors encountered, true otherwise |
| 263 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 264 | bool hdd_conn_is_connected(struct hdd_station_ctx *sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 265 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 266 | return hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | /** |
| 270 | * hdd_conn_get_connected_band() - get current connection radio band |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 271 | * @sta_ctx: pointer to global HDD Station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 272 | * |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 273 | * Return: BAND_2G or BAND_5G based on current AP connection |
| 274 | * BAND_ALL if not connected |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 275 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 276 | 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] | 277 | { |
| 278 | uint8_t staChannel = 0; |
| 279 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 280 | if (eConnectionState_Associated == sta_ctx->conn_info.connState) |
| 281 | staChannel = sta_ctx->conn_info.operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 282 | |
| 283 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 284 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 285 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 286 | return BAND_5G; |
Varun Reddy Yeturu | a48bc41 | 2017-11-17 15:33:35 -0800 | [diff] [blame] | 287 | else /* If station is not connected return as BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 288 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | /** |
| 292 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 293 | * @sta_ctx: pointer to global HDD Station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 294 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 295 | * |
| 296 | * Return: false if any errors encountered, true otherwise |
| 297 | */ |
| 298 | static inline bool |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 299 | hdd_conn_get_connected_cipher_algo(struct hdd_station_ctx *sta_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 300 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 301 | { |
| 302 | bool fConnected = false; |
| 303 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 304 | fConnected = hdd_conn_get_connection_state(sta_ctx, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 305 | |
| 306 | if (pConnectedCipherAlgo) |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 307 | *pConnectedCipherAlgo = sta_ctx->conn_info.ucEncryptionType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 308 | |
| 309 | return fConnected; |
| 310 | } |
| 311 | |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 312 | struct hdd_adapter *hdd_get_sta_connection_in_progress( |
| 313 | struct hdd_context *hdd_ctx) |
| 314 | { |
| 315 | struct hdd_adapter *adapter = NULL; |
| 316 | struct hdd_station_ctx *hdd_sta_ctx; |
| 317 | |
| 318 | if (!hdd_ctx) { |
| 319 | hdd_err("HDD context is NULL"); |
| 320 | return NULL; |
| 321 | } |
| 322 | |
| 323 | hdd_for_each_adapter(hdd_ctx, adapter) { |
| 324 | hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 325 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 326 | (QDF_P2P_CLIENT_MODE == adapter->device_mode) || |
| 327 | (QDF_P2P_DEVICE_MODE == adapter->device_mode)) { |
| 328 | if (eConnectionState_Connecting == |
| 329 | hdd_sta_ctx->conn_info.connState) { |
| 330 | hdd_debug("session_id %d: Connection is in progress", |
| 331 | adapter->session_id); |
| 332 | return adapter; |
| 333 | } else if ((eConnectionState_Associated == |
| 334 | hdd_sta_ctx->conn_info.connState) && |
Vignesh Viswanathan | 0a56929 | 2018-02-14 15:34:47 +0530 | [diff] [blame] | 335 | sme_is_sta_key_exchange_in_progress( |
| 336 | hdd_ctx->hHal, adapter->session_id)) { |
Himanshu Agarwal | 6c3607a | 2018-01-12 12:04:19 +0530 | [diff] [blame] | 337 | hdd_debug("session_id %d: Key exchange is in progress", |
| 338 | adapter->session_id); |
| 339 | return adapter; |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | return NULL; |
| 344 | } |
| 345 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 346 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 347 | * hdd_remove_beacon_filter() - remove beacon filter |
| 348 | * @adapter: Pointer to the hdd adapter |
| 349 | * |
| 350 | * Return: 0 on success and errno on failure |
| 351 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 352 | static int hdd_remove_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 353 | { |
| 354 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 355 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 356 | |
| 357 | status = sme_remove_beacon_filter(hdd_ctx->hHal, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 358 | adapter->session_id); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 359 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 360 | hdd_err("sme_remove_beacon_filter() failed"); |
| 361 | return -EFAULT; |
| 362 | } |
| 363 | |
| 364 | return 0; |
| 365 | } |
| 366 | |
| 367 | /** |
| 368 | * hdd_add_beacon_filter() - add beacon filter |
| 369 | * @adapter: Pointer to the hdd adapter |
| 370 | * |
| 371 | * Return: 0 on success and errno on failure |
| 372 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 373 | static int hdd_add_beacon_filter(struct hdd_adapter *adapter) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 374 | { |
| 375 | int i; |
| 376 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 377 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 378 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 379 | |
| 380 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 381 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 382 | (unsigned long int *)ie_map); |
| 383 | |
| 384 | status = sme_add_beacon_filter(hdd_ctx->hHal, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 385 | adapter->session_id, ie_map); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 386 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 387 | hdd_err("sme_add_beacon_filter() failed"); |
| 388 | return -EFAULT; |
| 389 | } |
| 390 | return 0; |
| 391 | } |
| 392 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 393 | void hdd_copy_ht_caps(struct ieee80211_ht_cap *hdd_ht_cap, |
| 394 | tDot11fIEHTCaps *roam_ht_cap) |
| 395 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 396 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 397 | uint32_t i, temp_ht_cap; |
| 398 | |
| 399 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 400 | |
| 401 | if (roam_ht_cap->advCodingCap) |
| 402 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 403 | if (roam_ht_cap->supportedChannelWidthSet) |
| 404 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 405 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 406 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 407 | if (temp_ht_cap) |
| 408 | hdd_ht_cap->cap_info |= |
| 409 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 410 | if (roam_ht_cap->greenField) |
| 411 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 412 | if (roam_ht_cap->shortGI20MHz) |
| 413 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 414 | if (roam_ht_cap->shortGI40MHz) |
| 415 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 416 | if (roam_ht_cap->txSTBC) |
| 417 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 418 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 419 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 420 | if (temp_ht_cap) |
| 421 | hdd_ht_cap->cap_info |= |
| 422 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 423 | if (roam_ht_cap->delayedBA) |
| 424 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 425 | if (roam_ht_cap->maximalAMSDUsize) |
| 426 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 427 | if (roam_ht_cap->dsssCckMode40MHz) |
| 428 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 429 | if (roam_ht_cap->psmp) |
| 430 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 431 | if (roam_ht_cap->stbcControlFrame) |
| 432 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 433 | if (roam_ht_cap->lsigTXOPProtection) |
| 434 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 435 | |
| 436 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 437 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 438 | hdd_ht_cap->ampdu_params_info |= |
| 439 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 440 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 441 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 442 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 443 | if (temp_ht_cap) |
| 444 | hdd_ht_cap->ampdu_params_info |= |
| 445 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 446 | |
| 447 | /* 802.11n HT extended capabilities masks */ |
| 448 | if (roam_ht_cap->pco) |
| 449 | hdd_ht_cap->extended_ht_cap_info |= |
| 450 | IEEE80211_HT_EXT_CAP_PCO; |
| 451 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 452 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 453 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 454 | if (temp_ht_cap) |
| 455 | hdd_ht_cap->extended_ht_cap_info |= |
| 456 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 457 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 458 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 459 | if (temp_ht_cap) |
| 460 | hdd_ht_cap->extended_ht_cap_info |= |
| 461 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 462 | |
| 463 | /* tx_bf_cap_info capabilities */ |
| 464 | if (roam_ht_cap->txBF) |
| 465 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 466 | if (roam_ht_cap->rxStaggeredSounding) |
| 467 | hdd_ht_cap->tx_BF_cap_info |= |
| 468 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 469 | if (roam_ht_cap->txStaggeredSounding) |
| 470 | hdd_ht_cap->tx_BF_cap_info |= |
| 471 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 472 | if (roam_ht_cap->rxZLF) |
| 473 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 474 | if (roam_ht_cap->txZLF) |
| 475 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 476 | if (roam_ht_cap->implicitTxBF) |
| 477 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 478 | temp_ht_cap = roam_ht_cap->calibration & |
| 479 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 480 | if (temp_ht_cap) |
| 481 | hdd_ht_cap->tx_BF_cap_info |= |
| 482 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 483 | if (roam_ht_cap->explicitCSITxBF) |
| 484 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 485 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 486 | hdd_ht_cap->tx_BF_cap_info |= |
| 487 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 488 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 489 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 490 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 491 | if (temp_ht_cap) |
| 492 | hdd_ht_cap->tx_BF_cap_info |= |
| 493 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 494 | temp_ht_cap = |
| 495 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 496 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 497 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 498 | if (temp_ht_cap) |
| 499 | hdd_ht_cap->tx_BF_cap_info |= |
| 500 | temp_ht_cap << |
| 501 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 502 | temp_ht_cap = |
| 503 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 504 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 505 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 506 | if (temp_ht_cap) |
| 507 | hdd_ht_cap->tx_BF_cap_info |= |
| 508 | temp_ht_cap << |
| 509 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 510 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 511 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 512 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 513 | if (temp_ht_cap) |
| 514 | hdd_ht_cap->tx_BF_cap_info |= |
| 515 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 516 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 517 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 518 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 519 | if (temp_ht_cap) |
| 520 | hdd_ht_cap->tx_BF_cap_info |= |
| 521 | temp_ht_cap << |
| 522 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 523 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 524 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 525 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 526 | if (temp_ht_cap) |
| 527 | hdd_ht_cap->tx_BF_cap_info |= |
| 528 | temp_ht_cap << |
| 529 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 530 | |
| 531 | /* antenna selection */ |
| 532 | if (roam_ht_cap->antennaSelection) |
| 533 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 534 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 535 | hdd_ht_cap->antenna_selection_info |= |
| 536 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 537 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 538 | hdd_ht_cap->antenna_selection_info |= |
| 539 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 540 | if (roam_ht_cap->explicitCSIFeedback) |
| 541 | hdd_ht_cap->antenna_selection_info |= |
| 542 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 543 | if (roam_ht_cap->antennaIndicesFeedback) |
| 544 | hdd_ht_cap->antenna_selection_info |= |
| 545 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 546 | if (roam_ht_cap->rxAS) |
| 547 | hdd_ht_cap->antenna_selection_info |= |
| 548 | ANTENNA_SEL_INFO_RX_AS; |
| 549 | if (roam_ht_cap->txSoundingPPDUs) |
| 550 | hdd_ht_cap->antenna_selection_info |= |
| 551 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 552 | |
| 553 | /* mcs data rate */ |
| 554 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 555 | hdd_ht_cap->mcs.rx_mask[i] = |
| 556 | roam_ht_cap->supportedMCSSet[i]; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 557 | hdd_ht_cap->mcs.rx_highest = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 558 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 559 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 560 | hdd_ht_cap->mcs.tx_params = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 561 | roam_ht_cap->supportedMCSSet[12]; |
| 562 | } |
| 563 | |
| 564 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 565 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 566 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 567 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 568 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 569 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 570 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 571 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 572 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 573 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 574 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 575 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 576 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 577 | |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 578 | void hdd_copy_vht_caps(struct ieee80211_vht_cap *hdd_vht_cap, |
| 579 | tDot11fIEVHTCaps *roam_vht_cap) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 580 | { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 581 | uint32_t temp_vht_cap; |
| 582 | |
| 583 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 584 | |
| 585 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 586 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 587 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 588 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 589 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 590 | if (temp_vht_cap) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 591 | if (roam_vht_cap->supportedChannelWidthSet & |
| 592 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 593 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 594 | hdd_vht_cap->vht_cap_info |= |
| 595 | temp_vht_cap << |
| 596 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 597 | if (roam_vht_cap->supportedChannelWidthSet & |
| 598 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 599 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 600 | hdd_vht_cap->vht_cap_info |= |
| 601 | temp_vht_cap << |
| 602 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 603 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 604 | if (roam_vht_cap->ldpcCodingCap) |
| 605 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 606 | if (roam_vht_cap->shortGI80MHz) |
| 607 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 608 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 609 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 610 | if (roam_vht_cap->txSTBC) |
| 611 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 612 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 613 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 614 | if (temp_vht_cap) |
| 615 | hdd_vht_cap->vht_cap_info |= |
| 616 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 617 | if (roam_vht_cap->suBeamFormerCap) |
| 618 | hdd_vht_cap->vht_cap_info |= |
| 619 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 620 | if (roam_vht_cap->suBeamformeeCap) |
| 621 | hdd_vht_cap->vht_cap_info |= |
| 622 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 623 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 624 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 625 | if (temp_vht_cap) |
| 626 | hdd_vht_cap->vht_cap_info |= |
| 627 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 628 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 629 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 630 | if (temp_vht_cap) |
| 631 | hdd_vht_cap->vht_cap_info |= |
| 632 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 633 | if (roam_vht_cap->muBeamformerCap) |
| 634 | hdd_vht_cap->vht_cap_info |= |
| 635 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 636 | if (roam_vht_cap->muBeamformeeCap) |
| 637 | hdd_vht_cap->vht_cap_info |= |
| 638 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 639 | if (roam_vht_cap->vhtTXOPPS) |
| 640 | hdd_vht_cap->vht_cap_info |= |
| 641 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 642 | if (roam_vht_cap->htcVHTCap) |
| 643 | hdd_vht_cap->vht_cap_info |= |
| 644 | IEEE80211_VHT_CAP_HTC_VHT; |
| 645 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 646 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 647 | if (temp_vht_cap) |
| 648 | hdd_vht_cap->vht_cap_info |= |
| 649 | temp_vht_cap << |
| 650 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 651 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 652 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 653 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 654 | if (temp_vht_cap) |
| 655 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 656 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 657 | if (roam_vht_cap->rxAntPattern) |
| 658 | hdd_vht_cap->vht_cap_info |= |
| 659 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 660 | if (roam_vht_cap->txAntPattern) |
| 661 | hdd_vht_cap->vht_cap_info |= |
| 662 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 663 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 664 | hdd_vht_cap->supp_mcs.rx_highest = |
| 665 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 666 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 667 | hdd_vht_cap->supp_mcs.tx_highest = |
| 668 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 669 | } |
| 670 | |
| 671 | /* ht param */ |
| 672 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 673 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 674 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 675 | |
| 676 | /* operatinon mode */ |
| 677 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 678 | |
| 679 | /* stbc_param */ |
| 680 | #define HT_STBC_PARAM_MCS 0x007f |
| 681 | |
| 682 | /** |
| 683 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 684 | * hdd station context. |
| 685 | * @hdd_sta_ctx: pointer to hdd station context |
| 686 | * @roam_info: pointer to roam info |
| 687 | * |
| 688 | * Return: None |
| 689 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 690 | 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] | 691 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 692 | { |
| 693 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 694 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 695 | &hdd_sta_ctx->conn_info.ht_operation; |
| 696 | uint32_t i, temp_ht_ops; |
| 697 | |
| 698 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 699 | |
| 700 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 701 | |
| 702 | /* HT_PARAMS */ |
| 703 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 704 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 705 | if (temp_ht_ops) |
| 706 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 707 | else |
| 708 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 709 | if (roam_ht_ops->recommendedTxWidthSet) |
| 710 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 711 | if (roam_ht_ops->rifsMode) |
| 712 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 713 | if (roam_ht_ops->controlledAccessOnly) |
| 714 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 715 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 716 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 717 | if (temp_ht_ops) |
| 718 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 719 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 720 | |
| 721 | /* operation mode */ |
| 722 | temp_ht_ops = roam_ht_ops->opMode & |
| 723 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 724 | switch (temp_ht_ops) { |
| 725 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 726 | hdd_ht_ops->operation_mode |= |
| 727 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 728 | break; |
| 729 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 730 | hdd_ht_ops->operation_mode |= |
| 731 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 732 | break; |
| 733 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 734 | hdd_ht_ops->operation_mode |= |
| 735 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 736 | break; |
| 737 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 738 | default: |
| 739 | hdd_ht_ops->operation_mode |= |
| 740 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 741 | } |
| 742 | if (roam_ht_ops->nonGFDevicesPresent) |
| 743 | hdd_ht_ops->operation_mode |= |
| 744 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 745 | if (roam_ht_ops->transmitBurstLimit) |
| 746 | hdd_ht_ops->operation_mode |= |
| 747 | HT_OP_MODE_TX_BURST_LIMIT; |
| 748 | if (roam_ht_ops->obssNonHTStaPresent) |
| 749 | hdd_ht_ops->operation_mode |= |
| 750 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 751 | |
| 752 | /* stbc_param */ |
| 753 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 754 | HT_STBC_PARAM_MCS; |
| 755 | if (temp_ht_ops) |
| 756 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 757 | if (roam_ht_ops->dualCTSProtection) |
| 758 | hdd_ht_ops->stbc_param |= |
| 759 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 760 | if (roam_ht_ops->secondaryBeacon) |
| 761 | hdd_ht_ops->stbc_param |= |
| 762 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 763 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 764 | hdd_ht_ops->stbc_param |= |
| 765 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 766 | if (roam_ht_ops->pcoActive) |
| 767 | hdd_ht_ops->stbc_param |= |
| 768 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 769 | if (roam_ht_ops->pcoPhase) |
| 770 | hdd_ht_ops->stbc_param |= |
| 771 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 772 | |
| 773 | /* basic MCs set */ |
| 774 | for (i = 0; i < 16; ++i) |
| 775 | hdd_ht_ops->basic_set[i] = |
| 776 | roam_ht_ops->basicMCSSet[i]; |
| 777 | } |
| 778 | |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 779 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) |
| 780 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 781 | tDot11fIEVHTOperation *roam_ops) |
| 782 | { |
| 783 | ieee_ops->center_freq_seg0_idx = roam_ops->chanCenterFreqSeg1; |
| 784 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg2; |
| 785 | } |
| 786 | #else |
| 787 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 788 | tDot11fIEVHTOperation *roam_ops) |
| 789 | { |
| 790 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg1; |
| 791 | ieee_ops->center_freq_seg2_idx = roam_ops->chanCenterFreqSeg2; |
| 792 | } |
| 793 | #endif /* KERNEL_VERSION(4, 12, 0) */ |
| 794 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 795 | /** |
| 796 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 797 | * hdd station context. |
| 798 | * @hdd_sta_ctx: pointer to hdd station context |
| 799 | * @roam_info: pointer to roam info |
| 800 | * |
| 801 | * Return: None |
| 802 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 803 | 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] | 804 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 805 | { |
| 806 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 807 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 808 | &hdd_sta_ctx->conn_info.vht_operation; |
| 809 | |
| 810 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 811 | |
| 812 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 813 | hdd_copy_vht_center_freq(hdd_vht_ops, roam_vht_ops); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 814 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 815 | } |
| 816 | |
| 817 | |
| 818 | /** |
| 819 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 820 | * @adapter: Pointer to adapter |
| 821 | * @roam_info: pointer to roam info |
| 822 | * |
| 823 | * Return: None |
| 824 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 825 | static void hdd_save_bss_info(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 826 | struct csr_roam_info *roam_info) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 827 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 828 | struct hdd_station_ctx *hdd_sta_ctx = |
| 829 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 830 | |
| 831 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 832 | hdd_sta_ctx->conn_info.operationChannel); |
| 833 | if (roam_info->vht_caps.present) { |
| 834 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 835 | hdd_copy_vht_caps(&hdd_sta_ctx->conn_info.vht_caps, |
| 836 | &roam_info->vht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 837 | } else { |
| 838 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 839 | } |
| 840 | if (roam_info->ht_caps.present) { |
| 841 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
Ashish Kumar Dhanotiya | 443d31f | 2017-10-13 12:41:19 +0530 | [diff] [blame] | 842 | hdd_copy_ht_caps(&hdd_sta_ctx->conn_info.ht_caps, |
| 843 | &roam_info->ht_caps); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 844 | } else { |
| 845 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 846 | } |
| 847 | if (roam_info->reassoc) |
| 848 | hdd_sta_ctx->conn_info.roam_count++; |
| 849 | if (roam_info->hs20vendor_ie.present) { |
| 850 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 851 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 852 | &roam_info->hs20vendor_ie, |
| 853 | sizeof(roam_info->hs20vendor_ie)); |
| 854 | } else { |
| 855 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 856 | } |
| 857 | if (roam_info->ht_operation.present) { |
| 858 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 859 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 860 | } else { |
| 861 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 862 | } |
| 863 | if (roam_info->vht_operation.present) { |
| 864 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 865 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 866 | } else { |
| 867 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 868 | } |
| 869 | } |
| 870 | |
| 871 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 872 | * hdd_conn_save_connect_info() - save current connection information |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 873 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 874 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 875 | * @eBssType: bss type |
| 876 | * |
| 877 | * Return: none |
| 878 | */ |
| 879 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 880 | hdd_conn_save_connect_info(struct hdd_adapter *adapter, |
| 881 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 882 | eCsrRoamBssType eBssType) |
| 883 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 884 | 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] | 885 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 886 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 887 | QDF_ASSERT(roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 888 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 889 | if (roam_info) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | /* Save the BSSID for the connection */ |
| 891 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 892 | QDF_ASSERT(roam_info->pBssDesc); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 893 | qdf_copy_macaddr(&sta_ctx->conn_info.bssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 894 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 895 | |
| 896 | /* |
| 897 | * Save the Station ID for this station from |
| 898 | * the 'Roam Info'. For IBSS mode, staId is |
| 899 | * assigned in NEW_PEER_IND. For reassoc, |
| 900 | * the staID doesn't change and it may be invalid |
| 901 | * in this structure so no change here. |
| 902 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 903 | if (!roam_info->fReassocReq) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 904 | sta_ctx->conn_info.staId[0] = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 905 | roam_info->staId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 906 | } |
| 907 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 908 | qdf_copy_macaddr(&sta_ctx->conn_info.bssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 909 | &roam_info->bssid); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 910 | } else { |
| 911 | /* |
| 912 | * can't happen. We need a valid IBSS or Infra setting |
| 913 | * in the BSSDescription or we can't function. |
| 914 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 915 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 916 | } |
| 917 | |
| 918 | /* notify WMM */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 919 | hdd_wmm_connect(adapter, roam_info, eBssType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 920 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 921 | if (!roam_info->u.pConnectedProfile) { |
| 922 | QDF_ASSERT(roam_info->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 923 | } else { |
| 924 | /* Get Multicast Encryption Type */ |
| 925 | encryptType = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 926 | roam_info->u.pConnectedProfile->mcEncryptionType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 927 | sta_ctx->conn_info.mcEncryptionType = encryptType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 928 | /* Get Unicast Encryption Type */ |
| 929 | encryptType = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 930 | roam_info->u.pConnectedProfile->EncryptionType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 931 | sta_ctx->conn_info.ucEncryptionType = encryptType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 932 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 933 | sta_ctx->conn_info.authType = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 934 | roam_info->u.pConnectedProfile->AuthType; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 935 | sta_ctx->conn_info.last_auth_type = |
| 936 | sta_ctx->conn_info.authType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 937 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 938 | sta_ctx->conn_info.operationChannel = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 939 | roam_info->u.pConnectedProfile->operationChannel; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 940 | |
| 941 | /* Save the ssid for the connection */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 942 | qdf_mem_copy(&sta_ctx->conn_info.SSID.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 943 | &roam_info->u.pConnectedProfile->SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 944 | sizeof(tSirMacSSid)); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 945 | qdf_mem_copy(&sta_ctx->conn_info.last_ssid.SSID, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 946 | &roam_info->u.pConnectedProfile->SSID, |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 947 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 948 | |
| 949 | /* Save dot11mode in which STA associated to AP */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 950 | sta_ctx->conn_info.dot11Mode = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 951 | roam_info->u.pConnectedProfile->dot11Mode; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 952 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 953 | sta_ctx->conn_info.proxyARPService = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 954 | roam_info->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 955 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 956 | sta_ctx->conn_info.nss = roam_info->chan_info.nss; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 957 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 958 | sta_ctx->conn_info.rate_flags = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 959 | roam_info->chan_info.rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 960 | } |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 961 | hdd_save_bss_info(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 962 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 963 | } |
| 964 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 965 | /** |
| 966 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 967 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 968 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 969 | * @pCsrRoamInfo: pointer to roam info |
| 970 | * |
| 971 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 972 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 973 | * for the same purpose.) |
| 974 | * |
| 975 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 976 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 977 | * This is the Assoc Response. |
| 978 | * |
| 979 | * Return: none |
| 980 | */ |
| 981 | static void |
| 982 | hdd_send_ft_assoc_response(struct net_device *dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 983 | struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 984 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 985 | { |
| 986 | union iwreq_data wrqu; |
| 987 | char *buff; |
| 988 | unsigned int len = 0; |
| 989 | u8 *pFTAssocRsp = NULL; |
| 990 | |
| 991 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 992 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 993 | return; |
| 994 | } |
| 995 | |
| 996 | pFTAssocRsp = |
| 997 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 998 | pCsrRoamInfo->nAssocReqLength); |
| 999 | if (pFTAssocRsp == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1000 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1001 | return; |
| 1002 | } |
| 1003 | /* pFTAssocRsp needs to point to the IEs */ |
| 1004 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1005 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1006 | (unsigned int)pFTAssocRsp[0], |
| 1007 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1008 | |
| 1009 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1010 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1011 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1012 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1013 | return; |
| 1014 | } |
| 1015 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 1016 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 1017 | wrqu.data.length = len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1018 | memcpy(buff, pFTAssocRsp, len); |
| 1019 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 1020 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1021 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1022 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1023 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1024 | /** |
| 1025 | * hdd_send_ft_event() - send fast transition event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1026 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1027 | * |
| 1028 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 1029 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 1030 | * followed by the auth response IEs to the supplicant. |
| 1031 | * Once both are received in the supplicant, an FT event is generated |
| 1032 | * to the supplicant. |
| 1033 | * |
| 1034 | * Return: none |
| 1035 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1036 | static void hdd_send_ft_event(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1037 | { |
| 1038 | uint16_t auth_resp_len = 0; |
| 1039 | uint32_t ric_ies_length = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1040 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1041 | |
| 1042 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 1043 | struct cfg80211_ft_event_params ftEvent; |
| 1044 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1045 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1046 | struct net_device *dev = adapter->dev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1047 | #else |
| 1048 | char *buff; |
| 1049 | union iwreq_data wrqu; |
| 1050 | uint16_t str_len; |
| 1051 | #endif |
| 1052 | |
| 1053 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1054 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1055 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1056 | |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1057 | sme_get_rici_es(hdd_ctx->hHal, adapter->session_id, (u8 *) ricIe, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1058 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1059 | if (ric_ies_length == 0) |
| 1060 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1061 | |
| 1062 | ftEvent.ric_ies = ricIe; |
| 1063 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1064 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1065 | |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1066 | sme_get_ft_pre_auth_response(hdd_ctx->hHal, adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1067 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1068 | &auth_resp_len); |
| 1069 | |
| 1070 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1071 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1072 | return; |
| 1073 | } |
| 1074 | |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1075 | sme_set_ft_pre_auth_state(hdd_ctx->hHal, adapter->session_id, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1076 | |
| 1077 | ftEvent.target_ap = ftIe; |
| 1078 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1079 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1080 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1081 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1082 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1083 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1084 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1085 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1086 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1087 | ftEvent.target_ap[5]); |
| 1088 | |
| 1089 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1090 | |
| 1091 | #else |
| 1092 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1093 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1094 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1095 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1096 | return; |
| 1097 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1098 | |
| 1099 | /* Sme needs to send the RIC IEs first */ |
| 1100 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1101 | sme_get_rici_es(hdd_ctx->hHal, adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1102 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1103 | &ric_ies_length); |
| 1104 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1105 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1106 | } else { |
| 1107 | wrqu.data.length = str_len + ric_ies_length; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1108 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1109 | } |
| 1110 | |
| 1111 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1112 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1113 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1114 | sme_get_ft_pre_auth_response(hdd_ctx->hHal, adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1115 | (u8 *) &buff[str_len], |
| 1116 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1117 | |
| 1118 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1119 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1120 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1121 | return; |
| 1122 | } |
| 1123 | |
| 1124 | wrqu.data.length = str_len + auth_resp_len; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1125 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1126 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1127 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1128 | #endif |
| 1129 | } |
| 1130 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1131 | #ifdef FEATURE_WLAN_ESE |
| 1132 | /** |
| 1133 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1134 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1135 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1136 | * @pCsrRoamInfo: pointer to roam info |
| 1137 | * |
| 1138 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1139 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1140 | * |
| 1141 | * The current (new AP) channel information is passed in. |
| 1142 | * |
| 1143 | * Return: none |
| 1144 | */ |
| 1145 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1146 | hdd_send_new_ap_channel_info(struct net_device *dev, |
| 1147 | struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1148 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1149 | { |
| 1150 | union iwreq_data wrqu; |
Jeff Johnson | 4ba73cb | 2017-10-06 11:12:33 -0700 | [diff] [blame] | 1151 | struct bss_description *descriptor = pCsrRoamInfo->pBssDesc; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1152 | |
| 1153 | if (descriptor == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1154 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1155 | return; |
| 1156 | } |
| 1157 | /* |
| 1158 | * Send the Channel event, the supplicant needs this to generate |
| 1159 | * the Adjacent AP report. |
| 1160 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1161 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1162 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1163 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1164 | wrqu.freq.m = descriptor->channelId; |
| 1165 | wrqu.freq.e = 0; |
| 1166 | wrqu.freq.i = 0; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1167 | wireless_send_event(adapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1168 | } |
| 1169 | |
| 1170 | #endif /* FEATURE_WLAN_ESE */ |
| 1171 | |
| 1172 | /** |
| 1173 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1174 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1175 | * @pCsrRoamInfo: pointer to roam info |
| 1176 | * |
| 1177 | * Return: none |
| 1178 | */ |
| 1179 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1180 | hdd_send_update_beacon_ies_event(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1181 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1182 | { |
| 1183 | union iwreq_data wrqu; |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1184 | u8 *beacon_ies; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1185 | u8 currentLen = 0; |
| 1186 | char *buff; |
| 1187 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1188 | |
| 1189 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1190 | |
| 1191 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1192 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1193 | return; |
| 1194 | } |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1195 | beacon_ies = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1196 | if (beacon_ies == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1197 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1198 | return; |
| 1199 | } |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1200 | /* beacon_ies needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1201 | hdd_debug("Beacon IEs is now at %02x%02x", |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1202 | (unsigned int)beacon_ies[0], |
| 1203 | (unsigned int)beacon_ies[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1204 | hdd_debug("Beacon IEs length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1205 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1206 | |
| 1207 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1208 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1209 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1210 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1211 | return; |
| 1212 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1213 | |
| 1214 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1215 | currentLen = strLen + 1; |
| 1216 | |
| 1217 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1218 | do { |
| 1219 | /* |
| 1220 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1221 | * into chunks of CUSTOM event max size and send it to |
| 1222 | * supplicant. Changes are done in supplicant to handle this. |
| 1223 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1224 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1225 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1226 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Jeff Johnson | 04e0008 | 2017-10-04 12:15:58 -0700 | [diff] [blame] | 1227 | qdf_mem_copy(&buff[strLen + 1], beacon_ies + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1228 | currentLen); |
| 1229 | currentOffset += currentLen; |
| 1230 | totalIeLen -= currentLen; |
| 1231 | wrqu.data.length = strLen + 1 + currentLen; |
| 1232 | if (totalIeLen) |
| 1233 | buff[strLen] = 1; /* more chunks pending */ |
| 1234 | else |
| 1235 | buff[strLen] = 0; /* last chunk */ |
| 1236 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1237 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1238 | currentLen); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1239 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1240 | } while (totalIeLen > 0); |
| 1241 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1242 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1243 | } |
| 1244 | |
| 1245 | /** |
| 1246 | * hdd_send_association_event() - send association event |
| 1247 | * @dev: pointer to net device |
| 1248 | * @pCsrRoamInfo: pointer to roam info |
| 1249 | * |
| 1250 | * Return: none |
| 1251 | */ |
| 1252 | static void hdd_send_association_event(struct net_device *dev, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1253 | struct csr_roam_info *pCsrRoamInfo) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1254 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1255 | int ret; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1256 | struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1257 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1258 | 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] | 1259 | union iwreq_data wrqu; |
| 1260 | int we_event; |
| 1261 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1262 | struct qdf_mac_addr peerMacAddr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1263 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1264 | /* Added to find the auth type on the fly at run time */ |
| 1265 | /* rather than with cfg to see if FT is enabled */ |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 1266 | struct hdd_wext_state *pWextState = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1267 | WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1268 | tCsrRoamProfile *roam_profile = &(pWextState->roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1269 | |
| 1270 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1271 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1272 | we_event = SIOCGIWAP; |
| 1273 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1274 | if (NULL != pCsrRoamInfo) |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1275 | if (pCsrRoamInfo->roamSynchInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1276 | /* change logging before release */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1277 | hdd_debug("LFR3:hdd_send_association_event"); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1278 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1279 | hdd_notify_sta_disconnect(adapter->session_id, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1280 | true, false, |
| 1281 | adapter->hdd_vdev); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1282 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1283 | #endif |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1284 | if (eConnectionState_Associated == sta_ctx->conn_info.connState) { |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1285 | tSirSmeChanInfo chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1286 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1287 | if (!pCsrRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1288 | hdd_warn("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1289 | return; |
| 1290 | } |
| 1291 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1292 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1293 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1294 | adapter->device_mode, adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1295 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1296 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1297 | |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1298 | ucfg_p2p_status_connect(adapter->hdd_vdev); |
| 1299 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1300 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " |
| 1301 | MAC_ADDRESS_STR "\n", |
Jeff Johnson | 1e851a1 | 2017-10-28 14:36:12 -0700 | [diff] [blame] | 1302 | MAC_ADDR_ARRAY(adapter->mac_addr.bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1303 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1304 | hdd_send_update_beacon_ies_event(adapter, pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1305 | |
| 1306 | /* |
| 1307 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1308 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1309 | * fFTEnable is true. |
| 1310 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1311 | */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1312 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1313 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1314 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1315 | eCSR_AUTH_TYPE_FT_RSN) |
| 1316 | #ifdef FEATURE_WLAN_ESE |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1317 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1318 | eCSR_AUTH_TYPE_CCKM_RSN) |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1319 | || (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1320 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1321 | #endif |
| 1322 | ) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1323 | hdd_send_ft_assoc_response(dev, adapter, pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1324 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1325 | qdf_copy_macaddr(&peerMacAddr, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1326 | &sta_ctx->conn_info.bssId); |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1327 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1328 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1329 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1330 | chan_info.band_center_freq1 = |
| 1331 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1332 | chan_info.band_center_freq2 = |
| 1333 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1334 | chan_info.reg_info_1 = |
| 1335 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1336 | chan_info.reg_info_2 = |
| 1337 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1338 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1339 | ret = hdd_objmgr_add_peer_object(adapter->hdd_vdev, |
| 1340 | adapter->device_mode, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1341 | peerMacAddr.bytes, |
| 1342 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1343 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1344 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1345 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1346 | ret = hdd_objmgr_set_peer_mlme_state(adapter->hdd_vdev, |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1347 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1348 | if (ret) |
| 1349 | hdd_err("Peer object %pM fail to set associated state", |
| 1350 | peerMacAddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1351 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1352 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1353 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
| 1354 | ePeerConnected, |
| 1355 | pCsrRoamInfo->timingMeasCap, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1356 | adapter->session_id, &chan_info, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1357 | adapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1358 | /* Update tdls module about connection event */ |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1359 | hdd_notify_sta_connect(adapter->session_id, |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1360 | pCsrRoamInfo->tdls_chan_swit_prohibited, |
| 1361 | pCsrRoamInfo->tdls_prohibited, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1362 | adapter->hdd_vdev); |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1363 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1364 | #ifdef MSM_PLATFORM |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1365 | /* start timer in sta/p2p_cli */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1366 | spin_lock_bh(&hdd_ctx->bus_bw_lock); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1367 | adapter->prev_tx_packets = adapter->stats.tx_packets; |
| 1368 | adapter->prev_rx_packets = adapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1369 | cdp_get_intra_bss_fwd_pkts_count( |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1370 | cds_get_context(QDF_MODULE_ID_SOC), adapter->session_id, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1371 | &adapter->prev_fwd_tx_packets, |
| 1372 | &adapter->prev_fwd_rx_packets); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1373 | spin_unlock_bh(&hdd_ctx->bus_bw_lock); |
| 1374 | hdd_bus_bw_compute_timer_start(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1375 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1376 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1377 | sta_ctx->conn_info.connState) { |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1378 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1379 | adapter->session_id); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1380 | memcpy(wrqu.ap_addr.sa_data, sta_ctx->conn_info.bssId.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1381 | ETH_ALEN); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1382 | hdd_debug("wlan: new IBSS peer connection to BSSID " MAC_ADDRESS_STR, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1383 | MAC_ADDR_ARRAY(sta_ctx->conn_info.bssId.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1384 | } else { /* Not Associated */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1385 | hdd_debug("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1386 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1387 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1388 | adapter->device_mode, adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1389 | |
| 1390 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1391 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1392 | #endif |
| 1393 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1394 | if ((adapter->device_mode == QDF_STA_MODE) || |
| 1395 | (adapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1396 | qdf_copy_macaddr(&peerMacAddr, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1397 | &sta_ctx->conn_info.bssId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1398 | |
| 1399 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1400 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1401 | ePeerDisconnected, 0, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1402 | adapter->session_id, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1403 | NULL, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1404 | adapter->device_mode); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1405 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, |
| 1406 | peerMacAddr.bytes); |
| 1407 | if (ret) |
| 1408 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1409 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1410 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1411 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1412 | hdd_lpass_notify_disconnect(adapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1413 | /* Update tdls module about the disconnection event */ |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1414 | hdd_notify_sta_disconnect(adapter->session_id, |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1415 | false, |
Kabilan Kannan | b6153b1 | 2017-07-13 17:54:02 -0700 | [diff] [blame] | 1416 | false, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1417 | adapter->hdd_vdev); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1418 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1419 | #ifdef MSM_PLATFORM |
| 1420 | /* stop timer in sta/p2p_cli */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1421 | spin_lock_bh(&hdd_ctx->bus_bw_lock); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1422 | adapter->prev_tx_packets = 0; |
| 1423 | adapter->prev_rx_packets = 0; |
| 1424 | adapter->prev_fwd_tx_packets = 0; |
| 1425 | adapter->prev_fwd_rx_packets = 0; |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1426 | spin_unlock_bh(&hdd_ctx->bus_bw_lock); |
| 1427 | hdd_bus_bw_compute_timer_try_stop(hdd_ctx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1428 | #endif |
| 1429 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1430 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1431 | /* Send SCC/MCC Switching event to IPA */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1432 | hdd_ipa_send_mcc_scc_msg(hdd_ctx, hdd_ctx->mcc_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1433 | |
| 1434 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1435 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1436 | * driver so not sending the status of the connection to supplicant |
| 1437 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1438 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1439 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1440 | #ifdef FEATURE_WLAN_ESE |
| 1441 | if (eConnectionState_Associated == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1442 | sta_ctx->conn_info.connState) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1443 | if ((roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1444 | eCSR_AUTH_TYPE_CCKM_RSN) || |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 1445 | (roam_profile->AuthType.authType[0] == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1446 | eCSR_AUTH_TYPE_CCKM_WPA)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1447 | hdd_send_new_ap_channel_info(dev, adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1448 | pCsrRoamInfo); |
| 1449 | } |
| 1450 | #endif |
| 1451 | } |
| 1452 | } |
| 1453 | |
| 1454 | /** |
| 1455 | * hdd_conn_remove_connect_info() - remove connection info |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1456 | * @sta_ctx: pointer to global HDD station context |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1457 | * @pCsrRoamInfo: pointer to roam info |
| 1458 | * |
| 1459 | * Return: none |
| 1460 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1461 | 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] | 1462 | { |
| 1463 | /* Remove staId, bssId and peerMacAddress */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1464 | sta_ctx->conn_info.staId[0] = HDD_WLAN_INVALID_STA_ID; |
| 1465 | qdf_mem_zero(&sta_ctx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1466 | qdf_mem_zero(&sta_ctx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1467 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1468 | |
| 1469 | /* Clear all security settings */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1470 | sta_ctx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1471 | sta_ctx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1472 | sta_ctx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1473 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1474 | qdf_mem_zero(&sta_ctx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1475 | qdf_mem_zero(&sta_ctx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1476 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1477 | sta_ctx->conn_info.proxyARPService = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1478 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1479 | qdf_mem_zero(&sta_ctx->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1480 | } |
| 1481 | |
| 1482 | /** |
| 1483 | * hdd_roam_deregister_sta() - deregister station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1484 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1485 | * @staId: station identifier |
| 1486 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1487 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1488 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 1489 | 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] | 1490 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1491 | QDF_STATUS qdf_status; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1492 | struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1493 | int ret = 0; |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1494 | struct qdf_mac_addr *peer_mac = NULL; |
Dustin Brown | ce5b3d3 | 2018-01-17 15:07:38 -0800 | [diff] [blame] | 1495 | struct qdf_mac_addr broadcastMacAddr = QDF_MAC_ADDR_BCAST_INIT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1496 | if (eConnectionState_IbssDisconnected == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1497 | sta_ctx->conn_info.connState) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1498 | /* |
| 1499 | * Do not set the carrier off when the last peer leaves. |
| 1500 | * We will set the carrier off while stopping the IBSS. |
| 1501 | */ |
| 1502 | } |
| 1503 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1504 | 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] | 1505 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1506 | staid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1507 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1508 | hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]", |
| 1509 | staid, qdf_status, qdf_status); |
| 1510 | } |
| 1511 | |
| 1512 | if (adapter->device_mode == QDF_STA_MODE) { |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1513 | peer_mac = &sta_ctx->conn_info.bssId; |
Naveen Rawat | 95eb406 | 2017-11-02 16:46:41 -0700 | [diff] [blame] | 1514 | } else if (adapter->device_mode == QDF_IBSS_MODE || |
| 1515 | adapter->device_mode == QDF_NDI_MODE) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1516 | if (sta_ctx->broadcast_staid == staid) |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1517 | peer_mac = &broadcastMacAddr; |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1518 | else |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1519 | peer_mac = |
| 1520 | hdd_wlan_get_ibss_mac_addr_from_staid(adapter, staid); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1521 | } |
Naveen Rawat | 95eb406 | 2017-11-02 16:46:41 -0700 | [diff] [blame] | 1522 | |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1523 | if (!peer_mac) { |
| 1524 | hdd_err("Coudnt find peer MAC for staid %d, delete fails", |
| 1525 | staid); |
| 1526 | return QDF_STATUS_E_FAILURE; |
| 1527 | } |
Naveen Rawat | 95eb406 | 2017-11-02 16:46:41 -0700 | [diff] [blame] | 1528 | |
| 1529 | hdd_debug("peer_mac_addr: "MAC_ADDRESS_STR, |
| 1530 | MAC_ADDR_ARRAY(peer_mac->bytes)); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 1531 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, peer_mac->bytes); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1532 | if (ret) { |
| 1533 | hdd_err("Peer obj %pM delete fails", peer_mac); |
| 1534 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1535 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1536 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1537 | } |
| 1538 | |
| 1539 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1540 | * hdd_print_bss_info() - print bss info |
| 1541 | * @hdd_sta_ctx: pointer to hdd station context |
| 1542 | * |
| 1543 | * Return: None |
| 1544 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1545 | 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] | 1546 | { |
| 1547 | uint32_t *cap_info; |
| 1548 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1549 | hdd_debug("WIFI DATA LOGGER"); |
| 1550 | hdd_debug("channel: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1551 | hdd_sta_ctx->conn_info.freq); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1552 | hdd_debug("dot11mode: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1553 | hdd_sta_ctx->conn_info.dot11Mode); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1554 | hdd_debug("AKM: %d", |
| 1555 | hdd_sta_ctx->conn_info.last_auth_type); |
| 1556 | hdd_debug("ssid: %.*s", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1557 | hdd_sta_ctx->conn_info.last_ssid.SSID.length, |
| 1558 | hdd_sta_ctx->conn_info.last_ssid.SSID.ssId); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1559 | hdd_debug("roam count: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1560 | hdd_sta_ctx->conn_info.roam_count); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1561 | hdd_debug("ant_info: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1562 | hdd_sta_ctx->conn_info.txrate.nss); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1563 | hdd_debug("datarate legacy %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1564 | hdd_sta_ctx->conn_info.txrate.legacy); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1565 | hdd_debug("datarate mcs: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1566 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1567 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1568 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1569 | hdd_debug("ht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1570 | } |
| 1571 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1572 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1573 | hdd_debug("vht caps: %x", *cap_info); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1574 | } |
| 1575 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1576 | hdd_debug("hs20 info: %x", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1577 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1578 | hdd_debug("signal: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1579 | hdd_sta_ctx->conn_info.signal); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1580 | hdd_debug("noise: %d", |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1581 | hdd_sta_ctx->conn_info.noise); |
| 1582 | } |
| 1583 | |
| 1584 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1585 | * hdd_dis_connect_handler() - disconnect event handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1586 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1587 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1588 | * @roamId: roam identifier |
| 1589 | * @roamStatus: roam status |
| 1590 | * @roamResult: roam result |
| 1591 | * |
| 1592 | * This function handles disconnect event: |
| 1593 | * 1. Disable transmit queues; |
| 1594 | * 2. Clean up internal connection states and data structures; |
| 1595 | * 3. Send disconnect indication to supplicant. |
| 1596 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1597 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1598 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1599 | static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1600 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1601 | uint32_t roamId, |
| 1602 | eRoamCmdStatus roamStatus, |
| 1603 | eCsrRoamResult roamResult) |
| 1604 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1605 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1606 | QDF_STATUS vstatus; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1607 | struct net_device *dev = adapter->dev; |
| 1608 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1609 | 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] | 1610 | uint8_t sta_id; |
| 1611 | bool sendDisconInd = true; |
| 1612 | |
| 1613 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1614 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1615 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1616 | } |
| 1617 | /* notify apps that we can't pass traffic anymore */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1618 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1619 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1620 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1621 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1623 | if (hdd_ipa_is_enabled(hdd_ctx)) |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1624 | hdd_ipa_wlan_evt(adapter, sta_ctx->conn_info.staId[0], |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 1625 | HDD_IPA_STA_DISCONNECT, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1626 | sta_ctx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1627 | |
| 1628 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1629 | wlan_hdd_auto_shutdown_enable(hdd_ctx, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1630 | #endif |
| 1631 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1632 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1633 | adapter->session_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1634 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1635 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1636 | |
| 1637 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1638 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1639 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1640 | * to cfg80211_disconnected. |
| 1641 | */ |
| 1642 | if ((eConnectionState_Disconnecting == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1643 | sta_ctx->conn_info.connState) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1644 | (eConnectionState_NotConnected == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1645 | sta_ctx->conn_info.connState)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1646 | 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] | 1647 | sendDisconInd = false; |
| 1648 | } |
| 1649 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1650 | if (sta_ctx->conn_info.connState != eConnectionState_Disconnecting) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1651 | INIT_COMPLETION(adapter->disconnect_comp_var); |
| 1652 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1653 | eConnectionState_Disconnecting); |
| 1654 | } |
| 1655 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1656 | hdd_clear_roam_profile_ie(adapter); |
| 1657 | hdd_wmm_init(adapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1658 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1659 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1660 | |
| 1661 | /* indicate 'disconnect' status to wpa_supplicant... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1662 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1663 | /* indicate disconnected event to nl80211 */ |
| 1664 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1665 | /* |
| 1666 | * Only send indication to kernel if not initiated |
| 1667 | * by kernel |
| 1668 | */ |
| 1669 | if (sendDisconInd) { |
| 1670 | /* |
| 1671 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1672 | * to ICS UI. |
| 1673 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1674 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1675 | if (roam_info->reasonCode == |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1676 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 1677 | pr_info("wlan: disconnected due to poor signal, rssi is %d dB\n", |
| 1678 | roam_info->rxRssi); |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1679 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1680 | dev, false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1681 | roam_info->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1682 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1683 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1684 | dev, false, |
| 1685 | WLAN_REASON_UNSPECIFIED |
| 1686 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1687 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 1689 | hdd_debug("sent disconnected event to nl80211, reason code %d", |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1690 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1691 | roam_info->reasonCode : |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1692 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1693 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1694 | |
Wu Gao | c02785d | 2017-09-07 18:17:13 +0800 | [diff] [blame] | 1695 | /* update P2P connection status */ |
| 1696 | ucfg_p2p_status_disconnect(adapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1697 | } |
| 1698 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1699 | hdd_wmm_adapter_clear(adapter); |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1700 | sme_ft_reset(WLAN_HDD_GET_HAL_CTX(adapter), adapter->session_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1701 | if (hdd_remove_beacon_filter(adapter) != 0) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1702 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1703 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1704 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1705 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1706 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1707 | sta_id = sta_ctx->broadcast_staid; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1708 | vstatus = hdd_roam_deregister_sta(adapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1709 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1710 | 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] | 1711 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1712 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1713 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1714 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1715 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
| 1716 | else |
| 1717 | hdd_debug("invalid sta id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1718 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1719 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1720 | if (HDD_WLAN_INVALID_STA_ID == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1721 | sta_ctx->conn_info.staId[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1722 | continue; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1723 | sta_id = sta_ctx->conn_info.staId[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1724 | hdd_debug("Deregister StaID %d", sta_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1725 | vstatus = hdd_roam_deregister_sta(adapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1726 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1727 | 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] | 1728 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1729 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1730 | } |
| 1731 | /* set the staid and peer mac as 0, all other |
| 1732 | * reset are done in hdd_connRemoveConnectInfo. |
| 1733 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1734 | sta_ctx->conn_info.staId[i] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1735 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1736 | qdf_mem_zero(&sta_ctx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1737 | sizeof(struct qdf_mac_addr)); |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1738 | if (sta_id < HDD_MAX_ADAPTERS) |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1739 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1740 | else |
| 1741 | hdd_debug("invalid sta_id %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1742 | } |
| 1743 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1744 | sta_id = sta_ctx->conn_info.staId[0]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1745 | hdd_debug("roamResult: %d", roamResult); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1746 | |
| 1747 | /* clear scan cache for Link Lost */ |
Sandeep Puligilla | f0b3058 | 2017-01-12 08:39:41 -0800 | [diff] [blame] | 1748 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult || |
| 1749 | eCSR_ROAM_RESULT_DISASSOC_IND == roamResult || |
yeshwanth sriram guntuka | 951725a | 2017-03-15 19:33:04 +0530 | [diff] [blame] | 1750 | eCSR_ROAM_LOSTLINK == roamStatus) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1751 | wlan_hdd_cfg80211_update_bss_list(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1752 | sta_ctx->conn_info.bssId.bytes); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 1753 | sme_remove_bssid_from_scan_list(hdd_ctx->hHal, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1754 | sta_ctx->conn_info.bssId.bytes); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1755 | } |
Rajeev Kumar | 4bc998f | 2017-10-19 14:41:43 -0700 | [diff] [blame] | 1756 | if (sta_id < HDD_MAX_ADAPTERS) |
| 1757 | hdd_ctx->sta_to_adapter[sta_id] = NULL; |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 1758 | else |
| 1759 | hdd_debug("invalid sta_id %d", sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1760 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1761 | /* Clear saved connection information in HDD */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1762 | hdd_conn_remove_connect_info(sta_ctx); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1763 | hdd_conn_set_connection_state(adapter, eConnectionState_NotConnected); |
| 1764 | pmo_ucfg_flush_gtk_offload_req(adapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1765 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1766 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 1767 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1768 | sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1769 | (adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1770 | adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1771 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1772 | wlan_hdd_clear_link_layer_stats(adapter); |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1773 | |
Jeff Johnson | 6ced42c | 2017-10-20 12:48:11 -0700 | [diff] [blame] | 1774 | adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0; |
Sravan Kumar Kairam | 3a69831 | 2017-10-16 14:16:16 +0530 | [diff] [blame] | 1775 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1776 | /* Unblock anyone waiting for disconnect to complete */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1777 | complete(&adapter->disconnect_comp_var); |
Ganesh Kondabattini | 479a8ae | 2017-10-03 16:49:24 +0530 | [diff] [blame] | 1778 | |
| 1779 | hdd_reset_limit_off_chan(adapter); |
| 1780 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1781 | hdd_print_bss_info(sta_ctx); |
Abhishek Singh | 1f217ec | 2017-12-22 11:48:27 +0530 | [diff] [blame] | 1782 | |
| 1783 | if (policy_mgr_is_sta_active_connection_exists(hdd_ctx->hdd_psoc)) |
| 1784 | sme_enable_roaming_on_connected_sta(hdd_ctx->hHal); |
| 1785 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1786 | return status; |
| 1787 | } |
| 1788 | |
| 1789 | /** |
| 1790 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1791 | * @vdev_id: vdevid |
| 1792 | * |
| 1793 | * Return: None |
| 1794 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1795 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1796 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1797 | struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 1798 | struct hdd_adapter *adapter = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1799 | |
| 1800 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1801 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1802 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1803 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1804 | } |
| 1805 | complete(&adapter->sta_authorized_event); |
| 1806 | } |
| 1807 | |
| 1808 | /** |
| 1809 | * hdd_change_peer_state() - change peer state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1810 | * @adapter: HDD adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1811 | * @sta_state: peer state |
| 1812 | * @roam_synch_in_progress: roam synch in progress |
| 1813 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1814 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1815 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1816 | QDF_STATUS hdd_change_peer_state(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1817 | uint8_t sta_id, |
| 1818 | enum ol_txrx_peer_state sta_state, |
| 1819 | bool roam_synch_in_progress) |
| 1820 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1821 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1822 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1823 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1824 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1825 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1826 | |
| 1827 | if (!pdev) { |
| 1828 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1829 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1830 | } |
| 1831 | |
| 1832 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1833 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1834 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1835 | } |
| 1836 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1837 | peer = cdp_peer_find_by_local_id(soc, |
| 1838 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1839 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1840 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1841 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1842 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1843 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1844 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1845 | return QDF_STATUS_E_FAULT; |
| 1846 | } |
| 1847 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1848 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1849 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1850 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1851 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1852 | } |
| 1853 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1854 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1855 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | #endif |
| 1857 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1858 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1859 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1860 | /* make sure event is reset */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1861 | INIT_COMPLETION(adapter->sta_authorized_event); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | #endif |
| 1863 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1864 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1865 | hdd_set_peer_authorized_event, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1866 | adapter->session_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1867 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1868 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1869 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1870 | } |
| 1871 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1872 | if (adapter->device_mode == QDF_STA_MODE || |
| 1873 | adapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1874 | #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] | 1875 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1876 | unsigned long rc; |
| 1877 | |
| 1878 | /* wait for event from firmware to set the event */ |
| 1879 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1880 | &adapter->sta_authorized_event, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1881 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1882 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1883 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1884 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1885 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 1886 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1887 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1888 | #endif |
| 1889 | } |
| 1890 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1891 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1892 | } |
| 1893 | |
| 1894 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1895 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 1896 | * @cbk_data: callback data |
| 1897 | * @sta_id: station id |
| 1898 | * @vdev_param: vdev parameter |
| 1899 | * @is_link_up: link state up or down |
| 1900 | * |
| 1901 | * Return: QDF status |
| 1902 | */ |
| 1903 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 1904 | uint8_t sta_id, |
| 1905 | uint32_t vdev_param, |
| 1906 | bool is_link_up) |
| 1907 | { |
| 1908 | struct cdp_vdev *data_vdev; |
| 1909 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1910 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1911 | struct hdd_context *hdd_ctx; |
Yun Park | 0dad100 | 2017-07-14 14:57:01 -0700 | [diff] [blame] | 1912 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1913 | struct wlan_objmgr_psoc **psoc; |
| 1914 | |
| 1915 | if (!cbk_data) |
| 1916 | return status; |
| 1917 | |
| 1918 | psoc = cbk_data; |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1919 | |
Kabilan Kannan | c0e3d58 | 2017-09-13 00:26:33 -0700 | [diff] [blame] | 1920 | hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Sourav Mohapatra | 5febc93 | 2018-01-08 14:38:30 +0530 | [diff] [blame] | 1921 | if (!hdd_ctx) { |
| 1922 | hdd_err("Invalid HDD Context"); |
| 1923 | return QDF_STATUS_E_INVAL; |
| 1924 | } |
| 1925 | |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1926 | if (!hdd_ctx->tdls_nap_active) |
| 1927 | return status; |
| 1928 | |
Yun Park | 0dad100 | 2017-07-14 14:57:01 -0700 | [diff] [blame] | 1929 | 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] | 1930 | if (NULL == data_vdev) { |
| 1931 | status = QDF_STATUS_E_FAILURE; |
| 1932 | return status; |
| 1933 | } |
| 1934 | |
| 1935 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 1936 | |
| 1937 | return status; |
| 1938 | } |
| 1939 | |
| 1940 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1941 | * hdd_roam_register_sta() - register station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1942 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 1943 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | * @staId: station identifier |
| 1945 | * @pPeerMacAddress: peer MAC address |
| 1946 | * @pBssDesc: pointer to BSS description |
| 1947 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1948 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1949 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1950 | QDF_STATUS hdd_roam_register_sta(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 1951 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1952 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1953 | struct qdf_mac_addr *pPeerMacAddress, |
Jeff Johnson | 4ba73cb | 2017-10-06 11:12:33 -0700 | [diff] [blame] | 1954 | struct bss_description *pBssDesc) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1955 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1956 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1957 | struct ol_txrx_desc_type staDesc = { 0 }; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 1958 | 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] | 1959 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1960 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1961 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1962 | |
| 1963 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1964 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1965 | |
| 1966 | /* Get the Station ID from the one saved during the association */ |
| 1967 | staDesc.sta_id = staId; |
| 1968 | |
| 1969 | /* set the QoS field appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1970 | if (hdd_wmm_is_active(adapter)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1971 | staDesc.is_qos_enabled = 1; |
| 1972 | else |
| 1973 | staDesc.is_qos_enabled = 0; |
| 1974 | |
| 1975 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 1976 | hdd_debug("WAPI STA Registered: %d", |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 1977 | adapter->wapi_info.is_wapi_sta); |
| 1978 | if (adapter->wapi_info.is_wapi_sta) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1979 | staDesc.is_wapi_supported = 1; |
| 1980 | else |
| 1981 | staDesc.is_wapi_supported = 0; |
| 1982 | #endif /* FEATURE_WLAN_WAPI */ |
| 1983 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1984 | /* Register the vdev transmit and receive functions */ |
| 1985 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 1986 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1987 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1988 | 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] | 1989 | (struct cdp_pdev *)pdev, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 1990 | adapter->session_id); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1991 | if (!adapter->txrx_vdev) { |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1992 | hdd_err("%s find vdev fail", __func__); |
| 1993 | return QDF_STATUS_E_FAILURE; |
| 1994 | } |
| 1995 | |
| 1996 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1997 | cdp_vdev_register(soc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 1998 | (struct cdp_vdev *)adapter->txrx_vdev, adapter, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1999 | if (!txrx_ops.tx.tx) { |
| 2000 | hdd_err("%s vdev register fail", __func__); |
| 2001 | return QDF_STATUS_E_FAILURE; |
| 2002 | } |
| 2003 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2004 | adapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2005 | qdf_status = cdp_peer_register(soc, |
| 2006 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2007 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2008 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2009 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2010 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2011 | } |
| 2012 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2013 | if (!roam_info->fAuthRequired) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | /* |
| 2015 | * Connections that do not need Upper layer auth, transition |
| 2016 | * TLSHIM directly to 'Authenticated' state |
| 2017 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2018 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2019 | hdd_change_peer_state(adapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2020 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2021 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2022 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2023 | #else |
| 2024 | false |
| 2025 | #endif |
| 2026 | ); |
| 2027 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2028 | hdd_conn_set_authenticated(adapter, true); |
| 2029 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2030 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2031 | 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] | 2032 | sta_ctx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2033 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2034 | hdd_change_peer_state(adapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2035 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2036 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2037 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2038 | #else |
| 2039 | false |
| 2040 | #endif |
| 2041 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2042 | hdd_conn_set_authenticated(adapter, false); |
| 2043 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2044 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2045 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2046 | } |
| 2047 | |
| 2048 | /** |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2049 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 2050 | * @dev: network device |
| 2051 | * @bss: cfg80211 roamed bss pointer |
| 2052 | * @req_ie: IEs used in reassociation request |
| 2053 | * @req_ie_len: Length of the @req_ie |
| 2054 | * @resp_ie: IEs received in successful reassociation response |
| 2055 | * @resp_ie_len: Length of @resp_ie |
| 2056 | * |
| 2057 | * Return: none |
| 2058 | */ |
| 2059 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 2060 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 2061 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 2062 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 2063 | size_t req_ie_len, const uint8_t *resp_ie, |
| 2064 | size_t resp_ie_len) |
| 2065 | { |
| 2066 | struct cfg80211_roam_info info = {0}; |
| 2067 | |
| 2068 | info.bss = bss; |
| 2069 | info.req_ie = req_ie; |
| 2070 | info.req_ie_len = req_ie_len; |
| 2071 | info.resp_ie = resp_ie; |
| 2072 | info.resp_ie_len = resp_ie_len; |
| 2073 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 2074 | } |
| 2075 | #else |
| 2076 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 2077 | struct cfg80211_bss *bss, |
| 2078 | const uint8_t *req_ie, size_t req_ie_len, |
| 2079 | const uint8_t *resp_ie, |
| 2080 | size_t resp_ie_len) |
| 2081 | { |
| 2082 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 2083 | GFP_KERNEL); |
| 2084 | } |
| 2085 | #endif |
| 2086 | |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2087 | #if defined(WLAN_FEATURE_ROAM_OFFLOAD) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2088 | #if defined(WLAN_FEATURE_FILS_SK) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2089 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2090 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2091 | { |
| 2092 | uint8_t *kek; |
| 2093 | uint32_t kek_len; |
| 2094 | |
| 2095 | if (is_reassoc) { |
| 2096 | kek = csr_roam_info->kek; |
| 2097 | kek_len = csr_roam_info->kek_len; |
| 2098 | } else { |
| 2099 | /* |
| 2100 | * This should come for FILS case only. |
| 2101 | * Caller should make sure fils_join_rsp is |
| 2102 | * not NULL, if there is need to use else where. |
| 2103 | */ |
| 2104 | kek = csr_roam_info->fils_join_rsp->kek; |
| 2105 | kek_len = csr_roam_info->fils_join_rsp->kek_len; |
| 2106 | } |
| 2107 | |
| 2108 | wlan_hdd_save_gtk_offload_params(adapter, NULL, kek, kek_len, |
| 2109 | csr_roam_info->replay_ctr, true); |
| 2110 | |
| 2111 | hdd_debug("Kek len %d", kek_len); |
| 2112 | } |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2113 | #else |
| 2114 | void hdd_save_gtk_params(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2115 | struct csr_roam_info *csr_roam_info, bool is_reassoc) |
Vignesh Viswanathan | 0b0fa27 | 2017-09-18 17:12:04 +0530 | [diff] [blame] | 2116 | { |
| 2117 | uint8_t *kek; |
| 2118 | uint32_t kek_len; |
| 2119 | |
| 2120 | /* |
| 2121 | * is_reassoc is set to true always for Legacy GTK offload |
| 2122 | * case, It is false only for FILS case |
| 2123 | */ |
| 2124 | kek = csr_roam_info->kek; |
| 2125 | kek_len = csr_roam_info->kek_len; |
| 2126 | |
| 2127 | wlan_hdd_save_gtk_offload_params(adapter, NULL, kek, kek_len, |
| 2128 | csr_roam_info->replay_ctr, true); |
| 2129 | |
| 2130 | hdd_debug("Kek len %d", kek_len); |
| 2131 | } |
| 2132 | #endif |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2133 | #endif |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2134 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2135 | * hdd_send_re_assoc_event() - send reassoc event |
| 2136 | * @dev: pointer to net device |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2137 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2138 | * @pCsrRoamInfo: pointer to roam info |
| 2139 | * @reqRsnIe: pointer to RSN Information element |
| 2140 | * @reqRsnLength: length of RSN IE |
| 2141 | * |
| 2142 | * Return: none |
| 2143 | */ |
| 2144 | static void hdd_send_re_assoc_event(struct net_device *dev, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2145 | struct hdd_adapter *adapter, struct csr_roam_info *pCsrRoamInfo, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2146 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2147 | { |
| 2148 | unsigned int len = 0; |
| 2149 | u8 *pFTAssocRsp = NULL; |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2150 | uint8_t *rspRsnIe = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
| 2151 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2152 | uint32_t rspRsnLength = 0; |
| 2153 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2154 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 2155 | uint8_t *buf_ptr, ssid_ie_len; |
| 2156 | struct cfg80211_bss *bss = NULL; |
| 2157 | uint8_t *final_req_ie = NULL; |
| 2158 | tCsrRoamConnectedProfile roam_profile; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2159 | tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(adapter); |
| 2160 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2161 | int chan_no; |
| 2162 | int freq; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2163 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2164 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2165 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2166 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2167 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2168 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2169 | } |
| 2170 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2171 | if (!assoc_req_ies) { |
| 2172 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2173 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2174 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2175 | if (pCsrRoamInfo == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2176 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2177 | goto done; |
| 2178 | } |
| 2179 | |
| 2180 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2181 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2182 | goto done; |
| 2183 | } |
| 2184 | |
| 2185 | pFTAssocRsp = |
| 2186 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2187 | pCsrRoamInfo->nAssocReqLength); |
| 2188 | if (pFTAssocRsp == NULL) |
| 2189 | goto done; |
| 2190 | |
| 2191 | /* pFTAssocRsp needs to point to the IEs */ |
| 2192 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2193 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2194 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2195 | |
| 2196 | /* |
| 2197 | * Active session count is decremented upon disconnection, but during |
| 2198 | * roaming, there is no disconnect indication and hence active session |
| 2199 | * count is not decremented. |
| 2200 | * After roaming is completed, active session count is incremented |
| 2201 | * as a part of connect indication but effectively after roaming the |
| 2202 | * active session count should still be the same and hence upon |
| 2203 | * successful reassoc decrement the active session count here. |
| 2204 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2205 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2206 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2207 | adapter->device_mode, adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2208 | |
| 2209 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 2210 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2211 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2212 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2213 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2214 | |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2215 | chan_no = pCsrRoamInfo->pBssDesc->channelId; |
| 2216 | if (chan_no <= 14) |
| 2217 | freq = ieee80211_channel_to_frequency(chan_no, |
| 2218 | NL80211_BAND_2GHZ); |
| 2219 | else |
| 2220 | freq = ieee80211_channel_to_frequency(chan_no, |
| 2221 | NL80211_BAND_5GHZ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2222 | chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); |
Ashish Kumar Dhanotiya | 52def21 | 2017-09-07 17:25:48 +0530 | [diff] [blame] | 2223 | |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2224 | sme_roam_get_connect_profile(hal_handle, adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2225 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2226 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2227 | bss = hdd_cfg80211_get_bss(adapter->wdev.wiphy, |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2228 | chan, pCsrRoamInfo->bssid.bytes, |
| 2229 | &roam_profile.SSID.ssId[0], |
| 2230 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2231 | |
| 2232 | if (bss == NULL) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2233 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2234 | buf_ptr = buf_ssid_ie; |
| 2235 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2236 | buf_ptr++; |
| 2237 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2238 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2239 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2240 | roam_profile.SSID.length); |
| 2241 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2242 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2243 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2244 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2245 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2246 | if (final_req_ie == NULL) { |
| 2247 | if (bss) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2248 | cfg80211_put_bss(adapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2249 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2250 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2251 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2252 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2253 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2254 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2255 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2256 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2257 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2258 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2259 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2260 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2261 | hdd_send_roamed_ind(dev, bss, final_req_ie, |
| 2262 | (ssid_ie_len + reqRsnLength), rspRsnIe, |
| 2263 | rspRsnLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2264 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2265 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2266 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2267 | pCsrRoamInfo->nAssocReqLength); |
| 2268 | |
Sridhar Selvaraj | e526044 | 2017-08-19 10:12:03 +0530 | [diff] [blame] | 2269 | hdd_save_gtk_params(adapter, pCsrRoamInfo, true); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2270 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2271 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2272 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2273 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2274 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2275 | wlan_hdd_send_roam_auth_event(adapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2276 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2277 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2278 | pCsrRoamInfo); |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2279 | |
| 2280 | hdd_update_hlp_info(dev, pCsrRoamInfo); |
| 2281 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2282 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2283 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2284 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2285 | qdf_mem_free(final_req_ie); |
| 2286 | qdf_mem_free(rspRsnIe); |
| 2287 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2288 | } |
| 2289 | |
| 2290 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2291 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2292 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2293 | * |
| 2294 | * Return: roam sync status if roaming offloaded else false |
| 2295 | */ |
| 2296 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2297 | bool hdd_is_roam_sync_in_progress(struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2298 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2299 | if (roaminfo) |
| 2300 | return roaminfo->roamSynchInProgress; |
| 2301 | else |
| 2302 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2303 | } |
| 2304 | #endif |
| 2305 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2306 | /** |
| 2307 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2308 | * @hddstactx: pointer to HDD sta context |
| 2309 | * @roaminfo: pointer to roaminfo structure |
| 2310 | * |
| 2311 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2312 | * MAC address return self staid(0) else find the peer sta id of |
| 2313 | * the peer. |
| 2314 | * |
| 2315 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2316 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2317 | 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] | 2318 | struct csr_roam_info *roaminfo) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2319 | { |
| 2320 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2321 | QDF_STATUS status; |
| 2322 | |
| 2323 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2324 | staid = 0; |
| 2325 | } else { |
| 2326 | status = hdd_get_peer_sta_id(hddstactx, |
| 2327 | &roaminfo->peerMac, &staid); |
| 2328 | if (status != QDF_STATUS_SUCCESS) { |
| 2329 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2330 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2331 | } |
| 2332 | } |
| 2333 | |
| 2334 | return staid; |
| 2335 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2336 | |
| 2337 | /** |
| 2338 | * hdd_change_sta_state_authenticated()- |
| 2339 | * This function changes STA state to authenticated |
| 2340 | * @adapter: pointer to the adapter structure. |
| 2341 | * @roaminfo: pointer to the RoamInfo structure. |
| 2342 | * |
| 2343 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2344 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2345 | * |
| 2346 | * Return: 0 on success and errno on failure |
| 2347 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2348 | static int hdd_change_sta_state_authenticated(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2349 | struct csr_roam_info *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2350 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2351 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2352 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2353 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2354 | struct hdd_station_ctx *hddstactx = |
| 2355 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2356 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2357 | |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 2358 | timeout = hddstactx->hdd_reassoc_scenario ? |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2359 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2360 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2361 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2362 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2363 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2364 | else |
| 2365 | staid = hddstactx->conn_info.staId[0]; |
| 2366 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2367 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2368 | |
| 2369 | /* Connections that do not need Upper layer authentication, |
| 2370 | * transition TL to 'Authenticated' state after the keys are set |
| 2371 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2372 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2373 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2374 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2375 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2376 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2377 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2378 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2379 | sme_ps_enable_auto_ps_timer( |
| 2380 | WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2381 | adapter->session_id, |
Dustin Brown | 84411b0 | 2017-07-21 16:44:44 -0700 | [diff] [blame] | 2382 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2383 | } |
| 2384 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2385 | return qdf_status_to_os_return(status); |
| 2386 | } |
| 2387 | |
| 2388 | /** |
| 2389 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2390 | * if key installation is required |
| 2391 | * @encr_type: encryption type |
| 2392 | * |
| 2393 | * Return: true if key installation is required and false otherwise. |
| 2394 | */ |
| 2395 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2396 | eCsrEncryptionType encr_type) |
| 2397 | { |
| 2398 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2399 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2400 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2401 | eCSR_ENCRYPT_TYPE_AES_GCMP == encr_type || |
| 2402 | eCSR_ENCRYPT_TYPE_AES_GCMP_256 == encr_type || |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2403 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2404 | return true; |
| 2405 | else |
| 2406 | return false; |
| 2407 | } |
| 2408 | |
| 2409 | /** |
| 2410 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2411 | * complete |
| 2412 | * @adapter: pointer to HDD adapter |
| 2413 | * @roaminfo: pointer to roam info |
| 2414 | * @roam_result: roam result |
| 2415 | * |
| 2416 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2417 | * This function checks for the successful set key completion and update |
| 2418 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2419 | * |
| 2420 | * Return: None |
| 2421 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2422 | 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] | 2423 | struct csr_roam_info *roaminfo, |
| 2424 | eCsrRoamResult roam_result) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2425 | { |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2426 | struct hdd_station_ctx *hdd_sta_ctx = |
| 2427 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2428 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2429 | |
| 2430 | /* |
| 2431 | * If the security mode is one of the following, IBSS peer will be |
| 2432 | * waiting in CONN state and we will move the peer state to AUTH |
| 2433 | * here. For non-secure connection, no need to wait for set-key complete |
| 2434 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2435 | */ |
| 2436 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2437 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2438 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2439 | |
| 2440 | return; |
| 2441 | } |
| 2442 | |
| 2443 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2444 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2445 | /* |
| 2446 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2447 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2448 | * after roaming. STA TL state moves to authenticated only if |
| 2449 | * ptk_installed is true. So, make ptk_installed to true in |
| 2450 | * case of 11R roaming. |
| 2451 | */ |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2452 | if (sme_neighbor_roam_is11r_assoc(WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2453 | adapter->session_id)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2454 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2455 | } else { |
| 2456 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2457 | } |
| 2458 | |
| 2459 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2460 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2461 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2462 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2463 | * set the unicast and broadcast key. |
| 2464 | */ |
| 2465 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2466 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2467 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2468 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2469 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2470 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2471 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2472 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2473 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2474 | } |
| 2475 | |
| 2476 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2477 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2478 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2479 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2480 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2481 | } |
| 2482 | |
| 2483 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2484 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2485 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2486 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2487 | * @roamId: roam id |
| 2488 | * @roamStatus: roam status |
| 2489 | * @roamResult: roam result |
| 2490 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2491 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2492 | */ |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2493 | static QDF_STATUS |
| 2494 | hdd_roam_set_key_complete_handler(struct hdd_adapter *adapter, |
| 2495 | struct csr_roam_info *roam_info, |
| 2496 | uint32_t roamId, |
| 2497 | eRoamCmdStatus roamStatus, |
| 2498 | eCsrRoamResult roamResult) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2499 | { |
| 2500 | eCsrEncryptionType connectedCipherAlgo; |
| 2501 | bool fConnected = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2502 | 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] | 2503 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2504 | ENTER(); |
| 2505 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2506 | if (NULL == roam_info) { |
| 2507 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2508 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2509 | } |
| 2510 | /* |
| 2511 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2512 | * then go to 'authenticated'. For all other authentication types |
| 2513 | * (those that do not require upper layer authentication) we can put TL |
| 2514 | * directly into 'authenticated' state. |
| 2515 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 2516 | hdd_debug("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2517 | MAC_ADDRESS_STR, roamStatus, roamResult, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2518 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2519 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2520 | fConnected = hdd_conn_get_connected_cipher_algo(sta_ctx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2521 | &connectedCipherAlgo); |
| 2522 | if (fConnected) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2523 | hdd_change_peer_state_after_set_key(adapter, roam_info, |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2524 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2525 | } |
| 2526 | |
| 2527 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2528 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2529 | } |
| 2530 | |
| 2531 | /** |
| 2532 | * hdd_perform_roam_set_key_complete() - perform set key complete |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2533 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2534 | * |
| 2535 | * Return: none |
| 2536 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2537 | void hdd_perform_roam_set_key_complete(struct hdd_adapter *adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2538 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2539 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2540 | 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] | 2541 | struct csr_roam_info roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2542 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2544 | qdf_mem_copy(roamInfo.bssid.bytes, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2545 | sta_ctx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2546 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2547 | sta_ctx->roam_info.peer_mac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2548 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2549 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2550 | hdd_roam_set_key_complete_handler(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2551 | &roamInfo, |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2552 | sta_ctx->roam_info.roam_id, |
| 2553 | sta_ctx->roam_info.roam_status, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2554 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2555 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2556 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2557 | |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2558 | sta_ctx->roam_info.defer_key_complete = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2559 | } |
| 2560 | |
Vignesh Viswanathan | 3fa1d38 | 2017-08-02 19:36:43 +0530 | [diff] [blame] | 2561 | #if defined(WLAN_FEATURE_FILS_SK) && \ |
| 2562 | (defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) || \ |
| 2563 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0))) |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 2564 | void hdd_clear_fils_connection_info(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2565 | { |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 2566 | struct hdd_wext_state *wext_state; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2567 | |
| 2568 | if ((adapter->device_mode == QDF_SAP_MODE) || |
| 2569 | (adapter->device_mode == QDF_P2P_GO_MODE)) |
| 2570 | return; |
| 2571 | |
| 2572 | wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 2573 | if (wext_state->roamProfile.fils_con_info) { |
| 2574 | qdf_mem_free(wext_state->roamProfile.fils_con_info); |
| 2575 | wext_state->roamProfile.fils_con_info = NULL; |
| 2576 | } |
Vignesh Viswanathan | c6d1e1c | 2017-09-18 12:32:49 +0530 | [diff] [blame] | 2577 | |
| 2578 | if (wext_state->roamProfile.hlp_ie) { |
| 2579 | qdf_mem_free(wext_state->roamProfile.hlp_ie); |
| 2580 | wext_state->roamProfile.hlp_ie = NULL; |
| 2581 | wext_state->roamProfile.hlp_ie_len = 0; |
| 2582 | } |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2583 | } |
| 2584 | #endif |
| 2585 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2586 | /** |
| 2587 | * hdd_association_completion_handler() - association completion handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2588 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2589 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2590 | * @roamId: roam id |
| 2591 | * @roamStatus: roam status |
| 2592 | * @roamResult: roam result |
| 2593 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2594 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2595 | */ |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2596 | static QDF_STATUS |
| 2597 | hdd_association_completion_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 2598 | struct csr_roam_info *roam_info, |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 2599 | uint32_t roamId, |
| 2600 | eRoamCmdStatus roamStatus, |
| 2601 | eCsrRoamResult roamResult) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2602 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2603 | struct net_device *dev = adapter->dev; |
| 2604 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2605 | 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] | 2606 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2607 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2608 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2609 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2610 | bool hddDisconInProgress = false; |
| 2611 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2612 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2613 | bool ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2614 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2615 | if (!hdd_ctx) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2616 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2617 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2618 | } |
| 2619 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2620 | /* validate config */ |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2621 | if (!hdd_ctx->config) { |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2622 | hdd_err("config is NULL"); |
| 2623 | return QDF_STATUS_E_NULL_VALUE; |
| 2624 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2625 | /* HDD has initiated disconnect, do not send connect result indication |
| 2626 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2627 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2628 | if (((eConnectionState_Disconnecting == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2629 | sta_ctx->conn_info.connState) || |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2630 | (eConnectionState_NotConnected == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2631 | sta_ctx->conn_info.connState)) && |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2632 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2633 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2634 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2635 | sta_ctx->conn_info.connState, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2636 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2637 | hddDisconInProgress = true; |
| 2638 | } |
| 2639 | |
| 2640 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2641 | if (NULL == roam_info) { |
| 2642 | hdd_err("roam_info is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2643 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2644 | } |
| 2645 | if (!hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2646 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2647 | eConnectionState_Associated); |
| 2648 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2649 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2650 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2651 | hdd_conn_save_connect_info(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2652 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2653 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2654 | if (hdd_add_beacon_filter(adapter) != 0) |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2655 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2656 | #ifdef FEATURE_WLAN_WAPI |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2657 | if (roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2658 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2659 | || roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2660 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2661 | adapter->wapi_info.is_wapi_sta = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2662 | } else { |
Jeff Johnson | 7d2f4c6 | 2017-11-02 09:25:45 -0700 | [diff] [blame] | 2663 | adapter->wapi_info.is_wapi_sta = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2664 | } |
| 2665 | #endif /* FEATURE_WLAN_WAPI */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2666 | hdd_debug("bss_descr[%d] devicemode[%d]", !!roam_info->pBssDesc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2667 | adapter->device_mode); |
| 2668 | if ((QDF_STA_MODE == adapter->device_mode) && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2669 | roam_info->pBssDesc) { |
| 2670 | ie_len = GET_IE_LEN_IN_BSS(roam_info->pBssDesc->length); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2671 | sta_ctx->ap_supports_immediate_power_save = |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2672 | wlan_hdd_is_ap_supports_immediate_power_save( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2673 | (uint8_t *) roam_info->pBssDesc->ieFields, |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2674 | ie_len); |
| 2675 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2676 | sta_ctx->ap_supports_immediate_power_save); |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2677 | } |
| 2678 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2679 | /* Indicate 'connect' status to user space */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2680 | hdd_send_association_event(dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2681 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2682 | if (policy_mgr_is_mcc_in_24G(hdd_ctx->hdd_psoc)) { |
| 2683 | if (hdd_ctx->miracast_value) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2684 | wlan_hdd_set_mas(adapter, |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2685 | hdd_ctx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2686 | } |
| 2687 | |
| 2688 | /* Initialize the Linkup event completion variable */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2689 | INIT_COMPLETION(adapter->linkup_event_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2690 | |
| 2691 | /* |
| 2692 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2693 | * the device properly. Before allowing any packet to go up to |
| 2694 | * the application, device activation has to be ensured for |
| 2695 | * proper queue mapping by the kernel. we have registered net |
| 2696 | * device notifier for device change notification. With this we |
| 2697 | * will come to know that the device is getting |
| 2698 | * activated properly. |
| 2699 | */ |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2700 | if (sta_ctx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2701 | /* |
| 2702 | * Enable Linkup Event Servicing which allows the net |
| 2703 | * device notifier to set the linkup event variable. |
| 2704 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2705 | adapter->is_link_up_service_needed = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2706 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2707 | /* Switch on the Carrier to activate the device */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2708 | wlan_hdd_netif_queue_control(adapter, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2709 | WLAN_NETIF_CARRIER_ON, |
| 2710 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2711 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2712 | /* |
| 2713 | * Wait for the Link to up to ensure all the queues |
| 2714 | * are set properly by the kernel. |
| 2715 | */ |
| 2716 | rc = wait_for_completion_timeout( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2717 | &adapter->linkup_event_var, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2718 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2719 | ); |
| 2720 | if (!rc) |
| 2721 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2722 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2723 | /* |
| 2724 | * Disable Linkup Event Servicing - no more service |
| 2725 | * required from the net device notifier call. |
| 2726 | */ |
Jeff Johnson | c72c573 | 2017-10-28 12:49:37 -0700 | [diff] [blame] | 2727 | adapter->is_link_up_service_needed = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2728 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2729 | sta_ctx->ft_carrier_on = false; |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2730 | ft_carrier_on = true; |
| 2731 | } |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 2732 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2733 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2734 | else |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2735 | hdd_err("Wrong Staid: %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2736 | |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2737 | if (hdd_ipa_is_enabled(hdd_ctx)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2738 | hdd_ipa_wlan_evt(adapter, roam_info->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2739 | HDD_IPA_STA_CONNECT, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2740 | roam_info->bssid.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2741 | |
| 2742 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2743 | wlan_hdd_auto_shutdown_enable(hdd_ctx, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2744 | #endif |
| 2745 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2746 | hdd_debug("check if STA chan ok for DNBS"); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2747 | if (policy_mgr_is_chan_ok_for_dnbs(hdd_ctx->hdd_psoc, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2748 | sta_ctx->conn_info.operationChannel, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2749 | &ok)) { |
| 2750 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2751 | sta_ctx->conn_info.operationChannel); |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2752 | return QDF_STATUS_E_FAILURE; |
| 2753 | } |
| 2754 | |
| 2755 | if (!ok) { |
| 2756 | hdd_err("Chan:%d not suitable for DNBS", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2757 | sta_ctx->conn_info.operationChannel); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2758 | wlan_hdd_netif_queue_control(adapter, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2759 | WLAN_NETIF_CARRIER_OFF, |
| 2760 | WLAN_CONTROL_PATH); |
| 2761 | if (!hddDisconInProgress) { |
| 2762 | hdd_err("Disconnecting..."); |
| 2763 | sme_roam_disconnect( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2764 | WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2765 | adapter->session_id, |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2766 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2767 | } |
| 2768 | return QDF_STATUS_E_FAILURE; |
| 2769 | } |
| 2770 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2771 | hdd_debug("check for SAP restart"); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2772 | policy_mgr_check_concurrent_intf_and_restart_sap( |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2773 | hdd_ctx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2774 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2775 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2776 | adapter->session_id, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2777 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2778 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2779 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2780 | /* |
| 2781 | * For reassoc, the station is already registered, all we need |
| 2782 | * is to change the state of the STA in TL. |
| 2783 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2784 | * CONNECTED instead of AUTHENTICATED. |
| 2785 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2786 | if (!roam_info->fReassocReq) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2787 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2788 | u8 *pFTAssocRsp = NULL; |
| 2789 | unsigned int assocRsplen = 0; |
| 2790 | u8 *pFTAssocReq = NULL; |
| 2791 | unsigned int assocReqlen = 0; |
| 2792 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2793 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2794 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2795 | |
| 2796 | /* add bss_id to cfg80211 data base */ |
| 2797 | bss = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2798 | wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2799 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2800 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2801 | hdd_err("wlan: Not able to create BSS entry"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2802 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2803 | WLAN_NETIF_CARRIER_OFF, |
| 2804 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2805 | if (!hddDisconInProgress) { |
| 2806 | /* |
| 2807 | * Here driver was not able to add bss |
| 2808 | * in cfg80211 database this can happen |
| 2809 | * if connected channel is not valid, |
| 2810 | * i.e reg domain was changed during |
| 2811 | * connection. Queue disconnect for the |
| 2812 | * session if disconnect is not in |
| 2813 | * progress. |
| 2814 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2815 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2816 | sme_roam_disconnect( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2817 | WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2818 | adapter->session_id, |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2819 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2820 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2821 | return QDF_STATUS_E_FAILURE; |
Jiachao Wu | 0411bc9 | 2017-11-21 10:43:27 +0800 | [diff] [blame] | 2822 | } else { |
| 2823 | cfg80211_put_bss( |
| 2824 | hdd_ctx->wiphy, |
| 2825 | bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2826 | } |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 2827 | |
| 2828 | /* Association Response */ |
| 2829 | pFTAssocRsp = |
| 2830 | (u8 *) (roam_info->pbFrames + |
| 2831 | roam_info->nBeaconLength + |
| 2832 | roam_info->nAssocReqLength); |
| 2833 | if (pFTAssocRsp != NULL) { |
| 2834 | /* |
| 2835 | * pFTAssocRsp needs to point to the IEs |
| 2836 | */ |
| 2837 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
| 2838 | hdd_debug("AssocRsp is now at %02x%02x", |
| 2839 | (unsigned int)pFTAssocRsp[0], |
| 2840 | (unsigned int)pFTAssocRsp[1]); |
| 2841 | assocRsplen = |
| 2842 | roam_info->nAssocRspLength - |
| 2843 | FT_ASSOC_RSP_IES_OFFSET; |
| 2844 | |
| 2845 | hdd_debug("assocRsplen %d", assocRsplen); |
| 2846 | hdd_debug("Assoc Rsp IE dump"); |
| 2847 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 2848 | QDF_TRACE_LEVEL_DEBUG, |
| 2849 | pFTAssocRsp, |
| 2850 | assocRsplen); |
| 2851 | } else { |
| 2852 | hdd_debug("AssocRsp is NULL"); |
| 2853 | assocRsplen = 0; |
| 2854 | } |
| 2855 | |
| 2856 | /* Association Request */ |
| 2857 | pFTAssocReq = (u8 *) (roam_info->pbFrames + |
| 2858 | roam_info->nBeaconLength); |
| 2859 | if (pFTAssocReq != NULL) { |
| 2860 | if (!ft_carrier_on) { |
| 2861 | /* |
| 2862 | * pFTAssocReq needs to point to |
| 2863 | * the IEs |
| 2864 | */ |
| 2865 | pFTAssocReq += |
| 2866 | FT_ASSOC_REQ_IES_OFFSET; |
| 2867 | hdd_debug("pFTAssocReq is now at %02x%02x", |
| 2868 | (unsigned int) |
| 2869 | pFTAssocReq[0], |
| 2870 | (unsigned int) |
| 2871 | pFTAssocReq[1]); |
| 2872 | assocReqlen = |
| 2873 | roam_info->nAssocReqLength - |
| 2874 | FT_ASSOC_REQ_IES_OFFSET; |
| 2875 | } else { |
| 2876 | /* |
| 2877 | * This should contain only the |
| 2878 | * FTIEs |
| 2879 | */ |
| 2880 | assocReqlen = |
| 2881 | roam_info->nAssocReqLength; |
| 2882 | } |
| 2883 | |
| 2884 | hdd_debug("assocReqlen %d", assocReqlen); |
| 2885 | hdd_debug("Assoc/Reassoc Req IE dump"); |
| 2886 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, |
| 2887 | QDF_TRACE_LEVEL_DEBUG, |
| 2888 | pFTAssocReq, |
| 2889 | assocReqlen); |
| 2890 | } else { |
| 2891 | hdd_debug("AssocReq is NULL"); |
| 2892 | assocReqlen = 0; |
| 2893 | } |
| 2894 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2895 | if (roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2896 | eCSR_AUTH_TYPE_FT_RSN |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2897 | || roam_info->u.pConnectedProfile->AuthType == |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2898 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2899 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 2900 | if (!hddDisconInProgress && |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2901 | roam_info->pBssDesc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2902 | struct cfg80211_bss *roam_bss; |
| 2903 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2904 | /* |
| 2905 | * After roaming is completed, |
| 2906 | * active session count is |
| 2907 | * incremented as a part of |
| 2908 | * connect indication but |
| 2909 | * effectively the active |
| 2910 | * session count should still |
| 2911 | * be the same and hence upon |
| 2912 | * successful reassoc |
| 2913 | * decrement the active session |
| 2914 | * count here. |
| 2915 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2916 | if (!hdd_is_roam_sync_in_progress |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2917 | (roam_info)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2918 | policy_mgr_decr_session_set_pcl( |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 2919 | hdd_ctx->hdd_psoc, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2920 | adapter->device_mode, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2921 | adapter->session_id); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2922 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2923 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2924 | chan = |
| 2925 | ieee80211_get_channel |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2926 | (adapter->wdev.wiphy, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2927 | (int)roam_info->pBssDesc-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2928 | channelId); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2929 | |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2930 | roam_bss = |
| 2931 | hdd_cfg80211_get_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2932 | adapter->wdev.wiphy, |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2933 | chan, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2934 | roam_info->bssid.bytes, |
| 2935 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2936 | pConnectedProfile->SSID.ssId, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2937 | roam_info->u. |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2938 | pConnectedProfile->SSID.length); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2939 | hdd_send_roamed_ind( |
| 2940 | dev, |
| 2941 | roam_bss, |
| 2942 | pFTAssocReq, |
| 2943 | assocReqlen, |
| 2944 | pFTAssocRsp, |
| 2945 | assocRsplen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2946 | wlan_hdd_send_roam_auth_event( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2947 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2948 | roam_info->bssid.bytes, |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2949 | pFTAssocReq, |
| 2950 | assocReqlen, |
| 2951 | pFTAssocRsp, |
| 2952 | assocRsplen, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2953 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2954 | } |
| 2955 | if (sme_get_ftptk_state |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2956 | (WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2957 | adapter->session_id)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2958 | sme_set_ftptk_state |
| 2959 | (WLAN_HDD_GET_HAL_CTX |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 2960 | (adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 2961 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2962 | false); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2963 | roam_info->fAuthRequired = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2964 | false; |
| 2965 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2966 | qdf_mem_copy(sta_ctx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2967 | roam_info.bssid, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2968 | roam_info->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2969 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2970 | qdf_mem_copy(sta_ctx-> |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2971 | roam_info.peer_mac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2972 | roam_info->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2973 | QDF_MAC_ADDR_SIZE); |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2974 | sta_ctx->roam_info.roam_id = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2975 | roamId; |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2976 | sta_ctx->roam_info.roam_status = |
| 2977 | roamStatus; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 2978 | sta_ctx->roam_info. |
Jeff Johnson | af2ae4b | 2017-11-01 11:38:50 -0700 | [diff] [blame] | 2979 | defer_key_complete = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2980 | } |
| 2981 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2982 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2983 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2984 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2985 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2986 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2987 | roam_info, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2988 | pFTAssocReq, |
| 2989 | assocReqlen, |
| 2990 | pFTAssocRsp, |
| 2991 | assocRsplen, |
| 2992 | WLAN_STATUS_SUCCESS, |
| 2993 | GFP_KERNEL, |
| 2994 | false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 2995 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2996 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2997 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2998 | /* |
| 2999 | * wpa supplicant expecting WPA/RSN IE in |
| 3000 | * connect result. |
| 3001 | */ |
| 3002 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3003 | (adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3004 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3005 | &reqRsnLength, |
| 3006 | reqRsnIe); |
| 3007 | |
| 3008 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3009 | (adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3010 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3011 | &rspRsnLength, |
| 3012 | rspRsnIe); |
| 3013 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3014 | if (ft_carrier_on) |
| 3015 | hdd_send_re_assoc_event(dev, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3016 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3017 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3018 | reqRsnIe, |
| 3019 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 3020 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3021 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3022 | MAC_ADDRESS_STR |
| 3023 | " result:%d and Status:%d", |
| 3024 | MAC_ADDR_ARRAY |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3025 | (roam_info->bssid.bytes), |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3026 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3027 | |
| 3028 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3029 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3030 | roam_info-> |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3031 | bssid.bytes, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3032 | roam_info, |
Padma, Santhosh Kumar | 22614a0 | 2017-11-09 19:05:14 +0530 | [diff] [blame] | 3033 | pFTAssocReq, |
| 3034 | assocReqlen, |
| 3035 | pFTAssocRsp, |
| 3036 | assocRsplen, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3037 | WLAN_STATUS_SUCCESS, |
| 3038 | GFP_KERNEL, |
| 3039 | false, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3040 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3041 | } |
| 3042 | } |
| 3043 | } |
| 3044 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3045 | /* |
| 3046 | * Perform any WMM-related association |
| 3047 | * processing. |
| 3048 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3049 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3050 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3051 | |
| 3052 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 3053 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3054 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3055 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3056 | roam_info, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3057 | sta_ctx->conn_info.staId[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3058 | NULL, roam_info->pBssDesc); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3059 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3060 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3061 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3062 | WLAN_CONTROL_PATH); |
| 3063 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3064 | } |
| 3065 | } else { |
| 3066 | /* |
| 3067 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 3068 | * in case of reassociation also need to indicate it to |
| 3069 | * supplicant. |
| 3070 | */ |
| 3071 | csr_roam_get_wpa_rsn_req_ie( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3072 | WLAN_HDD_GET_HAL_CTX(adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3073 | adapter->session_id, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3074 | &reqRsnLength, reqRsnIe); |
| 3075 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3076 | hdd_send_re_assoc_event(dev, adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3077 | reqRsnIe, reqRsnLength); |
| 3078 | /* Reassoc successfully */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3079 | if (roam_info->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3080 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3081 | hdd_change_peer_state(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3082 | sta_ctx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3083 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3084 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3085 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3086 | #else |
| 3087 | false |
| 3088 | #endif |
| 3089 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3090 | hdd_conn_set_authenticated(adapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3091 | hdd_objmgr_set_peer_mlme_auth_state( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3092 | adapter->hdd_vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3093 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3094 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3095 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3096 | sta_ctx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3097 | qdf_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3098 | hdd_change_peer_state(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3099 | sta_ctx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3100 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3101 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3102 | roam_info->roamSynchInProgress |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3103 | #else |
| 3104 | false |
| 3105 | #endif |
| 3106 | ); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3107 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3108 | hdd_objmgr_set_peer_mlme_auth_state( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3109 | adapter->hdd_vdev, |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3110 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3111 | } |
| 3112 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3113 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3114 | /* |
| 3115 | * Perform any WMM-related association |
| 3116 | * processing |
| 3117 | */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3118 | hdd_wmm_assoc(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3119 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3120 | } |
| 3121 | |
| 3122 | /* Start the tx queues */ |
| 3123 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3124 | if (roam_info->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3125 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3126 | #endif |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3127 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3128 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3129 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3130 | WLAN_CONTROL_PATH); |
| 3131 | } |
| 3132 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3133 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3134 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3135 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3136 | } |
| 3137 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 3138 | qdf_mem_zero(&adapter->hdd_stats.hdd_pmf_stats, |
| 3139 | sizeof(adapter->hdd_stats.hdd_pmf_stats)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3140 | #endif |
| 3141 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3142 | bool connect_timeout = false; |
Vignesh Viswanathan | 014096a | 2017-12-07 01:24:44 +0530 | [diff] [blame] | 3143 | if (roam_info && roam_info->is_fils_connection && |
| 3144 | eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) |
| 3145 | qdf_copy_macaddr(&roam_info->bssid, |
| 3146 | &sta_ctx->requested_bssid); |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3147 | if (roam_info) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3148 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3149 | " result: %d and Status: %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3150 | MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3151 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3152 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3153 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3154 | " result: %d and Status: %d", |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3155 | MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3156 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3157 | |
| 3158 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3159 | (roam_info && |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3160 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3161 | roam_info->statusCode) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3162 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3163 | roam_info->statusCode) || |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3164 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3165 | roam_info->statusCode)))) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3166 | wlan_hdd_cfg80211_update_bss_list(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3167 | roam_info ? |
| 3168 | roam_info->bssid.bytes : |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3169 | sta_ctx->requested_bssid.bytes); |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 3170 | sme_remove_bssid_from_scan_list(hdd_ctx->hHal, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3171 | roam_info ? |
| 3172 | roam_info->bssid.bytes : |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3173 | sta_ctx->requested_bssid.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3174 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3175 | } |
| 3176 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3177 | /* |
| 3178 | * CR465478: Only send up a connection failure result when CSR |
| 3179 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3180 | */ |
| 3181 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3182 | && !hddDisconInProgress) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3183 | if (roam_info) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3184 | hdd_err("send connect failure to nl80211: for bssid " |
| 3185 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3186 | " result: %d and Status: %d reasoncode: %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3187 | MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3188 | roamResult, roamStatus, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3189 | roam_info->reasonCode); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3190 | sta_ctx->conn_info.assoc_status_code = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3191 | roam_info->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3192 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3193 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3195 | " result: %d and status: %d ", |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3196 | MAC_ADDR_ARRAY(sta_ctx->requested_bssid.bytes), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3197 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3198 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3199 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3200 | wlan_deregister_txrx_packetdump(); |
| 3201 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3202 | /* inform association failure event to nl80211 */ |
| 3203 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3204 | roamResult) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3205 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3206 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3207 | roam_info->bssid.bytes, |
| 3208 | roam_info, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3209 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3210 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3211 | connect_timeout, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3212 | roam_info->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3213 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3214 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3215 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3216 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3217 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3218 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3219 | connect_timeout, |
| 3220 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3221 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3222 | if (roam_info) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3223 | hdd_connect_result(dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3224 | roam_info->bssid.bytes, |
| 3225 | roam_info, NULL, 0, NULL, 0, |
| 3226 | roam_info->reasonCode ? |
| 3227 | roam_info->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3228 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3229 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3230 | connect_timeout, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3231 | roam_info->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3232 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3233 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3234 | sta_ctx->requested_bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3235 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3236 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3237 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3238 | connect_timeout, |
| 3239 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3240 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3241 | hdd_clear_roam_profile_ie(adapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3242 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3243 | && !hddDisconInProgress)) { |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3244 | hdd_connect_result(dev, |
Jeff Johnson | 731bc32 | 2017-10-14 19:53:44 -0700 | [diff] [blame] | 3245 | sta_ctx->requested_bssid.bytes, |
Jeff Johnson | 59eb5fd | 2017-10-05 09:42:39 -0700 | [diff] [blame] | 3246 | NULL, NULL, 0, NULL, 0, |
| 3247 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
| 3248 | GFP_KERNEL, |
| 3249 | connect_timeout, |
| 3250 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3251 | } |
| 3252 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3253 | /* |
| 3254 | * Set connection state to eConnectionState_NotConnected only |
| 3255 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3256 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3257 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3258 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3259 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3260 | && !hddDisconInProgress) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3261 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3262 | eConnectionState_NotConnected); |
| 3263 | } |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3264 | hdd_wmm_init(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3266 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3267 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3268 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3269 | WLAN_CONTROL_PATH); |
| 3270 | } |
| 3271 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3272 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3273 | } |
| 3274 | |
| 3275 | /** |
| 3276 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3277 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3278 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3279 | * @roamId: roam id |
| 3280 | * @roamStatus: roam status |
| 3281 | * @roamResult: roam result |
| 3282 | * |
| 3283 | * Here we update the status of the Ibss when we receive information that we |
| 3284 | * have started/joined an ibss session. |
| 3285 | * |
| 3286 | * Return: none |
| 3287 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3288 | static void hdd_roam_ibss_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3289 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3290 | uint32_t roamId, |
| 3291 | eRoamCmdStatus roamStatus, |
| 3292 | eCsrRoamResult roamResult) |
| 3293 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3294 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3295 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3296 | hdd_debug("%s: id %d, status %d, result %d", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3297 | adapter->dev->name, roamId, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3298 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3299 | |
| 3300 | switch (roamResult) { |
| 3301 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3302 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3303 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3304 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3305 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3306 | struct hdd_station_ctx *hdd_sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3307 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Dustin Brown | ce5b3d3 | 2018-01-17 15:07:38 -0800 | [diff] [blame] | 3308 | struct qdf_mac_addr broadcastMacAddr = QDF_MAC_ADDR_BCAST_INIT; |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3309 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3310 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3311 | if (NULL == roam_info) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3312 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3313 | return; |
| 3314 | } |
| 3315 | |
| 3316 | /* When IBSS Started comes from CSR, we need to move |
| 3317 | * connection state to IBSS Disconnected (meaning no peers |
| 3318 | * are in the IBSS). |
| 3319 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3320 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | eConnectionState_IbssDisconnected); |
| 3322 | /* notify wmm */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3323 | hdd_wmm_connect(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3324 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3325 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3326 | hdd_sta_ctx->broadcast_staid = roam_info->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3327 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3328 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3329 | hdd_ctx->sta_to_adapter[roam_info->staId] = |
| 3330 | adapter; |
| 3331 | else |
| 3332 | hdd_debug("invalid sta id %d", roam_info->staId); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3333 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3334 | hdd_roam_register_sta(adapter, roam_info, |
| 3335 | roam_info->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3336 | &broadcastMacAddr, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3337 | roam_info->pBssDesc); |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3338 | ret = hdd_objmgr_add_peer_object(adapter->hdd_vdev, |
| 3339 | QDF_IBSS_MODE, |
| 3340 | broadcastMacAddr.bytes, |
| 3341 | false); |
| 3342 | if (ret) |
| 3343 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 3344 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3345 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3346 | if (roam_info->pBssDesc) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3347 | struct cfg80211_bss *bss; |
| 3348 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3349 | struct ieee80211_channel *chan; |
| 3350 | int chan_no; |
| 3351 | unsigned int freq; |
| 3352 | #endif |
| 3353 | /* we created the IBSS, notify supplicant */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3354 | hdd_debug("%s: created ibss " MAC_ADDRESS_STR, |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3355 | adapter->dev->name, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3356 | MAC_ADDR_ARRAY( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3357 | roam_info->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3358 | |
| 3359 | /* we must first give cfg80211 the BSS information */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3360 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3361 | roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3362 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3363 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3364 | adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3365 | return; |
| 3366 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3367 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3368 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3369 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3370 | WLAN_CONTROL_PATH); |
| 3371 | |
| 3372 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3373 | chan_no = roam_info->pBssDesc->channelId; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3374 | |
| 3375 | if (chan_no <= 14) |
| 3376 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3377 | HDD_NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3378 | else |
| 3379 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3380 | HDD_NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3381 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3382 | chan = ieee80211_get_channel(adapter->wdev.wiphy, freq); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3383 | |
| 3384 | if (chan) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3385 | cfg80211_ibss_joined(adapter->dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3386 | bss->bssid, chan, |
| 3387 | GFP_KERNEL); |
| 3388 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3389 | hdd_warn("%s: chanId: %d, can't find channel", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3390 | adapter->dev->name, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3391 | (int)roam_info->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3392 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3393 | cfg80211_ibss_joined(adapter->dev, bss->bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3394 | GFP_KERNEL); |
| 3395 | #endif |
| 3396 | cfg80211_put_bss( |
Jeff Johnson | 8095a31 | 2017-09-03 09:13:24 -0700 | [diff] [blame] | 3397 | hdd_ctx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3398 | bss); |
| 3399 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3400 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3401 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3402 | adapter->device_mode, adapter->session_id); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3403 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3404 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3405 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3406 | adapter->session_id); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3407 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3408 | break; |
| 3409 | } |
| 3410 | |
| 3411 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3412 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3413 | hdd_err("%s: unable to create IBSS", adapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3414 | break; |
| 3415 | } |
| 3416 | |
| 3417 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3418 | hdd_err("%s: unexpected result %d", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3419 | adapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3420 | break; |
| 3421 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3422 | } |
| 3423 | |
| 3424 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3425 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3426 | * @sta_ctx: pointer to hdd station context |
| 3427 | * @sta_id: station ID |
| 3428 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3429 | * |
| 3430 | * This information is passed to iwconfig later. The peer that joined |
| 3431 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3432 | |
| 3433 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3434 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3435 | 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] | 3436 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3437 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3438 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3439 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3440 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3441 | if (HDD_WLAN_INVALID_STA_ID == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3442 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3443 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3444 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3445 | qdf_copy_macaddr( |
| 3446 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3447 | peer_mac_addr); |
| 3448 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3449 | } |
| 3450 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3451 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3452 | } |
| 3453 | |
| 3454 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3455 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3456 | * @sta_ctx: pointer to hdd station context |
| 3457 | * @sta_id: station ID |
| 3458 | * |
| 3459 | * Return: None |
| 3460 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3461 | 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] | 3462 | { |
| 3463 | int i; |
| 3464 | |
| 3465 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3466 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3467 | sta_ctx->conn_info.staId[i] = HDD_WLAN_INVALID_STA_ID; |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3468 | return; |
| 3469 | } |
| 3470 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3471 | } |
| 3472 | |
| 3473 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3474 | * 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] | 3475 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3476 | * @staId: station id |
| 3477 | * |
| 3478 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3479 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3480 | * false otherwise. |
| 3481 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3482 | 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] | 3483 | { |
| 3484 | bool fSuccess = false; |
| 3485 | int idx = 0; |
| 3486 | uint8_t valid_idx = 0; |
| 3487 | uint8_t del_idx = 0; |
| 3488 | uint8_t empty_slots = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3489 | 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] | 3490 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3491 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3492 | if (staId == sta_ctx->conn_info.staId[idx]) { |
| 3493 | sta_ctx->conn_info.staId[idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3494 | HDD_WLAN_INVALID_STA_ID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3495 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3496 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3497 | peerMacAddress[idx]); |
| 3498 | |
| 3499 | fSuccess = true; |
| 3500 | |
| 3501 | /* |
| 3502 | * Note the deleted Index, if its 0 we need special |
| 3503 | * handling. |
| 3504 | */ |
| 3505 | del_idx = idx; |
| 3506 | |
| 3507 | empty_slots++; |
| 3508 | } else { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3509 | if (sta_ctx->conn_info.staId[idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3510 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3511 | valid_idx = idx; |
| 3512 | } else { |
| 3513 | /* Found an empty slot */ |
| 3514 | empty_slots++; |
| 3515 | } |
| 3516 | } |
| 3517 | } |
| 3518 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3519 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3520 | /* Last peer departed, set the IBSS state appropriately */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3521 | hdd_conn_set_connection_state(adapter, |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3522 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3523 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3524 | } |
| 3525 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3526 | if (fSuccess == true) { |
| 3527 | if (del_idx == 0) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3528 | if (sta_ctx->conn_info.staId[valid_idx] != |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3529 | HDD_WLAN_INVALID_STA_ID) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3530 | sta_ctx->conn_info.staId[0] = |
| 3531 | sta_ctx->conn_info.staId[valid_idx]; |
| 3532 | qdf_copy_macaddr(&sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3533 | peerMacAddress[0], |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3534 | &sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3535 | peerMacAddress[valid_idx]); |
| 3536 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3537 | sta_ctx->conn_info.staId[valid_idx] = |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3538 | HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3539 | qdf_zero_macaddr(&sta_ctx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3540 | peerMacAddress[valid_idx]); |
| 3541 | } |
| 3542 | } |
| 3543 | } |
| 3544 | return fSuccess; |
| 3545 | } |
| 3546 | |
| 3547 | /** |
| 3548 | * roam_ibss_connect_handler() - IBSS connection handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3549 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3550 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3551 | * |
| 3552 | * We update the status of the IBSS to connected in this function. |
| 3553 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3554 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3555 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3556 | static QDF_STATUS roam_ibss_connect_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3557 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3558 | { |
| 3559 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3560 | /* |
| 3561 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3562 | * a partner stations). |
| 3563 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3564 | hdd_conn_set_connection_state(adapter, eConnectionState_IbssConnected); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3565 | |
| 3566 | /* Save the connection info from CSR... */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3567 | hdd_conn_save_connect_info(adapter, roam_info, eCSR_BSS_TYPE_IBSS); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3568 | |
| 3569 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3570 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3571 | /* add bss_id to cfg80211 data base */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3572 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3573 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3574 | hdd_err("%s: unable to create IBSS entry", |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3575 | adapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3576 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3577 | } |
| 3578 | cfg80211_put_bss( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3579 | WLAN_HDD_GET_CTX(adapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3580 | bss); |
| 3581 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3582 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3583 | } |
| 3584 | |
| 3585 | /** |
| 3586 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3587 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3588 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3589 | * @roamId: roam id |
| 3590 | * @roamStatus: roam status |
| 3591 | * @roamResult: roam result |
| 3592 | * |
| 3593 | * This function indicates the Mic failure to the supplicant |
| 3594 | * |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3595 | * Return: None |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3596 | */ |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3597 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3598 | hdd_roam_mic_error_indication_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3599 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3600 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3601 | 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] | 3602 | tSirMicFailureInfo *mic_failure_info; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3603 | |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3604 | if (eConnectionState_Associated != sta_ctx->conn_info.connState) |
| 3605 | return; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3606 | |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 3607 | mic_failure_info = roam_info->u.pMICFailureInfo; |
| 3608 | cfg80211_michael_mic_failure(adapter->dev, |
| 3609 | mic_failure_info->taMacAddr, |
| 3610 | mic_failure_info->multicast ? |
| 3611 | NL80211_KEYTYPE_GROUP : |
| 3612 | NL80211_KEYTYPE_PAIRWISE, |
| 3613 | mic_failure_info->keyId, |
| 3614 | mic_failure_info->TSC, |
| 3615 | GFP_KERNEL); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3616 | } |
| 3617 | |
| 3618 | /** |
| 3619 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3620 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3621 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3622 | * @roamId: roam id |
| 3623 | * @roamStatus: roam status |
| 3624 | * @roamResult: roam result |
| 3625 | * |
| 3626 | * The Ibss connection status is updated regularly here in this function. |
| 3627 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3628 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3629 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3630 | static QDF_STATUS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3631 | roam_roam_connect_status_update_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3632 | struct csr_roam_info *roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3633 | uint32_t roamId, |
| 3634 | eRoamCmdStatus roamStatus, |
| 3635 | eCsrRoamResult roamResult) |
| 3636 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3637 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3638 | QDF_STATUS qdf_status; |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3639 | int ret; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3640 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3641 | switch (roamResult) { |
| 3642 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3643 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3644 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3645 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3646 | struct station_info *stainfo; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3647 | eCsrEncryptionType encr_type = sta_ctx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3648 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3649 | hdd_debug("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3650 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3651 | MAC_ADDRESS_STR " and stationID= %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3652 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3653 | MAC_ADDR_ARRAY(sta_ctx->conn_info.bssId.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3654 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3655 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3656 | if (!hdd_save_peer |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3657 | (WLAN_HDD_GET_STATION_CTX_PTR(adapter), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3658 | roam_info->staId, |
| 3659 | &roam_info->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3660 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3661 | break; |
| 3662 | } |
| 3663 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3664 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3665 | hdd_ctx->sta_to_adapter[roam_info->staId] = adapter; |
| 3666 | else |
| 3667 | hdd_debug("invalid sta id %d", roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3668 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3669 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3670 | roam_info->fAuthRequired = true; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3671 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3672 | /* Register the Station with TL for the new peer. */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3673 | qdf_status = hdd_roam_register_sta(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3674 | roam_info, |
| 3675 | roam_info->staId, |
| 3676 | &roam_info->peerMac, |
| 3677 | roam_info->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3678 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3679 | 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] | 3680 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3681 | } |
Abhishek Singh | 4472548 | 2017-11-02 16:53:23 +0530 | [diff] [blame] | 3682 | ret = hdd_objmgr_add_peer_object(adapter->hdd_vdev, |
| 3683 | QDF_IBSS_MODE, |
| 3684 | roam_info->peerMac.bytes, |
| 3685 | false); |
| 3686 | if (ret) |
| 3687 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 3688 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes)); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3689 | sta_ctx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3690 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3691 | if (stainfo == NULL) { |
| 3692 | hdd_err("memory allocation for station_info failed"); |
| 3693 | return QDF_STATUS_E_NOMEM; |
| 3694 | } |
| 3695 | stainfo->filled = 0; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3696 | stainfo->generation = sta_ctx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3697 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3698 | cfg80211_new_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3699 | (const u8 *)roam_info->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3700 | stainfo, GFP_KERNEL); |
| 3701 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3702 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3703 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3704 | sta_ctx->ibss_enc_key.keyDirection = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3705 | eSIR_TX_RX; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3706 | qdf_copy_macaddr(&sta_ctx->ibss_enc_key.peerMac, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3707 | &roam_info->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3708 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3709 | hdd_debug("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3710 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3711 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3712 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3713 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3714 | (adapter), |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3715 | adapter->session_id, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3716 | &sta_ctx->ibss_enc_key, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3717 | &roamId); |
| 3718 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3719 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3720 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3721 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3722 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3723 | } |
| 3724 | } |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3725 | hdd_debug("Enabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3726 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3727 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3728 | WLAN_CONTROL_PATH); |
| 3729 | break; |
| 3730 | } |
| 3731 | |
| 3732 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3733 | { |
| 3734 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3735 | roam_ibss_connect_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3736 | |
| 3737 | break; |
| 3738 | } |
| 3739 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3740 | { |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3741 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3742 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3743 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3744 | if (!roam_remove_ibss_station(adapter, roam_info->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3745 | 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] | 3746 | |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3747 | hdd_debug("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3748 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3749 | MAC_ADDRESS_STR " and stationID= %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3750 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3751 | MAC_ADDR_ARRAY(sta_ctx->conn_info.bssId.bytes), |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3752 | roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3753 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3754 | hdd_roam_deregister_sta(adapter, roam_info->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3755 | |
Rajeev Kumar | 7774cc8 | 2017-10-20 15:16:47 -0700 | [diff] [blame] | 3756 | if (roam_info->staId < HDD_MAX_ADAPTERS) |
| 3757 | hdd_ctx->sta_to_adapter[roam_info->staId] = NULL; |
| 3758 | else |
| 3759 | hdd_debug("invalid sta id %d", roam_info->staId); |
| 3760 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 3761 | sta_ctx->ibss_sta_generation++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3762 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3763 | cfg80211_del_sta(adapter->dev, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3764 | (const u8 *)&roam_info->peerMac.bytes, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3765 | GFP_KERNEL); |
| 3766 | break; |
| 3767 | } |
| 3768 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3769 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3770 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3771 | /* Stop only when we are inactive */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 3772 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3773 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3774 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3775 | WLAN_CONTROL_PATH); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3776 | hdd_conn_set_connection_state(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3777 | eConnectionState_NotConnected); |
| 3778 | |
| 3779 | /* Send the bssid address to the wext. */ |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 3780 | hdd_send_association_event(adapter->dev, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3781 | break; |
| 3782 | } |
| 3783 | default: |
| 3784 | break; |
| 3785 | |
| 3786 | } |
| 3787 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3788 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3789 | } |
| 3790 | |
| 3791 | #ifdef FEATURE_WLAN_TDLS |
| 3792 | /** |
| 3793 | * hdd_roam_register_tdlssta() - register new TDLS station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3794 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3795 | * @peerMac: pointer to peer MAC address |
| 3796 | * @staId: station identifier |
| 3797 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3798 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3799 | * |
| 3800 | * Construct the staDesc and register with TL the new STA. |
| 3801 | * This is called as part of ADD_STA in the TDLS setup. |
| 3802 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3803 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3804 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3805 | QDF_STATUS hdd_roam_register_tdlssta(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3806 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3807 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3808 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3809 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3810 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3811 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3812 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3813 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3814 | |
| 3815 | /* |
| 3816 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3817 | * be peer MAC, here we are working on direct Link |
| 3818 | */ |
| 3819 | staDesc.sta_id = staId; |
| 3820 | |
| 3821 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3822 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3823 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3824 | /* Register the vdev transmit and receive functions */ |
| 3825 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3826 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3827 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3828 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 3829 | (struct cdp_pdev *)pdev, adapter->session_id), |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3830 | adapter, &txrx_ops); |
| 3831 | adapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3832 | |
| 3833 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3834 | qdf_status = cdp_peer_register(soc, |
| 3835 | (struct cdp_pdev *)pdev, &staDesc); |
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("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3838 | qdf_status, qdf_status); |
| 3839 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3840 | } |
| 3841 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3842 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3843 | } |
| 3844 | |
| 3845 | /** |
| 3846 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3847 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | * @staId: station identifier |
| 3849 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3850 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3851 | */ |
Jeff Johnson | 5336784 | 2017-10-03 11:10:34 -0700 | [diff] [blame] | 3852 | QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter, |
| 3853 | uint8_t staId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3854 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3855 | QDF_STATUS qdf_status; |
Jeff Johnson | 4f7f7c6 | 2017-10-05 08:53:41 -0700 | [diff] [blame] | 3856 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3857 | 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] | 3858 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3859 | staId); |
Kabilan Kannan | b4e0137 | 2018-01-15 13:33:10 -0800 | [diff] [blame] | 3860 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3861 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3862 | } |
| 3863 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 3864 | #else |
| 3865 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3866 | inline QDF_STATUS hdd_roam_deregister_tdlssta(struct hdd_adapter *adapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 3867 | uint8_t staId) |
| 3868 | { |
| 3869 | return QDF_STATUS_SUCCESS; |
| 3870 | } |
| 3871 | |
| 3872 | static inline QDF_STATUS |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3873 | hdd_roam_tdls_status_update_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 3874 | struct csr_roam_info *roam_info, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 3875 | uint32_t roamId, |
| 3876 | eRoamCmdStatus roamStatus, |
| 3877 | eCsrRoamResult roamResult) |
| 3878 | { |
| 3879 | return QDF_STATUS_SUCCESS; |
| 3880 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3881 | #endif |
| 3882 | |
| 3883 | #ifdef WLAN_FEATURE_11W |
| 3884 | /** |
| 3885 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3886 | * @adapter: pointer to the adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3887 | * @nFrameLength: Length of the unprotected frame being passed |
| 3888 | * @pbFrames: Pointer to the frame buffer |
| 3889 | * @frameType: 802.11 frame type |
| 3890 | * |
| 3891 | * This function forwards the unprotected management frame to the supplicant. |
| 3892 | * |
| 3893 | * Return: nothing |
| 3894 | */ |
| 3895 | static void |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 3896 | hdd_indicate_unprot_mgmt_frame(struct hdd_adapter *adapter, |
| 3897 | uint32_t nFrameLength, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3898 | uint8_t *pbFrames, uint8_t frameType) |
| 3899 | { |
| 3900 | uint8_t type = 0; |
| 3901 | uint8_t subType = 0; |
| 3902 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3903 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3904 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3905 | |
| 3906 | /* Sanity Checks */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3907 | if (NULL == adapter) { |
| 3908 | hdd_err("adapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3909 | return; |
| 3910 | } |
| 3911 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3912 | if (NULL == adapter->dev) { |
| 3913 | hdd_err("adapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3914 | return; |
| 3915 | } |
| 3916 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3917 | if (WLAN_HDD_ADAPTER_MAGIC != adapter->magic) { |
| 3918 | hdd_err("adapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3919 | return; |
| 3920 | } |
| 3921 | |
| 3922 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3923 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3924 | return; |
| 3925 | } |
| 3926 | |
| 3927 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3928 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3929 | return; |
| 3930 | } |
| 3931 | |
| 3932 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 3933 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 3934 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3935 | /* Get adapter from Destination mac address of the frame */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3936 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 3937 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3938 | cfg80211_rx_unprot_mlme_mgmt(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3939 | nFrameLength); |
| 3940 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3941 | cfg80211_send_unprot_disassoc(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3942 | nFrameLength); |
| 3943 | #endif |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 3944 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_disassoc_rx++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3945 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 3946 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 3947 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3948 | cfg80211_rx_unprot_mlme_mgmt(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3949 | nFrameLength); |
| 3950 | #else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3951 | cfg80211_send_unprot_deauth(adapter->dev, pbFrames, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3952 | nFrameLength); |
| 3953 | #endif |
Jeff Johnson | dc179f4 | 2017-10-21 11:27:26 -0700 | [diff] [blame] | 3954 | adapter->hdd_stats.hdd_pmf_stats.num_unprot_deauth_rx++; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3955 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3956 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3957 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3958 | return; |
| 3959 | } |
| 3960 | } |
| 3961 | #endif |
| 3962 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 3963 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3964 | /** |
| 3965 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3966 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3967 | * @tid: traffic identifier |
| 3968 | * @state: state |
| 3969 | * @measInterval: measurement interval |
| 3970 | * |
| 3971 | * This function sends traffic stream metrics IE information to |
| 3972 | * the supplicant via wireless event. |
| 3973 | * |
| 3974 | * Return: none |
| 3975 | */ |
| 3976 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3977 | hdd_indicate_tsm_ie(struct hdd_adapter *adapter, uint8_t tid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3978 | uint8_t state, uint16_t measInterval) |
| 3979 | { |
| 3980 | union iwreq_data wrqu; |
| 3981 | char buf[IW_CUSTOM_MAX + 1]; |
| 3982 | int nBytes = 0; |
| 3983 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 3984 | if (NULL == adapter) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | return; |
| 3986 | |
| 3987 | /* create the event */ |
| 3988 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 3989 | memset(buf, '\0', sizeof(buf)); |
| 3990 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3991 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3992 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | |
| 3994 | nBytes = |
| 3995 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 3996 | measInterval); |
| 3997 | |
| 3998 | wrqu.data.pointer = buf; |
| 3999 | wrqu.data.length = nBytes; |
| 4000 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4001 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4002 | } |
| 4003 | |
| 4004 | /** |
| 4005 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4006 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4007 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4008 | * |
| 4009 | * This function sends cckm preauth indication to the supplicant |
| 4010 | * via wireless custom event. |
| 4011 | * |
| 4012 | * Return: none |
| 4013 | */ |
| 4014 | static void |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4015 | hdd_indicate_cckm_pre_auth(struct hdd_adapter *adapter, |
| 4016 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4017 | { |
| 4018 | union iwreq_data wrqu; |
| 4019 | char buf[IW_CUSTOM_MAX + 1]; |
| 4020 | char *pos = buf; |
| 4021 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4022 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4023 | if ((NULL == adapter) || (NULL == roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4024 | return; |
| 4025 | |
| 4026 | /* create the event */ |
| 4027 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4028 | memset(buf, '\0', sizeof(buf)); |
| 4029 | |
| 4030 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4031 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4032 | MAC_ADDR_ARRAY(roam_info->bssid.bytes), |
| 4033 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4034 | |
| 4035 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4036 | pos += nBytes; |
| 4037 | freeBytes -= nBytes; |
| 4038 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4039 | qdf_mem_copy(pos, roam_info->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4040 | pos += QDF_MAC_ADDR_SIZE; |
| 4041 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4042 | |
| 4043 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4044 | roam_info->timestamp[0], roam_info->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | freeBytes -= nBytes; |
| 4046 | |
| 4047 | wrqu.data.pointer = buf; |
| 4048 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4049 | |
| 4050 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4051 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4052 | } |
| 4053 | |
| 4054 | /** |
| 4055 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4056 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4057 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4058 | * |
| 4059 | * Return: none |
| 4060 | */ |
| 4061 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4062 | hdd_indicate_ese_adj_ap_rep_ind(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4063 | struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4064 | { |
| 4065 | union iwreq_data wrqu; |
| 4066 | char buf[IW_CUSTOM_MAX + 1]; |
| 4067 | int nBytes = 0; |
| 4068 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4069 | if ((NULL == adapter) || (NULL == roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4070 | return; |
| 4071 | |
| 4072 | /* create the event */ |
| 4073 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4074 | memset(buf, '\0', sizeof(buf)); |
| 4075 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4076 | hdd_debug("CCXADJAPREP=%u", roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4077 | |
| 4078 | nBytes = |
| 4079 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4080 | roam_info->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4081 | |
| 4082 | wrqu.data.pointer = buf; |
| 4083 | wrqu.data.length = nBytes; |
| 4084 | |
| 4085 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4086 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4087 | } |
| 4088 | |
| 4089 | /** |
| 4090 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4091 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4092 | * @measurementToken: measurement token |
| 4093 | * @flag: flag |
| 4094 | * @numBss: number of bss |
| 4095 | * |
| 4096 | * If the measurement is none and no scan results found, |
| 4097 | * indicate the supplicant about measurement done. |
| 4098 | * |
| 4099 | * Return: none |
| 4100 | */ |
| 4101 | void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4102 | hdd_indicate_ese_bcn_report_no_results(const struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4103 | const uint16_t measurementToken, |
| 4104 | const bool flag, const uint8_t numBss) |
| 4105 | { |
| 4106 | union iwreq_data wrqu; |
| 4107 | char buf[IW_CUSTOM_MAX]; |
| 4108 | char *pos = buf; |
| 4109 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4110 | |
| 4111 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4112 | memset(buf, '\0', sizeof(buf)); |
| 4113 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4114 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4115 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4116 | |
| 4117 | nBytes = |
| 4118 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4119 | flag, numBss); |
| 4120 | |
| 4121 | wrqu.data.pointer = buf; |
| 4122 | wrqu.data.length = nBytes; |
| 4123 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4124 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, buf); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4125 | } |
| 4126 | |
| 4127 | /** |
| 4128 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4129 | * @adapter: pointer to adapter |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4130 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4131 | * |
| 4132 | * If the measurement is none and no scan results found, |
| 4133 | * indicate the supplicant about measurement done. |
| 4134 | * |
| 4135 | * Return: none |
| 4136 | */ |
| 4137 | static void |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4138 | hdd_indicate_ese_bcn_report_ind(const struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4139 | const struct csr_roam_info *roam_info) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4140 | { |
| 4141 | union iwreq_data wrqu; |
| 4142 | char buf[IW_CUSTOM_MAX]; |
| 4143 | char *pos = buf; |
| 4144 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4145 | uint8_t i = 0, len = 0; |
| 4146 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4147 | uint8_t lastSent = 0, sendBss = 0; |
| 4148 | int bcnRepFieldSize = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4149 | sizeof(roam_info->pEseBcnReportRsp->bcnRepBssInfo[0]. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4150 | bcnReportFields); |
| 4151 | uint8_t ieLenByte = 1; |
| 4152 | /* |
| 4153 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4154 | */ |
| 4155 | #define ESEBCNREPHEADER_LEN (18) |
| 4156 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4157 | if ((NULL == adapter) || (NULL == roam_info)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4158 | return; |
| 4159 | |
| 4160 | /* |
| 4161 | * Custom event can pass maximum of 256 bytes of data, |
| 4162 | * based on the IE len we need to identify how many BSS info can |
| 4163 | * be filled in to custom event data. |
| 4164 | */ |
| 4165 | /* |
| 4166 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4167 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4168 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4169 | */ |
| 4170 | |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4171 | if ((roam_info->pEseBcnReportRsp->flag >> 1) |
| 4172 | && (!roam_info->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4173 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4174 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4175 | * indicate the supplicant about measurement done |
| 4176 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4177 | hdd_indicate_ese_bcn_report_no_results( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4178 | adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4179 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4180 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4181 | roam_info->pEseBcnReportRsp->flag, |
| 4182 | roam_info->pEseBcnReportRsp->numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4183 | } else { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4184 | while (lastSent < roam_info->pEseBcnReportRsp->numBss) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4185 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4186 | memset(buf, '\0', sizeof(buf)); |
| 4187 | tot_bcn_ieLen = 0; |
| 4188 | sendBss = 0; |
| 4189 | pos = buf; |
| 4190 | freeBytes = IW_CUSTOM_MAX; |
| 4191 | |
| 4192 | for (i = lastSent; |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4193 | i < roam_info->pEseBcnReportRsp->numBss; i++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4194 | len = |
| 4195 | bcnRepFieldSize + ieLenByte + |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4196 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4197 | bcnRepBssInfo[i].ieLen; |
| 4198 | if ((len + tot_bcn_ieLen) > |
| 4199 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4200 | break; |
| 4201 | } |
| 4202 | tot_bcn_ieLen += len; |
| 4203 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4204 | 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] | 4205 | i, bcnRepFieldSize, 1, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4206 | roam_info->pEseBcnReportRsp-> |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4207 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4208 | } |
| 4209 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4210 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4211 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4212 | roam_info->pEseBcnReportRsp->measurementToken, |
| 4213 | roam_info->pEseBcnReportRsp->flag, sendBss, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4214 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4215 | |
| 4216 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4217 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4218 | measurementToken, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4219 | roam_info->pEseBcnReportRsp->flag, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4220 | sendBss); |
| 4221 | pos += nBytes; |
| 4222 | freeBytes -= nBytes; |
| 4223 | |
| 4224 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4225 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4226 | sizeof(tot_bcn_ieLen)); |
| 4227 | pos += sizeof(tot_bcn_ieLen); |
| 4228 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4229 | |
| 4230 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4231 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4232 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4233 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4234 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4235 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4236 | bcnRepBssInfo[i + |
| 4237 | lastSent].bcnReportFields. |
| 4238 | ChanNum, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4239 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4240 | bcnRepBssInfo[i + |
| 4241 | lastSent].bcnReportFields. |
| 4242 | Spare, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4243 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4244 | bcnRepBssInfo[i + |
| 4245 | lastSent].bcnReportFields. |
| 4246 | MeasDuration, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4247 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4248 | bcnRepBssInfo[i + |
| 4249 | lastSent].bcnReportFields. |
| 4250 | PhyType, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4251 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4252 | bcnRepBssInfo[i + |
| 4253 | lastSent].bcnReportFields. |
| 4254 | RecvSigPower, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4255 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4256 | bcnRepBssInfo[i + |
| 4257 | lastSent].bcnReportFields. |
| 4258 | ParentTsf, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4259 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4260 | bcnRepBssInfo[i + |
| 4261 | lastSent].bcnReportFields. |
| 4262 | TargetTsf[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4263 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4264 | bcnRepBssInfo[i + |
| 4265 | lastSent].bcnReportFields. |
| 4266 | TargetTsf[1], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4267 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4268 | bcnRepBssInfo[i + |
| 4269 | lastSent].bcnReportFields. |
| 4270 | BcnInterval, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4271 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4272 | bcnRepBssInfo[i + |
| 4273 | lastSent].bcnReportFields. |
| 4274 | CapabilityInfo, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4275 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4276 | bcnRepBssInfo[i + |
| 4277 | lastSent].bcnReportFields. |
| 4278 | Bssid[0], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4279 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4280 | bcnRepBssInfo[i + |
| 4281 | lastSent].bcnReportFields. |
| 4282 | Bssid[1], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4283 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4284 | bcnRepBssInfo[i + |
| 4285 | lastSent].bcnReportFields. |
| 4286 | Bssid[2], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4287 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4288 | bcnRepBssInfo[i + |
| 4289 | lastSent].bcnReportFields. |
| 4290 | Bssid[3], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4291 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | bcnRepBssInfo[i + |
| 4293 | lastSent].bcnReportFields. |
| 4294 | Bssid[4], |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4295 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4296 | bcnRepBssInfo[i + |
| 4297 | lastSent].bcnReportFields. |
| 4298 | Bssid[5]); |
| 4299 | |
| 4300 | /* bcn report fields are copied */ |
| 4301 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4302 | sizeof(roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4303 | bcnRepBssInfo[i + |
| 4304 | lastSent]. |
| 4305 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4306 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4307 | (char *)&roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4308 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4309 | lastSent]. |
| 4310 | bcnReportFields, len); |
| 4311 | pos += len; |
| 4312 | freeBytes -= len; |
| 4313 | |
| 4314 | /* Add 1 byte of ie len */ |
| 4315 | len = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4316 | roam_info->pEseBcnReportRsp-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4317 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4318 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4319 | pos += sizeof(len); |
| 4320 | freeBytes -= sizeof(len); |
| 4321 | |
| 4322 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4323 | qdf_mem_copy(pos, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4324 | (char *)roam_info-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4325 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4326 | lastSent]. |
| 4327 | pBuf, len); |
| 4328 | pos += len; |
| 4329 | freeBytes -= len; |
| 4330 | } |
| 4331 | |
| 4332 | wrqu.data.pointer = buf; |
| 4333 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4334 | |
| 4335 | /* send the event */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4336 | wireless_send_event(adapter->dev, IWEVCUSTOM, &wrqu, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4337 | buf); |
| 4338 | lastSent += sendBss; |
| 4339 | } |
| 4340 | } |
| 4341 | } |
| 4342 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4343 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4344 | |
| 4345 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4346 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4347 | * @sta_ctx: Station Context |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4348 | * |
| 4349 | * API to check if the connection authentication type is 8021x_sha256. |
| 4350 | * |
| 4351 | * Return: bool |
| 4352 | */ |
| 4353 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4354 | static inline bool |
| 4355 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4356 | { |
| 4357 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4358 | sta_ctx->conn_info.authType; |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4359 | } |
| 4360 | #else |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 4361 | static inline bool |
| 4362 | hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *sta_ctx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4363 | { |
| 4364 | return false; |
| 4365 | } |
| 4366 | #endif |
| 4367 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4368 | /* |
| 4369 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4370 | * @adapter: Pointer to adapter context |
| 4371 | * @roam_info: Pointer to roam info |
| 4372 | * |
| 4373 | * Return: None |
| 4374 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 4375 | static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter, |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4376 | struct csr_roam_info *roam_info) |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4377 | { |
| 4378 | struct hdd_chan_change_params chan_change; |
| 4379 | struct cfg80211_bss *bss; |
| 4380 | struct net_device *dev = adapter->dev; |
| 4381 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4382 | struct wiphy *wiphy = wdev->wiphy; |
| 4383 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4384 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4385 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4386 | hdd_debug("channel switch for session:%d to channel:%d", |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4387 | adapter->session_id, roam_info->chan_info.chan_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4388 | |
| 4389 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4390 | chan_change.chan_params.ch_width = |
| 4391 | roam_info->chan_info.ch_width; |
| 4392 | chan_change.chan_params.sec_ch_offset = |
| 4393 | roam_info->chan_info.sec_ch_offset; |
| 4394 | chan_change.chan_params.center_freq_seg0 = |
| 4395 | roam_info->chan_info.band_center_freq1; |
| 4396 | chan_change.chan_params.center_freq_seg1 = |
| 4397 | roam_info->chan_info.band_center_freq2; |
| 4398 | |
| 4399 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4400 | if (NULL == bss) |
| 4401 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4402 | else |
| 4403 | cfg80211_put_bss(wiphy, bss); |
| 4404 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4405 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4406 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4407 | if (QDF_IS_STATUS_ERROR(status)) |
| 4408 | hdd_err("channel change notification failed"); |
| 4409 | |
Ganesh Kondabattini | 41f3478 | 2017-09-14 21:14:29 +0530 | [diff] [blame] | 4410 | hdd_debug("check for SAP restart"); |
| 4411 | policy_mgr_check_concurrent_intf_and_restart_sap(hdd_ctx->hdd_psoc); |
| 4412 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4413 | 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] | 4414 | adapter->session_id); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4415 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4416 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4417 | } |
| 4418 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4419 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4420 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4421 | * @pContext: pointer to adapter context |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4422 | * @roam_info: pointer to roam info |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4423 | * @roamId: roam id |
| 4424 | * @roamStatus: roam status |
| 4425 | * @roamResult: roam result |
| 4426 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4427 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4428 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4429 | QDF_STATUS |
Jeff Johnson | 172237b | 2017-11-07 15:32:59 -0800 | [diff] [blame] | 4430 | hdd_sme_roam_callback(void *pContext, struct csr_roam_info *roam_info, |
| 4431 | uint32_t roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4432 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4433 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4434 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4435 | struct hdd_adapter *adapter = (struct hdd_adapter *) pContext; |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4436 | struct hdd_wext_state *pWextState = NULL; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4437 | struct hdd_station_ctx *sta_ctx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4438 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4439 | struct cfg80211_bss *bss_status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4440 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4441 | |
Abhinav Kumar | 5670d36 | 2018-01-16 17:31:54 +0530 | [diff] [blame] | 4442 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4443 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
| 4444 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4445 | |
| 4446 | /* Sanity check */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4447 | if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4448 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4449 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4450 | } |
| 4451 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4452 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4453 | sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4454 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4455 | |
Sreelakshmi Konamki | 075431a | 2017-03-16 15:23:30 +0530 | [diff] [blame] | 4456 | /* Omitting eCSR_ROAM_UPDATE_SCAN_RESULT as this is too frequent */ |
| 4457 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4458 | 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] | 4459 | adapter->session_id, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4460 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4461 | switch (roamStatus) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4462 | /* |
| 4463 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4464 | * reassoc failed due to failure, timeout, reject from ap |
| 4465 | * in any case tell the OS, our carrier is off and mark |
| 4466 | * interface down. |
| 4467 | */ |
| 4468 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4469 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4470 | roamStatus, roamResult, adapter->session_id); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4471 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4472 | hdd_dis_connect_handler(adapter, roam_info, roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4473 | roamStatus, roamResult); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4474 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4475 | sta_ctx->hdd_reassoc_scenario = false; |
| 4476 | hdd_debug("hdd_reassoc_scenario set to: %d, ReAssoc Failed, session: %d", |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4477 | sta_ctx->hdd_reassoc_scenario, adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4478 | break; |
| 4479 | |
| 4480 | case eCSR_ROAM_FT_START: |
| 4481 | /* |
| 4482 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4483 | * informed that the link is down. So mark the link ready for |
| 4484 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4485 | * be received. Where in we will not mark the link down |
| 4486 | * Also we want to stop tx at this point when we will be |
| 4487 | * doing disassoc at this time. This saves 30-60 msec |
| 4488 | * after reassoc. |
| 4489 | */ |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4490 | hdd_debug("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4491 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4492 | hdd_napi_serialize(1); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4493 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4494 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4495 | WLAN_CONTROL_PATH); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4496 | status = hdd_roam_deregister_sta(adapter, |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4497 | sta_ctx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4498 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4499 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4500 | sta_ctx->ft_carrier_on = true; |
Jeff Johnson | 690fe95 | 2017-10-25 11:48:39 -0700 | [diff] [blame] | 4501 | sta_ctx->hdd_reassoc_scenario = true; |
| 4502 | 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] | 4503 | sta_ctx->hdd_reassoc_scenario, adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4504 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4505 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4506 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4507 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4508 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4509 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4510 | adapter->roam_ho_fail = true; |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4511 | else |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4512 | adapter->roam_ho_fail = false; |
| 4513 | complete(&adapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4514 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4515 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4516 | /* notify apps that we can't pass traffic anymore */ |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 4517 | hdd_info("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4518 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4519 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4520 | WLAN_CONTROL_PATH); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4521 | if (sta_ctx->ft_carrier_on == false) { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4522 | wlan_hdd_netif_queue_control(adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4523 | WLAN_NETIF_CARRIER_OFF, |
| 4524 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4525 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4526 | break; |
| 4527 | case eCSR_ROAM_LOSTLINK: |
| 4528 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4529 | hdd_debug("Roaming started due to connection lost"); |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 4530 | hdd_debug("Disabling queues"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4531 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4532 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4533 | WLAN_CONTROL_PATH); |
| 4534 | break; |
| 4535 | } |
| 4536 | case eCSR_ROAM_DISASSOCIATED: |
| 4537 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4538 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4539 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 4540 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4541 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4542 | adapter->roam_ho_fail = false; |
| 4543 | complete(&adapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 4544 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4545 | /* Call to clear any MC Addr List filter applied after |
| 4546 | * successful connection. |
| 4547 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4548 | hdd_disable_and_flush_mc_addr_list(adapter, |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4549 | pmo_peer_disconnect); |
| 4550 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4551 | hdd_dis_connect_handler(adapter, roam_info, roamId, |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 4552 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4553 | } |
| 4554 | break; |
| 4555 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4556 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4557 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4558 | hdd_dis_connect_handler(adapter, roam_info, roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4559 | roamStatus, roamResult); |
| 4560 | break; |
| 4561 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4562 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4563 | /* |
| 4564 | * To Do - address probable memory leak with WEP encryption upon |
| 4565 | * successful association. |
| 4566 | */ |
| 4567 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 4568 | /* Clear saved connection information in HDD */ |
| 4569 | hdd_conn_remove_connect_info( |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4570 | WLAN_HDD_GET_STATION_CTX_PTR(adapter)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4571 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4572 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4573 | hdd_association_completion_handler(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4574 | roamId, roamStatus, |
| 4575 | roamResult); |
| 4576 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4577 | if (roam_info) |
| 4578 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4579 | #endif |
| 4580 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 4581 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4582 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4583 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4584 | qdf_ret_status = hdd_association_completion_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4585 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4586 | roamId, |
| 4587 | roamStatus, |
| 4588 | roamResult); |
| 4589 | break; |
| 4590 | case eCSR_ROAM_IBSS_IND: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4591 | hdd_roam_ibss_indication_handler(adapter, roam_info, roamId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4592 | roamStatus, roamResult); |
| 4593 | break; |
| 4594 | |
| 4595 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4596 | qdf_ret_status = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4597 | roam_roam_connect_status_update_handler(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4598 | roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4599 | roamId, |
| 4600 | roamStatus, |
| 4601 | roamResult); |
| 4602 | break; |
| 4603 | |
| 4604 | case eCSR_ROAM_MIC_ERROR_IND: |
Jeff Johnson | 8b5e8f7 | 2017-10-16 12:36:09 -0700 | [diff] [blame] | 4605 | hdd_roam_mic_error_indication_handler(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4606 | break; |
| 4607 | |
| 4608 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 4609 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4610 | qdf_ret_status = |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4611 | hdd_roam_set_key_complete_handler(adapter, roam_info, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4612 | roamId, roamStatus, |
| 4613 | roamResult); |
| 4614 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
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, set key complete, session: %d", |
| 4617 | sta_ctx->hdd_reassoc_scenario, |
Jeff Johnson | 1b780e4 | 2017-10-31 14:11:45 -0700 | [diff] [blame] | 4618 | adapter->session_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4619 | } |
| 4620 | } |
| 4621 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4622 | if (roam_info != NULL) |
| 4623 | roam_info->roamSynchInProgress = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4624 | #endif |
| 4625 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4626 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4627 | case eCSR_ROAM_FT_RESPONSE: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4628 | hdd_send_ft_event(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4629 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4630 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4631 | case eCSR_ROAM_PMK_NOTIFY: |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4632 | if (eCSR_AUTH_TYPE_RSN == sta_ctx->conn_info.authType |
| 4633 | || hdd_is_8021x_sha256_auth_type(sta_ctx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4634 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4635 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4636 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4637 | adapter, roam_info, 1, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4638 | } |
| 4639 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4640 | |
| 4641 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 4642 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 4643 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4644 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4645 | wlan_hdd_cfg80211_roam_metrics_preauth(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4646 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4647 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4648 | } |
| 4649 | break; |
| 4650 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 4651 | /* |
| 4652 | * This event will notify pre-auth completion in case of success |
| 4653 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4654 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4655 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4656 | roam_info, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4657 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4658 | } |
| 4659 | break; |
| 4660 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 4661 | /* |
| 4662 | * This event will notify pre-auth completion incase of failure. |
| 4663 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4664 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4665 | wlan_hdd_cfg80211_roam_metrics_preauth_status(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4666 | roam_info, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4667 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4668 | } |
| 4669 | break; |
| 4670 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 4671 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4672 | * It will be only invoked on success |
| 4673 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4674 | if (QDF_STATUS_SUCCESS != |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4675 | wlan_hdd_cfg80211_roam_metrics_handover(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4676 | roam_info)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4677 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4678 | } |
| 4679 | break; |
| 4680 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4681 | #ifdef WLAN_FEATURE_11W |
| 4682 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4683 | hdd_indicate_unprot_mgmt_frame(adapter, |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4684 | roam_info->nFrameLength, |
| 4685 | roam_info->pbFrames, |
| 4686 | roam_info->frameType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4687 | break; |
| 4688 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4689 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4690 | case eCSR_ROAM_TSM_IE_IND: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4691 | hdd_indicate_tsm_ie(adapter, roam_info->tsmIe.tsid, |
| 4692 | roam_info->tsmIe.state, |
| 4693 | roam_info->tsmIe.msmt_interval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4694 | break; |
| 4695 | |
| 4696 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 4697 | { |
| 4698 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4699 | sta_ctx->conn_info.authType |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4700 | || eCSR_AUTH_TYPE_CCKM_RSN == |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4701 | sta_ctx->conn_info.authType) { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4702 | hdd_indicate_cckm_pre_auth(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4703 | } |
| 4704 | break; |
| 4705 | } |
| 4706 | |
| 4707 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 4708 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4709 | hdd_indicate_ese_adj_ap_rep_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4710 | break; |
| 4711 | } |
| 4712 | |
| 4713 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 4714 | { |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4715 | hdd_indicate_ese_bcn_report_ind(adapter, roam_info); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4716 | break; |
| 4717 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4718 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4719 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4720 | hdd_roam_channel_switch_handler(adapter, roam_info); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 4721 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4722 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4723 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4724 | if ((NULL != roam_info) && (NULL != roam_info->pBssDesc)) { |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4725 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4726 | adapter, roam_info->pBssDesc); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4727 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4728 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4729 | else |
| 4730 | cfg80211_put_bss( |
| 4731 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4732 | (WLAN_HDD_GET_CTX(adapter))->wiphy, |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4733 | #endif |
| 4734 | bss_status); |
| 4735 | } |
| 4736 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4737 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
Jeff Johnson | fd06085 | 2017-10-04 10:50:51 -0700 | [diff] [blame] | 4738 | hdd_ndp_event_handler(adapter, roam_info, roamId, roamStatus, |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 4739 | roamResult); |
| 4740 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4741 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4742 | hdd_debug("Process ROAM_START from firmware"); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4743 | wlan_hdd_netif_queue_control(adapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4744 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4745 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4746 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 4747 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4748 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4749 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4750 | break; |
| 4751 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4752 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4753 | hdd_napi_serialize(0); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4754 | wlan_hdd_netif_queue_control(adapter, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4755 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 4756 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 4757 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4758 | hdd_set_roaming_in_progress(false); |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4759 | adapter->roam_ho_fail = false; |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 4760 | sta_ctx->ft_carrier_on = false; |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4761 | complete(&adapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 4762 | break; |
| 4763 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4764 | default: |
| 4765 | break; |
| 4766 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4767 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4768 | } |
| 4769 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4770 | #ifdef WLAN_FEATURE_FILS_SK |
| 4771 | /** |
| 4772 | * hdd_translate_fils_rsn_to_csr_auth() - Translate FILS RSN to CSR auth type |
| 4773 | * @auth_suite: auth suite |
| 4774 | * @auth_type: pointer to eCsrAuthType |
| 4775 | * |
| 4776 | * Return: None |
| 4777 | */ |
| 4778 | static void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4779 | eCsrAuthType *auth_type) |
| 4780 | { |
| 4781 | if (!memcmp(auth_suite, ccp_rsn_oui_0e, 4)) |
| 4782 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA256; |
| 4783 | else if (!memcmp(auth_suite, ccp_rsn_oui_0f, 4)) |
| 4784 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA384; |
| 4785 | else if (!memcmp(auth_suite, ccp_rsn_oui_10, 4)) |
| 4786 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA256; |
| 4787 | else if (!memcmp(auth_suite, ccp_rsn_oui_11, 4)) |
| 4788 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA384; |
| 4789 | } |
| 4790 | #else |
| 4791 | static inline void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4792 | eCsrAuthType *auth_type) |
| 4793 | { |
| 4794 | } |
| 4795 | #endif |
| 4796 | |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 4797 | #ifdef WLAN_FEATURE_SAE |
| 4798 | /** |
| 4799 | * hdd_translate_sae_rsn_to_csr_auth() - Translate SAE RSN to CSR auth type |
| 4800 | * @auth_suite: auth suite |
| 4801 | * @auth_type: pointer to eCsrAuthType |
| 4802 | * |
| 4803 | * Return: None |
| 4804 | */ |
| 4805 | static void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4806 | eCsrAuthType *auth_type) |
| 4807 | { |
| 4808 | if (qdf_mem_cmp(auth_suite, ccp_rsn_oui_80, 4) == 0) |
| 4809 | *auth_type = eCSR_AUTH_TYPE_SAE; |
| 4810 | } |
| 4811 | #else |
| 4812 | static inline void hdd_translate_sae_rsn_to_csr_auth(int8_t auth_suite[4], |
| 4813 | eCsrAuthType *auth_type) |
| 4814 | { |
| 4815 | } |
| 4816 | #endif |
| 4817 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4818 | /** |
| 4819 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 4820 | * @auth_suite: auth suite |
| 4821 | * |
| 4822 | * Return: eCsrAuthType enumeration |
| 4823 | */ |
| 4824 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 4825 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4826 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4827 | /* is the auth type supported? */ |
| 4828 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 4829 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 4830 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 4831 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 4832 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4833 | /* Check for 11r FT Authentication with PSK */ |
| 4834 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 4835 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 4836 | /* Check for 11R FT Authentication with 802.1X */ |
| 4837 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 4838 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4839 | #ifdef FEATURE_WLAN_ESE |
| 4840 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 4841 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 4842 | } else |
| 4843 | #endif /* FEATURE_WLAN_ESE */ |
| 4844 | #ifdef WLAN_FEATURE_11W |
| 4845 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 4846 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 4847 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 4848 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 4849 | } else if (memcmp(auth_suite, ccp_rsn_oui_18, 4) == 0) { |
| 4850 | auth_type = eCSR_AUTH_TYPE_OWE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4851 | } else |
| 4852 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 4853 | if (memcmp(auth_suite, ccp_rsn_oui_12, 4) == 0) { |
| 4854 | auth_type = eCSR_AUTH_TYPE_DPP_RSN; |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 4855 | } else if (memcmp(auth_suite, ccp_rsn_oui_0b, 4) == 0) { |
| 4856 | /* Check for Suite B EAP 256 */ |
| 4857 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
| 4858 | } else if (memcmp(auth_suite, ccp_rsn_oui_0c, 4) == 0) { |
| 4859 | /* Check for Suite B EAP 384 */ |
| 4860 | auth_type = eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 4861 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4862 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4863 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 4864 | hdd_translate_sae_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4865 | } |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4866 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4867 | return auth_type; |
| 4868 | } |
| 4869 | |
| 4870 | /** |
| 4871 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 4872 | * @auth_suite: auth suite |
| 4873 | * |
| 4874 | * Return: eCsrAuthType enumeration |
| 4875 | */ |
| 4876 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 4877 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4878 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4879 | /* is the auth type supported? */ |
| 4880 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 4881 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 4882 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 4883 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 4884 | } else |
| 4885 | #ifdef FEATURE_WLAN_ESE |
| 4886 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 4887 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 4888 | } else |
| 4889 | #endif /* FEATURE_WLAN_ESE */ |
| 4890 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 4891 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4892 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4893 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4894 | return auth_type; |
| 4895 | } |
| 4896 | |
| 4897 | /** |
| 4898 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 4899 | * Translate RSN to CSR encryption type |
| 4900 | * @cipher_suite: cipher suite |
| 4901 | * |
| 4902 | * Return: eCsrEncryptionType enumeration |
| 4903 | */ |
| 4904 | eCsrEncryptionType |
| 4905 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 4906 | { |
| 4907 | eCsrEncryptionType cipher_type; |
| 4908 | |
| 4909 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 4910 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 4911 | else if (memcmp(cipher_suite, ccp_rsn_oui09, 4) == 0) |
| 4912 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP; |
| 4913 | else if (memcmp(cipher_suite, ccp_rsn_oui0a, 4) == 0) |
| 4914 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4915 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 4916 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 4917 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 4918 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 4919 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 4920 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4921 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 4922 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4923 | else |
| 4924 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4925 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4926 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4927 | return cipher_type; |
| 4928 | } |
| 4929 | |
| 4930 | /** |
| 4931 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 4932 | * Translate WPA to CSR encryption type |
| 4933 | * @cipher_suite: cipher suite |
| 4934 | * |
| 4935 | * Return: eCsrEncryptionType enumeration |
| 4936 | */ |
| 4937 | eCsrEncryptionType |
| 4938 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 4939 | { |
| 4940 | eCsrEncryptionType cipher_type; |
| 4941 | |
| 4942 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 4943 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 4944 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 4945 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 4946 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 4947 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 4948 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 4949 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 4950 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 4951 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 4952 | else |
| 4953 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 4954 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4955 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4956 | return cipher_type; |
| 4957 | } |
| 4958 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4959 | #ifdef WLAN_FEATURE_FILS_SK |
| 4960 | /* |
| 4961 | * hdd_is_fils_connection: API to determine if connection is FILS |
| 4962 | * @adapter: hdd adapter |
| 4963 | * |
| 4964 | * Return: true if fils connection else false |
| 4965 | */ |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 4966 | static inline bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4967 | { |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 4968 | struct hdd_wext_state *wext_state = |
| 4969 | WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4970 | |
| 4971 | if (wext_state->roamProfile.fils_con_info) |
| 4972 | return wext_state->roamProfile. |
| 4973 | fils_con_info->is_fils_connection; |
Min Liu | ab6ed4f | 2018-01-09 13:13:57 +0800 | [diff] [blame] | 4974 | |
| 4975 | return false; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4976 | } |
| 4977 | #else |
Jeff Johnson | b1704c8 | 2017-08-29 14:40:57 -0700 | [diff] [blame] | 4978 | static inline bool hdd_is_fils_connection(struct hdd_adapter *adapter) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 4979 | { |
| 4980 | return false; |
| 4981 | } |
| 4982 | #endif |
| 4983 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4984 | /** |
| 4985 | * hdd_process_genie() - process gen ie |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4986 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4987 | * @bssid: pointer to mac address |
| 4988 | * @pEncryptType: pointer to encryption type |
| 4989 | * @mcEncryptType: pointer to multicast encryption type |
| 4990 | * @pAuthType: pointer to auth type |
| 4991 | * |
| 4992 | * Return: 0 on success, error number otherwise |
| 4993 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 4994 | static int32_t hdd_process_genie(struct hdd_adapter *adapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4995 | u8 *bssid, |
| 4996 | eCsrEncryptionType *pEncryptType, |
| 4997 | eCsrEncryptionType *mcEncryptType, |
| 4998 | eCsrAuthType *pAuthType, |
| 4999 | #ifdef WLAN_FEATURE_11W |
| 5000 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5001 | #endif |
| 5002 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5003 | { |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5004 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5005 | tDot11fIERSN dot11RSNIE; |
| 5006 | tDot11fIEWPA dot11WPAIE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5007 | uint8_t *pRsnIe; |
| 5008 | uint16_t RSNIeLen; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5009 | uint32_t parse_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5010 | |
| 5011 | /* |
| 5012 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5013 | * setting present flag to 0. |
| 5014 | */ |
| 5015 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5016 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5017 | |
| 5018 | /* Type check */ |
| 5019 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5020 | /* Validity checks */ |
| 5021 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5022 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5023 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5024 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5025 | return -EINVAL; |
| 5026 | } |
| 5027 | /* Skip past the EID byte and length byte */ |
| 5028 | pRsnIe = gen_ie + 2; |
| 5029 | RSNIeLen = gen_ie_len - 2; |
| 5030 | /* Unpack the RSN IE */ |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5031 | parse_status = sme_unpack_rsn_ie(halHandle, pRsnIe, RSNIeLen, |
Abhishek Singh | 7dcb85b | 2017-12-27 15:15:01 +0530 | [diff] [blame] | 5032 | &dot11RSNIE, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5033 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5034 | hdd_err("Invalid RSN IE: parse status %d", |
| 5035 | parse_status); |
| 5036 | return -EINVAL; |
| 5037 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5038 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5039 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5040 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5041 | hdd_debug("authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5042 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5043 | /* dot11RSNIE.akm_suite_count */ |
| 5044 | /* Just translate the FIRST one */ |
| 5045 | *pAuthType = |
| 5046 | hdd_translate_rsn_to_csr_auth_type( |
| 5047 | dot11RSNIE.akm_suites[0]); |
| 5048 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5049 | *pEncryptType = |
| 5050 | hdd_translate_rsn_to_csr_encryption_type( |
| 5051 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5052 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5053 | *mcEncryptType = |
| 5054 | hdd_translate_rsn_to_csr_encryption_type( |
| 5055 | dot11RSNIE.gp_cipher_suite); |
| 5056 | #ifdef WLAN_FEATURE_11W |
| 5057 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 5058 | *pMfpCapable = csr_is_mfpc_capable(&dot11RSNIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5059 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5060 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5061 | /* Validity checks */ |
| 5062 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5063 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5064 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5065 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5066 | return -EINVAL; |
| 5067 | } |
| 5068 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5069 | pRsnIe = gen_ie + 2 + 4; |
| 5070 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5071 | /* Unpack the WPA IE */ |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5072 | parse_status = dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5073 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5074 | if (!DOT11F_SUCCEEDED(parse_status)) { |
| 5075 | hdd_err("Invalid WPA IE: parse status %d", |
| 5076 | parse_status); |
| 5077 | return -EINVAL; |
| 5078 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5079 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5080 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5081 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5082 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5083 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5084 | /* dot11WPAIE.auth_suite_count */ |
| 5085 | /* Just translate the FIRST one */ |
| 5086 | *pAuthType = |
| 5087 | hdd_translate_wpa_to_csr_auth_type( |
| 5088 | dot11WPAIE.auth_suites[0]); |
| 5089 | /* dot11WPAIE.unicast_cipher_count */ |
| 5090 | *pEncryptType = |
| 5091 | hdd_translate_wpa_to_csr_encryption_type( |
| 5092 | dot11WPAIE.unicast_ciphers[0]); |
| 5093 | /* dot11WPAIE.unicast_cipher_count */ |
| 5094 | *mcEncryptType = |
| 5095 | hdd_translate_wpa_to_csr_encryption_type( |
| 5096 | dot11WPAIE.multicast_cipher); |
| 5097 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5098 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5099 | return -EINVAL; |
| 5100 | } |
| 5101 | return 0; |
| 5102 | } |
| 5103 | |
| 5104 | /** |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5105 | * hdd_set_def_rsne_override() - set default encryption type and auth type |
| 5106 | * in profile. |
| 5107 | * @roam_profile: pointer to adapter |
| 5108 | * @auth_type: pointer to auth type |
| 5109 | * |
| 5110 | * Set default value of encryption type and auth type in profile to |
| 5111 | * search the AP using filter, as in force_rsne_override the RSNIE can be |
| 5112 | * currupt and we might not get the proper encryption type and auth type |
| 5113 | * while parsing the RSNIE. |
| 5114 | * |
| 5115 | * Return: void |
| 5116 | */ |
| 5117 | static void hdd_set_def_rsne_override( |
| 5118 | tCsrRoamProfile *roam_profile, eCsrAuthType *auth_type) |
| 5119 | { |
| 5120 | |
| 5121 | hdd_debug("Set def values in roam profile"); |
| 5122 | roam_profile->MFPCapable = roam_profile->MFPEnabled; |
| 5123 | roam_profile->EncryptionType.numEntries = 2; |
| 5124 | roam_profile->mcEncryptionType.numEntries = 2; |
| 5125 | /* Use the cipher type in the RSN IE */ |
| 5126 | roam_profile->EncryptionType.encryptionType[0] = eCSR_ENCRYPT_TYPE_AES; |
| 5127 | roam_profile->EncryptionType.encryptionType[1] = eCSR_ENCRYPT_TYPE_TKIP; |
| 5128 | roam_profile->mcEncryptionType.encryptionType[0] = |
| 5129 | eCSR_ENCRYPT_TYPE_AES; |
| 5130 | roam_profile->mcEncryptionType.encryptionType[1] = |
| 5131 | eCSR_ENCRYPT_TYPE_TKIP; |
| 5132 | *auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
| 5133 | } |
| 5134 | |
| 5135 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5136 | * hdd_set_genie_to_csr() - set genie to csr |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5137 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5138 | * @RSNAuthType: pointer to auth type |
| 5139 | * |
| 5140 | * Return: 0 on success, error number otherwise |
| 5141 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5142 | int hdd_set_genie_to_csr(struct hdd_adapter *adapter, |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5143 | eCsrAuthType *RSNAuthType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5144 | { |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5145 | struct hdd_wext_state *pWextState = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5146 | WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5147 | uint32_t status = 0; |
| 5148 | eCsrEncryptionType RSNEncryptType; |
| 5149 | eCsrEncryptionType mcRSNEncryptType; |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5150 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5151 | #ifdef WLAN_FEATURE_11W |
| 5152 | uint8_t RSNMfpRequired = 0; |
| 5153 | uint8_t RSNMfpCapable = 0; |
| 5154 | #endif |
| 5155 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5156 | /* MAC address of assoc peer */ |
| 5157 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5158 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5159 | pWextState->roamProfile.BSSIDs.bssid, |
| 5160 | sizeof(bssid)); |
| 5161 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5162 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5163 | /* continue */ |
| 5164 | } else { |
| 5165 | return 0; |
| 5166 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5167 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5168 | /* The actual processing may eventually be more extensive than this. */ |
| 5169 | /* 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] | 5170 | status = hdd_process_genie(adapter, bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5171 | &RSNEncryptType, |
| 5172 | &mcRSNEncryptType, RSNAuthType, |
| 5173 | #ifdef WLAN_FEATURE_11W |
| 5174 | &RSNMfpRequired, &RSNMfpCapable, |
| 5175 | #endif |
| 5176 | pWextState->WPARSNIE[1] + 2, |
| 5177 | pWextState->WPARSNIE); |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5178 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5179 | if (status == 0) { |
| 5180 | /* |
| 5181 | * Now copy over all the security attributes |
| 5182 | * you have parsed out. |
| 5183 | */ |
| 5184 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5185 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5186 | |
Jeff Johnson | 435e1b8 | 2017-10-07 14:13:10 -0700 | [diff] [blame] | 5187 | /* Use the cipher type in the RSN IE */ |
| 5188 | pWextState->roamProfile.EncryptionType.encryptionType[0] = |
| 5189 | RSNEncryptType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5190 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5191 | mcRSNEncryptType; |
| 5192 | |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5193 | if ((QDF_IBSS_MODE == adapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5194 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5195 | (eCSR_ENCRYPT_TYPE_AES_GCMP == mcRSNEncryptType) || |
| 5196 | (eCSR_ENCRYPT_TYPE_AES_GCMP_256 == mcRSNEncryptType) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5197 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5198 | /* |
| 5199 | * For wpa none supplicant sends the WPA IE with unicast |
| 5200 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5201 | * multicast cipher as either AES/TKIP based on group |
| 5202 | * cipher configuration mentioned in the |
| 5203 | * wpa_supplicant.conf. |
| 5204 | */ |
| 5205 | |
| 5206 | /* Set the unicast cipher same as multicast cipher */ |
| 5207 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5208 | = mcRSNEncryptType; |
| 5209 | } |
| 5210 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5211 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5212 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5213 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5214 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5215 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5216 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5217 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5218 | } |
Abhishek Singh | 6454ad3 | 2017-12-20 10:42:21 +0530 | [diff] [blame] | 5219 | |
| 5220 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 5221 | if (hdd_ctx->force_rsne_override && |
| 5222 | (pWextState->WPARSNIE[0] == DOT11F_EID_RSN)) { |
| 5223 | hdd_warn("Test mode enabled set def Auth and enc type. RSN IE passed in connect req: "); |
| 5224 | qdf_trace_hex_dump(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_WARN, |
| 5225 | pWextState->roamProfile.pRSNReqIE, |
| 5226 | pWextState->roamProfile.nRSNReqIELength); |
| 5227 | |
| 5228 | pWextState->roamProfile.force_rsne_override = true; |
| 5229 | /* If parsing failed set the def value for the roam profile */ |
| 5230 | if (status) |
| 5231 | hdd_set_def_rsne_override(&pWextState->roamProfile, |
| 5232 | RSNAuthType); |
| 5233 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5234 | return 0; |
| 5235 | } |
| 5236 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5237 | #ifdef WLAN_FEATURE_FILS_SK |
| 5238 | /** |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5239 | * hdd_check_fils_rsn_n_set_auth_type() - This API checks whether a give |
| 5240 | * auth type is fils if yes, sets it in profile. |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5241 | * @rsn_auth_type: auth type |
| 5242 | * |
| 5243 | * Return: true if FILS auth else false |
| 5244 | */ |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5245 | static bool hdd_check_fils_rsn_n_set_auth_type(tCsrRoamProfile *roam_profile, |
| 5246 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5247 | { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5248 | bool is_fils_rsn = false; |
| 5249 | |
| 5250 | if (!roam_profile->fils_con_info) |
| 5251 | return false; |
| 5252 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5253 | if ((rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA256) || |
| 5254 | (rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA384) || |
| 5255 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA256) || |
| 5256 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA384)) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5257 | is_fils_rsn = true; |
| 5258 | if (is_fils_rsn) |
| 5259 | roam_profile->fils_con_info->akm_type = rsn_auth_type; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5260 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5261 | return is_fils_rsn; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5262 | } |
| 5263 | #else |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5264 | static bool hdd_check_fils_rsn_n_set_auth_type(tCsrRoamProfile *roam_profile, |
| 5265 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5266 | { |
| 5267 | return false; |
| 5268 | } |
| 5269 | #endif |
| 5270 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5271 | /** |
| 5272 | * hdd_set_csr_auth_type() - set csr auth type |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5273 | * @adapter: pointer to adapter |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5274 | * @RSNAuthType: auth type |
| 5275 | * |
| 5276 | * Return: 0 on success, error number otherwise |
| 5277 | */ |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5278 | int hdd_set_csr_auth_type(struct hdd_adapter *adapter, |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5279 | eCsrAuthType RSNAuthType) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5280 | { |
Jeff Johnson | 2a72200 | 2017-09-30 20:02:35 -0700 | [diff] [blame] | 5281 | struct hdd_wext_state *pWextState = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5282 | WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5283 | tCsrRoamProfile *roam_profile = &(pWextState->roamProfile); |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5284 | struct hdd_station_ctx *sta_ctx = |
Jeff Johnson | ba38834 | 2017-10-02 13:31:01 -0700 | [diff] [blame] | 5285 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5286 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5287 | roam_profile->AuthType.numEntries = 1; |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5288 | hdd_debug("authType = %d RSNAuthType %d wpa_versions %d", |
| 5289 | sta_ctx->conn_info.authType, RSNAuthType, |
| 5290 | sta_ctx->wpa_versions); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5291 | |
Jeff Johnson | d377dce | 2017-10-04 10:32:42 -0700 | [diff] [blame] | 5292 | switch (sta_ctx->conn_info.authType) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5293 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5294 | #ifdef FEATURE_WLAN_ESE |
| 5295 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5296 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5297 | #endif |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5298 | if (!sta_ctx->wpa_versions) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5299 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5300 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5301 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5302 | } else if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_1) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5303 | |
| 5304 | #ifdef FEATURE_WLAN_ESE |
| 5305 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5306 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5307 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5308 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5309 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5310 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5311 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5312 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5313 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5314 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5315 | } else |
| 5316 | #endif |
| 5317 | if ((pWextState-> |
| 5318 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5319 | == IW_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5320 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5321 | eCSR_AUTH_TYPE_WPA; |
| 5322 | } else |
| 5323 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5324 | == IW_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5325 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5326 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5327 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5328 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5329 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5330 | } |
| 5331 | } |
Jeff Johnson | ce4a834 | 2017-10-14 13:12:22 -0700 | [diff] [blame] | 5332 | if (sta_ctx->wpa_versions & NL80211_WPA_VERSION_2) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5333 | #ifdef FEATURE_WLAN_ESE |
| 5334 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5335 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5336 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5337 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5338 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5339 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5340 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5341 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5342 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5343 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5344 | } else |
| 5345 | #endif |
Abhishek Singh | 02cb9e0 | 2017-08-30 17:39:50 +0530 | [diff] [blame] | 5346 | if (RSNAuthType == eCSR_AUTH_TYPE_DPP_RSN) { |
| 5347 | roam_profile->AuthType.authType[0] = |
| 5348 | eCSR_AUTH_TYPE_DPP_RSN; |
| 5349 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5350 | ((pWextState-> |
| 5351 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5352 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5353 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5354 | eCSR_AUTH_TYPE_FT_RSN; |
| 5355 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5356 | && |
| 5357 | ((pWextState-> |
| 5358 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5359 | == IW_AUTH_KEY_MGMT_PSK)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5360 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5361 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5362 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5363 | |
| 5364 | #ifdef WLAN_FEATURE_11W |
| 5365 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5366 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5367 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5368 | } else if (RSNAuthType == |
| 5369 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5370 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5371 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5372 | } else |
| 5373 | #endif |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5374 | if (hdd_check_fils_rsn_n_set_auth_type(roam_profile, |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5375 | RSNAuthType)) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5376 | roam_profile->AuthType.authType[0] = |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5377 | RSNAuthType; |
Yeshwanth Sriram Guntuka | 52bc6bb | 2017-05-02 16:57:13 +0530 | [diff] [blame] | 5378 | hdd_debug("updated profile authtype as %d", |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5379 | RSNAuthType); |
| 5380 | |
Padma, Santhosh Kumar | c69ce07 | 2017-11-06 18:21:05 +0530 | [diff] [blame] | 5381 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_OWE) && |
| 5382 | ((pWextState-> |
| 5383 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5384 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5385 | /* OWE case */ |
| 5386 | roam_profile->AuthType.authType[0] = |
| 5387 | eCSR_AUTH_TYPE_OWE; |
Padma, Santhosh Kumar | e587a5c | 2017-12-21 12:44:46 +0530 | [diff] [blame] | 5388 | } else if ((RSNAuthType == |
| 5389 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256) && |
| 5390 | ((pWextState-> |
| 5391 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5392 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5393 | /* Suite B EAP SHA 256 */ |
| 5394 | roam_profile->AuthType.authType[0] = |
| 5395 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA256; |
| 5396 | } else if ((RSNAuthType == |
| 5397 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384) && |
| 5398 | ((pWextState-> |
| 5399 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5400 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5401 | /* Suite B EAP SHA 384 */ |
| 5402 | roam_profile->AuthType.authType[0] = |
| 5403 | eCSR_AUTH_TYPE_SUITEB_EAP_SHA384; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5404 | } else if ((pWextState-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5405 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5406 | == IW_AUTH_KEY_MGMT_802_1X) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5407 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5408 | eCSR_AUTH_TYPE_RSN; |
| 5409 | } else |
| 5410 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5411 | == IW_AUTH_KEY_MGMT_PSK) { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5412 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5413 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5414 | } else { |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5415 | roam_profile->AuthType.authType[0] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5416 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5417 | } |
| 5418 | } |
| 5419 | break; |
| 5420 | |
| 5421 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5422 | |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5423 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5424 | break; |
Padma, Santhosh Kumar | 07eb80b | 2017-07-05 16:10:06 +0530 | [diff] [blame] | 5425 | |
| 5426 | case eCSR_AUTH_TYPE_SAE: |
| 5427 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_SAE; |
| 5428 | break; |
| 5429 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5430 | default: |
| 5431 | |
| 5432 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5433 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5434 | #endif /* FEATURE_WLAN_ESE */ |
Jeff Johnson | 5b34fce | 2017-10-13 13:24:51 -0700 | [diff] [blame] | 5435 | roam_profile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5436 | break; |
| 5437 | } |
| 5438 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5439 | hdd_debug("Set roam Authtype to %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5440 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5441 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5442 | return 0; |
| 5443 | } |