Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2017 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" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | |
| 69 | /* These are needed to recognize WPA and RSN suite types */ |
| 70 | #define HDD_WPA_OUI_SIZE 4 |
| 71 | #define HDD_RSN_OUI_SIZE 4 |
| 72 | uint8_t ccp_wpa_oui00[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x00 }; |
| 73 | uint8_t ccp_wpa_oui01[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x01 }; |
| 74 | uint8_t ccp_wpa_oui02[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x02 }; |
| 75 | uint8_t ccp_wpa_oui03[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x03 }; |
| 76 | uint8_t ccp_wpa_oui04[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x04 }; |
| 77 | uint8_t ccp_wpa_oui05[HDD_WPA_OUI_SIZE] = { 0x00, 0x50, 0xf2, 0x05 }; |
| 78 | |
| 79 | #ifdef FEATURE_WLAN_ESE |
| 80 | /* CCKM */ |
| 81 | uint8_t ccp_wpa_oui06[HDD_WPA_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 82 | /* CCKM */ |
| 83 | uint8_t ccp_rsn_oui06[HDD_RSN_OUI_SIZE] = { 0x00, 0x40, 0x96, 0x00 }; |
| 84 | #endif /* FEATURE_WLAN_ESE */ |
| 85 | |
| 86 | /* group cipher */ |
| 87 | uint8_t ccp_rsn_oui00[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x00 }; |
| 88 | |
| 89 | /* WEP-40 or RSN */ |
| 90 | uint8_t ccp_rsn_oui01[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x01 }; |
| 91 | |
| 92 | /* TKIP or RSN-PSK */ |
| 93 | uint8_t ccp_rsn_oui02[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x02 }; |
| 94 | |
| 95 | /* Reserved */ |
| 96 | uint8_t ccp_rsn_oui03[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x03 }; |
| 97 | |
| 98 | /* AES-CCMP */ |
| 99 | uint8_t ccp_rsn_oui04[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x04 }; |
| 100 | |
| 101 | /* WEP-104 */ |
| 102 | uint8_t ccp_rsn_oui05[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 103 | |
| 104 | #ifdef WLAN_FEATURE_11W |
| 105 | /* RSN-PSK-SHA256 */ |
| 106 | uint8_t ccp_rsn_oui07[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x06 }; |
| 107 | |
| 108 | /* RSN-8021X-SHA256 */ |
| 109 | uint8_t ccp_rsn_oui08[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x05 }; |
| 110 | #endif |
| 111 | |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 112 | /* AES-GCMP-128 */ |
| 113 | uint8_t ccp_rsn_oui09[HDD_RSN_OUI_SIZE] = { 0x00, 0x0F, 0xAC, 0x08 }; |
| 114 | |
| 115 | /* AES-GCMP-256 */ |
| 116 | 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] | 117 | #ifdef WLAN_FEATURE_FILS_SK |
| 118 | uint8_t ccp_rsn_oui_0e[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0E}; |
| 119 | uint8_t ccp_rsn_oui_0f[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x0F}; |
| 120 | uint8_t ccp_rsn_oui_10[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x10}; |
| 121 | uint8_t ccp_rsn_oui_11[HDD_RSN_OUI_SIZE] = {0x00, 0x0F, 0xAC, 0x11}; |
| 122 | #endif |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 123 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 124 | /* Offset where the EID-Len-IE, start. */ |
| 125 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 126 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 127 | |
| 128 | #define BEACON_FRAME_IES_OFFSET 12 |
| 129 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 130 | |
| 131 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 132 | * beacon_filter_table - table of IEs used for beacon filtering |
| 133 | */ |
| 134 | static const int beacon_filter_table[] = { |
| 135 | SIR_MAC_DS_PARAM_SET_EID, |
| 136 | SIR_MAC_ERP_INFO_EID, |
| 137 | SIR_MAC_EDCA_PARAM_SET_EID, |
| 138 | SIR_MAC_QOS_CAPABILITY_EID, |
| 139 | SIR_MAC_HT_INFO_EID, |
| 140 | SIR_MAC_VHT_OPMODE_EID, |
| 141 | SIR_MAC_VHT_OPERATION_EID, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 142 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 143 | /* |
| 144 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 145 | * bss-color-change IE till it gets any fixed number. This |
| 146 | * vendor EID needs to be replaced with bss-color-change IE |
| 147 | * number. |
| 148 | */ |
| 149 | SIR_MAC_EID_VENDOR, |
| 150 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 151 | }; |
| 152 | |
| 153 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 154 | * hdd_conn_set_authenticated() - set authentication state |
| 155 | * @pAdapter: pointer to the adapter |
| 156 | * @authState: authentication state |
| 157 | * |
| 158 | * This function updates the global HDD station context |
| 159 | * authentication state. |
| 160 | * |
| 161 | * Return: none |
| 162 | */ |
| 163 | static void |
| 164 | hdd_conn_set_authenticated(hdd_adapter_t *pAdapter, uint8_t authState) |
| 165 | { |
| 166 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 167 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 168 | |
| 169 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 170 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 171 | pHddStaCtx->conn_info.uIsAuthenticated, authState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 172 | pHddStaCtx->conn_info.uIsAuthenticated = authState; |
| 173 | |
| 174 | /* Check is pending ROC request or not when auth state changed */ |
| 175 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * hdd_conn_set_connection_state() - set connection state |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 180 | * @adapter: pointer to the adapter |
| 181 | * @conn_state: connection state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 182 | * |
| 183 | * This function updates the global HDD station context connection state. |
| 184 | * |
| 185 | * Return: none |
| 186 | */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 187 | void hdd_conn_set_connection_state(hdd_adapter_t *adapter, |
| 188 | eConnectionState conn_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 189 | { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 190 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 191 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 192 | |
| 193 | /* save the new connection state */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 194 | hdd_debug("%pS Changed conn state from old:%d to new:%d for dev %s", |
| 195 | (void *)_RET_IP_, hdd_sta_ctx->conn_info.connState, |
| 196 | conn_state, adapter->dev->name); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 197 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 198 | hdd_tsf_notify_wlan_state_change(adapter, |
| 199 | hdd_sta_ctx->conn_info.connState, |
| 200 | conn_state); |
| 201 | hdd_sta_ctx->conn_info.connState = conn_state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 202 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 203 | schedule_delayed_work(&hdd_ctx->roc_req_work, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | /** |
| 207 | * hdd_conn_get_connection_state() - get connection state |
| 208 | * @pAdapter: pointer to the adapter |
| 209 | * @pConnState: pointer to connection state |
| 210 | * |
| 211 | * This function updates the global HDD station context connection state. |
| 212 | * |
| 213 | * Return: true if (Infra Associated or IBSS Connected) |
| 214 | * and sets output parameter pConnState; |
| 215 | * false otherwise |
| 216 | */ |
| 217 | static inline bool hdd_conn_get_connection_state(hdd_station_ctx_t *pHddStaCtx, |
| 218 | eConnectionState *pConnState) |
| 219 | { |
| 220 | bool fConnected = false; |
| 221 | eConnectionState connState; |
| 222 | |
| 223 | /* get the connection state. */ |
| 224 | connState = pHddStaCtx->conn_info.connState; |
| 225 | |
| 226 | if (eConnectionState_Associated == connState || |
| 227 | eConnectionState_IbssConnected == connState || |
| 228 | eConnectionState_IbssDisconnected == connState) { |
| 229 | fConnected = true; |
| 230 | } |
| 231 | |
| 232 | if (pConnState) |
| 233 | *pConnState = connState; |
| 234 | |
| 235 | return fConnected; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * hdd_is_connecting() - Function to check connection progress |
| 240 | * @hdd_sta_ctx: pointer to global HDD Station context |
| 241 | * |
| 242 | * Return: true if connecting, false otherwise |
| 243 | */ |
| 244 | bool hdd_is_connecting(hdd_station_ctx_t *hdd_sta_ctx) |
| 245 | { |
| 246 | return hdd_sta_ctx->conn_info.connState == |
| 247 | eConnectionState_Connecting; |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * hdd_conn_is_connected() - Function to check connection status |
| 252 | * @pHddStaCtx: pointer to global HDD Station context |
| 253 | * |
| 254 | * Return: false if any errors encountered, true otherwise |
| 255 | */ |
| 256 | bool hdd_conn_is_connected(hdd_station_ctx_t *pHddStaCtx) |
| 257 | { |
| 258 | return hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * hdd_conn_get_connected_band() - get current connection radio band |
| 263 | * @pHddStaCtx: pointer to global HDD Station context |
| 264 | * |
| 265 | * Return: eCSR_BAND_24 or eCSR_BAND_5G based on current AP connection |
| 266 | * eCSR_BAND_ALL if not connected |
| 267 | */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 268 | enum band_info hdd_conn_get_connected_band(hdd_station_ctx_t *pHddStaCtx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 269 | { |
| 270 | uint8_t staChannel = 0; |
| 271 | |
| 272 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 273 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 274 | |
| 275 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 276 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 277 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 278 | return BAND_5G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 279 | else /* If station is not connected return as eCSR_BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 280 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | /** |
| 284 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
| 285 | * @pHddStaCtx: pointer to global HDD Station context |
| 286 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 287 | * |
| 288 | * Return: false if any errors encountered, true otherwise |
| 289 | */ |
| 290 | static inline bool |
| 291 | hdd_conn_get_connected_cipher_algo(hdd_station_ctx_t *pHddStaCtx, |
| 292 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 293 | { |
| 294 | bool fConnected = false; |
| 295 | |
| 296 | fConnected = hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 297 | |
| 298 | if (pConnectedCipherAlgo) |
| 299 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 300 | |
| 301 | return fConnected; |
| 302 | } |
| 303 | |
| 304 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 305 | * hdd_remove_beacon_filter() - remove beacon filter |
| 306 | * @adapter: Pointer to the hdd adapter |
| 307 | * |
| 308 | * Return: 0 on success and errno on failure |
| 309 | */ |
| 310 | static int hdd_remove_beacon_filter(hdd_adapter_t *adapter) |
| 311 | { |
| 312 | QDF_STATUS status; |
| 313 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 314 | |
| 315 | status = sme_remove_beacon_filter(hdd_ctx->hHal, |
| 316 | adapter->sessionId); |
| 317 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 318 | hdd_err("sme_remove_beacon_filter() failed"); |
| 319 | return -EFAULT; |
| 320 | } |
| 321 | |
| 322 | return 0; |
| 323 | } |
| 324 | |
| 325 | /** |
| 326 | * hdd_add_beacon_filter() - add beacon filter |
| 327 | * @adapter: Pointer to the hdd adapter |
| 328 | * |
| 329 | * Return: 0 on success and errno on failure |
| 330 | */ |
| 331 | static int hdd_add_beacon_filter(hdd_adapter_t *adapter) |
| 332 | { |
| 333 | int i; |
| 334 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 335 | QDF_STATUS status; |
| 336 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 337 | |
| 338 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 339 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 340 | (unsigned long int *)ie_map); |
| 341 | |
| 342 | status = sme_add_beacon_filter(hdd_ctx->hHal, |
| 343 | adapter->sessionId, ie_map); |
| 344 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 345 | hdd_err("sme_add_beacon_filter() failed"); |
| 346 | return -EFAULT; |
| 347 | } |
| 348 | return 0; |
| 349 | } |
| 350 | |
| 351 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 352 | * hdd_copy_vht_caps()- copy vht caps info from roam info to |
| 353 | * hdd station context. |
| 354 | * @hdd_sta_ctx: pointer to hdd station context |
| 355 | * @roam_info: pointer to roam info |
| 356 | * |
| 357 | * Return: None |
| 358 | */ |
| 359 | static void hdd_copy_ht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 360 | tCsrRoamInfo *roam_info) |
| 361 | { |
| 362 | tDot11fIEHTCaps *roam_ht_cap = &roam_info->ht_caps; |
| 363 | struct ieee80211_ht_cap *hdd_ht_cap = &hdd_sta_ctx->conn_info.ht_caps; |
| 364 | uint32_t i, temp_ht_cap; |
| 365 | |
| 366 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 367 | |
| 368 | if (roam_ht_cap->advCodingCap) |
| 369 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 370 | if (roam_ht_cap->supportedChannelWidthSet) |
| 371 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 372 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 373 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 374 | if (temp_ht_cap) |
| 375 | hdd_ht_cap->cap_info |= |
| 376 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 377 | if (roam_ht_cap->greenField) |
| 378 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 379 | if (roam_ht_cap->shortGI20MHz) |
| 380 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 381 | if (roam_ht_cap->shortGI40MHz) |
| 382 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 383 | if (roam_ht_cap->txSTBC) |
| 384 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 385 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 386 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 387 | if (temp_ht_cap) |
| 388 | hdd_ht_cap->cap_info |= |
| 389 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 390 | if (roam_ht_cap->delayedBA) |
| 391 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 392 | if (roam_ht_cap->maximalAMSDUsize) |
| 393 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 394 | if (roam_ht_cap->dsssCckMode40MHz) |
| 395 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 396 | if (roam_ht_cap->psmp) |
| 397 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 398 | if (roam_ht_cap->stbcControlFrame) |
| 399 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 400 | if (roam_ht_cap->lsigTXOPProtection) |
| 401 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 402 | |
| 403 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 404 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 405 | hdd_ht_cap->ampdu_params_info |= |
| 406 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 407 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 408 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 409 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 410 | if (temp_ht_cap) |
| 411 | hdd_ht_cap->ampdu_params_info |= |
| 412 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 413 | |
| 414 | /* 802.11n HT extended capabilities masks */ |
| 415 | if (roam_ht_cap->pco) |
| 416 | hdd_ht_cap->extended_ht_cap_info |= |
| 417 | IEEE80211_HT_EXT_CAP_PCO; |
| 418 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 419 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 420 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 421 | if (temp_ht_cap) |
| 422 | hdd_ht_cap->extended_ht_cap_info |= |
| 423 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 424 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 425 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 426 | if (temp_ht_cap) |
| 427 | hdd_ht_cap->extended_ht_cap_info |= |
| 428 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 429 | |
| 430 | /* tx_bf_cap_info capabilities */ |
| 431 | if (roam_ht_cap->txBF) |
| 432 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 433 | if (roam_ht_cap->rxStaggeredSounding) |
| 434 | hdd_ht_cap->tx_BF_cap_info |= |
| 435 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 436 | if (roam_ht_cap->txStaggeredSounding) |
| 437 | hdd_ht_cap->tx_BF_cap_info |= |
| 438 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 439 | if (roam_ht_cap->rxZLF) |
| 440 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 441 | if (roam_ht_cap->txZLF) |
| 442 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 443 | if (roam_ht_cap->implicitTxBF) |
| 444 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 445 | temp_ht_cap = roam_ht_cap->calibration & |
| 446 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 447 | if (temp_ht_cap) |
| 448 | hdd_ht_cap->tx_BF_cap_info |= |
| 449 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 450 | if (roam_ht_cap->explicitCSITxBF) |
| 451 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 452 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 453 | hdd_ht_cap->tx_BF_cap_info |= |
| 454 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 455 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 456 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 457 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 458 | if (temp_ht_cap) |
| 459 | hdd_ht_cap->tx_BF_cap_info |= |
| 460 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 461 | temp_ht_cap = |
| 462 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 463 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 464 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 465 | if (temp_ht_cap) |
| 466 | hdd_ht_cap->tx_BF_cap_info |= |
| 467 | temp_ht_cap << |
| 468 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 469 | temp_ht_cap = |
| 470 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 471 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 472 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 473 | if (temp_ht_cap) |
| 474 | hdd_ht_cap->tx_BF_cap_info |= |
| 475 | temp_ht_cap << |
| 476 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 477 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 478 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 479 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 480 | if (temp_ht_cap) |
| 481 | hdd_ht_cap->tx_BF_cap_info |= |
| 482 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 483 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 484 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 485 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 486 | if (temp_ht_cap) |
| 487 | hdd_ht_cap->tx_BF_cap_info |= |
| 488 | temp_ht_cap << |
| 489 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 490 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 491 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 492 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 493 | if (temp_ht_cap) |
| 494 | hdd_ht_cap->tx_BF_cap_info |= |
| 495 | temp_ht_cap << |
| 496 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 497 | |
| 498 | /* antenna selection */ |
| 499 | if (roam_ht_cap->antennaSelection) |
| 500 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 501 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 502 | hdd_ht_cap->antenna_selection_info |= |
| 503 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 504 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 505 | hdd_ht_cap->antenna_selection_info |= |
| 506 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 507 | if (roam_ht_cap->explicitCSIFeedback) |
| 508 | hdd_ht_cap->antenna_selection_info |= |
| 509 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 510 | if (roam_ht_cap->antennaIndicesFeedback) |
| 511 | hdd_ht_cap->antenna_selection_info |= |
| 512 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 513 | if (roam_ht_cap->rxAS) |
| 514 | hdd_ht_cap->antenna_selection_info |= |
| 515 | ANTENNA_SEL_INFO_RX_AS; |
| 516 | if (roam_ht_cap->txSoundingPPDUs) |
| 517 | hdd_ht_cap->antenna_selection_info |= |
| 518 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 519 | |
| 520 | /* mcs data rate */ |
| 521 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 522 | hdd_ht_cap->mcs.rx_mask[i] = |
| 523 | roam_ht_cap->supportedMCSSet[i]; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 524 | hdd_ht_cap->mcs.rx_highest = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 525 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 526 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 527 | hdd_ht_cap->mcs.tx_params = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 528 | roam_ht_cap->supportedMCSSet[12]; |
| 529 | } |
| 530 | |
| 531 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 532 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 533 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 534 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 535 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 536 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 537 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 538 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 539 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 540 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 541 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 542 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 543 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 544 | |
| 545 | /** |
| 546 | * hdd_copy_ht_caps()- copy ht caps info from roam info to |
| 547 | * hdd station context. |
| 548 | * @hdd_sta_ctx: pointer to hdd station context |
| 549 | * @roam_info: pointer to roam info |
| 550 | * |
| 551 | * Return: None |
| 552 | */ |
| 553 | static void hdd_copy_vht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 554 | tCsrRoamInfo *roam_info) |
| 555 | { |
| 556 | tDot11fIEVHTCaps *roam_vht_cap = &roam_info->vht_caps; |
| 557 | struct ieee80211_vht_cap *hdd_vht_cap = |
| 558 | &hdd_sta_ctx->conn_info.vht_caps; |
| 559 | uint32_t temp_vht_cap; |
| 560 | |
| 561 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 562 | |
| 563 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 564 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 565 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 566 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 567 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 568 | if (temp_vht_cap) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 569 | if (roam_vht_cap->supportedChannelWidthSet & |
| 570 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 571 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 572 | hdd_vht_cap->vht_cap_info |= |
| 573 | temp_vht_cap << |
| 574 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 575 | if (roam_vht_cap->supportedChannelWidthSet & |
| 576 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 577 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 578 | hdd_vht_cap->vht_cap_info |= |
| 579 | temp_vht_cap << |
| 580 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 581 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 582 | if (roam_vht_cap->ldpcCodingCap) |
| 583 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 584 | if (roam_vht_cap->shortGI80MHz) |
| 585 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 586 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 587 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 588 | if (roam_vht_cap->txSTBC) |
| 589 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 590 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 591 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 592 | if (temp_vht_cap) |
| 593 | hdd_vht_cap->vht_cap_info |= |
| 594 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 595 | if (roam_vht_cap->suBeamFormerCap) |
| 596 | hdd_vht_cap->vht_cap_info |= |
| 597 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 598 | if (roam_vht_cap->suBeamformeeCap) |
| 599 | hdd_vht_cap->vht_cap_info |= |
| 600 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 601 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 602 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 603 | if (temp_vht_cap) |
| 604 | hdd_vht_cap->vht_cap_info |= |
| 605 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 606 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 607 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 608 | if (temp_vht_cap) |
| 609 | hdd_vht_cap->vht_cap_info |= |
| 610 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 611 | if (roam_vht_cap->muBeamformerCap) |
| 612 | hdd_vht_cap->vht_cap_info |= |
| 613 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 614 | if (roam_vht_cap->muBeamformeeCap) |
| 615 | hdd_vht_cap->vht_cap_info |= |
| 616 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 617 | if (roam_vht_cap->vhtTXOPPS) |
| 618 | hdd_vht_cap->vht_cap_info |= |
| 619 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 620 | if (roam_vht_cap->htcVHTCap) |
| 621 | hdd_vht_cap->vht_cap_info |= |
| 622 | IEEE80211_VHT_CAP_HTC_VHT; |
| 623 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 624 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 625 | if (temp_vht_cap) |
| 626 | hdd_vht_cap->vht_cap_info |= |
| 627 | temp_vht_cap << |
| 628 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 629 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 630 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 631 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 632 | if (temp_vht_cap) |
| 633 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 634 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 635 | if (roam_vht_cap->rxAntPattern) |
| 636 | hdd_vht_cap->vht_cap_info |= |
| 637 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 638 | if (roam_vht_cap->txAntPattern) |
| 639 | hdd_vht_cap->vht_cap_info |= |
| 640 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 641 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 642 | hdd_vht_cap->supp_mcs.rx_highest = |
| 643 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 644 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 645 | hdd_vht_cap->supp_mcs.tx_highest = |
| 646 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 647 | } |
| 648 | |
| 649 | /* ht param */ |
| 650 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 651 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 652 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 653 | |
| 654 | /* operatinon mode */ |
| 655 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 656 | |
| 657 | /* stbc_param */ |
| 658 | #define HT_STBC_PARAM_MCS 0x007f |
| 659 | |
| 660 | /** |
| 661 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 662 | * hdd station context. |
| 663 | * @hdd_sta_ctx: pointer to hdd station context |
| 664 | * @roam_info: pointer to roam info |
| 665 | * |
| 666 | * Return: None |
| 667 | */ |
| 668 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 669 | tCsrRoamInfo *roam_info) |
| 670 | { |
| 671 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 672 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 673 | &hdd_sta_ctx->conn_info.ht_operation; |
| 674 | uint32_t i, temp_ht_ops; |
| 675 | |
| 676 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 677 | |
| 678 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 679 | |
| 680 | /* HT_PARAMS */ |
| 681 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 682 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 683 | if (temp_ht_ops) |
| 684 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 685 | else |
| 686 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 687 | if (roam_ht_ops->recommendedTxWidthSet) |
| 688 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 689 | if (roam_ht_ops->rifsMode) |
| 690 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 691 | if (roam_ht_ops->controlledAccessOnly) |
| 692 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 693 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 694 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 695 | if (temp_ht_ops) |
| 696 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 697 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 698 | |
| 699 | /* operation mode */ |
| 700 | temp_ht_ops = roam_ht_ops->opMode & |
| 701 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 702 | switch (temp_ht_ops) { |
| 703 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 704 | hdd_ht_ops->operation_mode |= |
| 705 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 706 | break; |
| 707 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 708 | hdd_ht_ops->operation_mode |= |
| 709 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 710 | break; |
| 711 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 712 | hdd_ht_ops->operation_mode |= |
| 713 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 714 | break; |
| 715 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 716 | default: |
| 717 | hdd_ht_ops->operation_mode |= |
| 718 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 719 | } |
| 720 | if (roam_ht_ops->nonGFDevicesPresent) |
| 721 | hdd_ht_ops->operation_mode |= |
| 722 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 723 | if (roam_ht_ops->transmitBurstLimit) |
| 724 | hdd_ht_ops->operation_mode |= |
| 725 | HT_OP_MODE_TX_BURST_LIMIT; |
| 726 | if (roam_ht_ops->obssNonHTStaPresent) |
| 727 | hdd_ht_ops->operation_mode |= |
| 728 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 729 | |
| 730 | /* stbc_param */ |
| 731 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 732 | HT_STBC_PARAM_MCS; |
| 733 | if (temp_ht_ops) |
| 734 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 735 | if (roam_ht_ops->dualCTSProtection) |
| 736 | hdd_ht_ops->stbc_param |= |
| 737 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 738 | if (roam_ht_ops->secondaryBeacon) |
| 739 | hdd_ht_ops->stbc_param |= |
| 740 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 741 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 742 | hdd_ht_ops->stbc_param |= |
| 743 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 744 | if (roam_ht_ops->pcoActive) |
| 745 | hdd_ht_ops->stbc_param |= |
| 746 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 747 | if (roam_ht_ops->pcoPhase) |
| 748 | hdd_ht_ops->stbc_param |= |
| 749 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 750 | |
| 751 | /* basic MCs set */ |
| 752 | for (i = 0; i < 16; ++i) |
| 753 | hdd_ht_ops->basic_set[i] = |
| 754 | roam_ht_ops->basicMCSSet[i]; |
| 755 | } |
| 756 | |
| 757 | /** |
| 758 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 759 | * hdd station context. |
| 760 | * @hdd_sta_ctx: pointer to hdd station context |
| 761 | * @roam_info: pointer to roam info |
| 762 | * |
| 763 | * Return: None |
| 764 | */ |
| 765 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 766 | tCsrRoamInfo *roam_info) |
| 767 | { |
| 768 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 769 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 770 | &hdd_sta_ctx->conn_info.vht_operation; |
| 771 | |
| 772 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 773 | |
| 774 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 775 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 776 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 777 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 778 | } |
| 779 | |
| 780 | |
| 781 | /** |
| 782 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 783 | * @adapter: Pointer to adapter |
| 784 | * @roam_info: pointer to roam info |
| 785 | * |
| 786 | * Return: None |
| 787 | */ |
| 788 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 789 | tCsrRoamInfo *roam_info) |
| 790 | { |
| 791 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 792 | |
| 793 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 794 | hdd_sta_ctx->conn_info.operationChannel); |
| 795 | if (roam_info->vht_caps.present) { |
| 796 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
| 797 | hdd_copy_vht_caps(hdd_sta_ctx, roam_info); |
| 798 | } else { |
| 799 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 800 | } |
| 801 | if (roam_info->ht_caps.present) { |
| 802 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
| 803 | hdd_copy_ht_caps(hdd_sta_ctx, roam_info); |
| 804 | } else { |
| 805 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 806 | } |
| 807 | if (roam_info->reassoc) |
| 808 | hdd_sta_ctx->conn_info.roam_count++; |
| 809 | if (roam_info->hs20vendor_ie.present) { |
| 810 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 811 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 812 | &roam_info->hs20vendor_ie, |
| 813 | sizeof(roam_info->hs20vendor_ie)); |
| 814 | } else { |
| 815 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 816 | } |
| 817 | if (roam_info->ht_operation.present) { |
| 818 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 819 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 820 | } else { |
| 821 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 822 | } |
| 823 | if (roam_info->vht_operation.present) { |
| 824 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 825 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 826 | } else { |
| 827 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 832 | * hdd_conn_save_connect_info() - save current connection information |
| 833 | * @pAdapter: pointer to adapter |
| 834 | * @pRoamInfo: pointer to roam info |
| 835 | * @eBssType: bss type |
| 836 | * |
| 837 | * Return: none |
| 838 | */ |
| 839 | static void |
| 840 | hdd_conn_save_connect_info(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 841 | eCsrRoamBssType eBssType) |
| 842 | { |
| 843 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 844 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 845 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 846 | QDF_ASSERT(pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 847 | |
| 848 | if (pRoamInfo) { |
| 849 | /* Save the BSSID for the connection */ |
| 850 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 851 | QDF_ASSERT(pRoamInfo->pBssDesc); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 852 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 853 | &pRoamInfo->bssid); |
| 854 | |
| 855 | /* |
| 856 | * Save the Station ID for this station from |
| 857 | * the 'Roam Info'. For IBSS mode, staId is |
| 858 | * assigned in NEW_PEER_IND. For reassoc, |
| 859 | * the staID doesn't change and it may be invalid |
| 860 | * in this structure so no change here. |
| 861 | */ |
| 862 | if (!pRoamInfo->fReassocReq) { |
| 863 | pHddStaCtx->conn_info.staId[0] = |
| 864 | pRoamInfo->staId; |
| 865 | } |
| 866 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 867 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 868 | &pRoamInfo->bssid); |
| 869 | } else { |
| 870 | /* |
| 871 | * can't happen. We need a valid IBSS or Infra setting |
| 872 | * in the BSSDescription or we can't function. |
| 873 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 874 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 875 | } |
| 876 | |
| 877 | /* notify WMM */ |
| 878 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 879 | |
| 880 | if (!pRoamInfo->u.pConnectedProfile) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 881 | QDF_ASSERT(pRoamInfo->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 882 | } else { |
| 883 | /* Get Multicast Encryption Type */ |
| 884 | encryptType = |
| 885 | pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 886 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 887 | /* Get Unicast Encryption Type */ |
| 888 | encryptType = |
| 889 | pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 890 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 891 | |
| 892 | pHddStaCtx->conn_info.authType = |
| 893 | pRoamInfo->u.pConnectedProfile->AuthType; |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 894 | pHddStaCtx->conn_info.last_auth_type = |
| 895 | pHddStaCtx->conn_info.authType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 896 | |
| 897 | pHddStaCtx->conn_info.operationChannel = |
| 898 | pRoamInfo->u.pConnectedProfile->operationChannel; |
| 899 | |
| 900 | /* Save the ssid for the connection */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 901 | qdf_mem_copy(&pHddStaCtx->conn_info.SSID.SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 902 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 903 | sizeof(tSirMacSSid)); |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 904 | qdf_mem_copy(&pHddStaCtx->conn_info.last_ssid.SSID, |
| 905 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 906 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 907 | |
| 908 | /* Save dot11mode in which STA associated to AP */ |
| 909 | pHddStaCtx->conn_info.dot11Mode = |
| 910 | pRoamInfo->u.pConnectedProfile->dot11Mode; |
| 911 | |
| 912 | pHddStaCtx->conn_info.proxyARPService = |
| 913 | pRoamInfo->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 914 | |
| 915 | pHddStaCtx->conn_info.nss = pRoamInfo->chan_info.nss; |
| 916 | |
| 917 | pHddStaCtx->conn_info.rate_flags = |
| 918 | pRoamInfo->chan_info.rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 919 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 920 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 921 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 922 | } |
| 923 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 924 | /** |
| 925 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 926 | * @dev: pointer to net device |
| 927 | * @pAdapter: pointer to adapter |
| 928 | * @pCsrRoamInfo: pointer to roam info |
| 929 | * |
| 930 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 931 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 932 | * for the same purpose.) |
| 933 | * |
| 934 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 935 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 936 | * This is the Assoc Response. |
| 937 | * |
| 938 | * Return: none |
| 939 | */ |
| 940 | static void |
| 941 | hdd_send_ft_assoc_response(struct net_device *dev, |
| 942 | hdd_adapter_t *pAdapter, |
| 943 | tCsrRoamInfo *pCsrRoamInfo) |
| 944 | { |
| 945 | union iwreq_data wrqu; |
| 946 | char *buff; |
| 947 | unsigned int len = 0; |
| 948 | u8 *pFTAssocRsp = NULL; |
| 949 | |
| 950 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 951 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 952 | return; |
| 953 | } |
| 954 | |
| 955 | pFTAssocRsp = |
| 956 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 957 | pCsrRoamInfo->nAssocReqLength); |
| 958 | if (pFTAssocRsp == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 959 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 960 | return; |
| 961 | } |
| 962 | /* pFTAssocRsp needs to point to the IEs */ |
| 963 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 964 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 965 | (unsigned int)pFTAssocRsp[0], |
| 966 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | |
| 968 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 969 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 970 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 971 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 972 | return; |
| 973 | } |
| 974 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 975 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 976 | wrqu.data.length = len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 977 | memcpy(buff, pFTAssocRsp, len); |
| 978 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 979 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 980 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 981 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 983 | /** |
| 984 | * hdd_send_ft_event() - send fast transition event |
| 985 | * @pAdapter: pointer to adapter |
| 986 | * |
| 987 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 988 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 989 | * followed by the auth response IEs to the supplicant. |
| 990 | * Once both are received in the supplicant, an FT event is generated |
| 991 | * to the supplicant. |
| 992 | * |
| 993 | * Return: none |
| 994 | */ |
| 995 | static void hdd_send_ft_event(hdd_adapter_t *pAdapter) |
| 996 | { |
| 997 | uint16_t auth_resp_len = 0; |
| 998 | uint32_t ric_ies_length = 0; |
| 999 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1000 | |
| 1001 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 1002 | struct cfg80211_ft_event_params ftEvent; |
| 1003 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1004 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 1005 | struct net_device *dev = pAdapter->dev; |
| 1006 | #else |
| 1007 | char *buff; |
| 1008 | union iwreq_data wrqu; |
| 1009 | uint16_t str_len; |
| 1010 | #endif |
| 1011 | |
| 1012 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1013 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1014 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1015 | |
| 1016 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, (u8 *) ricIe, |
| 1017 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1018 | if (ric_ies_length == 0) |
| 1019 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1020 | |
| 1021 | ftEvent.ric_ies = ricIe; |
| 1022 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1023 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1024 | |
| 1025 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1026 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1027 | &auth_resp_len); |
| 1028 | |
| 1029 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1030 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1031 | return; |
| 1032 | } |
| 1033 | |
| 1034 | sme_set_ft_pre_auth_state(pHddCtx->hHal, pAdapter->sessionId, true); |
| 1035 | |
| 1036 | ftEvent.target_ap = ftIe; |
| 1037 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1038 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1039 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1040 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1041 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1042 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1043 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1044 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1045 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1046 | ftEvent.target_ap[5]); |
| 1047 | |
| 1048 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1049 | |
| 1050 | #else |
| 1051 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1052 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1053 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1054 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | return; |
| 1056 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1057 | |
| 1058 | /* Sme needs to send the RIC IEs first */ |
| 1059 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
| 1060 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, |
| 1061 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1062 | &ric_ies_length); |
| 1063 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1064 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1065 | } else { |
| 1066 | wrqu.data.length = str_len + ric_ies_length; |
| 1067 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1068 | } |
| 1069 | |
| 1070 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1071 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1072 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
| 1073 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1074 | (u8 *) &buff[str_len], |
| 1075 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1076 | |
| 1077 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1078 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1079 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | return; |
| 1081 | } |
| 1082 | |
| 1083 | wrqu.data.length = str_len + auth_resp_len; |
| 1084 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1085 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1086 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1087 | #endif |
| 1088 | } |
| 1089 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1090 | #ifdef FEATURE_WLAN_ESE |
| 1091 | /** |
| 1092 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1093 | * @dev: pointer to net device |
| 1094 | * @pAdapter: pointer to adapter |
| 1095 | * @pCsrRoamInfo: pointer to roam info |
| 1096 | * |
| 1097 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1098 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1099 | * |
| 1100 | * The current (new AP) channel information is passed in. |
| 1101 | * |
| 1102 | * Return: none |
| 1103 | */ |
| 1104 | static void |
| 1105 | hdd_send_new_ap_channel_info(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1106 | tCsrRoamInfo *pCsrRoamInfo) |
| 1107 | { |
| 1108 | union iwreq_data wrqu; |
| 1109 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
| 1110 | |
| 1111 | if (descriptor == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1112 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1113 | return; |
| 1114 | } |
| 1115 | /* |
| 1116 | * Send the Channel event, the supplicant needs this to generate |
| 1117 | * the Adjacent AP report. |
| 1118 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1119 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1120 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1121 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1122 | wrqu.freq.m = descriptor->channelId; |
| 1123 | wrqu.freq.e = 0; |
| 1124 | wrqu.freq.i = 0; |
| 1125 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1126 | } |
| 1127 | |
| 1128 | #endif /* FEATURE_WLAN_ESE */ |
| 1129 | |
| 1130 | /** |
| 1131 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
| 1132 | * @pAdapter: pointer to adapter |
| 1133 | * @pCsrRoamInfo: pointer to roam info |
| 1134 | * |
| 1135 | * Return: none |
| 1136 | */ |
| 1137 | static void |
| 1138 | hdd_send_update_beacon_ies_event(hdd_adapter_t *pAdapter, |
| 1139 | tCsrRoamInfo *pCsrRoamInfo) |
| 1140 | { |
| 1141 | union iwreq_data wrqu; |
| 1142 | u8 *pBeaconIes; |
| 1143 | u8 currentLen = 0; |
| 1144 | char *buff; |
| 1145 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1146 | |
| 1147 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1148 | |
| 1149 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1150 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1151 | return; |
| 1152 | } |
| 1153 | pBeaconIes = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1154 | if (pBeaconIes == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1155 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1156 | return; |
| 1157 | } |
| 1158 | /* pBeaconIes needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1159 | hdd_debug("Beacon IEs is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1160 | (unsigned int)pBeaconIes[0], |
| 1161 | (unsigned int)pBeaconIes[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1162 | hdd_debug("Beacon IEs length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1163 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1164 | |
| 1165 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1166 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1167 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1168 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1169 | return; |
| 1170 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1171 | |
| 1172 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1173 | currentLen = strLen + 1; |
| 1174 | |
| 1175 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1176 | do { |
| 1177 | /* |
| 1178 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1179 | * into chunks of CUSTOM event max size and send it to |
| 1180 | * supplicant. Changes are done in supplicant to handle this. |
| 1181 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1182 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1183 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1184 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1185 | qdf_mem_copy(&buff[strLen + 1], pBeaconIes + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1186 | currentLen); |
| 1187 | currentOffset += currentLen; |
| 1188 | totalIeLen -= currentLen; |
| 1189 | wrqu.data.length = strLen + 1 + currentLen; |
| 1190 | if (totalIeLen) |
| 1191 | buff[strLen] = 1; /* more chunks pending */ |
| 1192 | else |
| 1193 | buff[strLen] = 0; /* last chunk */ |
| 1194 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1195 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1196 | currentLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1197 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1198 | } while (totalIeLen > 0); |
| 1199 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1200 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1201 | } |
| 1202 | |
| 1203 | /** |
| 1204 | * hdd_send_association_event() - send association event |
| 1205 | * @dev: pointer to net device |
| 1206 | * @pCsrRoamInfo: pointer to roam info |
| 1207 | * |
| 1208 | * Return: none |
| 1209 | */ |
| 1210 | static void hdd_send_association_event(struct net_device *dev, |
| 1211 | tCsrRoamInfo *pCsrRoamInfo) |
| 1212 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1213 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1214 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1215 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1216 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1217 | union iwreq_data wrqu; |
| 1218 | int we_event; |
| 1219 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1220 | struct qdf_mac_addr peerMacAddr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1221 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1222 | /* Added to find the auth type on the fly at run time */ |
| 1223 | /* rather than with cfg to see if FT is enabled */ |
| 1224 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1225 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1226 | |
| 1227 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1228 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1229 | we_event = SIOCGIWAP; |
| 1230 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1231 | if (NULL != pCsrRoamInfo) |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1232 | if (pCsrRoamInfo->roamSynchInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1233 | /* change logging before release */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1234 | hdd_debug("LFR3:hdd_send_association_event"); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1235 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1236 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1237 | true, pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1238 | wlan_hdd_tdls_notify_disconnect(pAdapter, true); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1239 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1240 | #endif |
| 1241 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1242 | tSirSmeChanInfo chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1243 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1244 | if (!pCsrRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1245 | hdd_warn("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1246 | return; |
| 1247 | } |
| 1248 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1249 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1250 | policy_mgr_incr_active_session(pHddCtx->hdd_psoc, |
| 1251 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1252 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1253 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1254 | |
| 1255 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1256 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1257 | if (global_p2p_connection_status == |
| 1258 | P2P_CLIENT_CONNECTING_STATE_1) { |
| 1259 | global_p2p_connection_status = |
| 1260 | P2P_CLIENT_CONNECTED_STATE_1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1261 | hdd_debug("[P2P State] Changing state from Connecting state to Connected State for 8-way Handshake"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1262 | } else if (global_p2p_connection_status == |
| 1263 | P2P_CLIENT_CONNECTING_STATE_2) { |
| 1264 | global_p2p_connection_status = |
| 1265 | P2P_CLIENT_COMPLETED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1266 | hdd_debug("[P2P State] Changing state from Connecting state to P2P Client Connection Completed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1267 | } |
| 1268 | } |
| 1269 | #endif |
| 1270 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " |
| 1271 | MAC_ADDRESS_STR "\n", |
| 1272 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1273 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
| 1274 | hdd_send_update_beacon_ies_event(pAdapter, pCsrRoamInfo); |
| 1275 | |
| 1276 | /* |
| 1277 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1278 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1279 | * fFTEnable is true. |
| 1280 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1281 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1282 | if ((pRoamProfile->AuthType.authType[0] == |
| 1283 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 1284 | || (pRoamProfile->AuthType.authType[0] == |
| 1285 | eCSR_AUTH_TYPE_FT_RSN) |
| 1286 | #ifdef FEATURE_WLAN_ESE |
| 1287 | || (pRoamProfile->AuthType.authType[0] == |
| 1288 | eCSR_AUTH_TYPE_CCKM_RSN) |
| 1289 | || (pRoamProfile->AuthType.authType[0] == |
| 1290 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1291 | #endif |
| 1292 | ) { |
| 1293 | hdd_send_ft_assoc_response(dev, pAdapter, pCsrRoamInfo); |
| 1294 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1295 | qdf_copy_macaddr(&peerMacAddr, |
| 1296 | &pHddStaCtx->conn_info.bssId); |
| 1297 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1298 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1299 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1300 | chan_info.band_center_freq1 = |
| 1301 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1302 | chan_info.band_center_freq2 = |
| 1303 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1304 | chan_info.reg_info_1 = |
| 1305 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1306 | chan_info.reg_info_2 = |
| 1307 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1308 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1309 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1310 | pAdapter->device_mode, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1311 | peerMacAddr.bytes, |
| 1312 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1313 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1314 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1315 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1316 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1317 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1318 | if (ret) |
| 1319 | hdd_err("Peer object %pM fail to set associated state", |
| 1320 | peerMacAddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1321 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1322 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1323 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
| 1324 | ePeerConnected, |
| 1325 | pCsrRoamInfo->timingMeasCap, |
| 1326 | pAdapter->sessionId, &chan_info, |
| 1327 | pAdapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1328 | /* Update tdls module about connection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1329 | hdd_notify_sta_connect(pAdapter->sessionId, |
| 1330 | pCsrRoamInfo->tdls_chan_swit_prohibited, |
| 1331 | pCsrRoamInfo->tdls_prohibited, |
| 1332 | pAdapter->hdd_vdev); |
| 1333 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1334 | wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo); |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 1335 | |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1336 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1337 | #ifdef MSM_PLATFORM |
Ravi Joshi | ae8e9a7 | 2016-08-03 17:38:03 -0700 | [diff] [blame] | 1338 | #if defined(CONFIG_ICNSS) || defined(CONFIG_CNSS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1339 | /* start timer in sta/p2p_cli */ |
| 1340 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1341 | pAdapter->prev_tx_packets = pAdapter->stats.tx_packets; |
| 1342 | pAdapter->prev_rx_packets = pAdapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1343 | cdp_get_intra_bss_fwd_pkts_count( |
| 1344 | cds_get_context(QDF_MODULE_ID_SOC), pAdapter->sessionId, |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1345 | &pAdapter->prev_fwd_tx_packets, |
| 1346 | &pAdapter->prev_fwd_rx_packets); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1347 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1348 | hdd_bus_bw_compute_timer_start(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1349 | #endif |
| 1350 | #endif |
| 1351 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
| 1352 | pHddStaCtx->conn_info.connState) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1353 | policy_mgr_update_connection_info(pHddCtx->hdd_psoc, |
| 1354 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1355 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1356 | ETH_ALEN); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1357 | hdd_info("wlan: new IBSS connection to " MAC_ADDRESS_STR, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1358 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes)); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1359 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1360 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1361 | QDF_IBSS_MODE, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1362 | pCsrRoamInfo->bssid.bytes, |
| 1363 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1364 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1365 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1366 | MAC_ADDR_ARRAY(pCsrRoamInfo->bssid.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1367 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1368 | WLAN_ASSOC_STATE); |
Mukul Sharma | eb01e13 | 2017-02-16 13:01:03 +0530 | [diff] [blame] | 1369 | if (ret) |
| 1370 | hdd_err("Peer object %pM fail to set associated state", |
| 1371 | peerMacAddr.bytes); |
| 1372 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1373 | } else { /* Not Associated */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1374 | hdd_info("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1375 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1376 | policy_mgr_decr_session_set_pcl(pHddCtx->hdd_psoc, |
| 1377 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1378 | |
| 1379 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1380 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1381 | #endif |
| 1382 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1383 | if ((pAdapter->device_mode == QDF_STA_MODE) || |
| 1384 | (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1385 | qdf_copy_macaddr(&peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1386 | &pHddStaCtx->conn_info.bssId); |
| 1387 | |
| 1388 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1389 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1390 | ePeerDisconnected, 0, |
| 1391 | pAdapter->sessionId, |
| 1392 | NULL, |
| 1393 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1394 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1395 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1396 | ret = hdd_objmgr_remove_peer_object(pAdapter->hdd_vdev, |
| 1397 | peerMacAddr.bytes); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 1398 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1399 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
| 1400 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
| 1401 | |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 1402 | hdd_lpass_notify_disconnect(pAdapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1403 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1404 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1405 | false, |
| 1406 | pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1407 | wlan_hdd_tdls_notify_disconnect(pAdapter, false); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1408 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1409 | #ifdef MSM_PLATFORM |
| 1410 | /* stop timer in sta/p2p_cli */ |
| 1411 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1412 | pAdapter->prev_tx_packets = 0; |
| 1413 | pAdapter->prev_rx_packets = 0; |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1414 | pAdapter->prev_fwd_tx_packets = 0; |
| 1415 | pAdapter->prev_fwd_rx_packets = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1416 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1417 | hdd_bus_bw_compute_timer_try_stop(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1418 | #endif |
| 1419 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1420 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1421 | /* Send SCC/MCC Switching event to IPA */ |
| 1422 | hdd_ipa_send_mcc_scc_msg(pHddCtx, pHddCtx->mcc_mode); |
| 1423 | |
| 1424 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1425 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1426 | * driver so not sending the status of the connection to supplicant |
| 1427 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1428 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1429 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1430 | #ifdef FEATURE_WLAN_ESE |
| 1431 | if (eConnectionState_Associated == |
| 1432 | pHddStaCtx->conn_info.connState) { |
| 1433 | if ((pRoamProfile->AuthType.authType[0] == |
| 1434 | eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1435 | (pRoamProfile->AuthType.authType[0] == |
| 1436 | eCSR_AUTH_TYPE_CCKM_WPA)) |
| 1437 | hdd_send_new_ap_channel_info(dev, pAdapter, |
| 1438 | pCsrRoamInfo); |
| 1439 | } |
| 1440 | #endif |
| 1441 | } |
| 1442 | } |
| 1443 | |
| 1444 | /** |
| 1445 | * hdd_conn_remove_connect_info() - remove connection info |
| 1446 | * @pHddStaCtx: pointer to global HDD station context |
| 1447 | * @pCsrRoamInfo: pointer to roam info |
| 1448 | * |
| 1449 | * Return: none |
| 1450 | */ |
| 1451 | static void hdd_conn_remove_connect_info(hdd_station_ctx_t *pHddStaCtx) |
| 1452 | { |
| 1453 | /* Remove staId, bssId and peerMacAddress */ |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1454 | pHddStaCtx->conn_info.staId[0] = HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1455 | qdf_mem_zero(&pHddStaCtx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1456 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1457 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1458 | |
| 1459 | /* Clear all security settings */ |
| 1460 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1461 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1462 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1463 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1464 | qdf_mem_zero(&pHddStaCtx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1465 | qdf_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1466 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1467 | pHddStaCtx->conn_info.proxyARPService = 0; |
| 1468 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1469 | qdf_mem_zero(&pHddStaCtx->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1470 | } |
| 1471 | |
| 1472 | /** |
| 1473 | * hdd_roam_deregister_sta() - deregister station |
| 1474 | * @pAdapter: pointer to adapter |
| 1475 | * @staId: station identifier |
| 1476 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1477 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1478 | */ |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1479 | QDF_STATUS hdd_roam_deregister_sta(hdd_adapter_t *adapter, uint8_t staid) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1480 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1481 | QDF_STATUS qdf_status; |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1482 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1483 | int ret = 0; |
| 1484 | uint8_t *peer_mac = NULL; |
| 1485 | struct qdf_mac_addr broadcastMacAddr = |
| 1486 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1487 | if (eConnectionState_IbssDisconnected == |
| 1488 | pHddStaCtx->conn_info.connState) { |
| 1489 | /* |
| 1490 | * Do not set the carrier off when the last peer leaves. |
| 1491 | * We will set the carrier off while stopping the IBSS. |
| 1492 | */ |
| 1493 | } |
| 1494 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1495 | 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] | 1496 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1497 | staid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1498 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1499 | hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]", |
| 1500 | staid, qdf_status, qdf_status); |
| 1501 | } |
| 1502 | |
| 1503 | if (adapter->device_mode == QDF_STA_MODE) { |
| 1504 | peer_mac = pHddStaCtx->conn_info.bssId.bytes; |
| 1505 | } else if (adapter->device_mode == QDF_IBSS_MODE) { |
| 1506 | if (pHddStaCtx->broadcast_staid == staid) |
| 1507 | peer_mac = broadcastMacAddr.bytes; |
| 1508 | else |
| 1509 | peer_mac = pHddStaCtx->conn_info. |
| 1510 | peerMacAddress[staid].bytes; |
| 1511 | } |
| 1512 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1513 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, peer_mac); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1514 | if (ret) { |
| 1515 | hdd_err("Peer obj %pM delete fails", peer_mac); |
| 1516 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1517 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1518 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1519 | } |
| 1520 | |
| 1521 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1522 | * hdd_print_bss_info() - print bss info |
| 1523 | * @hdd_sta_ctx: pointer to hdd station context |
| 1524 | * |
| 1525 | * Return: None |
| 1526 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1527 | static void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1528 | { |
| 1529 | uint32_t *cap_info; |
| 1530 | |
| 1531 | hdd_info("WIFI DATA LOGGER"); |
| 1532 | hdd_info("channel: %d", |
| 1533 | hdd_sta_ctx->conn_info.freq); |
| 1534 | hdd_info("dot11mode: %d", |
| 1535 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1536 | hdd_info("AKM: %d", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1537 | hdd_sta_ctx->conn_info.last_auth_type); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1538 | hdd_info("ssid: %.*s", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1539 | hdd_sta_ctx->conn_info.last_ssid.SSID.length, |
| 1540 | hdd_sta_ctx->conn_info.last_ssid.SSID.ssId); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1541 | hdd_info("roam count: %d", |
| 1542 | hdd_sta_ctx->conn_info.roam_count); |
| 1543 | hdd_info("ant_info: %d", |
| 1544 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1545 | hdd_info("datarate legacy %d", |
| 1546 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1547 | hdd_info("datarate mcs: %d", |
| 1548 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1549 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1550 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1551 | hdd_info("ht caps: %x", *cap_info); |
| 1552 | } |
| 1553 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1554 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1555 | hdd_info("vht caps: %x", *cap_info); |
| 1556 | } |
| 1557 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1558 | hdd_info("hs20 info: %x", |
| 1559 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1560 | hdd_info("signal: %d", |
| 1561 | hdd_sta_ctx->conn_info.signal); |
| 1562 | hdd_info("noise: %d", |
| 1563 | hdd_sta_ctx->conn_info.noise); |
| 1564 | } |
| 1565 | |
| 1566 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1567 | * hdd_dis_connect_handler() - disconnect event handler |
| 1568 | * @pAdapter: pointer to adapter |
| 1569 | * @pRoamInfo: pointer to roam info |
| 1570 | * @roamId: roam identifier |
| 1571 | * @roamStatus: roam status |
| 1572 | * @roamResult: roam result |
| 1573 | * |
| 1574 | * This function handles disconnect event: |
| 1575 | * 1. Disable transmit queues; |
| 1576 | * 2. Clean up internal connection states and data structures; |
| 1577 | * 3. Send disconnect indication to supplicant. |
| 1578 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1579 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1580 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1581 | static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1582 | tCsrRoamInfo *pRoamInfo, |
| 1583 | uint32_t roamId, |
| 1584 | eRoamCmdStatus roamStatus, |
| 1585 | eCsrRoamResult roamResult) |
| 1586 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1587 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1588 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1589 | struct net_device *dev = pAdapter->dev; |
| 1590 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1591 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1592 | uint8_t sta_id; |
| 1593 | bool sendDisconInd = true; |
| 1594 | |
| 1595 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1596 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1597 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1598 | } |
| 1599 | /* notify apps that we can't pass traffic anymore */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1600 | hdd_debug("Disabling queues"); |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1601 | wlan_hdd_netif_queue_control(pAdapter, |
| 1602 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1603 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1604 | |
| 1605 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 1606 | hdd_ipa_wlan_evt(pAdapter, pHddStaCtx->conn_info.staId[0], |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 1607 | HDD_IPA_STA_DISCONNECT, |
| 1608 | pHddStaCtx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1609 | |
| 1610 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1611 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1612 | #endif |
| 1613 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1614 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 1615 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1616 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1617 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1618 | |
| 1619 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1620 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1621 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1622 | * to cfg80211_disconnected. |
| 1623 | */ |
| 1624 | if ((eConnectionState_Disconnecting == |
| 1625 | pHddStaCtx->conn_info.connState) || |
| 1626 | (eConnectionState_NotConnected == |
| 1627 | pHddStaCtx->conn_info.connState)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1628 | 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] | 1629 | sendDisconInd = false; |
| 1630 | } |
| 1631 | |
| 1632 | if (pHddStaCtx->conn_info.connState != eConnectionState_Disconnecting) { |
| 1633 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1634 | hdd_conn_set_connection_state(pAdapter, |
| 1635 | eConnectionState_Disconnecting); |
| 1636 | } |
| 1637 | |
| 1638 | hdd_clear_roam_profile_ie(pAdapter); |
| 1639 | hdd_wmm_init(pAdapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1640 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1641 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1642 | |
| 1643 | /* indicate 'disconnect' status to wpa_supplicant... */ |
| 1644 | hdd_send_association_event(dev, pRoamInfo); |
| 1645 | /* indicate disconnected event to nl80211 */ |
| 1646 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1647 | /* |
| 1648 | * Only send indication to kernel if not initiated |
| 1649 | * by kernel |
| 1650 | */ |
| 1651 | if (sendDisconInd) { |
| 1652 | /* |
| 1653 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1654 | * to ICS UI. |
| 1655 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1656 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
| 1657 | if (pRoamInfo->reasonCode == |
| 1658 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
| 1659 | pr_info("wlan: disconnected due to poor signal, rssi is %d dB\n", pRoamInfo->rxRssi); |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1660 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1661 | dev, false, |
| 1662 | pRoamInfo->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1663 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1664 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1665 | dev, false, |
| 1666 | WLAN_REASON_UNSPECIFIED |
| 1667 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1668 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1669 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1670 | hdd_info("sent disconnected event to nl80211, reason code %d", |
| 1671 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
| 1672 | pRoamInfo->reasonCode : |
| 1673 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1674 | } |
| 1675 | /* |
| 1676 | * During the WLAN uninitialization,supplicant is stopped |
| 1677 | * before the driver so not sending the status of the |
| 1678 | * connection to supplicant. |
| 1679 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1680 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1681 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1682 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1683 | if (global_p2p_connection_status == |
| 1684 | P2P_CLIENT_CONNECTED_STATE_1) { |
| 1685 | global_p2p_connection_status = |
| 1686 | P2P_CLIENT_DISCONNECTED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1687 | hdd_debug("[P2P State] 8 way Handshake completed and moved to disconnected state"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1688 | } else if (global_p2p_connection_status == |
| 1689 | P2P_CLIENT_COMPLETED_STATE) { |
| 1690 | global_p2p_connection_status = |
| 1691 | P2P_NOT_ACTIVE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1692 | hdd_debug("[P2P State] P2P Client is removed and moved to inactive state"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1693 | } |
| 1694 | } |
| 1695 | #endif |
| 1696 | |
| 1697 | } |
| 1698 | } |
| 1699 | |
| 1700 | hdd_wmm_adapter_clear(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1701 | sme_ft_reset(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1702 | if (hdd_remove_beacon_filter(pAdapter) != 0) |
| 1703 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1704 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1705 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1706 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1707 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 1708 | sta_id = pHddStaCtx->broadcast_staid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1709 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1710 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1711 | 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] | 1712 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1713 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1714 | } |
| 1715 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1716 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1717 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1718 | if (HDD_WLAN_INVALID_STA_ID == |
| 1719 | pHddStaCtx->conn_info.staId[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1720 | continue; |
| 1721 | sta_id = pHddStaCtx->conn_info.staId[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1722 | hdd_debug("Deregister StaID %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1723 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1724 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1725 | 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] | 1726 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1727 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1728 | } |
| 1729 | /* set the staid and peer mac as 0, all other |
| 1730 | * reset are done in hdd_connRemoveConnectInfo. |
| 1731 | */ |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1732 | pHddStaCtx->conn_info.staId[i] = |
| 1733 | HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1734 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1735 | sizeof(struct qdf_mac_addr)); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1736 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1737 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1738 | } |
| 1739 | } else { |
| 1740 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1741 | hdd_debug("roamResult: %d", roamResult); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1742 | |
| 1743 | /* clear scan cache for Link Lost */ |
Sandeep Puligilla | f0b3058 | 2017-01-12 08:39:41 -0800 | [diff] [blame] | 1744 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult || |
| 1745 | eCSR_ROAM_RESULT_DISASSOC_IND == roamResult || |
yeshwanth sriram guntuka | 951725a | 2017-03-15 19:33:04 +0530 | [diff] [blame] | 1746 | eCSR_ROAM_LOSTLINK == roamStatus) { |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1747 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 1748 | pHddStaCtx->conn_info.bssId.bytes); |
| 1749 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1750 | pHddStaCtx->conn_info.bssId.bytes); |
| 1751 | } |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1752 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1753 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1754 | /* Clear saved connection information in HDD */ |
| 1755 | hdd_conn_remove_connect_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1756 | hdd_conn_set_connection_state(pAdapter, eConnectionState_NotConnected); |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 1757 | pmo_ucfg_flush_gtk_offload_req(pAdapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1758 | |
| 1759 | #ifdef FEATURE_WLAN_TDLS |
| 1760 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1761 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1762 | #endif |
| 1763 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1764 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 1765 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1766 | sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX |
| 1767 | (pAdapter), |
| 1768 | pAdapter->sessionId); |
| 1769 | } |
Mahesh A Saptasagar | 6dda202 | 2016-09-03 12:59:09 +0530 | [diff] [blame] | 1770 | wlan_hdd_clear_link_layer_stats(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1771 | /* Unblock anyone waiting for disconnect to complete */ |
| 1772 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1773 | hdd_print_bss_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1774 | return status; |
| 1775 | } |
| 1776 | |
| 1777 | /** |
| 1778 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1779 | * @vdev_id: vdevid |
| 1780 | * |
| 1781 | * Return: None |
| 1782 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1783 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1784 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1785 | hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1786 | hdd_adapter_t *adapter = NULL; |
| 1787 | |
| 1788 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1789 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1790 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1791 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1792 | } |
| 1793 | complete(&adapter->sta_authorized_event); |
| 1794 | } |
| 1795 | |
| 1796 | /** |
| 1797 | * hdd_change_peer_state() - change peer state |
| 1798 | * @pAdapter: HDD adapter |
| 1799 | * @sta_state: peer state |
| 1800 | * @roam_synch_in_progress: roam synch in progress |
| 1801 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1802 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1803 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1804 | QDF_STATUS hdd_change_peer_state(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1805 | uint8_t sta_id, |
| 1806 | enum ol_txrx_peer_state sta_state, |
| 1807 | bool roam_synch_in_progress) |
| 1808 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1809 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1810 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1811 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1812 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1813 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1814 | |
| 1815 | if (!pdev) { |
| 1816 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1817 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1818 | } |
| 1819 | |
| 1820 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1821 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1822 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1823 | } |
| 1824 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1825 | peer = cdp_peer_find_by_local_id(soc, |
| 1826 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1827 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1828 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1830 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1831 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1832 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1833 | return QDF_STATUS_E_FAULT; |
| 1834 | } |
| 1835 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1836 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1837 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1838 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1839 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1840 | } |
| 1841 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1842 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1843 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1844 | #endif |
| 1845 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1846 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1847 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1848 | /* make sure event is reset */ |
| 1849 | INIT_COMPLETION(pAdapter->sta_authorized_event); |
| 1850 | #endif |
| 1851 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1852 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1853 | hdd_set_peer_authorized_event, |
| 1854 | pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1855 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1856 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1857 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1858 | } |
| 1859 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1860 | if (pAdapter->device_mode == QDF_STA_MODE || |
| 1861 | pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | #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] | 1863 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1864 | unsigned long rc; |
| 1865 | |
| 1866 | /* wait for event from firmware to set the event */ |
| 1867 | rc = wait_for_completion_timeout( |
| 1868 | &pAdapter->sta_authorized_event, |
| 1869 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1870 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1871 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1872 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1873 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 1874 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1875 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1876 | #endif |
| 1877 | } |
| 1878 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1879 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1880 | } |
| 1881 | |
| 1882 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1883 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 1884 | * @cbk_data: callback data |
| 1885 | * @sta_id: station id |
| 1886 | * @vdev_param: vdev parameter |
| 1887 | * @is_link_up: link state up or down |
| 1888 | * |
| 1889 | * Return: QDF status |
| 1890 | */ |
| 1891 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 1892 | uint8_t sta_id, |
| 1893 | uint32_t vdev_param, |
| 1894 | bool is_link_up) |
| 1895 | { |
| 1896 | struct cdp_vdev *data_vdev; |
| 1897 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1898 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1899 | hdd_context_t *hdd_ctx; |
| 1900 | struct wlan_objmgr_psoc **psoc; |
| 1901 | |
| 1902 | if (!cbk_data) |
| 1903 | return status; |
| 1904 | |
| 1905 | psoc = cbk_data; |
| 1906 | hdd_ctx = container_of(psoc, hdd_context_t, hdd_psoc); |
| 1907 | |
| 1908 | if (!hdd_ctx->tdls_nap_active) |
| 1909 | return status; |
| 1910 | |
| 1911 | data_vdev = cdp_peer_get_vdev_by_sta_id(soc, sta_id); |
| 1912 | if (NULL == data_vdev) { |
| 1913 | status = QDF_STATUS_E_FAILURE; |
| 1914 | return status; |
| 1915 | } |
| 1916 | |
| 1917 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 1918 | |
| 1919 | return status; |
| 1920 | } |
| 1921 | |
| 1922 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1923 | * hdd_roam_register_sta() - register station |
| 1924 | * @pAdapter: pointer to adapter |
| 1925 | * @pRoamInfo: pointer to roam info |
| 1926 | * @staId: station identifier |
| 1927 | * @pPeerMacAddress: peer MAC address |
| 1928 | * @pBssDesc: pointer to BSS description |
| 1929 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1930 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1931 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 1932 | QDF_STATUS hdd_roam_register_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1933 | tCsrRoamInfo *pRoamInfo, |
| 1934 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1935 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1936 | tSirBssDescription *pBssDesc) |
| 1937 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1938 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1939 | struct ol_txrx_desc_type staDesc = { 0 }; |
| 1940 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 1941 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1942 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1943 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1944 | |
| 1945 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1946 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1947 | |
| 1948 | /* Get the Station ID from the one saved during the association */ |
| 1949 | staDesc.sta_id = staId; |
| 1950 | |
| 1951 | /* set the QoS field appropriately */ |
| 1952 | if (hdd_wmm_is_active(pAdapter)) |
| 1953 | staDesc.is_qos_enabled = 1; |
| 1954 | else |
| 1955 | staDesc.is_qos_enabled = 0; |
| 1956 | |
| 1957 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 1958 | hdd_debug("WAPI STA Registered: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1959 | pAdapter->wapi_info.fIsWapiSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1960 | if (pAdapter->wapi_info.fIsWapiSta) |
| 1961 | staDesc.is_wapi_supported = 1; |
| 1962 | else |
| 1963 | staDesc.is_wapi_supported = 0; |
| 1964 | #endif /* FEATURE_WLAN_WAPI */ |
| 1965 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1966 | /* Register the vdev transmit and receive functions */ |
| 1967 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 1968 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1969 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1970 | pAdapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
| 1971 | (struct cdp_pdev *)pdev, |
| 1972 | pAdapter->sessionId); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1973 | if (!pAdapter->txrx_vdev) { |
| 1974 | hdd_err("%s find vdev fail", __func__); |
| 1975 | return QDF_STATUS_E_FAILURE; |
| 1976 | } |
| 1977 | |
| 1978 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1979 | cdp_vdev_register(soc, |
| 1980 | (struct cdp_vdev *)pAdapter->txrx_vdev, pAdapter, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1981 | if (!txrx_ops.tx.tx) { |
| 1982 | hdd_err("%s vdev register fail", __func__); |
| 1983 | return QDF_STATUS_E_FAILURE; |
| 1984 | } |
| 1985 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1986 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1987 | qdf_status = cdp_peer_register(soc, |
| 1988 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1989 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1990 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1991 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1992 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1993 | } |
| 1994 | |
| 1995 | if (!pRoamInfo->fAuthRequired) { |
| 1996 | /* |
| 1997 | * Connections that do not need Upper layer auth, transition |
| 1998 | * TLSHIM directly to 'Authenticated' state |
| 1999 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2000 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2001 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2002 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2003 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2004 | pRoamInfo->roamSynchInProgress |
| 2005 | #else |
| 2006 | false |
| 2007 | #endif |
| 2008 | ); |
| 2009 | |
| 2010 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2011 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2012 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2013 | hdd_debug("ULA auth StaId= %d. Changing TL state to CONNECTED at Join time", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2014 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2015 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2016 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2017 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2018 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2019 | pRoamInfo->roamSynchInProgress |
| 2020 | #else |
| 2021 | false |
| 2022 | #endif |
| 2023 | ); |
| 2024 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2025 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2026 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2027 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2028 | } |
| 2029 | |
| 2030 | /** |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2031 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 2032 | * @dev: network device |
| 2033 | * @bss: cfg80211 roamed bss pointer |
| 2034 | * @req_ie: IEs used in reassociation request |
| 2035 | * @req_ie_len: Length of the @req_ie |
| 2036 | * @resp_ie: IEs received in successful reassociation response |
| 2037 | * @resp_ie_len: Length of @resp_ie |
| 2038 | * |
| 2039 | * Return: none |
| 2040 | */ |
| 2041 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 2042 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 2043 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 2044 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 2045 | size_t req_ie_len, const uint8_t *resp_ie, |
| 2046 | size_t resp_ie_len) |
| 2047 | { |
| 2048 | struct cfg80211_roam_info info = {0}; |
| 2049 | |
| 2050 | info.bss = bss; |
| 2051 | info.req_ie = req_ie; |
| 2052 | info.req_ie_len = req_ie_len; |
| 2053 | info.resp_ie = resp_ie; |
| 2054 | info.resp_ie_len = resp_ie_len; |
| 2055 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 2056 | } |
| 2057 | #else |
| 2058 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 2059 | struct cfg80211_bss *bss, |
| 2060 | const uint8_t *req_ie, size_t req_ie_len, |
| 2061 | const uint8_t *resp_ie, |
| 2062 | size_t resp_ie_len) |
| 2063 | { |
| 2064 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 2065 | GFP_KERNEL); |
| 2066 | } |
| 2067 | #endif |
| 2068 | |
| 2069 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2070 | * hdd_send_re_assoc_event() - send reassoc event |
| 2071 | * @dev: pointer to net device |
| 2072 | * @pAdapter: pointer to adapter |
| 2073 | * @pCsrRoamInfo: pointer to roam info |
| 2074 | * @reqRsnIe: pointer to RSN Information element |
| 2075 | * @reqRsnLength: length of RSN IE |
| 2076 | * |
| 2077 | * Return: none |
| 2078 | */ |
| 2079 | static void hdd_send_re_assoc_event(struct net_device *dev, |
| 2080 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo, |
| 2081 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2082 | { |
| 2083 | unsigned int len = 0; |
| 2084 | u8 *pFTAssocRsp = NULL; |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2085 | uint8_t *rspRsnIe = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
| 2086 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2087 | uint32_t rspRsnLength = 0; |
| 2088 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2089 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 2090 | uint8_t *buf_ptr, ssid_ie_len; |
| 2091 | struct cfg80211_bss *bss = NULL; |
| 2092 | uint8_t *final_req_ie = NULL; |
| 2093 | tCsrRoamConnectedProfile roam_profile; |
| 2094 | tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2095 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2097 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2098 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2099 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2100 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2101 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2102 | } |
| 2103 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2104 | if (!assoc_req_ies) { |
| 2105 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2106 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2107 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2108 | if (pCsrRoamInfo == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2109 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2110 | goto done; |
| 2111 | } |
| 2112 | |
| 2113 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2114 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2115 | goto done; |
| 2116 | } |
| 2117 | |
| 2118 | pFTAssocRsp = |
| 2119 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2120 | pCsrRoamInfo->nAssocReqLength); |
| 2121 | if (pFTAssocRsp == NULL) |
| 2122 | goto done; |
| 2123 | |
| 2124 | /* pFTAssocRsp needs to point to the IEs */ |
| 2125 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2126 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2127 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2128 | |
| 2129 | /* |
| 2130 | * Active session count is decremented upon disconnection, but during |
| 2131 | * roaming, there is no disconnect indication and hence active session |
| 2132 | * count is not decremented. |
| 2133 | * After roaming is completed, active session count is incremented |
| 2134 | * as a part of connect indication but effectively after roaming the |
| 2135 | * active session count should still be the same and hence upon |
| 2136 | * successful reassoc decrement the active session count here. |
| 2137 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2138 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2139 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
| 2140 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | |
| 2142 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 2143 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2144 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2145 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2146 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2147 | |
| 2148 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2149 | (int)pCsrRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2150 | sme_roam_get_connect_profile(hal_handle, pAdapter->sessionId, |
| 2151 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2152 | |
| 2153 | bss = hdd_cfg80211_get_bss(pAdapter->wdev.wiphy, |
| 2154 | chan, pCsrRoamInfo->bssid.bytes, |
| 2155 | &roam_profile.SSID.ssId[0], |
| 2156 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2157 | |
| 2158 | if (bss == NULL) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2159 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2160 | buf_ptr = buf_ssid_ie; |
| 2161 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2162 | buf_ptr++; |
| 2163 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2164 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2165 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2166 | roam_profile.SSID.length); |
| 2167 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2168 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2169 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2170 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2171 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2172 | if (final_req_ie == NULL) { |
| 2173 | if (bss) |
| 2174 | cfg80211_put_bss(pAdapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2175 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2176 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2177 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2178 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2179 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2180 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2181 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2182 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2183 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2184 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2185 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2186 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2187 | hdd_send_roamed_ind(dev, bss, final_req_ie, |
| 2188 | (ssid_ie_len + reqRsnLength), rspRsnIe, |
| 2189 | rspRsnLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2190 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2191 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2192 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2193 | pCsrRoamInfo->nAssocReqLength); |
| 2194 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2195 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2196 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2197 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2198 | |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2199 | wlan_hdd_send_roam_auth_event(pAdapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2200 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2201 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2202 | pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2203 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2204 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2205 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2206 | qdf_mem_free(final_req_ie); |
| 2207 | qdf_mem_free(rspRsnIe); |
| 2208 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2209 | } |
| 2210 | |
| 2211 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2212 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2213 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2214 | * |
| 2215 | * Return: roam sync status if roaming offloaded else false |
| 2216 | */ |
| 2217 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2218 | bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2219 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2220 | if (roaminfo) |
| 2221 | return roaminfo->roamSynchInProgress; |
| 2222 | else |
| 2223 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2224 | } |
| 2225 | #endif |
| 2226 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2227 | /** |
| 2228 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2229 | * @hddstactx: pointer to HDD sta context |
| 2230 | * @roaminfo: pointer to roaminfo structure |
| 2231 | * |
| 2232 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2233 | * MAC address return self staid(0) else find the peer sta id of |
| 2234 | * the peer. |
| 2235 | * |
| 2236 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2237 | */ |
| 2238 | static uint8_t hdd_get_ibss_peer_staid(hdd_station_ctx_t *hddstactx, |
| 2239 | tCsrRoamInfo *roaminfo) |
| 2240 | { |
| 2241 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2242 | QDF_STATUS status; |
| 2243 | |
| 2244 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2245 | staid = 0; |
| 2246 | } else { |
| 2247 | status = hdd_get_peer_sta_id(hddstactx, |
| 2248 | &roaminfo->peerMac, &staid); |
| 2249 | if (status != QDF_STATUS_SUCCESS) { |
| 2250 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2251 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2252 | } |
| 2253 | } |
| 2254 | |
| 2255 | return staid; |
| 2256 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2257 | |
| 2258 | /** |
| 2259 | * hdd_change_sta_state_authenticated()- |
| 2260 | * This function changes STA state to authenticated |
| 2261 | * @adapter: pointer to the adapter structure. |
| 2262 | * @roaminfo: pointer to the RoamInfo structure. |
| 2263 | * |
| 2264 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2265 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2266 | * |
| 2267 | * Return: 0 on success and errno on failure |
| 2268 | */ |
| 2269 | static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter, |
| 2270 | tCsrRoamInfo *roaminfo) |
| 2271 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2272 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2273 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2274 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2275 | hdd_station_ctx_t *hddstactx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2276 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2277 | |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2278 | timeout = hddstactx->hdd_ReassocScenario ? |
| 2279 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2280 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2281 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2282 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2283 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2284 | else |
| 2285 | staid = hddstactx->conn_info.staId[0]; |
| 2286 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2287 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2288 | |
| 2289 | /* Connections that do not need Upper layer authentication, |
| 2290 | * transition TL to 'Authenticated' state after the keys are set |
| 2291 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2292 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2293 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2294 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2295 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2296 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2297 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2298 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2299 | sme_ps_enable_auto_ps_timer( |
| 2300 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 2301 | adapter->sessionId, |
Dustin Brown | 84411b0 | 2017-07-21 16:44:44 -0700 | [diff] [blame] | 2302 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2303 | } |
| 2304 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2305 | return qdf_status_to_os_return(status); |
| 2306 | } |
| 2307 | |
| 2308 | /** |
| 2309 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2310 | * if key installation is required |
| 2311 | * @encr_type: encryption type |
| 2312 | * |
| 2313 | * Return: true if key installation is required and false otherwise. |
| 2314 | */ |
| 2315 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2316 | eCsrEncryptionType encr_type) |
| 2317 | { |
| 2318 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2319 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2320 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2321 | eCSR_ENCRYPT_TYPE_AES_GCMP == encr_type || |
| 2322 | eCSR_ENCRYPT_TYPE_AES_GCMP_256 == encr_type || |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2323 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2324 | return true; |
| 2325 | else |
| 2326 | return false; |
| 2327 | } |
| 2328 | |
| 2329 | /** |
| 2330 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2331 | * complete |
| 2332 | * @adapter: pointer to HDD adapter |
| 2333 | * @roaminfo: pointer to roam info |
| 2334 | * @roam_result: roam result |
| 2335 | * |
| 2336 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2337 | * This function checks for the successful set key completion and update |
| 2338 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2339 | * |
| 2340 | * Return: None |
| 2341 | */ |
| 2342 | static void hdd_change_peer_state_after_set_key(hdd_adapter_t *adapter, |
| 2343 | tCsrRoamInfo *roaminfo, eCsrRoamResult roam_result) |
| 2344 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2345 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 2346 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2347 | |
| 2348 | /* |
| 2349 | * If the security mode is one of the following, IBSS peer will be |
| 2350 | * waiting in CONN state and we will move the peer state to AUTH |
| 2351 | * here. For non-secure connection, no need to wait for set-key complete |
| 2352 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2353 | */ |
| 2354 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2355 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2356 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2357 | |
| 2358 | return; |
| 2359 | } |
| 2360 | |
| 2361 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2362 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2363 | /* |
| 2364 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2365 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2366 | * after roaming. STA TL state moves to authenticated only if |
| 2367 | * ptk_installed is true. So, make ptk_installed to true in |
| 2368 | * case of 11R roaming. |
| 2369 | */ |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2370 | if (sme_neighbor_roam_is11r_assoc(WLAN_HDD_GET_HAL_CTX(adapter), |
| 2371 | adapter->sessionId)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2372 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2373 | } else { |
| 2374 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2375 | } |
| 2376 | |
| 2377 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2378 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2379 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2380 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2381 | * set the unicast and broadcast key. |
| 2382 | */ |
| 2383 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2384 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2385 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2386 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2387 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2388 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2389 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2390 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2391 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2392 | } |
| 2393 | |
| 2394 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2395 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2396 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2397 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2398 | } |
| 2399 | |
| 2400 | hdd_sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2401 | |
| 2402 | return; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2403 | } |
| 2404 | |
| 2405 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2406 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
| 2407 | * @pAdapter: pointer to adapter |
| 2408 | * @pRoamInfo: pointer to roam info |
| 2409 | * @roamId: roam id |
| 2410 | * @roamStatus: roam status |
| 2411 | * @roamResult: roam result |
| 2412 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2413 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2414 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2415 | static QDF_STATUS hdd_roam_set_key_complete_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2416 | tCsrRoamInfo *pRoamInfo, |
| 2417 | uint32_t roamId, |
| 2418 | eRoamCmdStatus roamStatus, |
| 2419 | eCsrRoamResult roamResult) |
| 2420 | { |
| 2421 | eCsrEncryptionType connectedCipherAlgo; |
| 2422 | bool fConnected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2423 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2424 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2425 | ENTER(); |
| 2426 | |
| 2427 | if (NULL == pRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2428 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2429 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2430 | } |
| 2431 | /* |
| 2432 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2433 | * then go to 'authenticated'. For all other authentication types |
| 2434 | * (those that do not require upper layer authentication) we can put TL |
| 2435 | * directly into 'authenticated' state. |
| 2436 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2437 | hdd_info("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2438 | MAC_ADDRESS_STR, roamStatus, roamResult, |
| 2439 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 2440 | |
| 2441 | fConnected = hdd_conn_get_connected_cipher_algo(pHddStaCtx, |
| 2442 | &connectedCipherAlgo); |
| 2443 | if (fConnected) { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2444 | hdd_change_peer_state_after_set_key(pAdapter, pRoamInfo, |
| 2445 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2446 | } else { |
| 2447 | /* |
| 2448 | * possible disassoc after issuing set key and waiting |
| 2449 | * set key complete. |
| 2450 | */ |
| 2451 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2452 | } |
| 2453 | |
| 2454 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2455 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2456 | } |
| 2457 | |
| 2458 | /** |
| 2459 | * hdd_perform_roam_set_key_complete() - perform set key complete |
| 2460 | * @pAdapter: pointer to adapter |
| 2461 | * |
| 2462 | * Return: none |
| 2463 | */ |
| 2464 | void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter) |
| 2465 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2466 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2467 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2468 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2469 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2470 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2471 | qdf_mem_copy(roamInfo.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2472 | pHddStaCtx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2473 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2474 | pHddStaCtx->roam_info.peerMac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2475 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2476 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2477 | hdd_roam_set_key_complete_handler(pAdapter, |
| 2478 | &roamInfo, |
| 2479 | pHddStaCtx->roam_info.roamId, |
| 2480 | pHddStaCtx->roam_info.roamStatus, |
| 2481 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2482 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2483 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2484 | |
| 2485 | pHddStaCtx->roam_info.deferKeyComplete = false; |
| 2486 | } |
| 2487 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 2488 | #if defined(WLAN_FEATURE_FILS_SK) && defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) |
| 2489 | void hdd_clear_fils_connection_info(hdd_adapter_t *adapter) |
| 2490 | { |
| 2491 | hdd_wext_state_t *wext_state; |
| 2492 | |
| 2493 | if ((adapter->device_mode == QDF_SAP_MODE) || |
| 2494 | (adapter->device_mode == QDF_P2P_GO_MODE)) |
| 2495 | return; |
| 2496 | |
| 2497 | wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 2498 | if (wext_state->roamProfile.fils_con_info) { |
| 2499 | qdf_mem_free(wext_state->roamProfile.fils_con_info); |
| 2500 | wext_state->roamProfile.fils_con_info = NULL; |
| 2501 | } |
| 2502 | } |
| 2503 | #endif |
| 2504 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | /** |
| 2506 | * hdd_association_completion_handler() - association completion handler |
| 2507 | * @pAdapter: pointer to adapter |
| 2508 | * @pRoamInfo: pointer to roam info |
| 2509 | * @roamId: roam id |
| 2510 | * @roamStatus: roam status |
| 2511 | * @roamResult: roam result |
| 2512 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2513 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2514 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2515 | static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2516 | tCsrRoamInfo *pRoamInfo, |
| 2517 | uint32_t roamId, |
| 2518 | eRoamCmdStatus roamStatus, |
| 2519 | eCsrRoamResult roamResult) |
| 2520 | { |
| 2521 | struct net_device *dev = pAdapter->dev; |
| 2522 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2523 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2524 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2525 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2526 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2527 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2528 | bool hddDisconInProgress = false; |
| 2529 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2530 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2531 | bool ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2532 | |
| 2533 | if (!pHddCtx) { |
| 2534 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2535 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2536 | } |
| 2537 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2538 | /* validate config */ |
| 2539 | if (!pHddCtx->config) { |
| 2540 | hdd_err("config is NULL"); |
| 2541 | return QDF_STATUS_E_NULL_VALUE; |
| 2542 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | /* HDD has initiated disconnect, do not send connect result indication |
| 2544 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2545 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2546 | if (((eConnectionState_Disconnecting == |
| 2547 | pHddStaCtx->conn_info.connState) || |
| 2548 | (eConnectionState_NotConnected == |
| 2549 | pHddStaCtx->conn_info.connState)) && |
| 2550 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2551 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2552 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
| 2553 | pHddStaCtx->conn_info.connState, |
| 2554 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2555 | hddDisconInProgress = true; |
| 2556 | } |
| 2557 | |
| 2558 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
| 2559 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2560 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2561 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2562 | } |
| 2563 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2564 | hdd_conn_set_connection_state(pAdapter, |
| 2565 | eConnectionState_Associated); |
| 2566 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2567 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2568 | /* Save the connection info from CSR... */ |
| 2569 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, |
| 2570 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2571 | |
| 2572 | if (hdd_add_beacon_filter(pAdapter) != 0) |
| 2573 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | #ifdef FEATURE_WLAN_WAPI |
| 2575 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2576 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
| 2577 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2578 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
| 2579 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2580 | } else { |
| 2581 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2582 | } |
| 2583 | #endif /* FEATURE_WLAN_WAPI */ |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2584 | hdd_debug("bss_descr[%d] devicemode[%d]", !!pRoamInfo->pBssDesc, |
| 2585 | pAdapter->device_mode); |
| 2586 | if ((QDF_STA_MODE == pAdapter->device_mode) && |
| 2587 | pRoamInfo->pBssDesc) { |
| 2588 | ie_len = GET_IE_LEN_IN_BSS(pRoamInfo->pBssDesc->length); |
| 2589 | pHddStaCtx->ap_supports_immediate_power_save = |
| 2590 | wlan_hdd_is_ap_supports_immediate_power_save( |
| 2591 | (uint8_t *) pRoamInfo->pBssDesc->ieFields, |
| 2592 | ie_len); |
| 2593 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
| 2594 | pHddStaCtx->ap_supports_immediate_power_save); |
| 2595 | } |
| 2596 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2597 | /* Indicate 'connect' status to user space */ |
| 2598 | hdd_send_association_event(dev, pRoamInfo); |
| 2599 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2600 | if (policy_mgr_is_mcc_in_24G(pHddCtx->hdd_psoc)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2601 | if (pHddCtx->miracast_value) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2602 | wlan_hdd_set_mas(pAdapter, |
| 2603 | pHddCtx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2604 | } |
| 2605 | |
| 2606 | /* Initialize the Linkup event completion variable */ |
| 2607 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2608 | |
| 2609 | /* |
| 2610 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2611 | * the device properly. Before allowing any packet to go up to |
| 2612 | * the application, device activation has to be ensured for |
| 2613 | * proper queue mapping by the kernel. we have registered net |
| 2614 | * device notifier for device change notification. With this we |
| 2615 | * will come to know that the device is getting |
| 2616 | * activated properly. |
| 2617 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2618 | if (pHddStaCtx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2619 | /* |
| 2620 | * Enable Linkup Event Servicing which allows the net |
| 2621 | * device notifier to set the linkup event variable. |
| 2622 | */ |
| 2623 | pAdapter->isLinkUpSvcNeeded = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2624 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2625 | /* Switch on the Carrier to activate the device */ |
| 2626 | wlan_hdd_netif_queue_control(pAdapter, |
| 2627 | WLAN_NETIF_CARRIER_ON, |
| 2628 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2629 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2630 | /* |
| 2631 | * Wait for the Link to up to ensure all the queues |
| 2632 | * are set properly by the kernel. |
| 2633 | */ |
| 2634 | rc = wait_for_completion_timeout( |
| 2635 | &pAdapter->linkup_event_var, |
| 2636 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2637 | ); |
| 2638 | if (!rc) |
| 2639 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2640 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2641 | /* |
| 2642 | * Disable Linkup Event Servicing - no more service |
| 2643 | * required from the net device notifier call. |
| 2644 | */ |
| 2645 | pAdapter->isLinkUpSvcNeeded = false; |
| 2646 | } else { |
| 2647 | pHddStaCtx->ft_carrier_on = false; |
| 2648 | ft_carrier_on = true; |
| 2649 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2650 | if ((WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId) |
| 2651 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2652 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2653 | hdd_err("Wrong Staid: %d", pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2654 | |
| 2655 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2656 | |
| 2657 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 2658 | hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2659 | HDD_IPA_STA_CONNECT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2660 | pRoamInfo->bssid.bytes); |
| 2661 | |
| 2662 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2663 | wlan_hdd_auto_shutdown_enable(pHddCtx, false); |
| 2664 | #endif |
| 2665 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2666 | hdd_debug("check if STA chan ok for DNBS"); |
| 2667 | if (policy_mgr_is_chan_ok_for_dnbs(pHddCtx->hdd_psoc, |
| 2668 | pHddStaCtx->conn_info.operationChannel, |
| 2669 | &ok)) { |
| 2670 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
| 2671 | pHddStaCtx->conn_info.operationChannel); |
| 2672 | return QDF_STATUS_E_FAILURE; |
| 2673 | } |
| 2674 | |
| 2675 | if (!ok) { |
| 2676 | hdd_err("Chan:%d not suitable for DNBS", |
| 2677 | pHddStaCtx->conn_info.operationChannel); |
| 2678 | wlan_hdd_netif_queue_control(pAdapter, |
| 2679 | WLAN_NETIF_CARRIER_OFF, |
| 2680 | WLAN_CONTROL_PATH); |
| 2681 | if (!hddDisconInProgress) { |
| 2682 | hdd_err("Disconnecting..."); |
| 2683 | sme_roam_disconnect( |
| 2684 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2685 | pAdapter->sessionId, |
| 2686 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2687 | } |
| 2688 | return QDF_STATUS_E_FAILURE; |
| 2689 | } |
| 2690 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2691 | hdd_debug("check for SAP restart"); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2692 | policy_mgr_check_concurrent_intf_and_restart_sap( |
| 2693 | pHddCtx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2694 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2695 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 2696 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2697 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2698 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2699 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2700 | /* |
| 2701 | * For reassoc, the station is already registered, all we need |
| 2702 | * is to change the state of the STA in TL. |
| 2703 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2704 | * CONNECTED instead of AUTHENTICATED. |
| 2705 | */ |
| 2706 | if (!pRoamInfo->fReassocReq) { |
| 2707 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2708 | u8 *pFTAssocRsp = NULL; |
| 2709 | unsigned int assocRsplen = 0; |
| 2710 | u8 *pFTAssocReq = NULL; |
| 2711 | unsigned int assocReqlen = 0; |
| 2712 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2713 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2714 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2715 | |
| 2716 | /* add bss_id to cfg80211 data base */ |
| 2717 | bss = |
| 2718 | wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 2719 | pRoamInfo); |
| 2720 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2721 | hdd_err("wlan: Not able to create BSS entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2722 | wlan_hdd_netif_queue_control(pAdapter, |
| 2723 | WLAN_NETIF_CARRIER_OFF, |
| 2724 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2725 | if (!hddDisconInProgress) { |
| 2726 | /* |
| 2727 | * Here driver was not able to add bss |
| 2728 | * in cfg80211 database this can happen |
| 2729 | * if connected channel is not valid, |
| 2730 | * i.e reg domain was changed during |
| 2731 | * connection. Queue disconnect for the |
| 2732 | * session if disconnect is not in |
| 2733 | * progress. |
| 2734 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2735 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2736 | sme_roam_disconnect( |
| 2737 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2738 | pAdapter->sessionId, |
| 2739 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2740 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2741 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2742 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2743 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2744 | eCSR_AUTH_TYPE_FT_RSN |
| 2745 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2746 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
| 2747 | |
| 2748 | /* Association Response */ |
| 2749 | pFTAssocRsp = |
| 2750 | (u8 *) (pRoamInfo->pbFrames + |
| 2751 | pRoamInfo->nBeaconLength + |
| 2752 | pRoamInfo->nAssocReqLength); |
| 2753 | if (pFTAssocRsp != NULL) { |
| 2754 | /* |
| 2755 | * pFTAssocRsp needs to point to the IEs |
| 2756 | */ |
| 2757 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2758 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2759 | (unsigned int)pFTAssocRsp[0], |
| 2760 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2761 | assocRsplen = |
| 2762 | pRoamInfo->nAssocRspLength - |
| 2763 | FT_ASSOC_RSP_IES_OFFSET; |
| 2764 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2765 | hdd_debug("AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2766 | assocRsplen = 0; |
| 2767 | } |
| 2768 | |
| 2769 | /* Association Request */ |
| 2770 | pFTAssocReq = (u8 *) (pRoamInfo->pbFrames + |
| 2771 | pRoamInfo->nBeaconLength); |
| 2772 | if (pFTAssocReq != NULL) { |
| 2773 | if (!ft_carrier_on) { |
| 2774 | /* |
| 2775 | * pFTAssocReq needs to point to |
| 2776 | * the IEs |
| 2777 | */ |
| 2778 | pFTAssocReq += |
| 2779 | FT_ASSOC_REQ_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2780 | hdd_debug("pFTAssocReq is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2781 | (unsigned int) |
| 2782 | pFTAssocReq[0], |
| 2783 | (unsigned int) |
| 2784 | pFTAssocReq[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2785 | assocReqlen = |
| 2786 | pRoamInfo->nAssocReqLength - |
| 2787 | FT_ASSOC_REQ_IES_OFFSET; |
| 2788 | } else { |
| 2789 | /* |
| 2790 | * This should contain only the |
| 2791 | * FTIEs |
| 2792 | */ |
| 2793 | assocReqlen = |
| 2794 | pRoamInfo->nAssocReqLength; |
| 2795 | } |
| 2796 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2797 | hdd_debug("AssocReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2798 | assocReqlen = 0; |
| 2799 | } |
| 2800 | |
| 2801 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 2802 | if (!hddDisconInProgress && |
| 2803 | pRoamInfo->pBssDesc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2804 | struct cfg80211_bss *roam_bss; |
| 2805 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2806 | /* |
| 2807 | * After roaming is completed, |
| 2808 | * active session count is |
| 2809 | * incremented as a part of |
| 2810 | * connect indication but |
| 2811 | * effectively the active |
| 2812 | * session count should still |
| 2813 | * be the same and hence upon |
| 2814 | * successful reassoc |
| 2815 | * decrement the active session |
| 2816 | * count here. |
| 2817 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2818 | if (!hdd_is_roam_sync_in_progress |
| 2819 | (pRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2820 | policy_mgr_decr_session_set_pcl( |
| 2821 | pHddCtx->hdd_psoc, |
| 2822 | pAdapter->device_mode, |
| 2823 | pAdapter->sessionId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2824 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2825 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2826 | chan = |
| 2827 | ieee80211_get_channel |
| 2828 | (pAdapter->wdev.wiphy, |
| 2829 | (int)pRoamInfo->pBssDesc-> |
| 2830 | channelId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2831 | hdd_debug( |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2832 | "assocReqlen %d assocRsplen %d", |
| 2833 | assocReqlen, |
| 2834 | assocRsplen); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2835 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2836 | hdd_debug( |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2837 | "Reassoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2838 | QDF_TRACE_HEX_DUMP( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2839 | QDF_MODULE_ID_HDD, |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2840 | QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2841 | pFTAssocReq, |
| 2842 | assocReqlen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2843 | roam_bss = |
| 2844 | hdd_cfg80211_get_bss( |
| 2845 | pAdapter->wdev.wiphy, |
| 2846 | chan, |
| 2847 | pRoamInfo->bssid.bytes, |
| 2848 | pRoamInfo->u. |
| 2849 | pConnectedProfile->SSID.ssId, |
| 2850 | pRoamInfo->u. |
| 2851 | pConnectedProfile->SSID.length); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2852 | hdd_send_roamed_ind( |
| 2853 | dev, |
| 2854 | roam_bss, |
| 2855 | pFTAssocReq, |
| 2856 | assocReqlen, |
| 2857 | pFTAssocRsp, |
| 2858 | assocRsplen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2859 | wlan_hdd_send_roam_auth_event( |
| 2860 | pAdapter, |
| 2861 | pRoamInfo->bssid.bytes, |
| 2862 | pFTAssocReq, |
| 2863 | assocReqlen, |
| 2864 | pFTAssocRsp, |
| 2865 | assocRsplen, |
| 2866 | pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2867 | } |
| 2868 | if (sme_get_ftptk_state |
| 2869 | (WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2870 | pAdapter->sessionId)) { |
| 2871 | sme_set_ftptk_state |
| 2872 | (WLAN_HDD_GET_HAL_CTX |
| 2873 | (pAdapter), |
| 2874 | pAdapter->sessionId, |
| 2875 | false); |
| 2876 | pRoamInfo->fAuthRequired = |
| 2877 | false; |
| 2878 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2879 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2880 | roam_info.bssid, |
| 2881 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2882 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2883 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2884 | roam_info.peerMac, |
| 2885 | pRoamInfo->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2886 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2887 | pHddStaCtx->roam_info.roamId = |
| 2888 | roamId; |
| 2889 | pHddStaCtx->roam_info. |
| 2890 | roamStatus = roamStatus; |
| 2891 | pHddStaCtx->roam_info. |
| 2892 | deferKeyComplete = true; |
| 2893 | } |
| 2894 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2895 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2896 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2897 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2898 | pRoamInfo-> |
| 2899 | bssid.bytes, |
| 2900 | pRoamInfo, |
| 2901 | pFTAssocReq, |
| 2902 | assocReqlen, |
| 2903 | pFTAssocRsp, |
| 2904 | assocRsplen, |
| 2905 | WLAN_STATUS_SUCCESS, |
| 2906 | GFP_KERNEL, |
| 2907 | false, |
| 2908 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2909 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2910 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2911 | /* |
| 2912 | * wpa supplicant expecting WPA/RSN IE in |
| 2913 | * connect result. |
| 2914 | */ |
| 2915 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
| 2916 | (pAdapter), |
| 2917 | pAdapter->sessionId, |
| 2918 | &reqRsnLength, |
| 2919 | reqRsnIe); |
| 2920 | |
| 2921 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
| 2922 | (pAdapter), |
| 2923 | pAdapter->sessionId, |
| 2924 | &rspRsnLength, |
| 2925 | rspRsnIe); |
| 2926 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2927 | if (ft_carrier_on) |
| 2928 | hdd_send_re_assoc_event(dev, |
| 2929 | pAdapter, |
| 2930 | pRoamInfo, |
| 2931 | reqRsnIe, |
| 2932 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2933 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2934 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2935 | MAC_ADDRESS_STR |
| 2936 | " result:%d and Status:%d", |
| 2937 | MAC_ADDR_ARRAY |
| 2938 | (pRoamInfo->bssid.bytes), |
| 2939 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2940 | |
| 2941 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2942 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2943 | pRoamInfo-> |
| 2944 | bssid.bytes, |
| 2945 | pRoamInfo, |
| 2946 | reqRsnIe, |
| 2947 | reqRsnLength, |
| 2948 | rspRsnIe, |
| 2949 | rspRsnLength, |
| 2950 | WLAN_STATUS_SUCCESS, |
| 2951 | GFP_KERNEL, |
| 2952 | false, |
| 2953 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2954 | } |
| 2955 | } |
| 2956 | } |
| 2957 | if (!hddDisconInProgress) { |
| 2958 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2959 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2960 | bss); |
| 2961 | |
| 2962 | /* |
| 2963 | * Perform any WMM-related association |
| 2964 | * processing. |
| 2965 | */ |
| 2966 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2967 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2968 | |
| 2969 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2970 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2971 | */ |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2972 | qdf_status = hdd_roam_register_sta(pAdapter, |
| 2973 | pRoamInfo, |
| 2974 | pHddStaCtx->conn_info.staId[0], |
| 2975 | NULL, pRoamInfo->pBssDesc); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2976 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2977 | wlan_hdd_netif_queue_control(pAdapter, |
| 2978 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2979 | WLAN_CONTROL_PATH); |
| 2980 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2981 | } |
| 2982 | } else { |
| 2983 | /* |
| 2984 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 2985 | * in case of reassociation also need to indicate it to |
| 2986 | * supplicant. |
| 2987 | */ |
| 2988 | csr_roam_get_wpa_rsn_req_ie( |
| 2989 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2990 | pAdapter->sessionId, |
| 2991 | &reqRsnLength, reqRsnIe); |
| 2992 | |
| 2993 | hdd_send_re_assoc_event(dev, pAdapter, pRoamInfo, |
| 2994 | reqRsnIe, reqRsnLength); |
| 2995 | /* Reassoc successfully */ |
| 2996 | if (pRoamInfo->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2997 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2998 | hdd_change_peer_state(pAdapter, |
| 2999 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3000 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3001 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3002 | pRoamInfo->roamSynchInProgress |
| 3003 | #else |
| 3004 | false |
| 3005 | #endif |
| 3006 | ); |
| 3007 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3008 | hdd_objmgr_set_peer_mlme_auth_state( |
| 3009 | pAdapter->hdd_vdev, |
| 3010 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3011 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3012 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3013 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3014 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3015 | hdd_change_peer_state(pAdapter, |
| 3016 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3017 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3018 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3019 | pRoamInfo->roamSynchInProgress |
| 3020 | #else |
| 3021 | false |
| 3022 | #endif |
| 3023 | ); |
| 3024 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3025 | hdd_objmgr_set_peer_mlme_auth_state( |
| 3026 | pAdapter->hdd_vdev, |
| 3027 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3028 | } |
| 3029 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3030 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3031 | /* |
| 3032 | * Perform any WMM-related association |
| 3033 | * processing |
| 3034 | */ |
| 3035 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 3036 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3037 | } |
| 3038 | |
| 3039 | /* Start the tx queues */ |
| 3040 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3041 | if (pRoamInfo->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3042 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3043 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3044 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3045 | wlan_hdd_netif_queue_control(pAdapter, |
| 3046 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3047 | WLAN_CONTROL_PATH); |
| 3048 | } |
| 3049 | |
Padma, Santhosh Kumar | 724f63d | 2016-08-09 16:04:31 +0530 | [diff] [blame] | 3050 | #ifdef FEATURE_WLAN_TDLS |
| 3051 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 3052 | #endif |
| 3053 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3054 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3055 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3056 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3057 | } |
| 3058 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3059 | qdf_mem_zero(&pAdapter->hdd_stats.hddPmfStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3060 | sizeof(pAdapter->hdd_stats.hddPmfStats)); |
| 3061 | #endif |
| 3062 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3063 | bool connect_timeout = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3064 | hdd_wext_state_t *pWextState = |
| 3065 | WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3066 | if (pRoamInfo) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3067 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3068 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3069 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3070 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3071 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3072 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3073 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3074 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3075 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3076 | |
| 3077 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 3078 | (pRoamInfo && |
| 3079 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
| 3080 | pRoamInfo->statusCode) || |
| 3081 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
| 3082 | pRoamInfo->statusCode) || |
| 3083 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
| 3084 | pRoamInfo->statusCode)))) { |
| 3085 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 3086 | pRoamInfo ? |
| 3087 | pRoamInfo->bssid.bytes : |
| 3088 | pWextState->req_bssId.bytes); |
| 3089 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 3090 | pRoamInfo ? |
| 3091 | pRoamInfo->bssid.bytes : |
| 3092 | pWextState->req_bssId.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3093 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3094 | } |
| 3095 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3096 | /* |
| 3097 | * CR465478: Only send up a connection failure result when CSR |
| 3098 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3099 | */ |
| 3100 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3101 | && !hddDisconInProgress) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3102 | if (pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3103 | hdd_err("send connect failure to nl80211: for bssid " |
| 3104 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3105 | " result: %d and Status: %d reasoncode: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3106 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3107 | roamResult, roamStatus, |
| 3108 | pRoamInfo->reasonCode); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3109 | pHddStaCtx->conn_info.assoc_status_code = |
| 3110 | pRoamInfo->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3111 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3112 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3113 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3114 | " result: %d and status: %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3115 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3116 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3117 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3118 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3119 | wlan_deregister_txrx_packetdump(); |
| 3120 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3121 | /* inform association failure event to nl80211 */ |
| 3122 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3123 | roamResult) { |
| 3124 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3125 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3126 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3127 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3128 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3129 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3130 | connect_timeout, |
| 3131 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3132 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3133 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3134 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3135 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3136 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3137 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3138 | connect_timeout, |
| 3139 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3140 | } else { |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3141 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3142 | hdd_connect_result(dev, |
| 3143 | pRoamInfo->bssid.bytes, |
| 3144 | NULL, NULL, 0, NULL, 0, |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3145 | pRoamInfo->reasonCode ? |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3146 | pRoamInfo->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3148 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3149 | connect_timeout, |
| 3150 | pRoamInfo->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3151 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3152 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3153 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3154 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3155 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3156 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3157 | connect_timeout, |
| 3158 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3159 | } |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3160 | hdd_clear_roam_profile_ie(pAdapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3161 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3162 | && !hddDisconInProgress)) { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3163 | hdd_connect_result(dev, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3164 | pWextState->req_bssId.bytes, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3165 | NULL, NULL, 0, NULL, 0, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3166 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3167 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3168 | connect_timeout, |
| 3169 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3170 | } |
| 3171 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3172 | /* |
| 3173 | * Set connection state to eConnectionState_NotConnected only |
| 3174 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3175 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3176 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3177 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3178 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3179 | && !hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3180 | hdd_conn_set_connection_state(pAdapter, |
| 3181 | eConnectionState_NotConnected); |
| 3182 | } |
| 3183 | hdd_wmm_init(pAdapter); |
| 3184 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3185 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3186 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3187 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3188 | WLAN_CONTROL_PATH); |
| 3189 | } |
| 3190 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3191 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3192 | } |
| 3193 | |
| 3194 | /** |
| 3195 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
| 3196 | * @pAdapter: pointer to adapter |
| 3197 | * @pRoamInfo: pointer to roam info |
| 3198 | * @roamId: roam id |
| 3199 | * @roamStatus: roam status |
| 3200 | * @roamResult: roam result |
| 3201 | * |
| 3202 | * Here we update the status of the Ibss when we receive information that we |
| 3203 | * have started/joined an ibss session. |
| 3204 | * |
| 3205 | * Return: none |
| 3206 | */ |
| 3207 | static void hdd_roam_ibss_indication_handler(hdd_adapter_t *pAdapter, |
| 3208 | tCsrRoamInfo *pRoamInfo, |
| 3209 | uint32_t roamId, |
| 3210 | eRoamCmdStatus roamStatus, |
| 3211 | eCsrRoamResult roamResult) |
| 3212 | { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3213 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3214 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3215 | hdd_debug("%s: id %d, status %d, result %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3216 | pAdapter->dev->name, roamId, |
| 3217 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3218 | |
| 3219 | switch (roamResult) { |
| 3220 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3221 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3222 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3223 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3224 | { |
| 3225 | hdd_context_t *pHddCtx = |
| 3226 | (hdd_context_t *) pAdapter->pHddCtx; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3227 | hdd_station_ctx_t *hdd_sta_ctx = |
| 3228 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3229 | struct qdf_mac_addr broadcastMacAddr = |
| 3230 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3231 | |
| 3232 | if (NULL == pRoamInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3233 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3234 | return; |
| 3235 | } |
| 3236 | |
| 3237 | /* When IBSS Started comes from CSR, we need to move |
| 3238 | * connection state to IBSS Disconnected (meaning no peers |
| 3239 | * are in the IBSS). |
| 3240 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3241 | hdd_conn_set_connection_state(pAdapter, |
| 3242 | eConnectionState_IbssDisconnected); |
| 3243 | /* notify wmm */ |
| 3244 | hdd_wmm_connect(pAdapter, pRoamInfo, |
| 3245 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3246 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 3247 | hdd_sta_ctx->broadcast_staid = pRoamInfo->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3248 | |
| 3249 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3250 | pAdapter; |
| 3251 | hdd_roam_register_sta(pAdapter, pRoamInfo, |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3252 | pRoamInfo->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3253 | &broadcastMacAddr, |
| 3254 | pRoamInfo->pBssDesc); |
| 3255 | |
| 3256 | if (pRoamInfo->pBssDesc) { |
| 3257 | struct cfg80211_bss *bss; |
| 3258 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3259 | struct ieee80211_channel *chan; |
| 3260 | int chan_no; |
| 3261 | unsigned int freq; |
| 3262 | #endif |
| 3263 | /* we created the IBSS, notify supplicant */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3264 | hdd_info("%s: created ibss " MAC_ADDRESS_STR, |
| 3265 | pAdapter->dev->name, |
| 3266 | MAC_ADDR_ARRAY( |
| 3267 | pRoamInfo->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | |
| 3269 | /* we must first give cfg80211 the BSS information */ |
| 3270 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 3271 | pRoamInfo); |
| 3272 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3273 | hdd_err("%s: unable to create IBSS entry", |
| 3274 | pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3275 | return; |
| 3276 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3277 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3278 | wlan_hdd_netif_queue_control(pAdapter, |
| 3279 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3280 | WLAN_CONTROL_PATH); |
| 3281 | |
| 3282 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3283 | chan_no = pRoamInfo->pBssDesc->channelId; |
| 3284 | |
| 3285 | if (chan_no <= 14) |
| 3286 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3287 | HDD_NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3288 | else |
| 3289 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3290 | HDD_NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3291 | |
| 3292 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3293 | |
| 3294 | if (chan) |
| 3295 | cfg80211_ibss_joined(pAdapter->dev, |
| 3296 | bss->bssid, chan, |
| 3297 | GFP_KERNEL); |
| 3298 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3299 | hdd_warn("%s: chanId: %d, can't find channel", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3300 | pAdapter->dev->name, |
| 3301 | (int)pRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3302 | #else |
| 3303 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3304 | GFP_KERNEL); |
| 3305 | #endif |
| 3306 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3307 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3308 | bss); |
| 3309 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3310 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3311 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
| 3312 | pAdapter->device_mode, pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3313 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3314 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3315 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
| 3316 | pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3317 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3318 | break; |
| 3319 | } |
| 3320 | |
| 3321 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3322 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3323 | hdd_err("%s: unable to create IBSS", pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3324 | break; |
| 3325 | } |
| 3326 | |
| 3327 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3328 | hdd_err("%s: unexpected result %d", |
| 3329 | pAdapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3330 | break; |
| 3331 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3332 | } |
| 3333 | |
| 3334 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3335 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3336 | * @sta_ctx: pointer to hdd station context |
| 3337 | * @sta_id: station ID |
| 3338 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | * |
| 3340 | * This information is passed to iwconfig later. The peer that joined |
| 3341 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3342 | |
| 3343 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3344 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3345 | bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id, |
| 3346 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3347 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3348 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3349 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3350 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3351 | if (HDD_WLAN_INVALID_STA_ID == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3352 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3353 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3354 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3355 | qdf_copy_macaddr( |
| 3356 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3357 | peer_mac_addr); |
| 3358 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3359 | } |
| 3360 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3361 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3362 | } |
| 3363 | |
| 3364 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3365 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3366 | * @sta_ctx: pointer to hdd station context |
| 3367 | * @sta_id: station ID |
| 3368 | * |
| 3369 | * Return: None |
| 3370 | */ |
| 3371 | void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id) |
| 3372 | { |
| 3373 | int i; |
| 3374 | |
| 3375 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3376 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3377 | sta_ctx->conn_info.staId[i] = HDD_WLAN_INVALID_STA_ID; |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3378 | return; |
| 3379 | } |
| 3380 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3381 | } |
| 3382 | |
| 3383 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
| 3385 | * @pAdapter: pointer to adapter |
| 3386 | * @staId: station id |
| 3387 | * |
| 3388 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3389 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3390 | * false otherwise. |
| 3391 | */ |
| 3392 | static bool roam_remove_ibss_station(hdd_adapter_t *pAdapter, uint8_t staId) |
| 3393 | { |
| 3394 | bool fSuccess = false; |
| 3395 | int idx = 0; |
| 3396 | uint8_t valid_idx = 0; |
| 3397 | uint8_t del_idx = 0; |
| 3398 | uint8_t empty_slots = 0; |
| 3399 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3400 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3401 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3402 | if (staId == pHddStaCtx->conn_info.staId[idx]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3403 | pHddStaCtx->conn_info.staId[idx] = |
| 3404 | HDD_WLAN_INVALID_STA_ID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3405 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3406 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3407 | peerMacAddress[idx]); |
| 3408 | |
| 3409 | fSuccess = true; |
| 3410 | |
| 3411 | /* |
| 3412 | * Note the deleted Index, if its 0 we need special |
| 3413 | * handling. |
| 3414 | */ |
| 3415 | del_idx = idx; |
| 3416 | |
| 3417 | empty_slots++; |
| 3418 | } else { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3419 | if (pHddStaCtx->conn_info.staId[idx] != |
| 3420 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3421 | valid_idx = idx; |
| 3422 | } else { |
| 3423 | /* Found an empty slot */ |
| 3424 | empty_slots++; |
| 3425 | } |
| 3426 | } |
| 3427 | } |
| 3428 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3429 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3430 | /* Last peer departed, set the IBSS state appropriately */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3431 | hdd_conn_set_connection_state(pAdapter, |
| 3432 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3433 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3434 | } |
| 3435 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3436 | if (fSuccess == true) { |
| 3437 | if (del_idx == 0) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3438 | if (pHddStaCtx->conn_info.staId[valid_idx] != |
| 3439 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3440 | pHddStaCtx->conn_info.staId[0] = |
| 3441 | pHddStaCtx->conn_info.staId[valid_idx]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3442 | qdf_copy_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3443 | peerMacAddress[0], |
| 3444 | &pHddStaCtx->conn_info. |
| 3445 | peerMacAddress[valid_idx]); |
| 3446 | |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3447 | pHddStaCtx->conn_info.staId[valid_idx] = |
| 3448 | HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3449 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3450 | peerMacAddress[valid_idx]); |
| 3451 | } |
| 3452 | } |
| 3453 | } |
| 3454 | return fSuccess; |
| 3455 | } |
| 3456 | |
| 3457 | /** |
| 3458 | * roam_ibss_connect_handler() - IBSS connection handler |
| 3459 | * @pAdapter: pointer to adapter |
| 3460 | * @pRoamInfo: pointer to roam info |
| 3461 | * |
| 3462 | * We update the status of the IBSS to connected in this function. |
| 3463 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3464 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3465 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3466 | static QDF_STATUS roam_ibss_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3467 | tCsrRoamInfo *pRoamInfo) |
| 3468 | { |
| 3469 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3470 | /* |
| 3471 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3472 | * a partner stations). |
| 3473 | */ |
| 3474 | hdd_conn_set_connection_state(pAdapter, eConnectionState_IbssConnected); |
| 3475 | |
| 3476 | /* Save the connection info from CSR... */ |
| 3477 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
| 3478 | |
| 3479 | /* Send the bssid address to the wext. */ |
| 3480 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3481 | /* add bss_id to cfg80211 data base */ |
| 3482 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3483 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3484 | hdd_err("%s: unable to create IBSS entry", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3485 | pAdapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3486 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3487 | } |
| 3488 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3489 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3490 | bss); |
| 3491 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3492 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3493 | } |
| 3494 | |
| 3495 | /** |
| 3496 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
| 3497 | * @pAdapter: pointer to adapter |
| 3498 | * @pRoamInfo: pointer to roam info |
| 3499 | * @roamId: roam id |
| 3500 | * @roamStatus: roam status |
| 3501 | * @roamResult: roam result |
| 3502 | * |
| 3503 | * This function indicates the Mic failure to the supplicant |
| 3504 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3505 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3506 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3507 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | hdd_roam_mic_error_indication_handler(hdd_adapter_t *pAdapter, |
| 3509 | tCsrRoamInfo *pRoamInfo, |
| 3510 | uint32_t roamId, |
| 3511 | eRoamCmdStatus roamStatus, |
| 3512 | eCsrRoamResult roamResult) |
| 3513 | { |
| 3514 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3515 | |
| 3516 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3517 | TKIP_COUNTER_MEASURE_STOPED == |
| 3518 | pHddStaCtx->WextState.mTKIPCounterMeasures) { |
| 3519 | struct iw_michaelmicfailure msg; |
| 3520 | union iwreq_data wreq; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3521 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3522 | memset(&msg, '\0', sizeof(msg)); |
| 3523 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3524 | memcpy(msg.src_addr.sa_data, |
| 3525 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3526 | sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3527 | hdd_debug("MIC MAC " MAC_ADDRESS_STR, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3528 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3529 | |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3530 | if (pRoamInfo->u.pMICFailureInfo->multicast == true) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3531 | msg.flags = IW_MICFAILURE_GROUP; |
| 3532 | else |
| 3533 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3534 | memset(&wreq, 0, sizeof(wreq)); |
| 3535 | wreq.data.length = sizeof(msg); |
| 3536 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, |
| 3537 | (char *)&msg); |
| 3538 | /* inform mic failure to nl80211 */ |
| 3539 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 3540 | pRoamInfo->u.pMICFailureInfo-> |
| 3541 | taMacAddr, |
| 3542 | ((pRoamInfo->u.pMICFailureInfo-> |
| 3543 | multicast == |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3544 | true) ? |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3545 | NL80211_KEYTYPE_GROUP : |
| 3546 | NL80211_KEYTYPE_PAIRWISE), |
| 3547 | pRoamInfo->u.pMICFailureInfo-> |
| 3548 | keyId, |
| 3549 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 3550 | GFP_KERNEL); |
| 3551 | |
| 3552 | } |
| 3553 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3554 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3555 | } |
| 3556 | |
| 3557 | /** |
| 3558 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
| 3559 | * @pAdapter: pointer to adapter |
| 3560 | * @pRoamInfo: pointer to roam info |
| 3561 | * @roamId: roam id |
| 3562 | * @roamStatus: roam status |
| 3563 | * @roamResult: roam result |
| 3564 | * |
| 3565 | * The Ibss connection status is updated regularly here in this function. |
| 3566 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3567 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3568 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3569 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3570 | roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter, |
| 3571 | tCsrRoamInfo *pRoamInfo, |
| 3572 | uint32_t roamId, |
| 3573 | eRoamCmdStatus roamStatus, |
| 3574 | eCsrRoamResult roamResult) |
| 3575 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3576 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3577 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3578 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3579 | switch (roamResult) { |
| 3580 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3581 | { |
| 3582 | hdd_station_ctx_t *pHddStaCtx = |
| 3583 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3584 | struct station_info *stainfo; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3585 | eCsrEncryptionType encr_type = pHddStaCtx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3587 | hdd_info("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3588 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3589 | MAC_ADDRESS_STR " and stationID= %d", |
| 3590 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3591 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3592 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3593 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3594 | if (!hdd_save_peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3595 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 3596 | pRoamInfo->staId, |
| 3597 | &pRoamInfo->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3598 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3599 | break; |
| 3600 | } |
| 3601 | |
| 3602 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3603 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3604 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 3605 | pRoamInfo->fAuthRequired = true; |
| 3606 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3607 | /* Register the Station with TL for the new peer. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3608 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3609 | pRoamInfo, |
| 3610 | pRoamInfo->staId, |
| 3611 | &pRoamInfo->peerMac, |
| 3612 | pRoamInfo->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3613 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3614 | 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] | 3615 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3616 | } |
| 3617 | pHddStaCtx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3618 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3619 | if (stainfo == NULL) { |
| 3620 | hdd_err("memory allocation for station_info failed"); |
| 3621 | return QDF_STATUS_E_NOMEM; |
| 3622 | } |
| 3623 | stainfo->filled = 0; |
| 3624 | stainfo->generation = pHddStaCtx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3625 | |
| 3626 | cfg80211_new_sta(pAdapter->dev, |
| 3627 | (const u8 *)pRoamInfo->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3628 | stainfo, GFP_KERNEL); |
| 3629 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3630 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3631 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3632 | pHddStaCtx->ibss_enc_key.keyDirection = |
| 3633 | eSIR_TX_RX; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3634 | qdf_copy_macaddr(&pHddStaCtx->ibss_enc_key.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3635 | &pRoamInfo->peerMac); |
| 3636 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3637 | hdd_info("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3638 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3639 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3640 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3641 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
| 3642 | (pAdapter), |
| 3643 | pAdapter->sessionId, |
| 3644 | &pHddStaCtx->ibss_enc_key, |
| 3645 | &roamId); |
| 3646 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3647 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3648 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3649 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3650 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3651 | } |
| 3652 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3653 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3654 | wlan_hdd_netif_queue_control(pAdapter, |
| 3655 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3656 | WLAN_CONTROL_PATH); |
| 3657 | break; |
| 3658 | } |
| 3659 | |
| 3660 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3661 | { |
| 3662 | |
| 3663 | roam_ibss_connect_handler(pAdapter, pRoamInfo); |
| 3664 | |
| 3665 | break; |
| 3666 | } |
| 3667 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3668 | { |
| 3669 | hdd_station_ctx_t *pHddStaCtx = |
| 3670 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3671 | |
| 3672 | if (!roam_remove_ibss_station(pAdapter, pRoamInfo->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3673 | 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] | 3674 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3675 | hdd_info("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3676 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3677 | MAC_ADDRESS_STR " and stationID= %d", |
| 3678 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3679 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3680 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3681 | |
| 3682 | hdd_roam_deregister_sta(pAdapter, pRoamInfo->staId); |
| 3683 | |
| 3684 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 3685 | pHddStaCtx->ibss_sta_generation++; |
| 3686 | |
| 3687 | cfg80211_del_sta(pAdapter->dev, |
| 3688 | (const u8 *)&pRoamInfo->peerMac.bytes, |
| 3689 | GFP_KERNEL); |
| 3690 | break; |
| 3691 | } |
| 3692 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3693 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3694 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3695 | /* Stop only when we are inactive */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3696 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3697 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3698 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3699 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3700 | hdd_conn_set_connection_state(pAdapter, |
| 3701 | eConnectionState_NotConnected); |
| 3702 | |
| 3703 | /* Send the bssid address to the wext. */ |
| 3704 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3705 | break; |
| 3706 | } |
| 3707 | default: |
| 3708 | break; |
| 3709 | |
| 3710 | } |
| 3711 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3712 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3713 | } |
| 3714 | |
| 3715 | #ifdef FEATURE_WLAN_TDLS |
| 3716 | /** |
| 3717 | * hdd_roam_register_tdlssta() - register new TDLS station |
| 3718 | * @pAdapter: pointer to adapter |
| 3719 | * @peerMac: pointer to peer MAC address |
| 3720 | * @staId: station identifier |
| 3721 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3722 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3723 | * |
| 3724 | * Construct the staDesc and register with TL the new STA. |
| 3725 | * This is called as part of ADD_STA in the TDLS setup. |
| 3726 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3727 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3728 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3729 | QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3730 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3731 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3732 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3733 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3734 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3735 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3736 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3737 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3738 | |
| 3739 | /* |
| 3740 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3741 | * be peer MAC, here we are working on direct Link |
| 3742 | */ |
| 3743 | staDesc.sta_id = staId; |
| 3744 | |
| 3745 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3746 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3747 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3748 | /* Register the vdev transmit and receive functions */ |
| 3749 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3750 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3751 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3752 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
| 3753 | (struct cdp_pdev *)pdev, pAdapter->sessionId), |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3754 | pAdapter, &txrx_ops); |
| 3755 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3756 | |
| 3757 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3758 | qdf_status = cdp_peer_register(soc, |
| 3759 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3760 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3761 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3762 | qdf_status, qdf_status); |
| 3763 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3764 | } |
| 3765 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3766 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3767 | } |
| 3768 | |
| 3769 | /** |
| 3770 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
| 3771 | * @pAdapter: pointer to adapter |
| 3772 | * @staId: station identifier |
| 3773 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3774 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3775 | */ |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3776 | QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, uint8_t staId) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3777 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3778 | QDF_STATUS qdf_status; |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3779 | 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] | 3780 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3781 | staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3782 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3783 | hdd_err("cdp_clear_peer() failed for staID: %d Status: %d [0x%08X]", |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3784 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3785 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3786 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3787 | } |
| 3788 | |
| 3789 | /** |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3790 | * hdd_tdls_connection_tracker_update() - update connection tracker state |
| 3791 | * @adapter: pointer to adapter |
| 3792 | * @roam_info: pointer to roam info |
| 3793 | * @hdd_tdls_ctx: tdls context |
| 3794 | * |
| 3795 | * Return: QDF_STATUS enumeration |
| 3796 | */ |
| 3797 | static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, |
| 3798 | tCsrRoamInfo *roam_info, |
| 3799 | tdlsCtx_t *hdd_tdls_ctx) |
| 3800 | { |
| 3801 | hddTdlsPeer_t *curr_peer; |
| 3802 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3803 | |
| 3804 | curr_peer = wlan_hdd_tdls_find_peer(adapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3805 | roam_info->peerMac.bytes); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3806 | |
| 3807 | if (!curr_peer) { |
| 3808 | hdd_err("curr_peer is null"); |
| 3809 | return QDF_STATUS_E_FAILURE; |
| 3810 | } |
| 3811 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3812 | if (eTDLS_LINK_CONNECTED == |
| 3813 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3814 | hdd_debug("Received CONNECTION_TRACKER_NOTIFICATION " |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3815 | MAC_ADDRESS_STR |
| 3816 | " staId: %d, reason: %d", |
| 3817 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3818 | roam_info->staId, |
| 3819 | roam_info->reasonCode); |
| 3820 | |
| 3821 | if (roam_info->reasonCode == |
| 3822 | eWNI_TDLS_PEER_ENTER_BUF_STA || |
| 3823 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3824 | eWNI_TDLS_ENTER_BT_BUSY_MODE || |
| 3825 | roam_info->reasonCode == |
| 3826 | eWMI_TDLS_SCAN_STARTED_EVENT) |
| 3827 | hdd_ctx->enable_tdls_connection_tracker = false; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3828 | else if (roam_info->reasonCode == |
| 3829 | eWNI_TDLS_PEER_EXIT_BUF_STA || |
| 3830 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3831 | eWNI_TDLS_EXIT_BT_BUSY_MODE || |
| 3832 | roam_info->reasonCode == |
| 3833 | eWMI_TDLS_SCAN_COMPLETED_EVENT) |
| 3834 | hdd_ctx->enable_tdls_connection_tracker = true; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3835 | hdd_debug("hdd_ctx->enable_tdls_connection_tracker %d", |
Nitesh Shah | c549dd5 | 2017-02-23 16:45:44 +0530 | [diff] [blame] | 3836 | hdd_ctx->enable_tdls_connection_tracker); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3837 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3838 | hdd_debug("TDLS not connected, ignore notification, reason: %d", |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3839 | roam_info->reasonCode); |
| 3840 | } |
| 3841 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3842 | return QDF_STATUS_SUCCESS; |
| 3843 | } |
| 3844 | |
| 3845 | |
| 3846 | |
| 3847 | |
| 3848 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3849 | * hdd_roam_tdls_status_update_handler() - TDLS status update handler |
| 3850 | * @pAdapter: pointer to adapter |
| 3851 | * @pRoamInfo: pointer to roam info |
| 3852 | * @roamId: roam id |
| 3853 | * @roamStatus: roam status |
| 3854 | * @roamResult: roam result |
| 3855 | * |
| 3856 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3857 | * TL in case of new TDLS client is added and deregistration at the time |
| 3858 | * TDLS client is deleted. |
| 3859 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3860 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3861 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3862 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3863 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 3864 | tCsrRoamInfo *pRoamInfo, |
| 3865 | uint32_t roamId, |
| 3866 | eRoamCmdStatus roamStatus, |
| 3867 | eCsrRoamResult roamResult) |
| 3868 | { |
| 3869 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3870 | tdlsCtx_t *pHddTdlsCtx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3871 | tSmeTdlsPeerStateParams smeTdlsPeerStateParams; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3872 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3873 | uint8_t staIdx; |
| 3874 | hddTdlsPeer_t *curr_peer; |
| 3875 | uint32_t reason; |
| 3876 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3877 | hdd_debug("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3878 | roamResult == |
| 3879 | eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : roamResult |
| 3880 | == |
| 3881 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 3882 | roamResult == |
| 3883 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" |
| 3884 | : roamResult == |
| 3885 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3886 | "DEL_ALL_TDLS_PEER_IND" : roamResult == |
| 3887 | eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? "UPDATE_TDLS_PEER" : |
| 3888 | roamResult == |
| 3889 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 3890 | "LINK_ESTABLISH_REQ_RSP" : roamResult == |
| 3891 | eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER ? "TDLS_SHOULD_DISCOVER" |
| 3892 | : roamResult == |
| 3893 | eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN ? "TDLS_SHOULD_TEARDOWN" |
| 3894 | : roamResult == |
| 3895 | eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED ? |
| 3896 | "TDLS_SHOULD_PEER_DISCONNECTED" : "UNKNOWN", pRoamInfo->staId, |
| 3897 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3898 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3899 | switch (roamResult) { |
| 3900 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3901 | { |
| 3902 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3903 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3904 | pRoamInfo->statusCode); |
Selvaraj, Sridhar | 5d95e63 | 2016-09-14 17:00:38 +0530 | [diff] [blame] | 3905 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3906 | } else { |
| 3907 | /* |
| 3908 | * Check if there is available index for this new TDLS |
| 3909 | * STA. |
| 3910 | */ |
| 3911 | for (staIdx = 0; |
| 3912 | staIdx < pHddCtx->max_num_tdls_sta; |
| 3913 | staIdx++) { |
| 3914 | if (0 == |
| 3915 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3916 | staId) { |
| 3917 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3918 | sessionId = |
| 3919 | pRoamInfo->sessionId; |
| 3920 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3921 | staId = pRoamInfo->staId; |
| 3922 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3923 | hdd_debug("TDLS: STA IDX at %d is %d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3924 | "of mac " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3925 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3926 | staIdx, |
| 3927 | pHddCtx-> |
| 3928 | tdlsConnInfo[staIdx]. |
| 3929 | staId, |
| 3930 | MAC_ADDR_ARRAY |
| 3931 | (pRoamInfo->peerMac.bytes)); |
| 3932 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3933 | qdf_copy_macaddr(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3934 | tdlsConnInfo |
| 3935 | [staIdx]. |
| 3936 | peerMac, |
| 3937 | &pRoamInfo-> |
| 3938 | peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3939 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3940 | break; |
| 3941 | } |
| 3942 | } |
| 3943 | if (staIdx < pHddCtx->max_num_tdls_sta) { |
| 3944 | if (-1 == |
| 3945 | wlan_hdd_tdls_set_sta_id(pAdapter, |
| 3946 | pRoamInfo-> |
| 3947 | peerMac.bytes, |
| 3948 | pRoamInfo-> |
| 3949 | staId)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3950 | hdd_err("wlan_hdd_tdls_set_sta_id() failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3951 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3952 | } |
| 3953 | |
| 3954 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 3955 | sta_to_adapter[pRoamInfo->staId] = |
| 3956 | pAdapter; |
| 3957 | /* |
| 3958 | * store the ucast signature, |
| 3959 | * if required for further reference. |
| 3960 | */ |
| 3961 | |
| 3962 | wlan_hdd_tdls_set_signature(pAdapter, |
| 3963 | pRoamInfo-> |
| 3964 | peerMac.bytes, |
| 3965 | pRoamInfo-> |
| 3966 | ucastSig); |
| 3967 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3968 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3969 | hdd_debug("no available slot in conn_info. staId: %d cannot be stored", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3970 | pRoamInfo->staId); |
| 3971 | } |
| 3972 | pAdapter->tdlsAddStaStatus = status; |
| 3973 | } |
| 3974 | complete(&pAdapter->tdls_add_station_comp); |
| 3975 | break; |
| 3976 | } |
| 3977 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3978 | { |
| 3979 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3980 | hdd_err("Add Sta failed. status code: %d", |
Varun Reddy Yeturu | ed1215e | 2017-07-07 16:40:28 -0700 | [diff] [blame] | 3981 | pRoamInfo->statusCode); |
| 3982 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
| 3983 | } else { |
| 3984 | pAdapter->tdlsAddStaStatus = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3985 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3986 | complete(&pAdapter->tdls_add_station_comp); |
| 3987 | break; |
| 3988 | } |
| 3989 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3990 | { |
| 3991 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3992 | hdd_err("Link Establish Request failed. status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3993 | pRoamInfo->statusCode); |
| 3994 | } |
| 3995 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3996 | break; |
| 3997 | } |
| 3998 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
| 3999 | { |
| 4000 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 4001 | staIdx++) { |
| 4002 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 4003 | pRoamInfo->sessionId) |
| 4004 | && pRoamInfo->staId == |
| 4005 | pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4006 | hdd_debug("HDD: del STA IDX = %x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4007 | pRoamInfo->staId); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4008 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4009 | curr_peer = |
| 4010 | wlan_hdd_tdls_find_peer(pAdapter, |
| 4011 | pRoamInfo-> |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4012 | peerMac.bytes); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4013 | if (NULL != curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4014 | hdd_debug("Current status for peer " MAC_ADDRESS_STR " is %d", |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4015 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4016 | curr_peer->link_status); |
| 4017 | if (TDLS_IS_CONNECTED(curr_peer)) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4018 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4019 | hdd_roam_deregister_tdlssta |
| 4020 | (pAdapter, |
| 4021 | pRoamInfo->staId); |
| 4022 | wlan_hdd_tdls_decrement_peer_count |
| 4023 | (pAdapter); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4024 | } else if (eTDLS_LINK_CONNECTING == |
| 4025 | curr_peer->link_status) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4026 | mutex_unlock(&pHddCtx->tdls_lock); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4027 | hdd_roam_deregister_tdlssta |
| 4028 | (pAdapter, |
| 4029 | pRoamInfo->staId); |
Nitesh Shah | 0bf768f | 2017-03-31 15:01:37 +0530 | [diff] [blame] | 4030 | } else |
| 4031 | mutex_unlock(&pHddCtx->tdls_lock); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4032 | } else |
| 4033 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4034 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4035 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4036 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4037 | pRoamInfo-> |
| 4038 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4039 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4040 | |
| 4041 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4042 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4043 | sessionId = 255; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4044 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4045 | tdlsConnInfo[staIdx]. |
| 4046 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4047 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4048 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4049 | break; |
| 4050 | } |
| 4051 | } |
| 4052 | complete(&pAdapter->tdls_del_station_comp); |
| 4053 | } |
| 4054 | break; |
| 4055 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 4056 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4057 | hdd_debug("Sending teardown to supplicant with reason code %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4058 | pRoamInfo->reasonCode); |
| 4059 | |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4060 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4061 | curr_peer = |
| 4062 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4063 | pRoamInfo->peerMac.bytes); |
Ganesh Kondabattini | 9c8dc46 | 2017-04-19 10:52:54 +0530 | [diff] [blame] | 4064 | |
| 4065 | if (!curr_peer) { |
| 4066 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4067 | hdd_debug("peer doesn't exists"); |
| 4068 | status = QDF_STATUS_SUCCESS; |
| 4069 | break; |
| 4070 | } |
| 4071 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4072 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4073 | pRoamInfo->reasonCode); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4074 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4075 | curr_peer->peerMac); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4076 | mutex_unlock(&pHddCtx->tdls_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4077 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4078 | break; |
| 4079 | } |
| 4080 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 4081 | { |
| 4082 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
| 4083 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 4084 | staIdx++) { |
| 4085 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 4086 | pRoamInfo->sessionId) |
| 4087 | && pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4088 | hdd_debug("hdd_tdlsStatusUpdate: staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4089 | MAC_ADDRESS_STR, |
| 4090 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4091 | staId, |
| 4092 | MAC_ADDR_ARRAY(pHddCtx-> |
| 4093 | tdlsConnInfo |
| 4094 | [staIdx]. |
| 4095 | peerMac. |
| 4096 | bytes)); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4097 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4098 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4099 | pHddCtx-> |
| 4100 | tdlsConnInfo |
| 4101 | [staIdx]. |
| 4102 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4103 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4104 | hdd_roam_deregister_tdlssta(pAdapter, |
| 4105 | pHddCtx-> |
| 4106 | tdlsConnInfo |
| 4107 | [staIdx]. |
| 4108 | staId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4109 | qdf_mem_zero(&smeTdlsPeerStateParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4110 | sizeof |
| 4111 | (smeTdlsPeerStateParams)); |
| 4112 | smeTdlsPeerStateParams.vdevId = |
| 4113 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4114 | sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4115 | qdf_mem_copy(&smeTdlsPeerStateParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4116 | peerMacAddr, |
| 4117 | &pHddCtx-> |
| 4118 | tdlsConnInfo[staIdx]. |
| 4119 | peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4120 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4121 | smeTdlsPeerStateParams.peerState = |
| 4122 | eSME_TDLS_PEER_STATE_TEARDOWN; |
| 4123 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4124 | hdd_debug("calling sme_update_tdls_peer_state for staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4125 | MAC_ADDRESS_STR, |
| 4126 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4127 | staId, |
| 4128 | MAC_ADDR_ARRAY(pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | tdlsConnInfo |
| 4130 | [staIdx]. |
| 4131 | peerMac. |
| 4132 | bytes)); |
| 4133 | status = |
| 4134 | sme_update_tdls_peer_state( |
| 4135 | pHddCtx->hHal, |
| 4136 | &smeTdlsPeerStateParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4137 | if (QDF_STATUS_SUCCESS != status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4138 | hdd_err("sme_update_tdls_peer_state failed for " |
| 4139 | MAC_ADDRESS_STR, |
| 4140 | MAC_ADDR_ARRAY |
| 4141 | (pHddCtx-> |
| 4142 | tdlsConnInfo[staIdx]. |
| 4143 | peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4144 | } |
| 4145 | wlan_hdd_tdls_decrement_peer_count |
| 4146 | (pAdapter); |
| 4147 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4148 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4149 | tdlsConnInfo[staIdx]. |
| 4150 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4151 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4152 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4153 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4154 | sessionId = 255; |
| 4155 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4156 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4157 | } |
| 4158 | } |
| 4159 | break; |
| 4160 | } |
| 4161 | case eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER: |
| 4162 | { |
| 4163 | /* ignore TDLS_SHOULD_DISCOVER if any concurrency detected */ |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 4164 | if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { |
| 4165 | hdd_err("TDLS not allowed, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4166 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4167 | break; |
| 4168 | } |
| 4169 | |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4170 | if (pHddCtx->tdls_nss_switch_in_progress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4171 | hdd_debug("TDLS antenna switch is in progress, ignore SHOULD_DISCOVER"); |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4172 | status = QDF_STATUS_SUCCESS; |
| 4173 | break; |
| 4174 | } |
| 4175 | |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4176 | mutex_lock(&pHddCtx->tdls_lock); |
| 4177 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4178 | if (!pHddTdlsCtx) { |
| 4179 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4180 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4181 | roamResult); |
| 4182 | status = QDF_STATUS_E_FAILURE; |
| 4183 | break; |
| 4184 | } |
| 4185 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4186 | curr_peer = |
| 4187 | wlan_hdd_tdls_get_peer(pAdapter, |
Nitesh Shah | 379449e | 2017-01-31 19:11:29 +0530 | [diff] [blame] | 4188 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4189 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4190 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4191 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4192 | } else { |
| 4193 | if (eTDLS_LINK_CONNECTED == |
| 4194 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4195 | hdd_debug("TDLS link status is connected, ignore SHOULD_DISCOVER"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4196 | } else { |
| 4197 | /* |
| 4198 | * If external control is enabled then initiate |
| 4199 | * TDLS only if forced peer is set otherwise |
| 4200 | * ignore should Discover trigger from fw. |
| 4201 | */ |
| 4202 | if (pHddCtx->config-> |
| 4203 | fTDLSExternalControl |
| 4204 | && (false == |
| 4205 | curr_peer->isForcedPeer)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4206 | hdd_debug("TDLS ExternalControl enabled but curr_peer is not forced, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4207 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4208 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4209 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4210 | hdd_debug("initiate TDLS setup on SHOULD_DISCOVER, fTDLSExternalControl: %d, curr_peer->isForcedPeer: %d, reason: %d", |
Jeff Johnson | 6875531 | 2017-02-10 11:46:55 -0800 | [diff] [blame] | 4211 | pHddCtx->config-> |
| 4212 | fTDLSExternalControl, |
| 4213 | curr_peer->isForcedPeer, |
| 4214 | pRoamInfo->reasonCode); |
Nitesh Shah | 983e8f5 | 2016-11-25 12:36:29 +0530 | [diff] [blame] | 4215 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 4216 | wlan_hdd_tdls_implicit_send_discovery_request( |
| 4217 | pHddTdlsCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4218 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4219 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4220 | } |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4221 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4222 | break; |
| 4223 | } |
| 4224 | |
| 4225 | case eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN: |
| 4226 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4227 | mutex_lock(&pHddCtx->tdls_lock); |
| 4228 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4229 | if (!pHddTdlsCtx) { |
| 4230 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4231 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4232 | roamResult); |
| 4233 | status = QDF_STATUS_E_FAILURE; |
| 4234 | break; |
| 4235 | } |
| 4236 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4237 | curr_peer = |
| 4238 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4239 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4240 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4241 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4242 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4243 | } else { |
| 4244 | if (eTDLS_LINK_CONNECTED == |
| 4245 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4246 | hdd_debug("Received SHOULD_TEARDOWN for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4247 | MAC_ADDRESS_STR |
| 4248 | " staId: %d, reason: %d", |
| 4249 | MAC_ADDR_ARRAY(pRoamInfo-> |
| 4250 | peerMac.bytes), |
| 4251 | pRoamInfo->staId, |
| 4252 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4253 | |
| 4254 | if (pRoamInfo->reasonCode == |
| 4255 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4256 | pRoamInfo->reasonCode == |
| 4257 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4258 | pRoamInfo->reasonCode == |
| 4259 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4260 | pRoamInfo->reasonCode == |
| 4261 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4262 | reason = |
| 4263 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4264 | } else |
| 4265 | reason = |
| 4266 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4267 | |
| 4268 | wlan_hdd_tdls_indicate_teardown |
| 4269 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4270 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4271 | hdd_send_wlan_tdls_teardown_event( |
| 4272 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4273 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4274 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4275 | hdd_debug("TDLS link is not connected, ignore SHOULD_TEARDOWN, reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4276 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4277 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4278 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4279 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4280 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4281 | break; |
| 4282 | } |
| 4283 | |
| 4284 | case eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED: |
| 4285 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4286 | mutex_lock(&pHddCtx->tdls_lock); |
| 4287 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4288 | if (!pHddTdlsCtx) { |
| 4289 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4290 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4291 | roamResult); |
| 4292 | status = QDF_STATUS_E_FAILURE; |
| 4293 | break; |
| 4294 | } |
| 4295 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4296 | curr_peer = |
| 4297 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4298 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4299 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4300 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4301 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4302 | } else { |
| 4303 | if (eTDLS_LINK_CONNECTED == |
| 4304 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4305 | hdd_debug("Received SHOULD_PEER_DISCONNECTED for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4306 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4307 | " staId: %d reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4308 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4309 | pRoamInfo->staId, |
| 4310 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4311 | |
| 4312 | if (pRoamInfo->reasonCode == |
| 4313 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4314 | pRoamInfo->reasonCode == |
| 4315 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4316 | pRoamInfo->reasonCode == |
| 4317 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4318 | pRoamInfo->reasonCode == |
| 4319 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4320 | reason = |
| 4321 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4322 | } else |
| 4323 | reason = |
| 4324 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4325 | |
| 4326 | wlan_hdd_tdls_indicate_teardown |
| 4327 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4328 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4329 | hdd_send_wlan_tdls_teardown_event( |
| 4330 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4331 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4332 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4333 | hdd_debug("TDLS link is not connected, ignore SHOULD_PEER_DISCONNECTED, reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4334 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4335 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4336 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4337 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4338 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4339 | break; |
| 4340 | } |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4341 | |
| 4342 | case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4343 | mutex_lock(&pHddCtx->tdls_lock); |
| 4344 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4345 | if (!pHddTdlsCtx) { |
| 4346 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4347 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4348 | roamResult); |
| 4349 | status = QDF_STATUS_E_FAILURE; |
| 4350 | break; |
| 4351 | } |
| 4352 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4353 | status = hdd_tdls_connection_tracker_update(pAdapter, |
| 4354 | pRoamInfo, |
| 4355 | pHddTdlsCtx); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4356 | mutex_unlock(&pHddCtx->tdls_lock); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4357 | break; |
| 4358 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4359 | default: |
| 4360 | { |
| 4361 | break; |
| 4362 | } |
| 4363 | } |
| 4364 | |
| 4365 | return status; |
| 4366 | } |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4367 | #else |
| 4368 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4369 | inline QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4370 | uint8_t staId) |
| 4371 | { |
| 4372 | return QDF_STATUS_SUCCESS; |
| 4373 | } |
| 4374 | |
| 4375 | static inline QDF_STATUS |
| 4376 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 4377 | tCsrRoamInfo *pRoamInfo, |
| 4378 | uint32_t roamId, |
| 4379 | eRoamCmdStatus roamStatus, |
| 4380 | eCsrRoamResult roamResult) |
| 4381 | { |
| 4382 | return QDF_STATUS_SUCCESS; |
| 4383 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4384 | #endif |
| 4385 | |
| 4386 | #ifdef WLAN_FEATURE_11W |
| 4387 | /** |
| 4388 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
| 4389 | * @pAdapter: pointer to the adapter |
| 4390 | * @nFrameLength: Length of the unprotected frame being passed |
| 4391 | * @pbFrames: Pointer to the frame buffer |
| 4392 | * @frameType: 802.11 frame type |
| 4393 | * |
| 4394 | * This function forwards the unprotected management frame to the supplicant. |
| 4395 | * |
| 4396 | * Return: nothing |
| 4397 | */ |
| 4398 | static void |
| 4399 | hdd_indicate_unprot_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, |
| 4400 | uint8_t *pbFrames, uint8_t frameType) |
| 4401 | { |
| 4402 | uint8_t type = 0; |
| 4403 | uint8_t subType = 0; |
| 4404 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4405 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4406 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4407 | |
| 4408 | /* Sanity Checks */ |
| 4409 | if (NULL == pAdapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4410 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4411 | return; |
| 4412 | } |
| 4413 | |
| 4414 | if (NULL == pAdapter->dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4415 | hdd_err("pAdapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4416 | return; |
| 4417 | } |
| 4418 | |
| 4419 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4420 | hdd_err("pAdapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4421 | return; |
| 4422 | } |
| 4423 | |
| 4424 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4425 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4426 | return; |
| 4427 | } |
| 4428 | |
| 4429 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4430 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4431 | return; |
| 4432 | } |
| 4433 | |
| 4434 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4435 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4436 | |
| 4437 | /* Get pAdapter from Destination mac address of the frame */ |
| 4438 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4439 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4440 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4441 | nFrameLength); |
| 4442 | #else |
| 4443 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, |
| 4444 | nFrameLength); |
| 4445 | #endif |
| 4446 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4447 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4448 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4449 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4450 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4451 | nFrameLength); |
| 4452 | #else |
| 4453 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, |
| 4454 | nFrameLength); |
| 4455 | #endif |
| 4456 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4457 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4458 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4459 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4460 | return; |
| 4461 | } |
| 4462 | } |
| 4463 | #endif |
| 4464 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4465 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4466 | /** |
| 4467 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
| 4468 | * @pAdapter: pointer to adapter |
| 4469 | * @tid: traffic identifier |
| 4470 | * @state: state |
| 4471 | * @measInterval: measurement interval |
| 4472 | * |
| 4473 | * This function sends traffic stream metrics IE information to |
| 4474 | * the supplicant via wireless event. |
| 4475 | * |
| 4476 | * Return: none |
| 4477 | */ |
| 4478 | static void |
| 4479 | hdd_indicate_tsm_ie(hdd_adapter_t *pAdapter, uint8_t tid, |
| 4480 | uint8_t state, uint16_t measInterval) |
| 4481 | { |
| 4482 | union iwreq_data wrqu; |
| 4483 | char buf[IW_CUSTOM_MAX + 1]; |
| 4484 | int nBytes = 0; |
| 4485 | |
| 4486 | if (NULL == pAdapter) |
| 4487 | return; |
| 4488 | |
| 4489 | /* create the event */ |
| 4490 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4491 | memset(buf, '\0', sizeof(buf)); |
| 4492 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4493 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4494 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4495 | |
| 4496 | nBytes = |
| 4497 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4498 | measInterval); |
| 4499 | |
| 4500 | wrqu.data.pointer = buf; |
| 4501 | wrqu.data.length = nBytes; |
| 4502 | /* send the event */ |
| 4503 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4504 | } |
| 4505 | |
| 4506 | /** |
| 4507 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
| 4508 | * @pAdapter: pointer to adapter |
| 4509 | * @pRoamInfo: pointer to roam info |
| 4510 | * |
| 4511 | * This function sends cckm preauth indication to the supplicant |
| 4512 | * via wireless custom event. |
| 4513 | * |
| 4514 | * Return: none |
| 4515 | */ |
| 4516 | static void |
| 4517 | hdd_indicate_cckm_pre_auth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4518 | { |
| 4519 | union iwreq_data wrqu; |
| 4520 | char buf[IW_CUSTOM_MAX + 1]; |
| 4521 | char *pos = buf; |
| 4522 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4523 | |
| 4524 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4525 | return; |
| 4526 | |
| 4527 | /* create the event */ |
| 4528 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4529 | memset(buf, '\0', sizeof(buf)); |
| 4530 | |
| 4531 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4532 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4533 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 4534 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4535 | |
| 4536 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4537 | pos += nBytes; |
| 4538 | freeBytes -= nBytes; |
| 4539 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4540 | qdf_mem_copy(pos, pRoamInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4541 | pos += QDF_MAC_ADDR_SIZE; |
| 4542 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4543 | |
| 4544 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
| 4545 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4546 | freeBytes -= nBytes; |
| 4547 | |
| 4548 | wrqu.data.pointer = buf; |
| 4549 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4550 | |
| 4551 | /* send the event */ |
| 4552 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4553 | } |
| 4554 | |
| 4555 | /** |
| 4556 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
| 4557 | * @pAdapter: pointer to adapter |
| 4558 | * @pRoamInfo: pointer to roam info |
| 4559 | * |
| 4560 | * Return: none |
| 4561 | */ |
| 4562 | static void |
| 4563 | hdd_indicate_ese_adj_ap_rep_ind(hdd_adapter_t *pAdapter, |
| 4564 | tCsrRoamInfo *pRoamInfo) |
| 4565 | { |
| 4566 | union iwreq_data wrqu; |
| 4567 | char buf[IW_CUSTOM_MAX + 1]; |
| 4568 | int nBytes = 0; |
| 4569 | |
| 4570 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4571 | return; |
| 4572 | |
| 4573 | /* create the event */ |
| 4574 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4575 | memset(buf, '\0', sizeof(buf)); |
| 4576 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4577 | hdd_debug("CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4578 | |
| 4579 | nBytes = |
| 4580 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
| 4581 | pRoamInfo->tsmRoamDelay); |
| 4582 | |
| 4583 | wrqu.data.pointer = buf; |
| 4584 | wrqu.data.length = nBytes; |
| 4585 | |
| 4586 | /* send the event */ |
| 4587 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4588 | } |
| 4589 | |
| 4590 | /** |
| 4591 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
| 4592 | * @pAdapter: pointer to adapter |
| 4593 | * @measurementToken: measurement token |
| 4594 | * @flag: flag |
| 4595 | * @numBss: number of bss |
| 4596 | * |
| 4597 | * If the measurement is none and no scan results found, |
| 4598 | * indicate the supplicant about measurement done. |
| 4599 | * |
| 4600 | * Return: none |
| 4601 | */ |
| 4602 | void |
| 4603 | hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter, |
| 4604 | const uint16_t measurementToken, |
| 4605 | const bool flag, const uint8_t numBss) |
| 4606 | { |
| 4607 | union iwreq_data wrqu; |
| 4608 | char buf[IW_CUSTOM_MAX]; |
| 4609 | char *pos = buf; |
| 4610 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4611 | |
| 4612 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4613 | memset(buf, '\0', sizeof(buf)); |
| 4614 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4615 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4616 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4617 | |
| 4618 | nBytes = |
| 4619 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4620 | flag, numBss); |
| 4621 | |
| 4622 | wrqu.data.pointer = buf; |
| 4623 | wrqu.data.length = nBytes; |
| 4624 | /* send the event */ |
| 4625 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4626 | } |
| 4627 | |
| 4628 | /** |
| 4629 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
| 4630 | * @pAdapter: pointer to adapter |
| 4631 | * @pRoamInfo: pointer to roam info |
| 4632 | * |
| 4633 | * If the measurement is none and no scan results found, |
| 4634 | * indicate the supplicant about measurement done. |
| 4635 | * |
| 4636 | * Return: none |
| 4637 | */ |
| 4638 | static void |
| 4639 | hdd_indicate_ese_bcn_report_ind(const hdd_adapter_t *pAdapter, |
| 4640 | const tCsrRoamInfo *pRoamInfo) |
| 4641 | { |
| 4642 | union iwreq_data wrqu; |
| 4643 | char buf[IW_CUSTOM_MAX]; |
| 4644 | char *pos = buf; |
| 4645 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4646 | uint8_t i = 0, len = 0; |
| 4647 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4648 | uint8_t lastSent = 0, sendBss = 0; |
| 4649 | int bcnRepFieldSize = |
| 4650 | sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0]. |
| 4651 | bcnReportFields); |
| 4652 | uint8_t ieLenByte = 1; |
| 4653 | /* |
| 4654 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4655 | */ |
| 4656 | #define ESEBCNREPHEADER_LEN (18) |
| 4657 | |
| 4658 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4659 | return; |
| 4660 | |
| 4661 | /* |
| 4662 | * Custom event can pass maximum of 256 bytes of data, |
| 4663 | * based on the IE len we need to identify how many BSS info can |
| 4664 | * be filled in to custom event data. |
| 4665 | */ |
| 4666 | /* |
| 4667 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4668 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4669 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4670 | */ |
| 4671 | |
| 4672 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) |
| 4673 | && (!pRoamInfo->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4674 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4675 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4676 | * indicate the supplicant about measurement done |
| 4677 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4678 | hdd_indicate_ese_bcn_report_no_results( |
| 4679 | pAdapter, |
| 4680 | pRoamInfo->pEseBcnReportRsp-> |
| 4681 | measurementToken, |
| 4682 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4683 | pRoamInfo->pEseBcnReportRsp->numBss); |
| 4684 | } else { |
| 4685 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) { |
| 4686 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4687 | memset(buf, '\0', sizeof(buf)); |
| 4688 | tot_bcn_ieLen = 0; |
| 4689 | sendBss = 0; |
| 4690 | pos = buf; |
| 4691 | freeBytes = IW_CUSTOM_MAX; |
| 4692 | |
| 4693 | for (i = lastSent; |
| 4694 | i < pRoamInfo->pEseBcnReportRsp->numBss; i++) { |
| 4695 | len = |
| 4696 | bcnRepFieldSize + ieLenByte + |
| 4697 | pRoamInfo->pEseBcnReportRsp-> |
| 4698 | bcnRepBssInfo[i].ieLen; |
| 4699 | if ((len + tot_bcn_ieLen) > |
| 4700 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4701 | break; |
| 4702 | } |
| 4703 | tot_bcn_ieLen += len; |
| 4704 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4705 | 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] | 4706 | i, bcnRepFieldSize, 1, |
| 4707 | pRoamInfo->pEseBcnReportRsp-> |
| 4708 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4709 | } |
| 4710 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4711 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4712 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4713 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4714 | pRoamInfo->pEseBcnReportRsp->flag, sendBss, |
| 4715 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4716 | |
| 4717 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
| 4718 | pRoamInfo->pEseBcnReportRsp-> |
| 4719 | measurementToken, |
| 4720 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4721 | sendBss); |
| 4722 | pos += nBytes; |
| 4723 | freeBytes -= nBytes; |
| 4724 | |
| 4725 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4726 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4727 | sizeof(tot_bcn_ieLen)); |
| 4728 | pos += sizeof(tot_bcn_ieLen); |
| 4729 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4730 | |
| 4731 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4732 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4733 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4734 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4735 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
| 4736 | pRoamInfo->pEseBcnReportRsp-> |
| 4737 | bcnRepBssInfo[i + |
| 4738 | lastSent].bcnReportFields. |
| 4739 | ChanNum, |
| 4740 | pRoamInfo->pEseBcnReportRsp-> |
| 4741 | bcnRepBssInfo[i + |
| 4742 | lastSent].bcnReportFields. |
| 4743 | Spare, |
| 4744 | pRoamInfo->pEseBcnReportRsp-> |
| 4745 | bcnRepBssInfo[i + |
| 4746 | lastSent].bcnReportFields. |
| 4747 | MeasDuration, |
| 4748 | pRoamInfo->pEseBcnReportRsp-> |
| 4749 | bcnRepBssInfo[i + |
| 4750 | lastSent].bcnReportFields. |
| 4751 | PhyType, |
| 4752 | pRoamInfo->pEseBcnReportRsp-> |
| 4753 | bcnRepBssInfo[i + |
| 4754 | lastSent].bcnReportFields. |
| 4755 | RecvSigPower, |
| 4756 | pRoamInfo->pEseBcnReportRsp-> |
| 4757 | bcnRepBssInfo[i + |
| 4758 | lastSent].bcnReportFields. |
| 4759 | ParentTsf, |
| 4760 | pRoamInfo->pEseBcnReportRsp-> |
| 4761 | bcnRepBssInfo[i + |
| 4762 | lastSent].bcnReportFields. |
| 4763 | TargetTsf[0], |
| 4764 | pRoamInfo->pEseBcnReportRsp-> |
| 4765 | bcnRepBssInfo[i + |
| 4766 | lastSent].bcnReportFields. |
| 4767 | TargetTsf[1], |
| 4768 | pRoamInfo->pEseBcnReportRsp-> |
| 4769 | bcnRepBssInfo[i + |
| 4770 | lastSent].bcnReportFields. |
| 4771 | BcnInterval, |
| 4772 | pRoamInfo->pEseBcnReportRsp-> |
| 4773 | bcnRepBssInfo[i + |
| 4774 | lastSent].bcnReportFields. |
| 4775 | CapabilityInfo, |
| 4776 | pRoamInfo->pEseBcnReportRsp-> |
| 4777 | bcnRepBssInfo[i + |
| 4778 | lastSent].bcnReportFields. |
| 4779 | Bssid[0], |
| 4780 | pRoamInfo->pEseBcnReportRsp-> |
| 4781 | bcnRepBssInfo[i + |
| 4782 | lastSent].bcnReportFields. |
| 4783 | Bssid[1], |
| 4784 | pRoamInfo->pEseBcnReportRsp-> |
| 4785 | bcnRepBssInfo[i + |
| 4786 | lastSent].bcnReportFields. |
| 4787 | Bssid[2], |
| 4788 | pRoamInfo->pEseBcnReportRsp-> |
| 4789 | bcnRepBssInfo[i + |
| 4790 | lastSent].bcnReportFields. |
| 4791 | Bssid[3], |
| 4792 | pRoamInfo->pEseBcnReportRsp-> |
| 4793 | bcnRepBssInfo[i + |
| 4794 | lastSent].bcnReportFields. |
| 4795 | Bssid[4], |
| 4796 | pRoamInfo->pEseBcnReportRsp-> |
| 4797 | bcnRepBssInfo[i + |
| 4798 | lastSent].bcnReportFields. |
| 4799 | Bssid[5]); |
| 4800 | |
| 4801 | /* bcn report fields are copied */ |
| 4802 | len = |
| 4803 | sizeof(pRoamInfo->pEseBcnReportRsp-> |
| 4804 | bcnRepBssInfo[i + |
| 4805 | lastSent]. |
| 4806 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4807 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4808 | (char *)&pRoamInfo-> |
| 4809 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4810 | lastSent]. |
| 4811 | bcnReportFields, len); |
| 4812 | pos += len; |
| 4813 | freeBytes -= len; |
| 4814 | |
| 4815 | /* Add 1 byte of ie len */ |
| 4816 | len = |
| 4817 | pRoamInfo->pEseBcnReportRsp-> |
| 4818 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4819 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4820 | pos += sizeof(len); |
| 4821 | freeBytes -= sizeof(len); |
| 4822 | |
| 4823 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4824 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4825 | (char *)pRoamInfo-> |
| 4826 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4827 | lastSent]. |
| 4828 | pBuf, len); |
| 4829 | pos += len; |
| 4830 | freeBytes -= len; |
| 4831 | } |
| 4832 | |
| 4833 | wrqu.data.pointer = buf; |
| 4834 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4835 | |
| 4836 | /* send the event */ |
| 4837 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, |
| 4838 | buf); |
| 4839 | lastSent += sendBss; |
| 4840 | } |
| 4841 | } |
| 4842 | } |
| 4843 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4844 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4845 | |
| 4846 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4847 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
| 4848 | * @pHddStaCtx: Station Context |
| 4849 | * |
| 4850 | * API to check if the connection authentication type is 8021x_sha256. |
| 4851 | * |
| 4852 | * Return: bool |
| 4853 | */ |
| 4854 | #ifdef WLAN_FEATURE_11W |
| 4855 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4856 | { |
| 4857 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 4858 | pHddStaCtx->conn_info.authType; |
| 4859 | } |
| 4860 | #else |
| 4861 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4862 | { |
| 4863 | return false; |
| 4864 | } |
| 4865 | #endif |
| 4866 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4867 | /* |
| 4868 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4869 | * @adapter: Pointer to adapter context |
| 4870 | * @roam_info: Pointer to roam info |
| 4871 | * |
| 4872 | * Return: None |
| 4873 | */ |
| 4874 | static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter, |
| 4875 | tCsrRoamInfo *roam_info) |
| 4876 | { |
| 4877 | struct hdd_chan_change_params chan_change; |
| 4878 | struct cfg80211_bss *bss; |
| 4879 | struct net_device *dev = adapter->dev; |
| 4880 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4881 | struct wiphy *wiphy = wdev->wiphy; |
| 4882 | QDF_STATUS status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4883 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4884 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4885 | hdd_debug("channel switch for session:%d to channel:%d", |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4886 | adapter->sessionId, roam_info->chan_info.chan_id); |
| 4887 | |
| 4888 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4889 | chan_change.chan_params.ch_width = |
| 4890 | roam_info->chan_info.ch_width; |
| 4891 | chan_change.chan_params.sec_ch_offset = |
| 4892 | roam_info->chan_info.sec_ch_offset; |
| 4893 | chan_change.chan_params.center_freq_seg0 = |
| 4894 | roam_info->chan_info.band_center_freq1; |
| 4895 | chan_change.chan_params.center_freq_seg1 = |
| 4896 | roam_info->chan_info.band_center_freq2; |
| 4897 | |
| 4898 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4899 | if (NULL == bss) |
| 4900 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4901 | else |
| 4902 | cfg80211_put_bss(wiphy, bss); |
| 4903 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4904 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4905 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4906 | if (QDF_IS_STATUS_ERROR(status)) |
| 4907 | hdd_err("channel change notification failed"); |
| 4908 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4909 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->hdd_psoc, |
| 4910 | adapter->sessionId); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4911 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4912 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4913 | } |
| 4914 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4915 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4916 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4917 | * @pContext: pointer to adapter context |
| 4918 | * @pRoamInfo: pointer to roam info |
| 4919 | * @roamId: roam id |
| 4920 | * @roamStatus: roam status |
| 4921 | * @roamResult: roam result |
| 4922 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4923 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4924 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4925 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 4927 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4928 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4929 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4930 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 4931 | hdd_wext_state_t *pWextState = NULL; |
| 4932 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4933 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4934 | struct cfg80211_bss *bss_status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4935 | hdd_context_t *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4936 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4937 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4938 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4939 | |
| 4940 | /* Sanity check */ |
| 4941 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4942 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4943 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4944 | } |
| 4945 | |
| 4946 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4947 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4948 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4949 | |
Sreelakshmi Konamki | 075431a | 2017-03-16 15:23:30 +0530 | [diff] [blame] | 4950 | /* Omitting eCSR_ROAM_UPDATE_SCAN_RESULT as this is too frequent */ |
| 4951 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4952 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4953 | pAdapter->sessionId, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4954 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4955 | switch (roamStatus) { |
| 4956 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 6f3a865 | 2015-09-25 10:58:15 +0530 | [diff] [blame] | 4957 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4958 | complete(&pAdapter->session_open_comp_var); |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 4959 | hdd_debug("session %d opened", pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4960 | break; |
| 4961 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4962 | /* |
| 4963 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4964 | * reassoc failed due to failure, timeout, reject from ap |
| 4965 | * in any case tell the OS, our carrier is off and mark |
| 4966 | * interface down. |
| 4967 | */ |
| 4968 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4969 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
| 4970 | roamStatus, roamResult, pAdapter->sessionId); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4971 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4972 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4973 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4974 | pHddStaCtx->ft_carrier_on = false; |
| 4975 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4976 | hdd_debug("hdd_ReassocScenario set to: %d, ReAssoc Failed, session: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4977 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4978 | break; |
| 4979 | |
| 4980 | case eCSR_ROAM_FT_START: |
| 4981 | /* |
| 4982 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4983 | * informed that the link is down. So mark the link ready for |
| 4984 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4985 | * be received. Where in we will not mark the link down |
| 4986 | * Also we want to stop tx at this point when we will be |
| 4987 | * doing disassoc at this time. This saves 30-60 msec |
| 4988 | * after reassoc. |
| 4989 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4990 | hdd_info("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4991 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4992 | hdd_napi_serialize(1); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4993 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4994 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4995 | WLAN_CONTROL_PATH); |
| 4996 | status = hdd_roam_deregister_sta(pAdapter, |
| 4997 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4998 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4999 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5000 | pHddStaCtx->ft_carrier_on = true; |
| 5001 | pHddStaCtx->hdd_ReassocScenario = true; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5002 | hdd_info("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
| 5003 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5004 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5005 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5006 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5007 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5008 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5009 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
| 5010 | pAdapter->roam_ho_fail = true; |
| 5011 | else |
| 5012 | pAdapter->roam_ho_fail = false; |
| 5013 | complete(&pAdapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5014 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5015 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5016 | /* notify apps that we can't pass traffic anymore */ |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 5017 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5018 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5019 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5020 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5021 | if (pHddStaCtx->ft_carrier_on == false) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5022 | wlan_hdd_netif_queue_control(pAdapter, |
| 5023 | WLAN_NETIF_CARRIER_OFF, |
| 5024 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5025 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5026 | break; |
| 5027 | case eCSR_ROAM_LOSTLINK: |
| 5028 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5029 | hdd_debug("Roaming started due to connection lost"); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5030 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5031 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5032 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5033 | WLAN_CONTROL_PATH); |
| 5034 | break; |
| 5035 | } |
| 5036 | case eCSR_ROAM_DISASSOCIATED: |
| 5037 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5038 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5039 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 5040 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5041 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5042 | pAdapter->roam_ho_fail = false; |
| 5043 | complete(&pAdapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5044 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5045 | /* Call to clear any MC Addr List filter applied after |
| 5046 | * successful connection. |
| 5047 | */ |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 5048 | hdd_disable_and_flush_mc_addr_list(pAdapter, |
| 5049 | pmo_peer_disconnect); |
| 5050 | qdf_ret_status = |
| 5051 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 5052 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5053 | } |
| 5054 | break; |
| 5055 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5056 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5057 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5058 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 5059 | roamStatus, roamResult); |
| 5060 | break; |
| 5061 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5062 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5063 | /* |
| 5064 | * To Do - address probable memory leak with WEP encryption upon |
| 5065 | * successful association. |
| 5066 | */ |
| 5067 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 5068 | /* Clear saved connection information in HDD */ |
| 5069 | hdd_conn_remove_connect_info( |
| 5070 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 5071 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5072 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5073 | hdd_association_completion_handler(pAdapter, pRoamInfo, |
| 5074 | roamId, roamStatus, |
| 5075 | roamResult); |
| 5076 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5077 | if (pRoamInfo) |
| 5078 | pRoamInfo->roamSynchInProgress = false; |
| 5079 | #endif |
| 5080 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 5081 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5082 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5083 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5084 | qdf_ret_status = hdd_association_completion_handler(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5085 | pRoamInfo, |
| 5086 | roamId, |
| 5087 | roamStatus, |
| 5088 | roamResult); |
| 5089 | break; |
| 5090 | case eCSR_ROAM_IBSS_IND: |
| 5091 | hdd_roam_ibss_indication_handler(pAdapter, pRoamInfo, roamId, |
| 5092 | roamStatus, roamResult); |
| 5093 | break; |
| 5094 | |
| 5095 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5096 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5097 | roam_roam_connect_status_update_handler(pAdapter, |
| 5098 | pRoamInfo, |
| 5099 | roamId, |
| 5100 | roamStatus, |
| 5101 | roamResult); |
| 5102 | break; |
| 5103 | |
| 5104 | case eCSR_ROAM_MIC_ERROR_IND: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5105 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5106 | hdd_roam_mic_error_indication_handler(pAdapter, |
| 5107 | pRoamInfo, |
| 5108 | roamId, |
| 5109 | roamStatus, |
| 5110 | roamResult); |
| 5111 | break; |
| 5112 | |
| 5113 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 5114 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5115 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5116 | hdd_roam_set_key_complete_handler(pAdapter, pRoamInfo, |
| 5117 | roamId, roamStatus, |
| 5118 | roamResult); |
| 5119 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
| 5120 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5121 | hdd_debug("hdd_ReassocScenario set to: %d, set key complete, session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5122 | pHddStaCtx->hdd_ReassocScenario, |
| 5123 | pAdapter->sessionId); |
| 5124 | } |
| 5125 | } |
| 5126 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5127 | if (pRoamInfo != NULL) |
| 5128 | pRoamInfo->roamSynchInProgress = false; |
| 5129 | #endif |
| 5130 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5131 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5132 | case eCSR_ROAM_FT_RESPONSE: |
| 5133 | hdd_send_ft_event(pAdapter); |
| 5134 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5135 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5136 | case eCSR_ROAM_PMK_NOTIFY: |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 5137 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType |
| 5138 | || hdd_is_8021x_sha256_auth_type(pHddStaCtx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5139 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5140 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5141 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
| 5142 | pAdapter, pRoamInfo, 1, false); |
| 5143 | } |
| 5144 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5145 | |
| 5146 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 5147 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 5148 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5149 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5150 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, |
| 5151 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5152 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5153 | } |
| 5154 | break; |
| 5155 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 5156 | /* |
| 5157 | * This event will notify pre-auth completion in case of success |
| 5158 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5159 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5160 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5161 | pRoamInfo, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5162 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5163 | } |
| 5164 | break; |
| 5165 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 5166 | /* |
| 5167 | * This event will notify pre-auth completion incase of failure. |
| 5168 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5169 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5170 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5171 | pRoamInfo, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5172 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5173 | } |
| 5174 | break; |
| 5175 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 5176 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 5177 | * It will be only invoked on success |
| 5178 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5179 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5180 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, |
| 5181 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5182 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5183 | } |
| 5184 | break; |
| 5185 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5186 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 5187 | hdd_remain_chan_ready_handler(pAdapter, pRoamInfo->roc_scan_id); |
| 5188 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5189 | #ifdef FEATURE_WLAN_TDLS |
| 5190 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5191 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5192 | hdd_roam_tdls_status_update_handler(pAdapter, pRoamInfo, |
| 5193 | roamId, |
| 5194 | roamStatus, |
| 5195 | roamResult); |
| 5196 | break; |
| 5197 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 5198 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, |
| 5199 | pRoamInfo->reasonCode); |
| 5200 | break; |
| 5201 | #endif |
| 5202 | #ifdef WLAN_FEATURE_11W |
| 5203 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 5204 | hdd_indicate_unprot_mgmt_frame(pAdapter, |
| 5205 | pRoamInfo->nFrameLength, |
| 5206 | pRoamInfo->pbFrames, |
| 5207 | pRoamInfo->frameType); |
| 5208 | break; |
| 5209 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5210 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5211 | case eCSR_ROAM_TSM_IE_IND: |
| 5212 | hdd_indicate_tsm_ie(pAdapter, pRoamInfo->tsmIe.tsid, |
| 5213 | pRoamInfo->tsmIe.state, |
| 5214 | pRoamInfo->tsmIe.msmt_interval); |
| 5215 | break; |
| 5216 | |
| 5217 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 5218 | { |
| 5219 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
| 5220 | pHddStaCtx->conn_info.authType |
| 5221 | || eCSR_AUTH_TYPE_CCKM_RSN == |
| 5222 | pHddStaCtx->conn_info.authType) { |
| 5223 | hdd_indicate_cckm_pre_auth(pAdapter, pRoamInfo); |
| 5224 | } |
| 5225 | break; |
| 5226 | } |
| 5227 | |
| 5228 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 5229 | { |
| 5230 | hdd_indicate_ese_adj_ap_rep_ind(pAdapter, pRoamInfo); |
| 5231 | break; |
| 5232 | } |
| 5233 | |
| 5234 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 5235 | { |
| 5236 | hdd_indicate_ese_bcn_report_ind(pAdapter, pRoamInfo); |
| 5237 | break; |
| 5238 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5239 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5240 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5241 | hdd_roam_channel_switch_handler(pAdapter, pRoamInfo); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5242 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5243 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5244 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 5245 | if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { |
| 5246 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
| 5247 | pAdapter, pRoamInfo->pBssDesc); |
| 5248 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5249 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5250 | else |
| 5251 | cfg80211_put_bss( |
| 5252 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 5253 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 5254 | #endif |
| 5255 | bss_status); |
| 5256 | } |
| 5257 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 5258 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
| 5259 | hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, |
| 5260 | roamResult); |
| 5261 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5262 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5263 | hdd_debug("Process ROAM_START from firmware"); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5264 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5265 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5266 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5267 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5268 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5269 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 5270 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5271 | break; |
| 5272 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5273 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5274 | hdd_napi_serialize(0); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5275 | wlan_hdd_netif_queue_control(pAdapter, |
| 5276 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 5277 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5278 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5279 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5280 | pAdapter->roam_ho_fail = false; |
| 5281 | complete(&pAdapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5282 | break; |
| 5283 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5284 | default: |
| 5285 | break; |
| 5286 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5287 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5288 | } |
| 5289 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5290 | #ifdef WLAN_FEATURE_FILS_SK |
| 5291 | /** |
| 5292 | * hdd_translate_fils_rsn_to_csr_auth() - Translate FILS RSN to CSR auth type |
| 5293 | * @auth_suite: auth suite |
| 5294 | * @auth_type: pointer to eCsrAuthType |
| 5295 | * |
| 5296 | * Return: None |
| 5297 | */ |
| 5298 | static void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5299 | eCsrAuthType *auth_type) |
| 5300 | { |
| 5301 | if (!memcmp(auth_suite, ccp_rsn_oui_0e, 4)) |
| 5302 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA256; |
| 5303 | else if (!memcmp(auth_suite, ccp_rsn_oui_0f, 4)) |
| 5304 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA384; |
| 5305 | else if (!memcmp(auth_suite, ccp_rsn_oui_10, 4)) |
| 5306 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA256; |
| 5307 | else if (!memcmp(auth_suite, ccp_rsn_oui_11, 4)) |
| 5308 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA384; |
| 5309 | } |
| 5310 | #else |
| 5311 | static inline void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5312 | eCsrAuthType *auth_type) |
| 5313 | { |
| 5314 | } |
| 5315 | #endif |
| 5316 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5317 | /** |
| 5318 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5319 | * @auth_suite: auth suite |
| 5320 | * |
| 5321 | * Return: eCsrAuthType enumeration |
| 5322 | */ |
| 5323 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5324 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5325 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5326 | /* is the auth type supported? */ |
| 5327 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5328 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5329 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5330 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5331 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5332 | /* Check for 11r FT Authentication with PSK */ |
| 5333 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5334 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5335 | /* Check for 11R FT Authentication with 802.1X */ |
| 5336 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5337 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5338 | #ifdef FEATURE_WLAN_ESE |
| 5339 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5340 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5341 | } else |
| 5342 | #endif /* FEATURE_WLAN_ESE */ |
| 5343 | #ifdef WLAN_FEATURE_11W |
| 5344 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5345 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5346 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5347 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5348 | } else |
| 5349 | #endif |
| 5350 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5351 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5352 | } |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5353 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5354 | return auth_type; |
| 5355 | } |
| 5356 | |
| 5357 | /** |
| 5358 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5359 | * @auth_suite: auth suite |
| 5360 | * |
| 5361 | * Return: eCsrAuthType enumeration |
| 5362 | */ |
| 5363 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5364 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5365 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5366 | /* is the auth type supported? */ |
| 5367 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5368 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5369 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5370 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5371 | } else |
| 5372 | #ifdef FEATURE_WLAN_ESE |
| 5373 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5374 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5375 | } else |
| 5376 | #endif /* FEATURE_WLAN_ESE */ |
| 5377 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5378 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5379 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5380 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5381 | return auth_type; |
| 5382 | } |
| 5383 | |
| 5384 | /** |
| 5385 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5386 | * Translate RSN to CSR encryption type |
| 5387 | * @cipher_suite: cipher suite |
| 5388 | * |
| 5389 | * Return: eCsrEncryptionType enumeration |
| 5390 | */ |
| 5391 | eCsrEncryptionType |
| 5392 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5393 | { |
| 5394 | eCsrEncryptionType cipher_type; |
| 5395 | |
| 5396 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5397 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5398 | else if (memcmp(cipher_suite, ccp_rsn_oui09, 4) == 0) |
| 5399 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP; |
| 5400 | else if (memcmp(cipher_suite, ccp_rsn_oui0a, 4) == 0) |
| 5401 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5402 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5403 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5404 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5405 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5406 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5407 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5408 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5409 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5410 | else |
| 5411 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5412 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5413 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5414 | return cipher_type; |
| 5415 | } |
| 5416 | |
| 5417 | /** |
| 5418 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5419 | * Translate WPA to CSR encryption type |
| 5420 | * @cipher_suite: cipher suite |
| 5421 | * |
| 5422 | * Return: eCsrEncryptionType enumeration |
| 5423 | */ |
| 5424 | eCsrEncryptionType |
| 5425 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5426 | { |
| 5427 | eCsrEncryptionType cipher_type; |
| 5428 | |
| 5429 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5430 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5431 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5432 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5433 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5434 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5435 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5436 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5437 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5438 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5439 | else |
| 5440 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5441 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5442 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5443 | return cipher_type; |
| 5444 | } |
| 5445 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5446 | #ifdef WLAN_FEATURE_FILS_SK |
| 5447 | /* |
| 5448 | * hdd_is_fils_connection: API to determine if connection is FILS |
| 5449 | * @adapter: hdd adapter |
| 5450 | * |
| 5451 | * Return: true if fils connection else false |
| 5452 | */ |
| 5453 | static inline bool hdd_is_fils_connection(hdd_adapter_t *adapter) |
| 5454 | { |
| 5455 | hdd_wext_state_t *wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 5456 | |
| 5457 | if (wext_state->roamProfile.fils_con_info) |
| 5458 | return wext_state->roamProfile. |
| 5459 | fils_con_info->is_fils_connection; |
| 5460 | } |
| 5461 | #else |
| 5462 | static inline bool hdd_is_fils_connection(hdd_adapter_t *adapter) |
| 5463 | { |
| 5464 | return false; |
| 5465 | } |
| 5466 | #endif |
| 5467 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5468 | /** |
| 5469 | * hdd_process_genie() - process gen ie |
| 5470 | * @pAdapter: pointer to adapter |
| 5471 | * @bssid: pointer to mac address |
| 5472 | * @pEncryptType: pointer to encryption type |
| 5473 | * @mcEncryptType: pointer to multicast encryption type |
| 5474 | * @pAuthType: pointer to auth type |
| 5475 | * |
| 5476 | * Return: 0 on success, error number otherwise |
| 5477 | */ |
| 5478 | static int32_t hdd_process_genie(hdd_adapter_t *pAdapter, |
| 5479 | u8 *bssid, |
| 5480 | eCsrEncryptionType *pEncryptType, |
| 5481 | eCsrEncryptionType *mcEncryptType, |
| 5482 | eCsrAuthType *pAuthType, |
| 5483 | #ifdef WLAN_FEATURE_11W |
| 5484 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5485 | #endif |
| 5486 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5487 | { |
| 5488 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5489 | tDot11fIERSN dot11RSNIE; |
| 5490 | tDot11fIEWPA dot11WPAIE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5491 | uint8_t *pRsnIe; |
| 5492 | uint16_t RSNIeLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5493 | |
| 5494 | /* |
| 5495 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5496 | * setting present flag to 0. |
| 5497 | */ |
| 5498 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5499 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5500 | |
| 5501 | /* Type check */ |
| 5502 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5503 | /* Validity checks */ |
| 5504 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5505 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5506 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5507 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5508 | return -EINVAL; |
| 5509 | } |
| 5510 | /* Skip past the EID byte and length byte */ |
| 5511 | pRsnIe = gen_ie + 2; |
| 5512 | RSNIeLen = gen_ie_len - 2; |
| 5513 | /* Unpack the RSN IE */ |
| 5514 | dot11f_unpack_ie_rsn((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5515 | pRsnIe, RSNIeLen, &dot11RSNIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5516 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5517 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5518 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5519 | hdd_debug("authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5520 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5521 | /* dot11RSNIE.akm_suite_count */ |
| 5522 | /* Just translate the FIRST one */ |
| 5523 | *pAuthType = |
| 5524 | hdd_translate_rsn_to_csr_auth_type( |
| 5525 | dot11RSNIE.akm_suites[0]); |
| 5526 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5527 | *pEncryptType = |
| 5528 | hdd_translate_rsn_to_csr_encryption_type( |
| 5529 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5530 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5531 | *mcEncryptType = |
| 5532 | hdd_translate_rsn_to_csr_encryption_type( |
| 5533 | dot11RSNIE.gp_cipher_suite); |
| 5534 | #ifdef WLAN_FEATURE_11W |
| 5535 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 5536 | *pMfpCapable = csr_is_mfpc_capable(&dot11RSNIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5537 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5538 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5539 | /* Validity checks */ |
| 5540 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5541 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5542 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5543 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5544 | return -EINVAL; |
| 5545 | } |
| 5546 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5547 | pRsnIe = gen_ie + 2 + 4; |
| 5548 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5549 | /* Unpack the WPA IE */ |
| 5550 | dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5551 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5552 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5553 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5554 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5555 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5556 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5557 | /* dot11WPAIE.auth_suite_count */ |
| 5558 | /* Just translate the FIRST one */ |
| 5559 | *pAuthType = |
| 5560 | hdd_translate_wpa_to_csr_auth_type( |
| 5561 | dot11WPAIE.auth_suites[0]); |
| 5562 | /* dot11WPAIE.unicast_cipher_count */ |
| 5563 | *pEncryptType = |
| 5564 | hdd_translate_wpa_to_csr_encryption_type( |
| 5565 | dot11WPAIE.unicast_ciphers[0]); |
| 5566 | /* dot11WPAIE.unicast_cipher_count */ |
| 5567 | *mcEncryptType = |
| 5568 | hdd_translate_wpa_to_csr_encryption_type( |
| 5569 | dot11WPAIE.multicast_cipher); |
| 5570 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5571 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5572 | return -EINVAL; |
| 5573 | } |
| 5574 | return 0; |
| 5575 | } |
| 5576 | |
| 5577 | /** |
| 5578 | * hdd_set_genie_to_csr() - set genie to csr |
| 5579 | * @pAdapter: pointer to adapter |
| 5580 | * @RSNAuthType: pointer to auth type |
| 5581 | * |
| 5582 | * Return: 0 on success, error number otherwise |
| 5583 | */ |
| 5584 | int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 5585 | { |
| 5586 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5587 | uint32_t status = 0; |
| 5588 | eCsrEncryptionType RSNEncryptType; |
| 5589 | eCsrEncryptionType mcRSNEncryptType; |
| 5590 | #ifdef WLAN_FEATURE_11W |
| 5591 | uint8_t RSNMfpRequired = 0; |
| 5592 | uint8_t RSNMfpCapable = 0; |
| 5593 | #endif |
| 5594 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5595 | /* MAC address of assoc peer */ |
| 5596 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5597 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5598 | pWextState->roamProfile.BSSIDs.bssid, |
| 5599 | sizeof(bssid)); |
| 5600 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5601 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5602 | /* continue */ |
| 5603 | } else { |
| 5604 | return 0; |
| 5605 | } |
| 5606 | /* The actual processing may eventually be more extensive than this. */ |
| 5607 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
| 5608 | status = hdd_process_genie(pAdapter, bssid, |
| 5609 | &RSNEncryptType, |
| 5610 | &mcRSNEncryptType, RSNAuthType, |
| 5611 | #ifdef WLAN_FEATURE_11W |
| 5612 | &RSNMfpRequired, &RSNMfpCapable, |
| 5613 | #endif |
| 5614 | pWextState->WPARSNIE[1] + 2, |
| 5615 | pWextState->WPARSNIE); |
| 5616 | if (status == 0) { |
| 5617 | /* |
| 5618 | * Now copy over all the security attributes |
| 5619 | * you have parsed out. |
| 5620 | */ |
| 5621 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5622 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5623 | |
| 5624 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; /* Use the cipher type in the RSN IE */ |
| 5625 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5626 | mcRSNEncryptType; |
| 5627 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5628 | if ((QDF_IBSS_MODE == pAdapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5629 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5630 | (eCSR_ENCRYPT_TYPE_AES_GCMP == mcRSNEncryptType) || |
| 5631 | (eCSR_ENCRYPT_TYPE_AES_GCMP_256 == mcRSNEncryptType) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5632 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5633 | /* |
| 5634 | * For wpa none supplicant sends the WPA IE with unicast |
| 5635 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5636 | * multicast cipher as either AES/TKIP based on group |
| 5637 | * cipher configuration mentioned in the |
| 5638 | * wpa_supplicant.conf. |
| 5639 | */ |
| 5640 | |
| 5641 | /* Set the unicast cipher same as multicast cipher */ |
| 5642 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5643 | = mcRSNEncryptType; |
| 5644 | } |
| 5645 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5646 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5647 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5648 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5649 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5650 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5651 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5652 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5653 | } |
| 5654 | return 0; |
| 5655 | } |
| 5656 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5657 | #ifdef WLAN_FEATURE_FILS_SK |
| 5658 | /** |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5659 | * hdd_check_fils_rsn_n_set_auth_type() - This API checks whether a give |
| 5660 | * auth type is fils if yes, sets it in profile. |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5661 | * @rsn_auth_type: auth type |
| 5662 | * |
| 5663 | * Return: true if FILS auth else false |
| 5664 | */ |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5665 | static bool hdd_check_fils_rsn_n_set_auth_type(tCsrRoamProfile *roam_profile, |
| 5666 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5667 | { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5668 | bool is_fils_rsn = false; |
| 5669 | |
| 5670 | if (!roam_profile->fils_con_info) |
| 5671 | return false; |
| 5672 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5673 | if ((rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA256) || |
| 5674 | (rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA384) || |
| 5675 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA256) || |
| 5676 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA384)) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5677 | is_fils_rsn = true; |
| 5678 | if (is_fils_rsn) |
| 5679 | roam_profile->fils_con_info->akm_type = rsn_auth_type; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5680 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5681 | return is_fils_rsn; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5682 | } |
| 5683 | #else |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5684 | static bool hdd_check_fils_rsn_n_set_auth_type(tCsrRoamProfile *roam_profile, |
| 5685 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5686 | { |
| 5687 | return false; |
| 5688 | } |
| 5689 | #endif |
| 5690 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5691 | /** |
| 5692 | * hdd_set_csr_auth_type() - set csr auth type |
| 5693 | * @pAdapter: pointer to adapter |
| 5694 | * @RSNAuthType: auth type |
| 5695 | * |
| 5696 | * Return: 0 on success, error number otherwise |
| 5697 | */ |
| 5698 | int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 5699 | { |
| 5700 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5701 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 5702 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5703 | |
| 5704 | pRoamProfile->AuthType.numEntries = 1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5705 | hdd_debug("pHddStaCtx->conn_info.authType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5706 | pHddStaCtx->conn_info.authType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5707 | |
| 5708 | switch (pHddStaCtx->conn_info.authType) { |
| 5709 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5710 | #ifdef FEATURE_WLAN_ESE |
| 5711 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5712 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5713 | #endif |
| 5714 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 5715 | |
| 5716 | pRoamProfile->AuthType.authType[0] = |
| 5717 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5718 | } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 5719 | |
| 5720 | #ifdef FEATURE_WLAN_ESE |
| 5721 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5722 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5723 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5724 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5725 | pRoamProfile->AuthType.authType[0] = |
| 5726 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5727 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5728 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5729 | pRoamProfile->AuthType.authType[0] = |
| 5730 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5731 | } else |
| 5732 | #endif |
| 5733 | if ((pWextState-> |
| 5734 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5735 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5736 | pRoamProfile->AuthType.authType[0] = |
| 5737 | eCSR_AUTH_TYPE_WPA; |
| 5738 | } else |
| 5739 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5740 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5741 | pRoamProfile->AuthType.authType[0] = |
| 5742 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5743 | } else { |
| 5744 | pRoamProfile->AuthType.authType[0] = |
| 5745 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5746 | } |
| 5747 | } |
| 5748 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 5749 | #ifdef FEATURE_WLAN_ESE |
| 5750 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5751 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5752 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5753 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5754 | pRoamProfile->AuthType.authType[0] = |
| 5755 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5756 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5757 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5758 | pRoamProfile->AuthType.authType[0] = |
| 5759 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5760 | } else |
| 5761 | #endif |
| 5762 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5763 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 5764 | ((pWextState-> |
| 5765 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5766 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5767 | pRoamProfile->AuthType.authType[0] = |
| 5768 | eCSR_AUTH_TYPE_FT_RSN; |
| 5769 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5770 | && |
| 5771 | ((pWextState-> |
| 5772 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5773 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 5774 | pRoamProfile->AuthType.authType[0] = |
| 5775 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5776 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5777 | |
| 5778 | #ifdef WLAN_FEATURE_11W |
| 5779 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5780 | pRoamProfile->AuthType.authType[0] = |
| 5781 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5782 | } else if (RSNAuthType == |
| 5783 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5784 | pRoamProfile->AuthType.authType[0] = |
| 5785 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5786 | } else |
| 5787 | #endif |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5788 | if (hdd_check_fils_rsn_n_set_auth_type(pRoamProfile, |
| 5789 | RSNAuthType)) { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5790 | pRoamProfile->AuthType.authType[0] = |
| 5791 | RSNAuthType; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame^] | 5792 | hdd_info("updated profile authtype as %d", |
| 5793 | RSNAuthType); |
| 5794 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5795 | } else if ((pWextState-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5796 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5797 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5798 | pRoamProfile->AuthType.authType[0] = |
| 5799 | eCSR_AUTH_TYPE_RSN; |
| 5800 | } else |
| 5801 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5802 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5803 | pRoamProfile->AuthType.authType[0] = |
| 5804 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5805 | } else { |
| 5806 | pRoamProfile->AuthType.authType[0] = |
| 5807 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5808 | } |
| 5809 | } |
| 5810 | break; |
| 5811 | |
| 5812 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5813 | |
| 5814 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5815 | break; |
| 5816 | default: |
| 5817 | |
| 5818 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5819 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5820 | #endif /* FEATURE_WLAN_ESE */ |
| 5821 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5822 | break; |
| 5823 | } |
| 5824 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5825 | hdd_debug("Set roam Authtype to %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5826 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5827 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5828 | return 0; |
| 5829 | } |
| 5830 | |
| 5831 | /** |
| 5832 | * __iw_set_essid() - This function sets the ssid received from wpa_supplicant |
| 5833 | * to the CSR roam profile. |
| 5834 | * |
| 5835 | * @dev: Pointer to the net device. |
| 5836 | * @info: Pointer to the iw_request_info. |
| 5837 | * @wrqu: Pointer to the iwreq_data. |
| 5838 | * @extra: Pointer to the data. |
| 5839 | * |
| 5840 | * Return: 0 for success, error number on failure |
| 5841 | */ |
| 5842 | static int __iw_set_essid(struct net_device *dev, |
| 5843 | struct iw_request_info *info, |
| 5844 | union iwreq_data *wrqu, char *extra) |
| 5845 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5846 | uint32_t status = 0; |
| 5847 | hdd_wext_state_t *pWextState; |
| 5848 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5849 | hdd_context_t *hdd_ctx; |
| 5850 | uint32_t roamId; |
| 5851 | tCsrRoamProfile *pRoamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5852 | eCsrAuthType RSNAuthType; |
| 5853 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5854 | int ret; |
| 5855 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5856 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5857 | |
| 5858 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5859 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5860 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5861 | return ret; |
| 5862 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5863 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5864 | if (0 != ret) |
| 5865 | return ret; |
| 5866 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5867 | if (pAdapter->device_mode != QDF_STA_MODE && |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5868 | pAdapter->device_mode != QDF_IBSS_MODE && |
| 5869 | pAdapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5870 | hdd_warn("device mode %s(%d) is not allowed", |
| 5871 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 5872 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5873 | return -EINVAL; |
| 5874 | } |
| 5875 | |
| 5876 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5877 | |
| 5878 | if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5879 | hdd_warn("Counter measure is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5880 | return -EBUSY; |
| 5881 | } |
| 5882 | if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length) |
| 5883 | return -EINVAL; |
| 5884 | |
| 5885 | pRoamProfile = &pWextState->roamProfile; |
Agrawal Ashish | 3d000b4 | 2017-02-07 13:44:50 +0530 | [diff] [blame] | 5886 | /*Try disconnecting if already in connected state*/ |
| 5887 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5888 | if (0 > status) { |
Srinivas Girigowda | 576b235 | 2017-08-25 14:44:26 -0700 | [diff] [blame] | 5889 | hdd_err("Failed to disconnect the existing connection"); |
| 5890 | return -EALREADY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5891 | } |
| 5892 | |
| 5893 | /* |
| 5894 | * when cfg80211 defined, wpa_supplicant wext driver uses |
| 5895 | * zero-length, null-string ssid for force disconnection. |
| 5896 | * after disconnection (if previously connected) and cleaning ssid, |
| 5897 | * driver MUST return success. |
| 5898 | */ |
| 5899 | if (0 == wrqu->essid.length) |
| 5900 | return 0; |
| 5901 | |
| 5902 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5903 | &pWextState->roamProfile.uapsd_mask); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5904 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5905 | pWextState->roamProfile.uapsd_mask = 0; |
| 5906 | |
| 5907 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 5908 | |
| 5909 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = |
| 5910 | wrqu->essid.length; |
| 5911 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5912 | qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5913 | sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5914 | qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5915 | ssId), extra, wrqu->essid.length); |
| 5916 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion |
| 5917 | || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { |
| 5918 | |
| 5919 | /* set gen ie */ |
| 5920 | hdd_set_genie_to_csr(pAdapter, &RSNAuthType); |
| 5921 | |
| 5922 | /* set auth */ |
| 5923 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5924 | } |
| 5925 | #ifdef FEATURE_WLAN_WAPI |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5926 | hdd_debug("Setting WAPI AUTH Type and Encryption Mode values"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5927 | if (pAdapter->wapi_info.nWapiMode) { |
| 5928 | switch (pAdapter->wapi_info.wapiAuthMode) { |
| 5929 | case WAPI_AUTH_MODE_PSK: |
| 5930 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5931 | hdd_debug("WAPI AUTH TYPE: PSK: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5932 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5933 | pRoamProfile->AuthType.numEntries = 1; |
| 5934 | pRoamProfile->AuthType.authType[0] = |
| 5935 | eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5936 | break; |
| 5937 | } |
| 5938 | case WAPI_AUTH_MODE_CERT: |
| 5939 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5940 | hdd_debug("WAPI AUTH TYPE: CERT: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5941 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5942 | pRoamProfile->AuthType.numEntries = 1; |
| 5943 | pRoamProfile->AuthType.authType[0] = |
| 5944 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5945 | break; |
| 5946 | } |
| 5947 | } /* End of switch */ |
| 5948 | if (pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5949 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5950 | hdd_debug("WAPI PAIRWISE/GROUP ENCRYPTION: WPI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5951 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5952 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5953 | eCSR_ENCRYPT_TYPE_WPI; |
| 5954 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5955 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5956 | eCSR_ENCRYPT_TYPE_WPI; |
| 5957 | } |
| 5958 | } |
| 5959 | #endif /* FEATURE_WLAN_WAPI */ |
| 5960 | /* if previous genIE is not NULL, update AssocIE */ |
| 5961 | if (0 != pWextState->genIE.length) { |
| 5962 | memset(&pWextState->assocAddIE, 0, |
| 5963 | sizeof(pWextState->assocAddIE)); |
| 5964 | memcpy(pWextState->assocAddIE.addIEdata, |
| 5965 | pWextState->genIE.addIEdata, pWextState->genIE.length); |
| 5966 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5967 | pWextState->roamProfile.pAddIEAssoc = |
| 5968 | pWextState->assocAddIE.addIEdata; |
| 5969 | pWextState->roamProfile.nAddIEAssocLength = |
| 5970 | pWextState->assocAddIE.length; |
| 5971 | |
| 5972 | /* clear previous genIE after use it */ |
| 5973 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 5974 | } |
| 5975 | |
| 5976 | /* |
| 5977 | * Assumes it is not WPS Association by default, except when |
| 5978 | * pAddIEAssoc has WPS IE. |
| 5979 | */ |
| 5980 | pWextState->roamProfile.bWPSAssociation = false; |
| 5981 | |
| 5982 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5983 | pWextState->roamProfile. |
| 5984 | nAddIEAssocLength)) |
| 5985 | pWextState->roamProfile.bWPSAssociation = true; |
| 5986 | |
| 5987 | /* Disable auto BMPS entry by PMC until DHCP is done */ |
| 5988 | sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5989 | true); |
| 5990 | |
| 5991 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 5992 | |
| 5993 | if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) { |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5994 | pRoamProfile->ch_params.ch_width = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5995 | hdd_select_cbmode(pAdapter, |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5996 | (WLAN_HDD_GET_CTX(pAdapter))->config->AdHocChannel5G, |
| 5997 | &pRoamProfile->ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5998 | } |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5999 | |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6000 | /* |
| 6001 | * Change conn_state to connecting before sme_roam_connect(), |
| 6002 | * because sme_roam_connect() has a direct path to call |
| 6003 | * hdd_sme_roam_callback(), which will change the conn_state |
| 6004 | * If direct path, conn_state will be accordingly changed to |
| 6005 | * NotConnected or Associated by either |
| 6006 | * hdd_association_completion_handler() or hdd_dis_connect_handler() |
| 6007 | * in sme_RoamCallback()if sme_RomConnect is to be queued, |
| 6008 | * Connecting state will remain until it is completed. |
| 6009 | * |
| 6010 | * If connection state is not changed, |
| 6011 | * connection state will remain in eConnectionState_NotConnected state. |
| 6012 | * In hdd_association_completion_handler, "hddDisconInProgress" is |
| 6013 | * set to true if conn state is eConnectionState_NotConnected. |
| 6014 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 6015 | * informed of connect result indication which is an issue. |
| 6016 | */ |
| 6017 | if (QDF_STA_MODE == pAdapter->device_mode || |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6018 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode) |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6019 | hdd_conn_set_connection_state(pAdapter, |
| 6020 | eConnectionState_Connecting); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6021 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6022 | status = sme_roam_connect(hHal, pAdapter->sessionId, |
| 6023 | &(pWextState->roamProfile), &roamId); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6024 | if ((QDF_STATUS_SUCCESS != status) && |
| 6025 | (QDF_STA_MODE == pAdapter->device_mode || |
| 6026 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6027 | hdd_err("sme_roam_connect failed session_id: %d status %d -> NotConnected", |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6028 | pAdapter->sessionId, status); |
| 6029 | /* change back to NotAssociated */ |
| 6030 | hdd_conn_set_connection_state(pAdapter, |
| 6031 | eConnectionState_NotConnected); |
| 6032 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6033 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 6034 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 6035 | |
| 6036 | EXIT(); |
| 6037 | return status; |
| 6038 | } |
| 6039 | |
| 6040 | /** |
| 6041 | * iw_set_essid() - set essid handler function |
| 6042 | * @dev: Pointer to the net device. |
| 6043 | * @info: Pointer to the iw_request_info. |
| 6044 | * @wrqu: Pointer to the iwreq_data. |
| 6045 | * @extra: Pointer to the data. |
| 6046 | * |
| 6047 | * Return: 0 for success, error number on failure |
| 6048 | */ |
| 6049 | int iw_set_essid(struct net_device *dev, |
| 6050 | struct iw_request_info *info, |
| 6051 | union iwreq_data *wrqu, char *extra) |
| 6052 | { |
| 6053 | int ret; |
| 6054 | |
| 6055 | cds_ssr_protect(__func__); |
| 6056 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 6057 | cds_ssr_unprotect(__func__); |
| 6058 | |
| 6059 | return ret; |
| 6060 | } |
| 6061 | |
| 6062 | /** |
| 6063 | * __iw_get_essid() - This function returns the essid to the wpa_supplicant |
| 6064 | * @dev: pointer to the net device |
| 6065 | * @info: pointer to the iw request info |
| 6066 | * @dwrq: pointer to iw_point |
| 6067 | * @extra: pointer to the data |
| 6068 | * |
| 6069 | * Return: 0 on success, error number otherwise |
| 6070 | */ |
| 6071 | static int __iw_get_essid(struct net_device *dev, |
| 6072 | struct iw_request_info *info, |
| 6073 | struct iw_point *dwrq, char *extra) |
| 6074 | { |
| 6075 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6076 | hdd_context_t *hdd_ctx; |
| 6077 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6078 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6079 | int ret; |
| 6080 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6081 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6082 | |
| 6083 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6084 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6085 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6086 | return ret; |
| 6087 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6088 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6089 | if (0 != ret) |
| 6090 | return ret; |
| 6091 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6092 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 6093 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 6094 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected |
| 6095 | || pHddStaCtx->conn_info.connState == |
| 6096 | eConnectionState_IbssDisconnected) |
| 6097 | && wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) { |
| 6098 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 6099 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 6100 | dwrq->length); |
| 6101 | dwrq->flags = 1; |
| 6102 | } else { |
| 6103 | memset(extra, 0, dwrq->length); |
| 6104 | dwrq->length = 0; |
| 6105 | dwrq->flags = 0; |
| 6106 | } |
| 6107 | EXIT(); |
| 6108 | return 0; |
| 6109 | } |
| 6110 | |
| 6111 | /** |
| 6112 | * iw_get_essid() - get essid handler function |
| 6113 | * @dev: Pointer to the net device. |
| 6114 | * @info: Pointer to the iw_request_info. |
| 6115 | * @wrqu: Pointer to the iwreq_data. |
| 6116 | * @extra: Pointer to the data. |
| 6117 | * |
| 6118 | * Return: 0 for success, error number on failure |
| 6119 | */ |
| 6120 | int iw_get_essid(struct net_device *dev, |
| 6121 | struct iw_request_info *info, |
| 6122 | struct iw_point *wrqu, char *extra) |
| 6123 | { |
| 6124 | int ret; |
| 6125 | |
| 6126 | cds_ssr_protect(__func__); |
| 6127 | ret = __iw_get_essid(dev, info, wrqu, extra); |
| 6128 | cds_ssr_unprotect(__func__); |
| 6129 | |
| 6130 | return ret; |
| 6131 | } |
| 6132 | |
| 6133 | /** |
| 6134 | * __iw_set_auth() - |
| 6135 | * This function sets the auth type received from the wpa_supplicant |
| 6136 | * @dev: pointer to the net device |
| 6137 | * @info: pointer to the iw request info |
| 6138 | * @wrqu: pointer to iwreq_data |
| 6139 | * @extra: pointer to the data |
| 6140 | * |
| 6141 | * Return: 0 on success, error number otherwise |
| 6142 | */ |
| 6143 | static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6144 | union iwreq_data *wrqu, char *extra) |
| 6145 | { |
| 6146 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6147 | hdd_context_t *hdd_ctx; |
| 6148 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6149 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6150 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6151 | eCsrEncryptionType mcEncryptionType; |
| 6152 | eCsrEncryptionType ucEncryptionType; |
| 6153 | int ret; |
| 6154 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6155 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6156 | |
| 6157 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6158 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6159 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6160 | return ret; |
| 6161 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6162 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6163 | if (0 != ret) |
| 6164 | return ret; |
| 6165 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6166 | switch (wrqu->param.flags & IW_AUTH_INDEX) { |
| 6167 | case IW_AUTH_WPA_VERSION: |
| 6168 | pWextState->wpaVersion = wrqu->param.value; |
| 6169 | break; |
| 6170 | |
| 6171 | case IW_AUTH_CIPHER_PAIRWISE: |
| 6172 | { |
| 6173 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6174 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6175 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6176 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6177 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6178 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6179 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6180 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6181 | == |
| 6182 | (pWextState-> |
| 6183 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6184 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6185 | pHddStaCtx->conn_info.authType)) |
| 6186 | /*Dynamic WEP key */ |
| 6187 | ucEncryptionType = |
| 6188 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6189 | else |
| 6190 | /*Static WEP key */ |
| 6191 | ucEncryptionType = |
| 6192 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6193 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6194 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6195 | == |
| 6196 | (pWextState-> |
| 6197 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6198 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6199 | pHddStaCtx->conn_info.authType)) |
| 6200 | /*Dynamic WEP key */ |
| 6201 | ucEncryptionType = |
| 6202 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6203 | else |
| 6204 | /*Static WEP key */ |
| 6205 | ucEncryptionType = |
| 6206 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6207 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6208 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
| 6209 | wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6210 | return -EINVAL; |
| 6211 | } |
| 6212 | |
| 6213 | pRoamProfile->EncryptionType.numEntries = 1; |
| 6214 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 6215 | ucEncryptionType; |
| 6216 | } |
| 6217 | break; |
| 6218 | case IW_AUTH_CIPHER_GROUP: |
| 6219 | { |
| 6220 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6221 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6222 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6223 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6224 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6225 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6226 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6227 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6228 | == |
| 6229 | (pWextState-> |
| 6230 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6231 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6232 | pHddStaCtx->conn_info.authType)) |
| 6233 | mcEncryptionType = |
| 6234 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6235 | else |
| 6236 | mcEncryptionType = |
| 6237 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6238 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6239 | /* Dynamic WEP keys won't work with shared keys */ |
| 6240 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6241 | == |
| 6242 | (pWextState-> |
| 6243 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6244 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6245 | pHddStaCtx->conn_info.authType)) { |
| 6246 | mcEncryptionType = |
| 6247 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6248 | } else { |
| 6249 | mcEncryptionType = |
| 6250 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6251 | } |
| 6252 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6253 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6254 | wrqu->param.value); |
| 6255 | return -EINVAL; |
| 6256 | } |
| 6257 | |
| 6258 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 6259 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 6260 | mcEncryptionType; |
| 6261 | } |
| 6262 | break; |
| 6263 | |
| 6264 | case IW_AUTH_80211_AUTH_ALG: |
| 6265 | { |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 6266 | /* Save the auth algo here and set auth type to SME |
| 6267 | * Roam profile in the iw_set_ap_address |
| 6268 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6269 | if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 6270 | pHddStaCtx->conn_info.authType = |
| 6271 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6272 | |
| 6273 | else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 6274 | pHddStaCtx->conn_info.authType = |
| 6275 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 6276 | |
| 6277 | else if (wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 6278 | /*Not supported */ |
| 6279 | pHddStaCtx->conn_info.authType = |
| 6280 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6281 | pWextState->roamProfile.AuthType.authType[0] = |
| 6282 | pHddStaCtx->conn_info.authType; |
| 6283 | } |
| 6284 | break; |
| 6285 | |
| 6286 | case IW_AUTH_KEY_MGMT: |
| 6287 | { |
| 6288 | #ifdef FEATURE_WLAN_ESE |
| 6289 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 6290 | /*Check for CCKM AKM type */ |
| 6291 | if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6292 | hdd_debug("CCKM AKM Set %d", wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6293 | /* Set the CCKM bit in authKeyMgmt */ |
| 6294 | /* |
| 6295 | * Right now, this breaks all ref to authKeyMgmt because |
| 6296 | * our code doesn't realize it is a "bitfield" |
| 6297 | */ |
Jeff Johnson | d084adb | 2017-08-16 11:19:52 -0700 | [diff] [blame] | 6298 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6299 | } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 6300 | /* Save the key management */ |
| 6301 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
Jeff Johnson | 3474602 | 2017-02-07 16:32:57 -0800 | [diff] [blame] | 6302 | } else if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6303 | /* Save the key management anyway */ |
| 6304 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6305 | } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */ |
| 6306 | /* Save the key management */ |
| 6307 | pWextState->authKeyMgmt |= |
| 6308 | IW_AUTH_KEY_MGMT_802_1X; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6309 | } |
| 6310 | #else |
| 6311 | /* Save the key management */ |
| 6312 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6313 | #endif /* FEATURE_WLAN_ESE */ |
| 6314 | } |
| 6315 | break; |
| 6316 | |
| 6317 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 6318 | { |
| 6319 | if (wrqu->param.value) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6320 | hdd_debug("Counter Measure started %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6321 | wrqu->param.value); |
| 6322 | pWextState->mTKIPCounterMeasures = |
| 6323 | TKIP_COUNTER_MEASURE_STARTED; |
| 6324 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6325 | hdd_debug("Counter Measure stopped=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6326 | wrqu->param.value); |
| 6327 | pWextState->mTKIPCounterMeasures = |
| 6328 | TKIP_COUNTER_MEASURE_STOPED; |
| 6329 | } |
| 6330 | } |
| 6331 | break; |
| 6332 | case IW_AUTH_DROP_UNENCRYPTED: |
| 6333 | case IW_AUTH_WPA_ENABLED: |
| 6334 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 6335 | case IW_AUTH_ROAMING_CONTROL: |
| 6336 | case IW_AUTH_PRIVACY_INVOKED: |
| 6337 | |
| 6338 | default: |
| 6339 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6340 | hdd_warn("called with unsupported auth type %d", |
| 6341 | wrqu->param.flags & IW_AUTH_INDEX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6342 | break; |
| 6343 | } |
| 6344 | |
| 6345 | EXIT(); |
| 6346 | return 0; |
| 6347 | } |
| 6348 | |
| 6349 | /** |
| 6350 | * iw_set_auth() - set auth callback function |
| 6351 | * @dev: Pointer to the net device. |
| 6352 | * @info: Pointer to the iw_request_info. |
| 6353 | * @wrqu: Pointer to the iwreq_data. |
| 6354 | * @extra: Pointer to the data. |
| 6355 | * |
| 6356 | * Return: 0 for success, error number on failure. |
| 6357 | */ |
| 6358 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6359 | union iwreq_data *wrqu, char *extra) |
| 6360 | { |
| 6361 | int ret; |
| 6362 | |
| 6363 | cds_ssr_protect(__func__); |
| 6364 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 6365 | cds_ssr_unprotect(__func__); |
| 6366 | |
| 6367 | return ret; |
| 6368 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6369 | /** |
| 6370 | * __iw_get_auth() - |
| 6371 | * This function returns the auth type to the wpa_supplicant |
| 6372 | * @dev: pointer to the net device |
| 6373 | * @info: pointer to the iw request info |
| 6374 | * @wrqu: pointer to iwreq_data |
| 6375 | * @extra: pointer to the data |
| 6376 | * |
| 6377 | * Return: 0 on success, error number otherwise |
| 6378 | */ |
| 6379 | static int __iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6380 | union iwreq_data *wrqu, char *extra) |
| 6381 | { |
| 6382 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6383 | hdd_context_t *hdd_ctx; |
| 6384 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6385 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6386 | int ret; |
| 6387 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6388 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6389 | |
| 6390 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6391 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6392 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6393 | return ret; |
| 6394 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6395 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6396 | if (0 != ret) |
| 6397 | return ret; |
| 6398 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6399 | switch (pRoamProfile->negotiatedAuthType) { |
| 6400 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 6401 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6402 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 6403 | break; |
| 6404 | case eCSR_AUTH_TYPE_WPA: |
| 6405 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6406 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 6407 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6408 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6409 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6410 | case eCSR_AUTH_TYPE_RSN: |
| 6411 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6412 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 6413 | break; |
| 6414 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 6415 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6416 | break; |
| 6417 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 6418 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 6419 | break; |
| 6420 | case eCSR_AUTH_TYPE_UNKNOWN: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6421 | hdd_debug("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6422 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6423 | break; |
| 6424 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 6425 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6426 | break; |
| 6427 | case eCSR_AUTH_TYPE_WPA_PSK: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6428 | hdd_debug("called with WPA PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6429 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6430 | return -EIO; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6431 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6432 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6433 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 6434 | #ifdef WLAN_FEATURE_11W |
| 6435 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 6436 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 6437 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6438 | hdd_debug("called with RSN PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6439 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6440 | return -EIO; |
| 6441 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6442 | hdd_warn("Unknown auth type: %d", |
| 6443 | pRoamProfile->negotiatedAuthType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6444 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6445 | return -EIO; |
| 6446 | } |
| 6447 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) { |
| 6448 | switch (pRoamProfile->negotiatedUCEncryptionType) { |
| 6449 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6450 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6451 | break; |
| 6452 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6453 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6454 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6455 | break; |
| 6456 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6457 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6458 | break; |
| 6459 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6460 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6461 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6462 | break; |
| 6463 | case eCSR_ENCRYPT_TYPE_AES: |
| 6464 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6465 | break; |
| 6466 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6467 | hdd_warn("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6468 | pRoamProfile->negotiatedUCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6469 | return -EIO; |
| 6470 | } |
| 6471 | } |
| 6472 | |
| 6473 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) { |
| 6474 | switch (pRoamProfile->negotiatedMCEncryptionType) { |
| 6475 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6476 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6477 | break; |
| 6478 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6479 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6480 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6481 | break; |
| 6482 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6483 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6484 | break; |
| 6485 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6486 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6487 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6488 | break; |
| 6489 | case eCSR_ENCRYPT_TYPE_AES: |
| 6490 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6491 | break; |
| 6492 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6493 | hdd_err("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6494 | pRoamProfile->negotiatedMCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6495 | return -EIO; |
| 6496 | } |
| 6497 | } |
| 6498 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6499 | hdd_debug("called with auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6500 | pRoamProfile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6501 | EXIT(); |
| 6502 | return 0; |
| 6503 | } |
| 6504 | |
| 6505 | /** |
| 6506 | * iw_get_auth() - get auth callback function |
| 6507 | * @dev: Pointer to the net device. |
| 6508 | * @info: Pointer to the iw_request_info. |
| 6509 | * @wrqu: Pointer to the iwreq_data. |
| 6510 | * @extra: Pointer to the data. |
| 6511 | * |
| 6512 | * Return: 0 for success, error number on failure. |
| 6513 | */ |
| 6514 | int iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6515 | union iwreq_data *wrqu, char *extra) |
| 6516 | { |
| 6517 | int ret; |
| 6518 | |
| 6519 | cds_ssr_protect(__func__); |
| 6520 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 6521 | cds_ssr_unprotect(__func__); |
| 6522 | |
| 6523 | return ret; |
| 6524 | } |
| 6525 | |
| 6526 | /** |
| 6527 | * __iw_set_ap_address() - set ap address |
| 6528 | * @dev: pointer to the net device |
| 6529 | * @info: pointer to the iw request info |
| 6530 | * @wrqu: pointer to iwreq_data |
| 6531 | * @extra: pointer to the data |
| 6532 | * |
| 6533 | * This function updates the HDD global station context connection info |
| 6534 | * BSSID with the MAC address received from the wpa_supplicant. |
| 6535 | * |
| 6536 | * Return: 0 on success, error number otherwise |
| 6537 | */ |
| 6538 | static int __iw_set_ap_address(struct net_device *dev, |
| 6539 | struct iw_request_info *info, |
| 6540 | union iwreq_data *wrqu, char *extra) |
| 6541 | { |
| 6542 | |
| 6543 | hdd_adapter_t *adapter; |
| 6544 | hdd_context_t *hdd_ctx; |
| 6545 | hdd_station_ctx_t *pHddStaCtx = |
| 6546 | WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 6547 | uint8_t *pMacAddress = NULL; |
| 6548 | int ret; |
| 6549 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6550 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6551 | |
| 6552 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6553 | |
| 6554 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6555 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6556 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6557 | return ret; |
| 6558 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6559 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6560 | if (0 != ret) |
| 6561 | return ret; |
| 6562 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6563 | pMacAddress = (uint8_t *) wrqu->ap_addr.sa_data; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6564 | hdd_debug(" " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMacAddress)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6565 | qdf_mem_copy(pHddStaCtx->conn_info.bssId.bytes, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6566 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6567 | EXIT(); |
| 6568 | |
| 6569 | return 0; |
| 6570 | } |
| 6571 | |
| 6572 | /** |
| 6573 | * iw_set_ap_address() - set ap addresses callback function |
| 6574 | * @dev: Pointer to the net device. |
| 6575 | * @info: Pointer to the iw_request_info. |
| 6576 | * @wrqu: Pointer to the iwreq_data. |
| 6577 | * @extra: Pointer to the data. |
| 6578 | * |
| 6579 | * Return: 0 for success, error number on failure. |
| 6580 | */ |
| 6581 | int iw_set_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6582 | union iwreq_data *wrqu, char *extra) |
| 6583 | { |
| 6584 | int ret; |
| 6585 | |
| 6586 | cds_ssr_protect(__func__); |
| 6587 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 6588 | cds_ssr_unprotect(__func__); |
| 6589 | |
| 6590 | return ret; |
| 6591 | } |
| 6592 | |
| 6593 | /** |
| 6594 | * __iw_get_ap_address() - get ap address |
| 6595 | * @dev: pointer to the net device |
| 6596 | * @info: pointer to the iw request info |
| 6597 | * @wrqu: pointer to iwreq_data |
| 6598 | * @extra: pointer to the data |
| 6599 | * |
| 6600 | * This function returns currently associated BSSID. |
| 6601 | * |
| 6602 | * Return: 0 on success, error number otherwise |
| 6603 | */ |
| 6604 | static int __iw_get_ap_address(struct net_device *dev, |
| 6605 | struct iw_request_info *info, |
| 6606 | union iwreq_data *wrqu, char *extra) |
| 6607 | { |
| 6608 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6609 | hdd_context_t *hdd_ctx; |
| 6610 | hdd_station_ctx_t *pHddStaCtx = |
| 6611 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6612 | int ret; |
| 6613 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6614 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6615 | |
| 6616 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6617 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6618 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6619 | return ret; |
| 6620 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6621 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6622 | if (0 != ret) |
| 6623 | return ret; |
| 6624 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6625 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated || |
| 6626 | eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6627 | qdf_mem_copy(wrqu->ap_addr.sa_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6628 | pHddStaCtx->conn_info.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6629 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6630 | } else { |
| 6631 | memset(wrqu->ap_addr.sa_data, 0, sizeof(wrqu->ap_addr.sa_data)); |
| 6632 | } |
| 6633 | EXIT(); |
| 6634 | return 0; |
| 6635 | } |
| 6636 | |
| 6637 | /** |
| 6638 | * iw_get_ap_address() - get ap addresses callback function |
| 6639 | * @dev: Pointer to the net device. |
| 6640 | * @info: Pointer to the iw_request_info. |
| 6641 | * @wrqu: Pointer to the iwreq_data. |
| 6642 | * @extra: Pointer to the data. |
| 6643 | * |
| 6644 | * Return: 0 for success, error number on failure. |
| 6645 | */ |
| 6646 | int iw_get_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6647 | union iwreq_data *wrqu, char *extra) |
| 6648 | { |
| 6649 | int ret; |
| 6650 | |
| 6651 | cds_ssr_protect(__func__); |
| 6652 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 6653 | cds_ssr_unprotect(__func__); |
| 6654 | |
| 6655 | return ret; |
| 6656 | } |