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 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 166 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 167 | struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 190 | struct hdd_station_ctx *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 191 | struct hdd_context *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 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 217 | static inline bool hdd_conn_get_connection_state(struct hdd_station_ctx *pHddStaCtx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 244 | bool hdd_is_connecting(struct hdd_station_ctx *hdd_sta_ctx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 256 | bool hdd_conn_is_connected(struct hdd_station_ctx *pHddStaCtx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 268 | enum band_info hdd_conn_get_connected_band(struct hdd_station_ctx *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 |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 291 | hdd_conn_get_connected_cipher_algo(struct hdd_station_ctx *pHddStaCtx, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 313 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 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; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 336 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 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 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 359 | static void hdd_copy_ht_caps(struct hdd_station_ctx *hdd_sta_ctx, |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 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 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 553 | static void hdd_copy_vht_caps(struct hdd_station_ctx *hdd_sta_ctx, |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 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 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 668 | static void hdd_copy_ht_operation(struct hdd_station_ctx *hdd_sta_ctx, |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 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 | |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 757 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) |
| 758 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 759 | tDot11fIEVHTOperation *roam_ops) |
| 760 | { |
| 761 | ieee_ops->center_freq_seg0_idx = roam_ops->chanCenterFreqSeg1; |
| 762 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg2; |
| 763 | } |
| 764 | #else |
| 765 | static void hdd_copy_vht_center_freq(struct ieee80211_vht_operation *ieee_ops, |
| 766 | tDot11fIEVHTOperation *roam_ops) |
| 767 | { |
| 768 | ieee_ops->center_freq_seg1_idx = roam_ops->chanCenterFreqSeg1; |
| 769 | ieee_ops->center_freq_seg2_idx = roam_ops->chanCenterFreqSeg2; |
| 770 | } |
| 771 | #endif /* KERNEL_VERSION(4, 12, 0) */ |
| 772 | |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 773 | /** |
| 774 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 775 | * hdd station context. |
| 776 | * @hdd_sta_ctx: pointer to hdd station context |
| 777 | * @roam_info: pointer to roam info |
| 778 | * |
| 779 | * Return: None |
| 780 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 781 | static void hdd_copy_vht_operation(struct hdd_station_ctx *hdd_sta_ctx, |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 782 | tCsrRoamInfo *roam_info) |
| 783 | { |
| 784 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 785 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 786 | &hdd_sta_ctx->conn_info.vht_operation; |
| 787 | |
| 788 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 789 | |
| 790 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
Dustin Brown | 8aef46d | 2017-08-10 15:44:50 -0700 | [diff] [blame] | 791 | hdd_copy_vht_center_freq(hdd_vht_ops, roam_vht_ops); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 792 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 793 | } |
| 794 | |
| 795 | |
| 796 | /** |
| 797 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 798 | * @adapter: Pointer to adapter |
| 799 | * @roam_info: pointer to roam info |
| 800 | * |
| 801 | * Return: None |
| 802 | */ |
| 803 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 804 | tCsrRoamInfo *roam_info) |
| 805 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 806 | struct hdd_station_ctx *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 807 | |
| 808 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 809 | hdd_sta_ctx->conn_info.operationChannel); |
| 810 | if (roam_info->vht_caps.present) { |
| 811 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
| 812 | hdd_copy_vht_caps(hdd_sta_ctx, roam_info); |
| 813 | } else { |
| 814 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 815 | } |
| 816 | if (roam_info->ht_caps.present) { |
| 817 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
| 818 | hdd_copy_ht_caps(hdd_sta_ctx, roam_info); |
| 819 | } else { |
| 820 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 821 | } |
| 822 | if (roam_info->reassoc) |
| 823 | hdd_sta_ctx->conn_info.roam_count++; |
| 824 | if (roam_info->hs20vendor_ie.present) { |
| 825 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 826 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 827 | &roam_info->hs20vendor_ie, |
| 828 | sizeof(roam_info->hs20vendor_ie)); |
| 829 | } else { |
| 830 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 831 | } |
| 832 | if (roam_info->ht_operation.present) { |
| 833 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 834 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 835 | } else { |
| 836 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 837 | } |
| 838 | if (roam_info->vht_operation.present) { |
| 839 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 840 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 841 | } else { |
| 842 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 843 | } |
| 844 | } |
| 845 | |
| 846 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 847 | * hdd_conn_save_connect_info() - save current connection information |
| 848 | * @pAdapter: pointer to adapter |
| 849 | * @pRoamInfo: pointer to roam info |
| 850 | * @eBssType: bss type |
| 851 | * |
| 852 | * Return: none |
| 853 | */ |
| 854 | static void |
| 855 | hdd_conn_save_connect_info(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 856 | eCsrRoamBssType eBssType) |
| 857 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 858 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 859 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 860 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 861 | QDF_ASSERT(pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 862 | |
| 863 | if (pRoamInfo) { |
| 864 | /* Save the BSSID for the connection */ |
| 865 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 866 | QDF_ASSERT(pRoamInfo->pBssDesc); |
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 | |
| 870 | /* |
| 871 | * Save the Station ID for this station from |
| 872 | * the 'Roam Info'. For IBSS mode, staId is |
| 873 | * assigned in NEW_PEER_IND. For reassoc, |
| 874 | * the staID doesn't change and it may be invalid |
| 875 | * in this structure so no change here. |
| 876 | */ |
| 877 | if (!pRoamInfo->fReassocReq) { |
| 878 | pHddStaCtx->conn_info.staId[0] = |
| 879 | pRoamInfo->staId; |
| 880 | } |
| 881 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 882 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 883 | &pRoamInfo->bssid); |
| 884 | } else { |
| 885 | /* |
| 886 | * can't happen. We need a valid IBSS or Infra setting |
| 887 | * in the BSSDescription or we can't function. |
| 888 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 889 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | /* notify WMM */ |
| 893 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 894 | |
| 895 | if (!pRoamInfo->u.pConnectedProfile) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 896 | QDF_ASSERT(pRoamInfo->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 897 | } else { |
| 898 | /* Get Multicast Encryption Type */ |
| 899 | encryptType = |
| 900 | pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 901 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 902 | /* Get Unicast Encryption Type */ |
| 903 | encryptType = |
| 904 | pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 905 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 906 | |
| 907 | pHddStaCtx->conn_info.authType = |
| 908 | pRoamInfo->u.pConnectedProfile->AuthType; |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 909 | pHddStaCtx->conn_info.last_auth_type = |
| 910 | pHddStaCtx->conn_info.authType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 911 | |
| 912 | pHddStaCtx->conn_info.operationChannel = |
| 913 | pRoamInfo->u.pConnectedProfile->operationChannel; |
| 914 | |
| 915 | /* Save the ssid for the connection */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 916 | qdf_mem_copy(&pHddStaCtx->conn_info.SSID.SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 917 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 918 | sizeof(tSirMacSSid)); |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 919 | qdf_mem_copy(&pHddStaCtx->conn_info.last_ssid.SSID, |
| 920 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 921 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 922 | |
| 923 | /* Save dot11mode in which STA associated to AP */ |
| 924 | pHddStaCtx->conn_info.dot11Mode = |
| 925 | pRoamInfo->u.pConnectedProfile->dot11Mode; |
| 926 | |
| 927 | pHddStaCtx->conn_info.proxyARPService = |
| 928 | pRoamInfo->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 929 | |
| 930 | pHddStaCtx->conn_info.nss = pRoamInfo->chan_info.nss; |
| 931 | |
| 932 | pHddStaCtx->conn_info.rate_flags = |
| 933 | pRoamInfo->chan_info.rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 934 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 935 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 936 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 937 | } |
| 938 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 939 | /** |
| 940 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 941 | * @dev: pointer to net device |
| 942 | * @pAdapter: pointer to adapter |
| 943 | * @pCsrRoamInfo: pointer to roam info |
| 944 | * |
| 945 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 946 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 947 | * for the same purpose.) |
| 948 | * |
| 949 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 950 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 951 | * This is the Assoc Response. |
| 952 | * |
| 953 | * Return: none |
| 954 | */ |
| 955 | static void |
| 956 | hdd_send_ft_assoc_response(struct net_device *dev, |
| 957 | hdd_adapter_t *pAdapter, |
| 958 | tCsrRoamInfo *pCsrRoamInfo) |
| 959 | { |
| 960 | union iwreq_data wrqu; |
| 961 | char *buff; |
| 962 | unsigned int len = 0; |
| 963 | u8 *pFTAssocRsp = NULL; |
| 964 | |
| 965 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 966 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 967 | return; |
| 968 | } |
| 969 | |
| 970 | pFTAssocRsp = |
| 971 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 972 | pCsrRoamInfo->nAssocReqLength); |
| 973 | if (pFTAssocRsp == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 974 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 975 | return; |
| 976 | } |
| 977 | /* pFTAssocRsp needs to point to the IEs */ |
| 978 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 979 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 980 | (unsigned int)pFTAssocRsp[0], |
| 981 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 982 | |
| 983 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 984 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 985 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 986 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 987 | return; |
| 988 | } |
| 989 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 990 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 991 | wrqu.data.length = len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 992 | memcpy(buff, pFTAssocRsp, len); |
| 993 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 994 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 995 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 996 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 997 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 998 | /** |
| 999 | * hdd_send_ft_event() - send fast transition event |
| 1000 | * @pAdapter: pointer to adapter |
| 1001 | * |
| 1002 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 1003 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 1004 | * followed by the auth response IEs to the supplicant. |
| 1005 | * Once both are received in the supplicant, an FT event is generated |
| 1006 | * to the supplicant. |
| 1007 | * |
| 1008 | * Return: none |
| 1009 | */ |
| 1010 | static void hdd_send_ft_event(hdd_adapter_t *pAdapter) |
| 1011 | { |
| 1012 | uint16_t auth_resp_len = 0; |
| 1013 | uint32_t ric_ies_length = 0; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1014 | struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1015 | |
| 1016 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 1017 | struct cfg80211_ft_event_params ftEvent; |
| 1018 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 1019 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 1020 | struct net_device *dev = pAdapter->dev; |
| 1021 | #else |
| 1022 | char *buff; |
| 1023 | union iwreq_data wrqu; |
| 1024 | uint16_t str_len; |
| 1025 | #endif |
| 1026 | |
| 1027 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1028 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1029 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1030 | |
| 1031 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, (u8 *) ricIe, |
| 1032 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1033 | if (ric_ies_length == 0) |
| 1034 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1035 | |
| 1036 | ftEvent.ric_ies = ricIe; |
| 1037 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1038 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1039 | |
| 1040 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1041 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1042 | &auth_resp_len); |
| 1043 | |
| 1044 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1045 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1046 | return; |
| 1047 | } |
| 1048 | |
| 1049 | sme_set_ft_pre_auth_state(pHddCtx->hHal, pAdapter->sessionId, true); |
| 1050 | |
| 1051 | ftEvent.target_ap = ftIe; |
| 1052 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1053 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1054 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1055 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1056 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1057 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1058 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1059 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1060 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1061 | ftEvent.target_ap[5]); |
| 1062 | |
| 1063 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1064 | |
| 1065 | #else |
| 1066 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1067 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1068 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1069 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1070 | return; |
| 1071 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1072 | |
| 1073 | /* Sme needs to send the RIC IEs first */ |
| 1074 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
| 1075 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, |
| 1076 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1077 | &ric_ies_length); |
| 1078 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1079 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1080 | } else { |
| 1081 | wrqu.data.length = str_len + ric_ies_length; |
| 1082 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1083 | } |
| 1084 | |
| 1085 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1086 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1087 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
| 1088 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1089 | (u8 *) &buff[str_len], |
| 1090 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1091 | |
| 1092 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1093 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1094 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1095 | return; |
| 1096 | } |
| 1097 | |
| 1098 | wrqu.data.length = str_len + auth_resp_len; |
| 1099 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1100 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1101 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1102 | #endif |
| 1103 | } |
| 1104 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1105 | #ifdef FEATURE_WLAN_ESE |
| 1106 | /** |
| 1107 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1108 | * @dev: pointer to net device |
| 1109 | * @pAdapter: pointer to adapter |
| 1110 | * @pCsrRoamInfo: pointer to roam info |
| 1111 | * |
| 1112 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1113 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1114 | * |
| 1115 | * The current (new AP) channel information is passed in. |
| 1116 | * |
| 1117 | * Return: none |
| 1118 | */ |
| 1119 | static void |
| 1120 | hdd_send_new_ap_channel_info(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1121 | tCsrRoamInfo *pCsrRoamInfo) |
| 1122 | { |
| 1123 | union iwreq_data wrqu; |
| 1124 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
| 1125 | |
| 1126 | if (descriptor == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1127 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1128 | return; |
| 1129 | } |
| 1130 | /* |
| 1131 | * Send the Channel event, the supplicant needs this to generate |
| 1132 | * the Adjacent AP report. |
| 1133 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1134 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1135 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1136 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1137 | wrqu.freq.m = descriptor->channelId; |
| 1138 | wrqu.freq.e = 0; |
| 1139 | wrqu.freq.i = 0; |
| 1140 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1141 | } |
| 1142 | |
| 1143 | #endif /* FEATURE_WLAN_ESE */ |
| 1144 | |
| 1145 | /** |
| 1146 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
| 1147 | * @pAdapter: pointer to adapter |
| 1148 | * @pCsrRoamInfo: pointer to roam info |
| 1149 | * |
| 1150 | * Return: none |
| 1151 | */ |
| 1152 | static void |
| 1153 | hdd_send_update_beacon_ies_event(hdd_adapter_t *pAdapter, |
| 1154 | tCsrRoamInfo *pCsrRoamInfo) |
| 1155 | { |
| 1156 | union iwreq_data wrqu; |
| 1157 | u8 *pBeaconIes; |
| 1158 | u8 currentLen = 0; |
| 1159 | char *buff; |
| 1160 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1161 | |
| 1162 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1163 | |
| 1164 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1165 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1166 | return; |
| 1167 | } |
| 1168 | pBeaconIes = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1169 | if (pBeaconIes == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1170 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1171 | return; |
| 1172 | } |
| 1173 | /* pBeaconIes needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1174 | hdd_debug("Beacon IEs is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1175 | (unsigned int)pBeaconIes[0], |
| 1176 | (unsigned int)pBeaconIes[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1177 | hdd_debug("Beacon IEs length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1178 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1179 | |
| 1180 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1181 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1182 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1183 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1184 | return; |
| 1185 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1186 | |
| 1187 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1188 | currentLen = strLen + 1; |
| 1189 | |
| 1190 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1191 | do { |
| 1192 | /* |
| 1193 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1194 | * into chunks of CUSTOM event max size and send it to |
| 1195 | * supplicant. Changes are done in supplicant to handle this. |
| 1196 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1197 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1198 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1199 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1200 | qdf_mem_copy(&buff[strLen + 1], pBeaconIes + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1201 | currentLen); |
| 1202 | currentOffset += currentLen; |
| 1203 | totalIeLen -= currentLen; |
| 1204 | wrqu.data.length = strLen + 1 + currentLen; |
| 1205 | if (totalIeLen) |
| 1206 | buff[strLen] = 1; /* more chunks pending */ |
| 1207 | else |
| 1208 | buff[strLen] = 0; /* last chunk */ |
| 1209 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1210 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1211 | currentLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1212 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1213 | } while (totalIeLen > 0); |
| 1214 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1215 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1216 | } |
| 1217 | |
| 1218 | /** |
| 1219 | * hdd_send_association_event() - send association event |
| 1220 | * @dev: pointer to net device |
| 1221 | * @pCsrRoamInfo: pointer to roam info |
| 1222 | * |
| 1223 | * Return: none |
| 1224 | */ |
| 1225 | static void hdd_send_association_event(struct net_device *dev, |
| 1226 | tCsrRoamInfo *pCsrRoamInfo) |
| 1227 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1228 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1229 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1230 | struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1231 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1232 | union iwreq_data wrqu; |
| 1233 | int we_event; |
| 1234 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1235 | struct qdf_mac_addr peerMacAddr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1236 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1237 | /* Added to find the auth type on the fly at run time */ |
| 1238 | /* rather than with cfg to see if FT is enabled */ |
| 1239 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1240 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1241 | |
| 1242 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1243 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1244 | we_event = SIOCGIWAP; |
| 1245 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1246 | if (NULL != pCsrRoamInfo) |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1247 | if (pCsrRoamInfo->roamSynchInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1248 | /* change logging before release */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1249 | hdd_debug("LFR3:hdd_send_association_event"); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1250 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1251 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1252 | true, pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1253 | wlan_hdd_tdls_notify_disconnect(pAdapter, true); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1254 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1255 | #endif |
| 1256 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1257 | tSirSmeChanInfo chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1258 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1259 | if (!pCsrRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1260 | hdd_warn("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1261 | return; |
| 1262 | } |
| 1263 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1264 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1265 | policy_mgr_incr_active_session(pHddCtx->hdd_psoc, |
| 1266 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1267 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1268 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1269 | |
| 1270 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1271 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1272 | if (global_p2p_connection_status == |
| 1273 | P2P_CLIENT_CONNECTING_STATE_1) { |
| 1274 | global_p2p_connection_status = |
| 1275 | P2P_CLIENT_CONNECTED_STATE_1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1276 | 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] | 1277 | } else if (global_p2p_connection_status == |
| 1278 | P2P_CLIENT_CONNECTING_STATE_2) { |
| 1279 | global_p2p_connection_status = |
| 1280 | P2P_CLIENT_COMPLETED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1281 | 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] | 1282 | } |
| 1283 | } |
| 1284 | #endif |
| 1285 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " |
| 1286 | MAC_ADDRESS_STR "\n", |
| 1287 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1288 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
| 1289 | hdd_send_update_beacon_ies_event(pAdapter, pCsrRoamInfo); |
| 1290 | |
| 1291 | /* |
| 1292 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1293 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1294 | * fFTEnable is true. |
| 1295 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1296 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1297 | if ((pRoamProfile->AuthType.authType[0] == |
| 1298 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 1299 | || (pRoamProfile->AuthType.authType[0] == |
| 1300 | eCSR_AUTH_TYPE_FT_RSN) |
| 1301 | #ifdef FEATURE_WLAN_ESE |
| 1302 | || (pRoamProfile->AuthType.authType[0] == |
| 1303 | eCSR_AUTH_TYPE_CCKM_RSN) |
| 1304 | || (pRoamProfile->AuthType.authType[0] == |
| 1305 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1306 | #endif |
| 1307 | ) { |
| 1308 | hdd_send_ft_assoc_response(dev, pAdapter, pCsrRoamInfo); |
| 1309 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1310 | qdf_copy_macaddr(&peerMacAddr, |
| 1311 | &pHddStaCtx->conn_info.bssId); |
| 1312 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1313 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1314 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1315 | chan_info.band_center_freq1 = |
| 1316 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1317 | chan_info.band_center_freq2 = |
| 1318 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1319 | chan_info.reg_info_1 = |
| 1320 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1321 | chan_info.reg_info_2 = |
| 1322 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1323 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1324 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1325 | pAdapter->device_mode, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1326 | peerMacAddr.bytes, |
| 1327 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1328 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1329 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1330 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1331 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1332 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1333 | if (ret) |
| 1334 | hdd_err("Peer object %pM fail to set associated state", |
| 1335 | peerMacAddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1336 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1337 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1338 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
| 1339 | ePeerConnected, |
| 1340 | pCsrRoamInfo->timingMeasCap, |
| 1341 | pAdapter->sessionId, &chan_info, |
| 1342 | pAdapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1343 | /* Update tdls module about connection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1344 | hdd_notify_sta_connect(pAdapter->sessionId, |
| 1345 | pCsrRoamInfo->tdls_chan_swit_prohibited, |
| 1346 | pCsrRoamInfo->tdls_prohibited, |
| 1347 | pAdapter->hdd_vdev); |
| 1348 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1349 | wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo); |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 1350 | |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1351 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1352 | #ifdef MSM_PLATFORM |
Ravi Joshi | ae8e9a7 | 2016-08-03 17:38:03 -0700 | [diff] [blame] | 1353 | #if defined(CONFIG_ICNSS) || defined(CONFIG_CNSS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1354 | /* start timer in sta/p2p_cli */ |
| 1355 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1356 | pAdapter->prev_tx_packets = pAdapter->stats.tx_packets; |
| 1357 | pAdapter->prev_rx_packets = pAdapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1358 | cdp_get_intra_bss_fwd_pkts_count( |
| 1359 | cds_get_context(QDF_MODULE_ID_SOC), pAdapter->sessionId, |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1360 | &pAdapter->prev_fwd_tx_packets, |
| 1361 | &pAdapter->prev_fwd_rx_packets); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1362 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1363 | hdd_bus_bw_compute_timer_start(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1364 | #endif |
| 1365 | #endif |
| 1366 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
| 1367 | pHddStaCtx->conn_info.connState) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1368 | policy_mgr_update_connection_info(pHddCtx->hdd_psoc, |
| 1369 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1370 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1371 | ETH_ALEN); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1372 | hdd_info("wlan: new IBSS connection to " MAC_ADDRESS_STR, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1373 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes)); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1374 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1375 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1376 | QDF_IBSS_MODE, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1377 | pCsrRoamInfo->bssid.bytes, |
| 1378 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1379 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1380 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1381 | MAC_ADDR_ARRAY(pCsrRoamInfo->bssid.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1382 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1383 | WLAN_ASSOC_STATE); |
Mukul Sharma | eb01e13 | 2017-02-16 13:01:03 +0530 | [diff] [blame] | 1384 | if (ret) |
| 1385 | hdd_err("Peer object %pM fail to set associated state", |
| 1386 | peerMacAddr.bytes); |
| 1387 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1388 | } else { /* Not Associated */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1389 | hdd_info("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1390 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1391 | policy_mgr_decr_session_set_pcl(pHddCtx->hdd_psoc, |
| 1392 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1393 | |
| 1394 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1395 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1396 | #endif |
| 1397 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1398 | if ((pAdapter->device_mode == QDF_STA_MODE) || |
| 1399 | (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1400 | qdf_copy_macaddr(&peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1401 | &pHddStaCtx->conn_info.bssId); |
| 1402 | |
| 1403 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1404 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1405 | ePeerDisconnected, 0, |
| 1406 | pAdapter->sessionId, |
| 1407 | NULL, |
| 1408 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1409 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1410 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1411 | ret = hdd_objmgr_remove_peer_object(pAdapter->hdd_vdev, |
| 1412 | peerMacAddr.bytes); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 1413 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1414 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
| 1415 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
| 1416 | |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 1417 | hdd_lpass_notify_disconnect(pAdapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1418 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1419 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1420 | false, |
| 1421 | pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1422 | wlan_hdd_tdls_notify_disconnect(pAdapter, false); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1423 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1424 | #ifdef MSM_PLATFORM |
| 1425 | /* stop timer in sta/p2p_cli */ |
| 1426 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1427 | pAdapter->prev_tx_packets = 0; |
| 1428 | pAdapter->prev_rx_packets = 0; |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1429 | pAdapter->prev_fwd_tx_packets = 0; |
| 1430 | pAdapter->prev_fwd_rx_packets = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1431 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1432 | hdd_bus_bw_compute_timer_try_stop(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1433 | #endif |
| 1434 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1435 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1436 | /* Send SCC/MCC Switching event to IPA */ |
| 1437 | hdd_ipa_send_mcc_scc_msg(pHddCtx, pHddCtx->mcc_mode); |
| 1438 | |
| 1439 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1440 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1441 | * driver so not sending the status of the connection to supplicant |
| 1442 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1443 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1444 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1445 | #ifdef FEATURE_WLAN_ESE |
| 1446 | if (eConnectionState_Associated == |
| 1447 | pHddStaCtx->conn_info.connState) { |
| 1448 | if ((pRoamProfile->AuthType.authType[0] == |
| 1449 | eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1450 | (pRoamProfile->AuthType.authType[0] == |
| 1451 | eCSR_AUTH_TYPE_CCKM_WPA)) |
| 1452 | hdd_send_new_ap_channel_info(dev, pAdapter, |
| 1453 | pCsrRoamInfo); |
| 1454 | } |
| 1455 | #endif |
| 1456 | } |
| 1457 | } |
| 1458 | |
| 1459 | /** |
| 1460 | * hdd_conn_remove_connect_info() - remove connection info |
| 1461 | * @pHddStaCtx: pointer to global HDD station context |
| 1462 | * @pCsrRoamInfo: pointer to roam info |
| 1463 | * |
| 1464 | * Return: none |
| 1465 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1466 | static void hdd_conn_remove_connect_info(struct hdd_station_ctx *pHddStaCtx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1467 | { |
| 1468 | /* Remove staId, bssId and peerMacAddress */ |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1469 | pHddStaCtx->conn_info.staId[0] = HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1470 | qdf_mem_zero(&pHddStaCtx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1471 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1472 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1473 | |
| 1474 | /* Clear all security settings */ |
| 1475 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1476 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1477 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1478 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1479 | qdf_mem_zero(&pHddStaCtx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1480 | qdf_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1481 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1482 | pHddStaCtx->conn_info.proxyARPService = 0; |
| 1483 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1484 | qdf_mem_zero(&pHddStaCtx->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1485 | } |
| 1486 | |
| 1487 | /** |
| 1488 | * hdd_roam_deregister_sta() - deregister station |
| 1489 | * @pAdapter: pointer to adapter |
| 1490 | * @staId: station identifier |
| 1491 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1492 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1493 | */ |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1494 | 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] | 1495 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1496 | QDF_STATUS qdf_status; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1497 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1498 | int ret = 0; |
| 1499 | uint8_t *peer_mac = NULL; |
| 1500 | struct qdf_mac_addr broadcastMacAddr = |
| 1501 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1502 | if (eConnectionState_IbssDisconnected == |
| 1503 | pHddStaCtx->conn_info.connState) { |
| 1504 | /* |
| 1505 | * Do not set the carrier off when the last peer leaves. |
| 1506 | * We will set the carrier off while stopping the IBSS. |
| 1507 | */ |
| 1508 | } |
| 1509 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1510 | 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] | 1511 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1512 | staid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1513 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1514 | hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]", |
| 1515 | staid, qdf_status, qdf_status); |
| 1516 | } |
| 1517 | |
| 1518 | if (adapter->device_mode == QDF_STA_MODE) { |
| 1519 | peer_mac = pHddStaCtx->conn_info.bssId.bytes; |
| 1520 | } else if (adapter->device_mode == QDF_IBSS_MODE) { |
| 1521 | if (pHddStaCtx->broadcast_staid == staid) |
| 1522 | peer_mac = broadcastMacAddr.bytes; |
| 1523 | else |
| 1524 | peer_mac = pHddStaCtx->conn_info. |
| 1525 | peerMacAddress[staid].bytes; |
| 1526 | } |
| 1527 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1528 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, peer_mac); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1529 | if (ret) { |
| 1530 | hdd_err("Peer obj %pM delete fails", peer_mac); |
| 1531 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1532 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1533 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1534 | } |
| 1535 | |
| 1536 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1537 | * hdd_print_bss_info() - print bss info |
| 1538 | * @hdd_sta_ctx: pointer to hdd station context |
| 1539 | * |
| 1540 | * Return: None |
| 1541 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1542 | static void hdd_print_bss_info(struct hdd_station_ctx *hdd_sta_ctx) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1543 | { |
| 1544 | uint32_t *cap_info; |
| 1545 | |
| 1546 | hdd_info("WIFI DATA LOGGER"); |
| 1547 | hdd_info("channel: %d", |
| 1548 | hdd_sta_ctx->conn_info.freq); |
| 1549 | hdd_info("dot11mode: %d", |
| 1550 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1551 | hdd_info("AKM: %d", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1552 | hdd_sta_ctx->conn_info.last_auth_type); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1553 | hdd_info("ssid: %.*s", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1554 | hdd_sta_ctx->conn_info.last_ssid.SSID.length, |
| 1555 | hdd_sta_ctx->conn_info.last_ssid.SSID.ssId); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1556 | hdd_info("roam count: %d", |
| 1557 | hdd_sta_ctx->conn_info.roam_count); |
| 1558 | hdd_info("ant_info: %d", |
| 1559 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1560 | hdd_info("datarate legacy %d", |
| 1561 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1562 | hdd_info("datarate mcs: %d", |
| 1563 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1564 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1565 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1566 | hdd_info("ht caps: %x", *cap_info); |
| 1567 | } |
| 1568 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1569 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1570 | hdd_info("vht caps: %x", *cap_info); |
| 1571 | } |
| 1572 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1573 | hdd_info("hs20 info: %x", |
| 1574 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1575 | hdd_info("signal: %d", |
| 1576 | hdd_sta_ctx->conn_info.signal); |
| 1577 | hdd_info("noise: %d", |
| 1578 | hdd_sta_ctx->conn_info.noise); |
| 1579 | } |
| 1580 | |
| 1581 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1582 | * hdd_dis_connect_handler() - disconnect event handler |
| 1583 | * @pAdapter: pointer to adapter |
| 1584 | * @pRoamInfo: pointer to roam info |
| 1585 | * @roamId: roam identifier |
| 1586 | * @roamStatus: roam status |
| 1587 | * @roamResult: roam result |
| 1588 | * |
| 1589 | * This function handles disconnect event: |
| 1590 | * 1. Disable transmit queues; |
| 1591 | * 2. Clean up internal connection states and data structures; |
| 1592 | * 3. Send disconnect indication to supplicant. |
| 1593 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1594 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1595 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1596 | static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1597 | tCsrRoamInfo *pRoamInfo, |
| 1598 | uint32_t roamId, |
| 1599 | eRoamCmdStatus roamStatus, |
| 1600 | eCsrRoamResult roamResult) |
| 1601 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1602 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1603 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1604 | struct net_device *dev = pAdapter->dev; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1605 | struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1606 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1607 | uint8_t sta_id; |
| 1608 | bool sendDisconInd = true; |
| 1609 | |
| 1610 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1611 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1612 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1613 | } |
| 1614 | /* notify apps that we can't pass traffic anymore */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1615 | hdd_debug("Disabling queues"); |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1616 | wlan_hdd_netif_queue_control(pAdapter, |
| 1617 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1618 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1619 | |
| 1620 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 1621 | hdd_ipa_wlan_evt(pAdapter, pHddStaCtx->conn_info.staId[0], |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 1622 | HDD_IPA_STA_DISCONNECT, |
| 1623 | pHddStaCtx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1624 | |
| 1625 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1626 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1627 | #endif |
| 1628 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1629 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 1630 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1631 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1632 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1633 | |
| 1634 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1635 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1636 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1637 | * to cfg80211_disconnected. |
| 1638 | */ |
| 1639 | if ((eConnectionState_Disconnecting == |
| 1640 | pHddStaCtx->conn_info.connState) || |
| 1641 | (eConnectionState_NotConnected == |
| 1642 | pHddStaCtx->conn_info.connState)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1643 | 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] | 1644 | sendDisconInd = false; |
| 1645 | } |
| 1646 | |
| 1647 | if (pHddStaCtx->conn_info.connState != eConnectionState_Disconnecting) { |
| 1648 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1649 | hdd_conn_set_connection_state(pAdapter, |
| 1650 | eConnectionState_Disconnecting); |
| 1651 | } |
| 1652 | |
| 1653 | hdd_clear_roam_profile_ie(pAdapter); |
| 1654 | hdd_wmm_init(pAdapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1655 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1656 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1657 | |
| 1658 | /* indicate 'disconnect' status to wpa_supplicant... */ |
| 1659 | hdd_send_association_event(dev, pRoamInfo); |
| 1660 | /* indicate disconnected event to nl80211 */ |
| 1661 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1662 | /* |
| 1663 | * Only send indication to kernel if not initiated |
| 1664 | * by kernel |
| 1665 | */ |
| 1666 | if (sendDisconInd) { |
| 1667 | /* |
| 1668 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1669 | * to ICS UI. |
| 1670 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1671 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
| 1672 | if (pRoamInfo->reasonCode == |
| 1673 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
| 1674 | 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] | 1675 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1676 | dev, false, |
| 1677 | pRoamInfo->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1678 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1679 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1680 | dev, false, |
| 1681 | WLAN_REASON_UNSPECIFIED |
| 1682 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1683 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1684 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1685 | hdd_info("sent disconnected event to nl80211, reason code %d", |
| 1686 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
| 1687 | pRoamInfo->reasonCode : |
| 1688 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1689 | } |
| 1690 | /* |
| 1691 | * During the WLAN uninitialization,supplicant is stopped |
| 1692 | * before the driver so not sending the status of the |
| 1693 | * connection to supplicant. |
| 1694 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1695 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1696 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1697 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1698 | if (global_p2p_connection_status == |
| 1699 | P2P_CLIENT_CONNECTED_STATE_1) { |
| 1700 | global_p2p_connection_status = |
| 1701 | P2P_CLIENT_DISCONNECTED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1702 | 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] | 1703 | } else if (global_p2p_connection_status == |
| 1704 | P2P_CLIENT_COMPLETED_STATE) { |
| 1705 | global_p2p_connection_status = |
| 1706 | P2P_NOT_ACTIVE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1707 | 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] | 1708 | } |
| 1709 | } |
| 1710 | #endif |
| 1711 | |
| 1712 | } |
| 1713 | } |
| 1714 | |
| 1715 | hdd_wmm_adapter_clear(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1716 | sme_ft_reset(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1717 | if (hdd_remove_beacon_filter(pAdapter) != 0) |
| 1718 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1719 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1720 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1721 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1722 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 1723 | sta_id = pHddStaCtx->broadcast_staid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1724 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1725 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1726 | 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] | 1727 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1728 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1729 | } |
| 1730 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1731 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1732 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1733 | if (HDD_WLAN_INVALID_STA_ID == |
| 1734 | pHddStaCtx->conn_info.staId[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1735 | continue; |
| 1736 | sta_id = pHddStaCtx->conn_info.staId[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1737 | hdd_debug("Deregister StaID %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1738 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1739 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1740 | 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] | 1741 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1742 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1743 | } |
| 1744 | /* set the staid and peer mac as 0, all other |
| 1745 | * reset are done in hdd_connRemoveConnectInfo. |
| 1746 | */ |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1747 | pHddStaCtx->conn_info.staId[i] = |
| 1748 | HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1749 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1750 | sizeof(struct qdf_mac_addr)); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1751 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1752 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1753 | } |
| 1754 | } else { |
| 1755 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1756 | hdd_debug("roamResult: %d", roamResult); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1757 | |
| 1758 | /* clear scan cache for Link Lost */ |
Sandeep Puligilla | f0b3058 | 2017-01-12 08:39:41 -0800 | [diff] [blame] | 1759 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult || |
| 1760 | eCSR_ROAM_RESULT_DISASSOC_IND == roamResult || |
yeshwanth sriram guntuka | 951725a | 2017-03-15 19:33:04 +0530 | [diff] [blame] | 1761 | eCSR_ROAM_LOSTLINK == roamStatus) { |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1762 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 1763 | pHddStaCtx->conn_info.bssId.bytes); |
| 1764 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1765 | pHddStaCtx->conn_info.bssId.bytes); |
| 1766 | } |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1767 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1768 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1769 | /* Clear saved connection information in HDD */ |
| 1770 | hdd_conn_remove_connect_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1771 | hdd_conn_set_connection_state(pAdapter, eConnectionState_NotConnected); |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 1772 | pmo_ucfg_flush_gtk_offload_req(pAdapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1773 | |
| 1774 | #ifdef FEATURE_WLAN_TDLS |
| 1775 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1776 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1777 | #endif |
| 1778 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1779 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 1780 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1781 | sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX |
| 1782 | (pAdapter), |
| 1783 | pAdapter->sessionId); |
| 1784 | } |
Mahesh A Saptasagar | 6dda202 | 2016-09-03 12:59:09 +0530 | [diff] [blame] | 1785 | wlan_hdd_clear_link_layer_stats(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1786 | /* Unblock anyone waiting for disconnect to complete */ |
| 1787 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1788 | hdd_print_bss_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1789 | return status; |
| 1790 | } |
| 1791 | |
| 1792 | /** |
| 1793 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1794 | * @vdev_id: vdevid |
| 1795 | * |
| 1796 | * Return: None |
| 1797 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1798 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1799 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1800 | struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1801 | hdd_adapter_t *adapter = NULL; |
| 1802 | |
| 1803 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1804 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1805 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1806 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1807 | } |
| 1808 | complete(&adapter->sta_authorized_event); |
| 1809 | } |
| 1810 | |
| 1811 | /** |
| 1812 | * hdd_change_peer_state() - change peer state |
| 1813 | * @pAdapter: HDD adapter |
| 1814 | * @sta_state: peer state |
| 1815 | * @roam_synch_in_progress: roam synch in progress |
| 1816 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1817 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1818 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1819 | QDF_STATUS hdd_change_peer_state(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1820 | uint8_t sta_id, |
| 1821 | enum ol_txrx_peer_state sta_state, |
| 1822 | bool roam_synch_in_progress) |
| 1823 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1824 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1825 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1826 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1827 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1828 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1829 | |
| 1830 | if (!pdev) { |
| 1831 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1832 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1833 | } |
| 1834 | |
| 1835 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1836 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1837 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1838 | } |
| 1839 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1840 | peer = cdp_peer_find_by_local_id(soc, |
| 1841 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1842 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1843 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1844 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1845 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1846 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1847 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1848 | return QDF_STATUS_E_FAULT; |
| 1849 | } |
| 1850 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1851 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1852 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1853 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1854 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1855 | } |
| 1856 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1857 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1858 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1859 | #endif |
| 1860 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1861 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1862 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1863 | /* make sure event is reset */ |
| 1864 | INIT_COMPLETION(pAdapter->sta_authorized_event); |
| 1865 | #endif |
| 1866 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1867 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1868 | hdd_set_peer_authorized_event, |
| 1869 | pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1870 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1871 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1872 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1873 | } |
| 1874 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1875 | if (pAdapter->device_mode == QDF_STA_MODE || |
| 1876 | pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1877 | #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] | 1878 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1879 | unsigned long rc; |
| 1880 | |
| 1881 | /* wait for event from firmware to set the event */ |
| 1882 | rc = wait_for_completion_timeout( |
| 1883 | &pAdapter->sta_authorized_event, |
| 1884 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1885 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1886 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1887 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1888 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 1889 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1890 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1891 | #endif |
| 1892 | } |
| 1893 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1894 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1895 | } |
| 1896 | |
| 1897 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1898 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 1899 | * @cbk_data: callback data |
| 1900 | * @sta_id: station id |
| 1901 | * @vdev_param: vdev parameter |
| 1902 | * @is_link_up: link state up or down |
| 1903 | * |
| 1904 | * Return: QDF status |
| 1905 | */ |
| 1906 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 1907 | uint8_t sta_id, |
| 1908 | uint32_t vdev_param, |
| 1909 | bool is_link_up) |
| 1910 | { |
| 1911 | struct cdp_vdev *data_vdev; |
| 1912 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1913 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1914 | struct hdd_context *hdd_ctx; |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1915 | struct wlan_objmgr_psoc **psoc; |
| 1916 | |
| 1917 | if (!cbk_data) |
| 1918 | return status; |
| 1919 | |
| 1920 | psoc = cbk_data; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 1921 | hdd_ctx = container_of(psoc, struct hdd_context, hdd_psoc); |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1922 | |
| 1923 | if (!hdd_ctx->tdls_nap_active) |
| 1924 | return status; |
| 1925 | |
| 1926 | data_vdev = cdp_peer_get_vdev_by_sta_id(soc, sta_id); |
| 1927 | if (NULL == data_vdev) { |
| 1928 | status = QDF_STATUS_E_FAILURE; |
| 1929 | return status; |
| 1930 | } |
| 1931 | |
| 1932 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 1933 | |
| 1934 | return status; |
| 1935 | } |
| 1936 | |
| 1937 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1938 | * hdd_roam_register_sta() - register station |
| 1939 | * @pAdapter: pointer to adapter |
| 1940 | * @pRoamInfo: pointer to roam info |
| 1941 | * @staId: station identifier |
| 1942 | * @pPeerMacAddress: peer MAC address |
| 1943 | * @pBssDesc: pointer to BSS description |
| 1944 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1945 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1946 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 1947 | QDF_STATUS hdd_roam_register_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1948 | tCsrRoamInfo *pRoamInfo, |
| 1949 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1950 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1951 | tSirBssDescription *pBssDesc) |
| 1952 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1953 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1954 | struct ol_txrx_desc_type staDesc = { 0 }; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 1955 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 1956 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1957 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1958 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1959 | |
| 1960 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1961 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1962 | |
| 1963 | /* Get the Station ID from the one saved during the association */ |
| 1964 | staDesc.sta_id = staId; |
| 1965 | |
| 1966 | /* set the QoS field appropriately */ |
| 1967 | if (hdd_wmm_is_active(pAdapter)) |
| 1968 | staDesc.is_qos_enabled = 1; |
| 1969 | else |
| 1970 | staDesc.is_qos_enabled = 0; |
| 1971 | |
| 1972 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 1973 | hdd_debug("WAPI STA Registered: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1974 | pAdapter->wapi_info.fIsWapiSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1975 | if (pAdapter->wapi_info.fIsWapiSta) |
| 1976 | staDesc.is_wapi_supported = 1; |
| 1977 | else |
| 1978 | staDesc.is_wapi_supported = 0; |
| 1979 | #endif /* FEATURE_WLAN_WAPI */ |
| 1980 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1981 | /* Register the vdev transmit and receive functions */ |
| 1982 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 1983 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1984 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1985 | pAdapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
| 1986 | (struct cdp_pdev *)pdev, |
| 1987 | pAdapter->sessionId); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1988 | if (!pAdapter->txrx_vdev) { |
| 1989 | hdd_err("%s find vdev fail", __func__); |
| 1990 | return QDF_STATUS_E_FAILURE; |
| 1991 | } |
| 1992 | |
| 1993 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1994 | cdp_vdev_register(soc, |
| 1995 | (struct cdp_vdev *)pAdapter->txrx_vdev, pAdapter, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1996 | if (!txrx_ops.tx.tx) { |
| 1997 | hdd_err("%s vdev register fail", __func__); |
| 1998 | return QDF_STATUS_E_FAILURE; |
| 1999 | } |
| 2000 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 2001 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 2002 | qdf_status = cdp_peer_register(soc, |
| 2003 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2004 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2005 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2006 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2007 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2008 | } |
| 2009 | |
| 2010 | if (!pRoamInfo->fAuthRequired) { |
| 2011 | /* |
| 2012 | * Connections that do not need Upper layer auth, transition |
| 2013 | * TLSHIM directly to 'Authenticated' state |
| 2014 | */ |
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_AUTH, |
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 | |
| 2025 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2026 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2027 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2028 | 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] | 2029 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2030 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2031 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2032 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2033 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2034 | pRoamInfo->roamSynchInProgress |
| 2035 | #else |
| 2036 | false |
| 2037 | #endif |
| 2038 | ); |
| 2039 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2040 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2041 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2042 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2043 | } |
| 2044 | |
| 2045 | /** |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2046 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 2047 | * @dev: network device |
| 2048 | * @bss: cfg80211 roamed bss pointer |
| 2049 | * @req_ie: IEs used in reassociation request |
| 2050 | * @req_ie_len: Length of the @req_ie |
| 2051 | * @resp_ie: IEs received in successful reassociation response |
| 2052 | * @resp_ie_len: Length of @resp_ie |
| 2053 | * |
| 2054 | * Return: none |
| 2055 | */ |
| 2056 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 2057 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 2058 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 2059 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 2060 | size_t req_ie_len, const uint8_t *resp_ie, |
| 2061 | size_t resp_ie_len) |
| 2062 | { |
| 2063 | struct cfg80211_roam_info info = {0}; |
| 2064 | |
| 2065 | info.bss = bss; |
| 2066 | info.req_ie = req_ie; |
| 2067 | info.req_ie_len = req_ie_len; |
| 2068 | info.resp_ie = resp_ie; |
| 2069 | info.resp_ie_len = resp_ie_len; |
| 2070 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 2071 | } |
| 2072 | #else |
| 2073 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 2074 | struct cfg80211_bss *bss, |
| 2075 | const uint8_t *req_ie, size_t req_ie_len, |
| 2076 | const uint8_t *resp_ie, |
| 2077 | size_t resp_ie_len) |
| 2078 | { |
| 2079 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 2080 | GFP_KERNEL); |
| 2081 | } |
| 2082 | #endif |
| 2083 | |
| 2084 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2085 | * hdd_send_re_assoc_event() - send reassoc event |
| 2086 | * @dev: pointer to net device |
| 2087 | * @pAdapter: pointer to adapter |
| 2088 | * @pCsrRoamInfo: pointer to roam info |
| 2089 | * @reqRsnIe: pointer to RSN Information element |
| 2090 | * @reqRsnLength: length of RSN IE |
| 2091 | * |
| 2092 | * Return: none |
| 2093 | */ |
| 2094 | static void hdd_send_re_assoc_event(struct net_device *dev, |
| 2095 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo, |
| 2096 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2097 | { |
| 2098 | unsigned int len = 0; |
| 2099 | u8 *pFTAssocRsp = NULL; |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2100 | uint8_t *rspRsnIe = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
| 2101 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2102 | uint32_t rspRsnLength = 0; |
| 2103 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2104 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 2105 | uint8_t *buf_ptr, ssid_ie_len; |
| 2106 | struct cfg80211_bss *bss = NULL; |
| 2107 | uint8_t *final_req_ie = NULL; |
| 2108 | tCsrRoamConnectedProfile roam_profile; |
| 2109 | tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2110 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2111 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2112 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2113 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2114 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2115 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2116 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2117 | } |
| 2118 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2119 | if (!assoc_req_ies) { |
| 2120 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2121 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2122 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2123 | if (pCsrRoamInfo == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2124 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2125 | goto done; |
| 2126 | } |
| 2127 | |
| 2128 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2129 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2130 | goto done; |
| 2131 | } |
| 2132 | |
| 2133 | pFTAssocRsp = |
| 2134 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2135 | pCsrRoamInfo->nAssocReqLength); |
| 2136 | if (pFTAssocRsp == NULL) |
| 2137 | goto done; |
| 2138 | |
| 2139 | /* pFTAssocRsp needs to point to the IEs */ |
| 2140 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2141 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2142 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2143 | |
| 2144 | /* |
| 2145 | * Active session count is decremented upon disconnection, but during |
| 2146 | * roaming, there is no disconnect indication and hence active session |
| 2147 | * count is not decremented. |
| 2148 | * After roaming is completed, active session count is incremented |
| 2149 | * as a part of connect indication but effectively after roaming the |
| 2150 | * active session count should still be the same and hence upon |
| 2151 | * successful reassoc decrement the active session count here. |
| 2152 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2153 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2154 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
| 2155 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2156 | |
| 2157 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 2158 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2159 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2160 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2161 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2162 | |
| 2163 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2164 | (int)pCsrRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2165 | sme_roam_get_connect_profile(hal_handle, pAdapter->sessionId, |
| 2166 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2167 | |
| 2168 | bss = hdd_cfg80211_get_bss(pAdapter->wdev.wiphy, |
| 2169 | chan, pCsrRoamInfo->bssid.bytes, |
| 2170 | &roam_profile.SSID.ssId[0], |
| 2171 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2172 | |
| 2173 | if (bss == NULL) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2174 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2175 | buf_ptr = buf_ssid_ie; |
| 2176 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2177 | buf_ptr++; |
| 2178 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2179 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2180 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2181 | roam_profile.SSID.length); |
| 2182 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2183 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2184 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2185 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2186 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2187 | if (final_req_ie == NULL) { |
| 2188 | if (bss) |
| 2189 | cfg80211_put_bss(pAdapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2190 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2191 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2192 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2193 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2194 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2195 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2196 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2197 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2198 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2199 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2200 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2201 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2202 | hdd_send_roamed_ind(dev, bss, final_req_ie, |
| 2203 | (ssid_ie_len + reqRsnLength), rspRsnIe, |
| 2204 | rspRsnLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2205 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2206 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2207 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2208 | pCsrRoamInfo->nAssocReqLength); |
| 2209 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2210 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2211 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2212 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2213 | |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2214 | wlan_hdd_send_roam_auth_event(pAdapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2215 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2216 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2217 | pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2218 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2219 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2220 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2221 | qdf_mem_free(final_req_ie); |
| 2222 | qdf_mem_free(rspRsnIe); |
| 2223 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2224 | } |
| 2225 | |
| 2226 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2227 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2228 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2229 | * |
| 2230 | * Return: roam sync status if roaming offloaded else false |
| 2231 | */ |
| 2232 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2233 | bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2234 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2235 | if (roaminfo) |
| 2236 | return roaminfo->roamSynchInProgress; |
| 2237 | else |
| 2238 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2239 | } |
| 2240 | #endif |
| 2241 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2242 | /** |
| 2243 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2244 | * @hddstactx: pointer to HDD sta context |
| 2245 | * @roaminfo: pointer to roaminfo structure |
| 2246 | * |
| 2247 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2248 | * MAC address return self staid(0) else find the peer sta id of |
| 2249 | * the peer. |
| 2250 | * |
| 2251 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2252 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2253 | static uint8_t hdd_get_ibss_peer_staid(struct hdd_station_ctx *hddstactx, |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2254 | tCsrRoamInfo *roaminfo) |
| 2255 | { |
| 2256 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2257 | QDF_STATUS status; |
| 2258 | |
| 2259 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2260 | staid = 0; |
| 2261 | } else { |
| 2262 | status = hdd_get_peer_sta_id(hddstactx, |
| 2263 | &roaminfo->peerMac, &staid); |
| 2264 | if (status != QDF_STATUS_SUCCESS) { |
| 2265 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2266 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2267 | } |
| 2268 | } |
| 2269 | |
| 2270 | return staid; |
| 2271 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2272 | |
| 2273 | /** |
| 2274 | * hdd_change_sta_state_authenticated()- |
| 2275 | * This function changes STA state to authenticated |
| 2276 | * @adapter: pointer to the adapter structure. |
| 2277 | * @roaminfo: pointer to the RoamInfo structure. |
| 2278 | * |
| 2279 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2280 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2281 | * |
| 2282 | * Return: 0 on success and errno on failure |
| 2283 | */ |
| 2284 | static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter, |
| 2285 | tCsrRoamInfo *roaminfo) |
| 2286 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2287 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2288 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2289 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2290 | struct hdd_station_ctx *hddstactx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2291 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2292 | |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2293 | timeout = hddstactx->hdd_ReassocScenario ? |
| 2294 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2295 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2296 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2297 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2298 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2299 | else |
| 2300 | staid = hddstactx->conn_info.staId[0]; |
| 2301 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2302 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2303 | |
| 2304 | /* Connections that do not need Upper layer authentication, |
| 2305 | * transition TL to 'Authenticated' state after the keys are set |
| 2306 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2307 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2308 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2309 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2310 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2311 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2312 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2313 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2314 | sme_ps_enable_auto_ps_timer( |
| 2315 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 2316 | adapter->sessionId, |
Dustin Brown | 84411b0 | 2017-07-21 16:44:44 -0700 | [diff] [blame] | 2317 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2318 | } |
| 2319 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2320 | return qdf_status_to_os_return(status); |
| 2321 | } |
| 2322 | |
| 2323 | /** |
| 2324 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2325 | * if key installation is required |
| 2326 | * @encr_type: encryption type |
| 2327 | * |
| 2328 | * Return: true if key installation is required and false otherwise. |
| 2329 | */ |
| 2330 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2331 | eCsrEncryptionType encr_type) |
| 2332 | { |
| 2333 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2334 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2335 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2336 | eCSR_ENCRYPT_TYPE_AES_GCMP == encr_type || |
| 2337 | eCSR_ENCRYPT_TYPE_AES_GCMP_256 == encr_type || |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2338 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2339 | return true; |
| 2340 | else |
| 2341 | return false; |
| 2342 | } |
| 2343 | |
| 2344 | /** |
| 2345 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2346 | * complete |
| 2347 | * @adapter: pointer to HDD adapter |
| 2348 | * @roaminfo: pointer to roam info |
| 2349 | * @roam_result: roam result |
| 2350 | * |
| 2351 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2352 | * This function checks for the successful set key completion and update |
| 2353 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2354 | * |
| 2355 | * Return: None |
| 2356 | */ |
| 2357 | static void hdd_change_peer_state_after_set_key(hdd_adapter_t *adapter, |
| 2358 | tCsrRoamInfo *roaminfo, eCsrRoamResult roam_result) |
| 2359 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2360 | struct hdd_station_ctx *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2361 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2362 | |
| 2363 | /* |
| 2364 | * If the security mode is one of the following, IBSS peer will be |
| 2365 | * waiting in CONN state and we will move the peer state to AUTH |
| 2366 | * here. For non-secure connection, no need to wait for set-key complete |
| 2367 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2368 | */ |
| 2369 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2370 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2371 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2372 | |
| 2373 | return; |
| 2374 | } |
| 2375 | |
| 2376 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2377 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2378 | /* |
| 2379 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2380 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2381 | * after roaming. STA TL state moves to authenticated only if |
| 2382 | * ptk_installed is true. So, make ptk_installed to true in |
| 2383 | * case of 11R roaming. |
| 2384 | */ |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2385 | if (sme_neighbor_roam_is11r_assoc(WLAN_HDD_GET_HAL_CTX(adapter), |
| 2386 | adapter->sessionId)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2387 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2388 | } else { |
| 2389 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2390 | } |
| 2391 | |
| 2392 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2393 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2394 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2395 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2396 | * set the unicast and broadcast key. |
| 2397 | */ |
| 2398 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2399 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2400 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2401 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2402 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2403 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2404 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2405 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2406 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2407 | } |
| 2408 | |
| 2409 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2410 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2411 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2412 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2413 | } |
| 2414 | |
| 2415 | hdd_sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2416 | |
| 2417 | return; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2418 | } |
| 2419 | |
| 2420 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2421 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
| 2422 | * @pAdapter: pointer to adapter |
| 2423 | * @pRoamInfo: pointer to roam info |
| 2424 | * @roamId: roam id |
| 2425 | * @roamStatus: roam status |
| 2426 | * @roamResult: roam result |
| 2427 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2428 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2429 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2430 | 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] | 2431 | tCsrRoamInfo *pRoamInfo, |
| 2432 | uint32_t roamId, |
| 2433 | eRoamCmdStatus roamStatus, |
| 2434 | eCsrRoamResult roamResult) |
| 2435 | { |
| 2436 | eCsrEncryptionType connectedCipherAlgo; |
| 2437 | bool fConnected = false; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2438 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2439 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | ENTER(); |
| 2441 | |
| 2442 | if (NULL == pRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2443 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2444 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2445 | } |
| 2446 | /* |
| 2447 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2448 | * then go to 'authenticated'. For all other authentication types |
| 2449 | * (those that do not require upper layer authentication) we can put TL |
| 2450 | * directly into 'authenticated' state. |
| 2451 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2452 | hdd_info("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2453 | MAC_ADDRESS_STR, roamStatus, roamResult, |
| 2454 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 2455 | |
| 2456 | fConnected = hdd_conn_get_connected_cipher_algo(pHddStaCtx, |
| 2457 | &connectedCipherAlgo); |
| 2458 | if (fConnected) { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2459 | hdd_change_peer_state_after_set_key(pAdapter, pRoamInfo, |
| 2460 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2461 | } else { |
| 2462 | /* |
| 2463 | * possible disassoc after issuing set key and waiting |
| 2464 | * set key complete. |
| 2465 | */ |
| 2466 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2467 | } |
| 2468 | |
| 2469 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2470 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2471 | } |
| 2472 | |
| 2473 | /** |
| 2474 | * hdd_perform_roam_set_key_complete() - perform set key complete |
| 2475 | * @pAdapter: pointer to adapter |
| 2476 | * |
| 2477 | * Return: none |
| 2478 | */ |
| 2479 | void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter) |
| 2480 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2481 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2482 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2483 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2484 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2485 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2486 | qdf_mem_copy(roamInfo.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2487 | pHddStaCtx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2488 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2489 | pHddStaCtx->roam_info.peerMac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2490 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2491 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2492 | hdd_roam_set_key_complete_handler(pAdapter, |
| 2493 | &roamInfo, |
| 2494 | pHddStaCtx->roam_info.roamId, |
| 2495 | pHddStaCtx->roam_info.roamStatus, |
| 2496 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2497 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2498 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2499 | |
| 2500 | pHddStaCtx->roam_info.deferKeyComplete = false; |
| 2501 | } |
| 2502 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 2503 | #if defined(WLAN_FEATURE_FILS_SK) && defined(CFG80211_FILS_SK_OFFLOAD_SUPPORT) |
| 2504 | void hdd_clear_fils_connection_info(hdd_adapter_t *adapter) |
| 2505 | { |
| 2506 | hdd_wext_state_t *wext_state; |
| 2507 | |
| 2508 | if ((adapter->device_mode == QDF_SAP_MODE) || |
| 2509 | (adapter->device_mode == QDF_P2P_GO_MODE)) |
| 2510 | return; |
| 2511 | |
| 2512 | wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 2513 | if (wext_state->roamProfile.fils_con_info) { |
| 2514 | qdf_mem_free(wext_state->roamProfile.fils_con_info); |
| 2515 | wext_state->roamProfile.fils_con_info = NULL; |
| 2516 | } |
| 2517 | } |
| 2518 | #endif |
| 2519 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2520 | /** |
| 2521 | * hdd_association_completion_handler() - association completion handler |
| 2522 | * @pAdapter: pointer to adapter |
| 2523 | * @pRoamInfo: pointer to roam info |
| 2524 | * @roamId: roam id |
| 2525 | * @roamStatus: roam status |
| 2526 | * @roamResult: roam result |
| 2527 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2528 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2529 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2530 | static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2531 | tCsrRoamInfo *pRoamInfo, |
| 2532 | uint32_t roamId, |
| 2533 | eRoamCmdStatus roamStatus, |
| 2534 | eCsrRoamResult roamResult) |
| 2535 | { |
| 2536 | struct net_device *dev = pAdapter->dev; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 2537 | struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 2538 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2539 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2540 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2541 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2542 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2543 | bool hddDisconInProgress = false; |
| 2544 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2545 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2546 | bool ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2547 | |
| 2548 | if (!pHddCtx) { |
| 2549 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2550 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2551 | } |
| 2552 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2553 | /* validate config */ |
| 2554 | if (!pHddCtx->config) { |
| 2555 | hdd_err("config is NULL"); |
| 2556 | return QDF_STATUS_E_NULL_VALUE; |
| 2557 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2558 | /* HDD has initiated disconnect, do not send connect result indication |
| 2559 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2560 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2561 | if (((eConnectionState_Disconnecting == |
| 2562 | pHddStaCtx->conn_info.connState) || |
| 2563 | (eConnectionState_NotConnected == |
| 2564 | pHddStaCtx->conn_info.connState)) && |
| 2565 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2566 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2567 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
| 2568 | pHddStaCtx->conn_info.connState, |
| 2569 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2570 | hddDisconInProgress = true; |
| 2571 | } |
| 2572 | |
| 2573 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
| 2574 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2575 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2576 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2577 | } |
| 2578 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2579 | hdd_conn_set_connection_state(pAdapter, |
| 2580 | eConnectionState_Associated); |
| 2581 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2582 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2583 | /* Save the connection info from CSR... */ |
| 2584 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, |
| 2585 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2586 | |
| 2587 | if (hdd_add_beacon_filter(pAdapter) != 0) |
| 2588 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2589 | #ifdef FEATURE_WLAN_WAPI |
| 2590 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2591 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
| 2592 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2593 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
| 2594 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2595 | } else { |
| 2596 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2597 | } |
| 2598 | #endif /* FEATURE_WLAN_WAPI */ |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2599 | hdd_debug("bss_descr[%d] devicemode[%d]", !!pRoamInfo->pBssDesc, |
| 2600 | pAdapter->device_mode); |
| 2601 | if ((QDF_STA_MODE == pAdapter->device_mode) && |
| 2602 | pRoamInfo->pBssDesc) { |
| 2603 | ie_len = GET_IE_LEN_IN_BSS(pRoamInfo->pBssDesc->length); |
| 2604 | pHddStaCtx->ap_supports_immediate_power_save = |
| 2605 | wlan_hdd_is_ap_supports_immediate_power_save( |
| 2606 | (uint8_t *) pRoamInfo->pBssDesc->ieFields, |
| 2607 | ie_len); |
| 2608 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
| 2609 | pHddStaCtx->ap_supports_immediate_power_save); |
| 2610 | } |
| 2611 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2612 | /* Indicate 'connect' status to user space */ |
| 2613 | hdd_send_association_event(dev, pRoamInfo); |
| 2614 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2615 | if (policy_mgr_is_mcc_in_24G(pHddCtx->hdd_psoc)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2616 | if (pHddCtx->miracast_value) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2617 | wlan_hdd_set_mas(pAdapter, |
| 2618 | pHddCtx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2619 | } |
| 2620 | |
| 2621 | /* Initialize the Linkup event completion variable */ |
| 2622 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2623 | |
| 2624 | /* |
| 2625 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2626 | * the device properly. Before allowing any packet to go up to |
| 2627 | * the application, device activation has to be ensured for |
| 2628 | * proper queue mapping by the kernel. we have registered net |
| 2629 | * device notifier for device change notification. With this we |
| 2630 | * will come to know that the device is getting |
| 2631 | * activated properly. |
| 2632 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2633 | if (pHddStaCtx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2634 | /* |
| 2635 | * Enable Linkup Event Servicing which allows the net |
| 2636 | * device notifier to set the linkup event variable. |
| 2637 | */ |
| 2638 | pAdapter->isLinkUpSvcNeeded = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2639 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2640 | /* Switch on the Carrier to activate the device */ |
| 2641 | wlan_hdd_netif_queue_control(pAdapter, |
| 2642 | WLAN_NETIF_CARRIER_ON, |
| 2643 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2644 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2645 | /* |
| 2646 | * Wait for the Link to up to ensure all the queues |
| 2647 | * are set properly by the kernel. |
| 2648 | */ |
| 2649 | rc = wait_for_completion_timeout( |
| 2650 | &pAdapter->linkup_event_var, |
| 2651 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2652 | ); |
| 2653 | if (!rc) |
| 2654 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2655 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2656 | /* |
| 2657 | * Disable Linkup Event Servicing - no more service |
| 2658 | * required from the net device notifier call. |
| 2659 | */ |
| 2660 | pAdapter->isLinkUpSvcNeeded = false; |
| 2661 | } else { |
| 2662 | pHddStaCtx->ft_carrier_on = false; |
| 2663 | ft_carrier_on = true; |
| 2664 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2665 | if ((WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId) |
| 2666 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2667 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2668 | hdd_err("Wrong Staid: %d", pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2669 | |
| 2670 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2671 | |
| 2672 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 2673 | hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2674 | HDD_IPA_STA_CONNECT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2675 | pRoamInfo->bssid.bytes); |
| 2676 | |
| 2677 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2678 | wlan_hdd_auto_shutdown_enable(pHddCtx, false); |
| 2679 | #endif |
| 2680 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2681 | hdd_debug("check if STA chan ok for DNBS"); |
| 2682 | if (policy_mgr_is_chan_ok_for_dnbs(pHddCtx->hdd_psoc, |
| 2683 | pHddStaCtx->conn_info.operationChannel, |
| 2684 | &ok)) { |
| 2685 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
| 2686 | pHddStaCtx->conn_info.operationChannel); |
| 2687 | return QDF_STATUS_E_FAILURE; |
| 2688 | } |
| 2689 | |
| 2690 | if (!ok) { |
| 2691 | hdd_err("Chan:%d not suitable for DNBS", |
| 2692 | pHddStaCtx->conn_info.operationChannel); |
| 2693 | wlan_hdd_netif_queue_control(pAdapter, |
| 2694 | WLAN_NETIF_CARRIER_OFF, |
| 2695 | WLAN_CONTROL_PATH); |
| 2696 | if (!hddDisconInProgress) { |
| 2697 | hdd_err("Disconnecting..."); |
| 2698 | sme_roam_disconnect( |
| 2699 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2700 | pAdapter->sessionId, |
| 2701 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2702 | } |
| 2703 | return QDF_STATUS_E_FAILURE; |
| 2704 | } |
| 2705 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2706 | hdd_debug("check for SAP restart"); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2707 | policy_mgr_check_concurrent_intf_and_restart_sap( |
| 2708 | pHddCtx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2709 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2710 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 2711 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2712 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2713 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2714 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2715 | /* |
| 2716 | * For reassoc, the station is already registered, all we need |
| 2717 | * is to change the state of the STA in TL. |
| 2718 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2719 | * CONNECTED instead of AUTHENTICATED. |
| 2720 | */ |
| 2721 | if (!pRoamInfo->fReassocReq) { |
| 2722 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2723 | u8 *pFTAssocRsp = NULL; |
| 2724 | unsigned int assocRsplen = 0; |
| 2725 | u8 *pFTAssocReq = NULL; |
| 2726 | unsigned int assocReqlen = 0; |
| 2727 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2728 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2729 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2730 | |
| 2731 | /* add bss_id to cfg80211 data base */ |
| 2732 | bss = |
| 2733 | wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 2734 | pRoamInfo); |
| 2735 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2736 | hdd_err("wlan: Not able to create BSS entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2737 | wlan_hdd_netif_queue_control(pAdapter, |
| 2738 | WLAN_NETIF_CARRIER_OFF, |
| 2739 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2740 | if (!hddDisconInProgress) { |
| 2741 | /* |
| 2742 | * Here driver was not able to add bss |
| 2743 | * in cfg80211 database this can happen |
| 2744 | * if connected channel is not valid, |
| 2745 | * i.e reg domain was changed during |
| 2746 | * connection. Queue disconnect for the |
| 2747 | * session if disconnect is not in |
| 2748 | * progress. |
| 2749 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2750 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2751 | sme_roam_disconnect( |
| 2752 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2753 | pAdapter->sessionId, |
| 2754 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2755 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2756 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2757 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2758 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2759 | eCSR_AUTH_TYPE_FT_RSN |
| 2760 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2761 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
| 2762 | |
| 2763 | /* Association Response */ |
| 2764 | pFTAssocRsp = |
| 2765 | (u8 *) (pRoamInfo->pbFrames + |
| 2766 | pRoamInfo->nBeaconLength + |
| 2767 | pRoamInfo->nAssocReqLength); |
| 2768 | if (pFTAssocRsp != NULL) { |
| 2769 | /* |
| 2770 | * pFTAssocRsp needs to point to the IEs |
| 2771 | */ |
| 2772 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2773 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2774 | (unsigned int)pFTAssocRsp[0], |
| 2775 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2776 | assocRsplen = |
| 2777 | pRoamInfo->nAssocRspLength - |
| 2778 | FT_ASSOC_RSP_IES_OFFSET; |
| 2779 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2780 | hdd_debug("AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2781 | assocRsplen = 0; |
| 2782 | } |
| 2783 | |
| 2784 | /* Association Request */ |
| 2785 | pFTAssocReq = (u8 *) (pRoamInfo->pbFrames + |
| 2786 | pRoamInfo->nBeaconLength); |
| 2787 | if (pFTAssocReq != NULL) { |
| 2788 | if (!ft_carrier_on) { |
| 2789 | /* |
| 2790 | * pFTAssocReq needs to point to |
| 2791 | * the IEs |
| 2792 | */ |
| 2793 | pFTAssocReq += |
| 2794 | FT_ASSOC_REQ_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2795 | hdd_debug("pFTAssocReq is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2796 | (unsigned int) |
| 2797 | pFTAssocReq[0], |
| 2798 | (unsigned int) |
| 2799 | pFTAssocReq[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2800 | assocReqlen = |
| 2801 | pRoamInfo->nAssocReqLength - |
| 2802 | FT_ASSOC_REQ_IES_OFFSET; |
| 2803 | } else { |
| 2804 | /* |
| 2805 | * This should contain only the |
| 2806 | * FTIEs |
| 2807 | */ |
| 2808 | assocReqlen = |
| 2809 | pRoamInfo->nAssocReqLength; |
| 2810 | } |
| 2811 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2812 | hdd_debug("AssocReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2813 | assocReqlen = 0; |
| 2814 | } |
| 2815 | |
| 2816 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 2817 | if (!hddDisconInProgress && |
| 2818 | pRoamInfo->pBssDesc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2819 | struct cfg80211_bss *roam_bss; |
| 2820 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2821 | /* |
| 2822 | * After roaming is completed, |
| 2823 | * active session count is |
| 2824 | * incremented as a part of |
| 2825 | * connect indication but |
| 2826 | * effectively the active |
| 2827 | * session count should still |
| 2828 | * be the same and hence upon |
| 2829 | * successful reassoc |
| 2830 | * decrement the active session |
| 2831 | * count here. |
| 2832 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2833 | if (!hdd_is_roam_sync_in_progress |
| 2834 | (pRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2835 | policy_mgr_decr_session_set_pcl( |
| 2836 | pHddCtx->hdd_psoc, |
| 2837 | pAdapter->device_mode, |
| 2838 | pAdapter->sessionId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2839 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2840 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2841 | chan = |
| 2842 | ieee80211_get_channel |
| 2843 | (pAdapter->wdev.wiphy, |
| 2844 | (int)pRoamInfo->pBssDesc-> |
| 2845 | channelId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2846 | hdd_debug( |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2847 | "assocReqlen %d assocRsplen %d", |
| 2848 | assocReqlen, |
| 2849 | assocRsplen); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2850 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2851 | hdd_debug( |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2852 | "Reassoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2853 | QDF_TRACE_HEX_DUMP( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2854 | QDF_MODULE_ID_HDD, |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2855 | QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2856 | pFTAssocReq, |
| 2857 | assocReqlen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2858 | roam_bss = |
| 2859 | hdd_cfg80211_get_bss( |
| 2860 | pAdapter->wdev.wiphy, |
| 2861 | chan, |
| 2862 | pRoamInfo->bssid.bytes, |
| 2863 | pRoamInfo->u. |
| 2864 | pConnectedProfile->SSID.ssId, |
| 2865 | pRoamInfo->u. |
| 2866 | pConnectedProfile->SSID.length); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2867 | hdd_send_roamed_ind( |
| 2868 | dev, |
| 2869 | roam_bss, |
| 2870 | pFTAssocReq, |
| 2871 | assocReqlen, |
| 2872 | pFTAssocRsp, |
| 2873 | assocRsplen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2874 | wlan_hdd_send_roam_auth_event( |
| 2875 | pAdapter, |
| 2876 | pRoamInfo->bssid.bytes, |
| 2877 | pFTAssocReq, |
| 2878 | assocReqlen, |
| 2879 | pFTAssocRsp, |
| 2880 | assocRsplen, |
| 2881 | pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2882 | } |
| 2883 | if (sme_get_ftptk_state |
| 2884 | (WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2885 | pAdapter->sessionId)) { |
| 2886 | sme_set_ftptk_state |
| 2887 | (WLAN_HDD_GET_HAL_CTX |
| 2888 | (pAdapter), |
| 2889 | pAdapter->sessionId, |
| 2890 | false); |
| 2891 | pRoamInfo->fAuthRequired = |
| 2892 | false; |
| 2893 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2894 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2895 | roam_info.bssid, |
| 2896 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2897 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2898 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2899 | roam_info.peerMac, |
| 2900 | pRoamInfo->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2901 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2902 | pHddStaCtx->roam_info.roamId = |
| 2903 | roamId; |
| 2904 | pHddStaCtx->roam_info. |
| 2905 | roamStatus = roamStatus; |
| 2906 | pHddStaCtx->roam_info. |
| 2907 | deferKeyComplete = true; |
| 2908 | } |
| 2909 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2910 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2911 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2912 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2913 | pRoamInfo-> |
| 2914 | bssid.bytes, |
| 2915 | pRoamInfo, |
| 2916 | pFTAssocReq, |
| 2917 | assocReqlen, |
| 2918 | pFTAssocRsp, |
| 2919 | assocRsplen, |
| 2920 | WLAN_STATUS_SUCCESS, |
| 2921 | GFP_KERNEL, |
| 2922 | false, |
| 2923 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2924 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2925 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2926 | /* |
| 2927 | * wpa supplicant expecting WPA/RSN IE in |
| 2928 | * connect result. |
| 2929 | */ |
| 2930 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
| 2931 | (pAdapter), |
| 2932 | pAdapter->sessionId, |
| 2933 | &reqRsnLength, |
| 2934 | reqRsnIe); |
| 2935 | |
| 2936 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
| 2937 | (pAdapter), |
| 2938 | pAdapter->sessionId, |
| 2939 | &rspRsnLength, |
| 2940 | rspRsnIe); |
| 2941 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2942 | if (ft_carrier_on) |
| 2943 | hdd_send_re_assoc_event(dev, |
| 2944 | pAdapter, |
| 2945 | pRoamInfo, |
| 2946 | reqRsnIe, |
| 2947 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2948 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2949 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2950 | MAC_ADDRESS_STR |
| 2951 | " result:%d and Status:%d", |
| 2952 | MAC_ADDR_ARRAY |
| 2953 | (pRoamInfo->bssid.bytes), |
| 2954 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2955 | |
| 2956 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2957 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2958 | pRoamInfo-> |
| 2959 | bssid.bytes, |
| 2960 | pRoamInfo, |
| 2961 | reqRsnIe, |
| 2962 | reqRsnLength, |
| 2963 | rspRsnIe, |
| 2964 | rspRsnLength, |
| 2965 | WLAN_STATUS_SUCCESS, |
| 2966 | GFP_KERNEL, |
| 2967 | false, |
| 2968 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2969 | } |
| 2970 | } |
| 2971 | } |
| 2972 | if (!hddDisconInProgress) { |
| 2973 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2974 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2975 | bss); |
| 2976 | |
| 2977 | /* |
| 2978 | * Perform any WMM-related association |
| 2979 | * processing. |
| 2980 | */ |
| 2981 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2982 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2983 | |
| 2984 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2985 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2986 | */ |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2987 | qdf_status = hdd_roam_register_sta(pAdapter, |
| 2988 | pRoamInfo, |
| 2989 | pHddStaCtx->conn_info.staId[0], |
| 2990 | NULL, pRoamInfo->pBssDesc); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2991 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2992 | wlan_hdd_netif_queue_control(pAdapter, |
| 2993 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2994 | WLAN_CONTROL_PATH); |
| 2995 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2996 | } |
| 2997 | } else { |
| 2998 | /* |
| 2999 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 3000 | * in case of reassociation also need to indicate it to |
| 3001 | * supplicant. |
| 3002 | */ |
| 3003 | csr_roam_get_wpa_rsn_req_ie( |
| 3004 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 3005 | pAdapter->sessionId, |
| 3006 | &reqRsnLength, reqRsnIe); |
| 3007 | |
| 3008 | hdd_send_re_assoc_event(dev, pAdapter, pRoamInfo, |
| 3009 | reqRsnIe, reqRsnLength); |
| 3010 | /* Reassoc successfully */ |
| 3011 | if (pRoamInfo->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3012 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3013 | hdd_change_peer_state(pAdapter, |
| 3014 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3015 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3016 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3017 | pRoamInfo->roamSynchInProgress |
| 3018 | #else |
| 3019 | false |
| 3020 | #endif |
| 3021 | ); |
| 3022 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3023 | hdd_objmgr_set_peer_mlme_auth_state( |
| 3024 | pAdapter->hdd_vdev, |
| 3025 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3026 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3027 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3028 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3029 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3030 | hdd_change_peer_state(pAdapter, |
| 3031 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 3032 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3033 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3034 | pRoamInfo->roamSynchInProgress |
| 3035 | #else |
| 3036 | false |
| 3037 | #endif |
| 3038 | ); |
| 3039 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3040 | hdd_objmgr_set_peer_mlme_auth_state( |
| 3041 | pAdapter->hdd_vdev, |
| 3042 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3043 | } |
| 3044 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3045 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3046 | /* |
| 3047 | * Perform any WMM-related association |
| 3048 | * processing |
| 3049 | */ |
| 3050 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 3051 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3052 | } |
| 3053 | |
| 3054 | /* Start the tx queues */ |
| 3055 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3056 | if (pRoamInfo->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3057 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3058 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3059 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3060 | wlan_hdd_netif_queue_control(pAdapter, |
| 3061 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3062 | WLAN_CONTROL_PATH); |
| 3063 | } |
| 3064 | |
Padma, Santhosh Kumar | 724f63d | 2016-08-09 16:04:31 +0530 | [diff] [blame] | 3065 | #ifdef FEATURE_WLAN_TDLS |
| 3066 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 3067 | #endif |
| 3068 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3069 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3070 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3071 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3072 | } |
| 3073 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3074 | qdf_mem_zero(&pAdapter->hdd_stats.hddPmfStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3075 | sizeof(pAdapter->hdd_stats.hddPmfStats)); |
| 3076 | #endif |
| 3077 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3078 | bool connect_timeout = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3079 | hdd_wext_state_t *pWextState = |
| 3080 | WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3081 | if (pRoamInfo) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3082 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3083 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3084 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3085 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3086 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3087 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3088 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3089 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3090 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3091 | |
| 3092 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 3093 | (pRoamInfo && |
| 3094 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
| 3095 | pRoamInfo->statusCode) || |
| 3096 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
| 3097 | pRoamInfo->statusCode) || |
| 3098 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
| 3099 | pRoamInfo->statusCode)))) { |
| 3100 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 3101 | pRoamInfo ? |
| 3102 | pRoamInfo->bssid.bytes : |
| 3103 | pWextState->req_bssId.bytes); |
| 3104 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 3105 | pRoamInfo ? |
| 3106 | pRoamInfo->bssid.bytes : |
| 3107 | pWextState->req_bssId.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3108 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3109 | } |
| 3110 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3111 | /* |
| 3112 | * CR465478: Only send up a connection failure result when CSR |
| 3113 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3114 | */ |
| 3115 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3116 | && !hddDisconInProgress) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3117 | if (pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3118 | hdd_err("send connect failure to nl80211: for bssid " |
| 3119 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3120 | " result: %d and Status: %d reasoncode: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3121 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3122 | roamResult, roamStatus, |
| 3123 | pRoamInfo->reasonCode); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3124 | pHddStaCtx->conn_info.assoc_status_code = |
| 3125 | pRoamInfo->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3126 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3127 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3128 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3129 | " result: %d and status: %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3131 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3132 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3133 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3134 | wlan_deregister_txrx_packetdump(); |
| 3135 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3136 | /* inform association failure event to nl80211 */ |
| 3137 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3138 | roamResult) { |
| 3139 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3140 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3141 | pRoamInfo->bssid.bytes, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 3142 | pRoamInfo, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3143 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3144 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3145 | connect_timeout, |
| 3146 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3148 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3149 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3150 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3151 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3152 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3153 | connect_timeout, |
| 3154 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3155 | } else { |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3156 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3157 | hdd_connect_result(dev, |
| 3158 | pRoamInfo->bssid.bytes, |
Sridhar Selvaraj | 0d5d2c7 | 2017-08-17 17:30:01 +0530 | [diff] [blame] | 3159 | pRoamInfo, NULL, 0, NULL, 0, |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3160 | pRoamInfo->reasonCode ? |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3161 | pRoamInfo->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3162 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3163 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3164 | connect_timeout, |
| 3165 | pRoamInfo->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3166 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3167 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3168 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3169 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3170 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3171 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3172 | connect_timeout, |
| 3173 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3174 | } |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3175 | hdd_clear_roam_profile_ie(pAdapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3176 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3177 | && !hddDisconInProgress)) { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3178 | hdd_connect_result(dev, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3179 | pWextState->req_bssId.bytes, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3180 | NULL, NULL, 0, NULL, 0, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3181 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3182 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3183 | connect_timeout, |
| 3184 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3185 | } |
| 3186 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3187 | /* |
| 3188 | * Set connection state to eConnectionState_NotConnected only |
| 3189 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3190 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3191 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3192 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3193 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3194 | && !hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3195 | hdd_conn_set_connection_state(pAdapter, |
| 3196 | eConnectionState_NotConnected); |
| 3197 | } |
| 3198 | hdd_wmm_init(pAdapter); |
| 3199 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3200 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3201 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3202 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3203 | WLAN_CONTROL_PATH); |
| 3204 | } |
| 3205 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3206 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3207 | } |
| 3208 | |
| 3209 | /** |
| 3210 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
| 3211 | * @pAdapter: pointer to adapter |
| 3212 | * @pRoamInfo: pointer to roam info |
| 3213 | * @roamId: roam id |
| 3214 | * @roamStatus: roam status |
| 3215 | * @roamResult: roam result |
| 3216 | * |
| 3217 | * Here we update the status of the Ibss when we receive information that we |
| 3218 | * have started/joined an ibss session. |
| 3219 | * |
| 3220 | * Return: none |
| 3221 | */ |
| 3222 | static void hdd_roam_ibss_indication_handler(hdd_adapter_t *pAdapter, |
| 3223 | tCsrRoamInfo *pRoamInfo, |
| 3224 | uint32_t roamId, |
| 3225 | eRoamCmdStatus roamStatus, |
| 3226 | eCsrRoamResult roamResult) |
| 3227 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 3228 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3229 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3230 | hdd_debug("%s: id %d, status %d, result %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3231 | pAdapter->dev->name, roamId, |
| 3232 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3233 | |
| 3234 | switch (roamResult) { |
| 3235 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3236 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3237 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3238 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3239 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 3240 | struct hdd_context *pHddCtx = |
| 3241 | (struct hdd_context *) pAdapter->pHddCtx; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3242 | struct hdd_station_ctx *hdd_sta_ctx = |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3243 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3244 | struct qdf_mac_addr broadcastMacAddr = |
| 3245 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3246 | |
| 3247 | if (NULL == pRoamInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3248 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3249 | return; |
| 3250 | } |
| 3251 | |
| 3252 | /* When IBSS Started comes from CSR, we need to move |
| 3253 | * connection state to IBSS Disconnected (meaning no peers |
| 3254 | * are in the IBSS). |
| 3255 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3256 | hdd_conn_set_connection_state(pAdapter, |
| 3257 | eConnectionState_IbssDisconnected); |
| 3258 | /* notify wmm */ |
| 3259 | hdd_wmm_connect(pAdapter, pRoamInfo, |
| 3260 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3261 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 3262 | hdd_sta_ctx->broadcast_staid = pRoamInfo->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3263 | |
| 3264 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | pAdapter; |
| 3266 | hdd_roam_register_sta(pAdapter, pRoamInfo, |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3267 | pRoamInfo->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | &broadcastMacAddr, |
| 3269 | pRoamInfo->pBssDesc); |
| 3270 | |
| 3271 | if (pRoamInfo->pBssDesc) { |
| 3272 | struct cfg80211_bss *bss; |
| 3273 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3274 | struct ieee80211_channel *chan; |
| 3275 | int chan_no; |
| 3276 | unsigned int freq; |
| 3277 | #endif |
| 3278 | /* we created the IBSS, notify supplicant */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3279 | hdd_info("%s: created ibss " MAC_ADDRESS_STR, |
| 3280 | pAdapter->dev->name, |
| 3281 | MAC_ADDR_ARRAY( |
| 3282 | pRoamInfo->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3283 | |
| 3284 | /* we must first give cfg80211 the BSS information */ |
| 3285 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 3286 | pRoamInfo); |
| 3287 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3288 | hdd_err("%s: unable to create IBSS entry", |
| 3289 | pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3290 | return; |
| 3291 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3292 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3293 | wlan_hdd_netif_queue_control(pAdapter, |
| 3294 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3295 | WLAN_CONTROL_PATH); |
| 3296 | |
| 3297 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3298 | chan_no = pRoamInfo->pBssDesc->channelId; |
| 3299 | |
| 3300 | if (chan_no <= 14) |
| 3301 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3302 | HDD_NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3303 | else |
| 3304 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3305 | HDD_NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3306 | |
| 3307 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3308 | |
| 3309 | if (chan) |
| 3310 | cfg80211_ibss_joined(pAdapter->dev, |
| 3311 | bss->bssid, chan, |
| 3312 | GFP_KERNEL); |
| 3313 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3314 | hdd_warn("%s: chanId: %d, can't find channel", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3315 | pAdapter->dev->name, |
| 3316 | (int)pRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3317 | #else |
| 3318 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3319 | GFP_KERNEL); |
| 3320 | #endif |
| 3321 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3322 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3323 | bss); |
| 3324 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3325 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3326 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
| 3327 | pAdapter->device_mode, pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3328 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3329 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3330 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
| 3331 | pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3332 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3333 | break; |
| 3334 | } |
| 3335 | |
| 3336 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3337 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3338 | hdd_err("%s: unable to create IBSS", pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | break; |
| 3340 | } |
| 3341 | |
| 3342 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3343 | hdd_err("%s: unexpected result %d", |
| 3344 | pAdapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3345 | break; |
| 3346 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3347 | } |
| 3348 | |
| 3349 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3350 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3351 | * @sta_ctx: pointer to hdd station context |
| 3352 | * @sta_id: station ID |
| 3353 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3354 | * |
| 3355 | * This information is passed to iwconfig later. The peer that joined |
| 3356 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3357 | |
| 3358 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3359 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3360 | bool hdd_save_peer(struct hdd_station_ctx *sta_ctx, uint8_t sta_id, |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3361 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3362 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3363 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3364 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3365 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3366 | if (HDD_WLAN_INVALID_STA_ID == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3367 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3368 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3369 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3370 | qdf_copy_macaddr( |
| 3371 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3372 | peer_mac_addr); |
| 3373 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3374 | } |
| 3375 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3376 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3377 | } |
| 3378 | |
| 3379 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3380 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3381 | * @sta_ctx: pointer to hdd station context |
| 3382 | * @sta_id: station ID |
| 3383 | * |
| 3384 | * Return: None |
| 3385 | */ |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3386 | void hdd_delete_peer(struct hdd_station_ctx *sta_ctx, uint8_t sta_id) |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3387 | { |
| 3388 | int i; |
| 3389 | |
| 3390 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3391 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3392 | sta_ctx->conn_info.staId[i] = HDD_WLAN_INVALID_STA_ID; |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3393 | return; |
| 3394 | } |
| 3395 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3396 | } |
| 3397 | |
| 3398 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3399 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
| 3400 | * @pAdapter: pointer to adapter |
| 3401 | * @staId: station id |
| 3402 | * |
| 3403 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3404 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3405 | * false otherwise. |
| 3406 | */ |
| 3407 | static bool roam_remove_ibss_station(hdd_adapter_t *pAdapter, uint8_t staId) |
| 3408 | { |
| 3409 | bool fSuccess = false; |
| 3410 | int idx = 0; |
| 3411 | uint8_t valid_idx = 0; |
| 3412 | uint8_t del_idx = 0; |
| 3413 | uint8_t empty_slots = 0; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3414 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3415 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3416 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3417 | if (staId == pHddStaCtx->conn_info.staId[idx]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3418 | pHddStaCtx->conn_info.staId[idx] = |
| 3419 | HDD_WLAN_INVALID_STA_ID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3420 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3421 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3422 | peerMacAddress[idx]); |
| 3423 | |
| 3424 | fSuccess = true; |
| 3425 | |
| 3426 | /* |
| 3427 | * Note the deleted Index, if its 0 we need special |
| 3428 | * handling. |
| 3429 | */ |
| 3430 | del_idx = idx; |
| 3431 | |
| 3432 | empty_slots++; |
| 3433 | } else { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3434 | if (pHddStaCtx->conn_info.staId[idx] != |
| 3435 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3436 | valid_idx = idx; |
| 3437 | } else { |
| 3438 | /* Found an empty slot */ |
| 3439 | empty_slots++; |
| 3440 | } |
| 3441 | } |
| 3442 | } |
| 3443 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3444 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3445 | /* Last peer departed, set the IBSS state appropriately */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3446 | hdd_conn_set_connection_state(pAdapter, |
| 3447 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3448 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3449 | } |
| 3450 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3451 | if (fSuccess == true) { |
| 3452 | if (del_idx == 0) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3453 | if (pHddStaCtx->conn_info.staId[valid_idx] != |
| 3454 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3455 | pHddStaCtx->conn_info.staId[0] = |
| 3456 | pHddStaCtx->conn_info.staId[valid_idx]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3457 | qdf_copy_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3458 | peerMacAddress[0], |
| 3459 | &pHddStaCtx->conn_info. |
| 3460 | peerMacAddress[valid_idx]); |
| 3461 | |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3462 | pHddStaCtx->conn_info.staId[valid_idx] = |
| 3463 | HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3464 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3465 | peerMacAddress[valid_idx]); |
| 3466 | } |
| 3467 | } |
| 3468 | } |
| 3469 | return fSuccess; |
| 3470 | } |
| 3471 | |
| 3472 | /** |
| 3473 | * roam_ibss_connect_handler() - IBSS connection handler |
| 3474 | * @pAdapter: pointer to adapter |
| 3475 | * @pRoamInfo: pointer to roam info |
| 3476 | * |
| 3477 | * We update the status of the IBSS to connected in this function. |
| 3478 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3479 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3480 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3481 | static QDF_STATUS roam_ibss_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3482 | tCsrRoamInfo *pRoamInfo) |
| 3483 | { |
| 3484 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3485 | /* |
| 3486 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3487 | * a partner stations). |
| 3488 | */ |
| 3489 | hdd_conn_set_connection_state(pAdapter, eConnectionState_IbssConnected); |
| 3490 | |
| 3491 | /* Save the connection info from CSR... */ |
| 3492 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
| 3493 | |
| 3494 | /* Send the bssid address to the wext. */ |
| 3495 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3496 | /* add bss_id to cfg80211 data base */ |
| 3497 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3498 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3499 | hdd_err("%s: unable to create IBSS entry", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3500 | pAdapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3501 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3502 | } |
| 3503 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3504 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3505 | bss); |
| 3506 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3507 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | } |
| 3509 | |
| 3510 | /** |
| 3511 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
| 3512 | * @pAdapter: pointer to adapter |
| 3513 | * @pRoamInfo: pointer to roam info |
| 3514 | * @roamId: roam id |
| 3515 | * @roamStatus: roam status |
| 3516 | * @roamResult: roam result |
| 3517 | * |
| 3518 | * This function indicates the Mic failure to the supplicant |
| 3519 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3520 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3521 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3522 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3523 | hdd_roam_mic_error_indication_handler(hdd_adapter_t *pAdapter, |
| 3524 | tCsrRoamInfo *pRoamInfo, |
| 3525 | uint32_t roamId, |
| 3526 | eRoamCmdStatus roamStatus, |
| 3527 | eCsrRoamResult roamResult) |
| 3528 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3529 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3530 | |
| 3531 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3532 | TKIP_COUNTER_MEASURE_STOPED == |
| 3533 | pHddStaCtx->WextState.mTKIPCounterMeasures) { |
| 3534 | struct iw_michaelmicfailure msg; |
| 3535 | union iwreq_data wreq; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3536 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3537 | memset(&msg, '\0', sizeof(msg)); |
| 3538 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3539 | memcpy(msg.src_addr.sa_data, |
| 3540 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3541 | sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3542 | hdd_debug("MIC MAC " MAC_ADDRESS_STR, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3543 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3544 | |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3545 | if (pRoamInfo->u.pMICFailureInfo->multicast == true) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3546 | msg.flags = IW_MICFAILURE_GROUP; |
| 3547 | else |
| 3548 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3549 | memset(&wreq, 0, sizeof(wreq)); |
| 3550 | wreq.data.length = sizeof(msg); |
| 3551 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, |
| 3552 | (char *)&msg); |
| 3553 | /* inform mic failure to nl80211 */ |
| 3554 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 3555 | pRoamInfo->u.pMICFailureInfo-> |
| 3556 | taMacAddr, |
| 3557 | ((pRoamInfo->u.pMICFailureInfo-> |
| 3558 | multicast == |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3559 | true) ? |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3560 | NL80211_KEYTYPE_GROUP : |
| 3561 | NL80211_KEYTYPE_PAIRWISE), |
| 3562 | pRoamInfo->u.pMICFailureInfo-> |
| 3563 | keyId, |
| 3564 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 3565 | GFP_KERNEL); |
| 3566 | |
| 3567 | } |
| 3568 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3569 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3570 | } |
| 3571 | |
| 3572 | /** |
| 3573 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
| 3574 | * @pAdapter: pointer to adapter |
| 3575 | * @pRoamInfo: pointer to roam info |
| 3576 | * @roamId: roam id |
| 3577 | * @roamStatus: roam status |
| 3578 | * @roamResult: roam result |
| 3579 | * |
| 3580 | * The Ibss connection status is updated regularly here in this function. |
| 3581 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3582 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3583 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3584 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3585 | roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter, |
| 3586 | tCsrRoamInfo *pRoamInfo, |
| 3587 | uint32_t roamId, |
| 3588 | eRoamCmdStatus roamStatus, |
| 3589 | eCsrRoamResult roamResult) |
| 3590 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 3591 | struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3592 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3593 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3594 | switch (roamResult) { |
| 3595 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3596 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3597 | struct hdd_station_ctx *pHddStaCtx = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3598 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3599 | struct station_info *stainfo; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3600 | eCsrEncryptionType encr_type = pHddStaCtx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3601 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3602 | hdd_info("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3603 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3604 | MAC_ADDRESS_STR " and stationID= %d", |
| 3605 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3606 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3607 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3608 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3609 | if (!hdd_save_peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3610 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 3611 | pRoamInfo->staId, |
| 3612 | &pRoamInfo->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3613 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3614 | break; |
| 3615 | } |
| 3616 | |
| 3617 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3618 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3619 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 3620 | pRoamInfo->fAuthRequired = true; |
| 3621 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3622 | /* Register the Station with TL for the new peer. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3623 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3624 | pRoamInfo, |
| 3625 | pRoamInfo->staId, |
| 3626 | &pRoamInfo->peerMac, |
| 3627 | pRoamInfo->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3628 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3629 | 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] | 3630 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3631 | } |
| 3632 | pHddStaCtx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3633 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3634 | if (stainfo == NULL) { |
| 3635 | hdd_err("memory allocation for station_info failed"); |
| 3636 | return QDF_STATUS_E_NOMEM; |
| 3637 | } |
| 3638 | stainfo->filled = 0; |
| 3639 | stainfo->generation = pHddStaCtx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3640 | |
| 3641 | cfg80211_new_sta(pAdapter->dev, |
| 3642 | (const u8 *)pRoamInfo->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3643 | stainfo, GFP_KERNEL); |
| 3644 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3645 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3646 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3647 | pHddStaCtx->ibss_enc_key.keyDirection = |
| 3648 | eSIR_TX_RX; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3649 | qdf_copy_macaddr(&pHddStaCtx->ibss_enc_key.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3650 | &pRoamInfo->peerMac); |
| 3651 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3652 | hdd_info("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3653 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3654 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3655 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3656 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
| 3657 | (pAdapter), |
| 3658 | pAdapter->sessionId, |
| 3659 | &pHddStaCtx->ibss_enc_key, |
| 3660 | &roamId); |
| 3661 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3662 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3663 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3664 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3665 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3666 | } |
| 3667 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3668 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3669 | wlan_hdd_netif_queue_control(pAdapter, |
| 3670 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3671 | WLAN_CONTROL_PATH); |
| 3672 | break; |
| 3673 | } |
| 3674 | |
| 3675 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3676 | { |
| 3677 | |
| 3678 | roam_ibss_connect_handler(pAdapter, pRoamInfo); |
| 3679 | |
| 3680 | break; |
| 3681 | } |
| 3682 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3683 | { |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 3684 | struct hdd_station_ctx *pHddStaCtx = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3685 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3686 | |
| 3687 | if (!roam_remove_ibss_station(pAdapter, pRoamInfo->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3688 | 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] | 3689 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3690 | hdd_info("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3691 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3692 | MAC_ADDRESS_STR " and stationID= %d", |
| 3693 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3694 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3695 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3696 | |
| 3697 | hdd_roam_deregister_sta(pAdapter, pRoamInfo->staId); |
| 3698 | |
| 3699 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 3700 | pHddStaCtx->ibss_sta_generation++; |
| 3701 | |
| 3702 | cfg80211_del_sta(pAdapter->dev, |
| 3703 | (const u8 *)&pRoamInfo->peerMac.bytes, |
| 3704 | GFP_KERNEL); |
| 3705 | break; |
| 3706 | } |
| 3707 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3708 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3709 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3710 | /* Stop only when we are inactive */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3711 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3712 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3713 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3714 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3715 | hdd_conn_set_connection_state(pAdapter, |
| 3716 | eConnectionState_NotConnected); |
| 3717 | |
| 3718 | /* Send the bssid address to the wext. */ |
| 3719 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3720 | break; |
| 3721 | } |
| 3722 | default: |
| 3723 | break; |
| 3724 | |
| 3725 | } |
| 3726 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3727 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3728 | } |
| 3729 | |
| 3730 | #ifdef FEATURE_WLAN_TDLS |
| 3731 | /** |
| 3732 | * hdd_roam_register_tdlssta() - register new TDLS station |
| 3733 | * @pAdapter: pointer to adapter |
| 3734 | * @peerMac: pointer to peer MAC address |
| 3735 | * @staId: station identifier |
| 3736 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3737 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3738 | * |
| 3739 | * Construct the staDesc and register with TL the new STA. |
| 3740 | * This is called as part of ADD_STA in the TDLS setup. |
| 3741 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3742 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3743 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3744 | QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3745 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3746 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3747 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3748 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3749 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3750 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3751 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3752 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3753 | |
| 3754 | /* |
| 3755 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3756 | * be peer MAC, here we are working on direct Link |
| 3757 | */ |
| 3758 | staDesc.sta_id = staId; |
| 3759 | |
| 3760 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3761 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3762 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3763 | /* Register the vdev transmit and receive functions */ |
| 3764 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3765 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3766 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3767 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
| 3768 | (struct cdp_pdev *)pdev, pAdapter->sessionId), |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3769 | pAdapter, &txrx_ops); |
| 3770 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3771 | |
| 3772 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3773 | qdf_status = cdp_peer_register(soc, |
| 3774 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3775 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3776 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3777 | qdf_status, qdf_status); |
| 3778 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3779 | } |
| 3780 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3781 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3782 | } |
| 3783 | |
| 3784 | /** |
| 3785 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
| 3786 | * @pAdapter: pointer to adapter |
| 3787 | * @staId: station identifier |
| 3788 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3789 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3790 | */ |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3791 | 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] | 3792 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3793 | QDF_STATUS qdf_status; |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3794 | 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] | 3795 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3796 | staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3797 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3798 | 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] | 3799 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3800 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3801 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3802 | } |
| 3803 | |
| 3804 | /** |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3805 | * hdd_tdls_connection_tracker_update() - update connection tracker state |
| 3806 | * @adapter: pointer to adapter |
| 3807 | * @roam_info: pointer to roam info |
| 3808 | * @hdd_tdls_ctx: tdls context |
| 3809 | * |
| 3810 | * Return: QDF_STATUS enumeration |
| 3811 | */ |
| 3812 | static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, |
| 3813 | tCsrRoamInfo *roam_info, |
| 3814 | tdlsCtx_t *hdd_tdls_ctx) |
| 3815 | { |
| 3816 | hddTdlsPeer_t *curr_peer; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 3817 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3818 | |
| 3819 | curr_peer = wlan_hdd_tdls_find_peer(adapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3820 | roam_info->peerMac.bytes); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3821 | |
| 3822 | if (!curr_peer) { |
| 3823 | hdd_err("curr_peer is null"); |
| 3824 | return QDF_STATUS_E_FAILURE; |
| 3825 | } |
| 3826 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3827 | if (eTDLS_LINK_CONNECTED == |
| 3828 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3829 | hdd_debug("Received CONNECTION_TRACKER_NOTIFICATION " |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3830 | MAC_ADDRESS_STR |
| 3831 | " staId: %d, reason: %d", |
| 3832 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3833 | roam_info->staId, |
| 3834 | roam_info->reasonCode); |
| 3835 | |
| 3836 | if (roam_info->reasonCode == |
| 3837 | eWNI_TDLS_PEER_ENTER_BUF_STA || |
| 3838 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3839 | eWNI_TDLS_ENTER_BT_BUSY_MODE || |
| 3840 | roam_info->reasonCode == |
| 3841 | eWMI_TDLS_SCAN_STARTED_EVENT) |
| 3842 | hdd_ctx->enable_tdls_connection_tracker = false; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3843 | else if (roam_info->reasonCode == |
| 3844 | eWNI_TDLS_PEER_EXIT_BUF_STA || |
| 3845 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3846 | eWNI_TDLS_EXIT_BT_BUSY_MODE || |
| 3847 | roam_info->reasonCode == |
| 3848 | eWMI_TDLS_SCAN_COMPLETED_EVENT) |
| 3849 | hdd_ctx->enable_tdls_connection_tracker = true; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3850 | hdd_debug("hdd_ctx->enable_tdls_connection_tracker %d", |
Nitesh Shah | c549dd5 | 2017-02-23 16:45:44 +0530 | [diff] [blame] | 3851 | hdd_ctx->enable_tdls_connection_tracker); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3852 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3853 | hdd_debug("TDLS not connected, ignore notification, reason: %d", |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3854 | roam_info->reasonCode); |
| 3855 | } |
| 3856 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3857 | return QDF_STATUS_SUCCESS; |
| 3858 | } |
| 3859 | |
| 3860 | |
| 3861 | |
| 3862 | |
| 3863 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3864 | * hdd_roam_tdls_status_update_handler() - TDLS status update handler |
| 3865 | * @pAdapter: pointer to adapter |
| 3866 | * @pRoamInfo: pointer to roam info |
| 3867 | * @roamId: roam id |
| 3868 | * @roamStatus: roam status |
| 3869 | * @roamResult: roam result |
| 3870 | * |
| 3871 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3872 | * TL in case of new TDLS client is added and deregistration at the time |
| 3873 | * TDLS client is deleted. |
| 3874 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3875 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3876 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3877 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3878 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 3879 | tCsrRoamInfo *pRoamInfo, |
| 3880 | uint32_t roamId, |
| 3881 | eRoamCmdStatus roamStatus, |
| 3882 | eCsrRoamResult roamResult) |
| 3883 | { |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 3884 | struct hdd_context *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3885 | tdlsCtx_t *pHddTdlsCtx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3886 | tSmeTdlsPeerStateParams smeTdlsPeerStateParams; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3887 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3888 | uint8_t staIdx; |
| 3889 | hddTdlsPeer_t *curr_peer; |
| 3890 | uint32_t reason; |
| 3891 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3892 | hdd_debug("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3893 | roamResult == |
| 3894 | eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : roamResult |
| 3895 | == |
| 3896 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 3897 | roamResult == |
| 3898 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" |
| 3899 | : roamResult == |
| 3900 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3901 | "DEL_ALL_TDLS_PEER_IND" : roamResult == |
| 3902 | eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? "UPDATE_TDLS_PEER" : |
| 3903 | roamResult == |
| 3904 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 3905 | "LINK_ESTABLISH_REQ_RSP" : roamResult == |
| 3906 | eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER ? "TDLS_SHOULD_DISCOVER" |
| 3907 | : roamResult == |
| 3908 | eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN ? "TDLS_SHOULD_TEARDOWN" |
| 3909 | : roamResult == |
| 3910 | eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED ? |
| 3911 | "TDLS_SHOULD_PEER_DISCONNECTED" : "UNKNOWN", pRoamInfo->staId, |
| 3912 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3913 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3914 | switch (roamResult) { |
| 3915 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3916 | { |
| 3917 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3918 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3919 | pRoamInfo->statusCode); |
Selvaraj, Sridhar | 5d95e63 | 2016-09-14 17:00:38 +0530 | [diff] [blame] | 3920 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3921 | } else { |
| 3922 | /* |
| 3923 | * Check if there is available index for this new TDLS |
| 3924 | * STA. |
| 3925 | */ |
| 3926 | for (staIdx = 0; |
| 3927 | staIdx < pHddCtx->max_num_tdls_sta; |
| 3928 | staIdx++) { |
| 3929 | if (0 == |
| 3930 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3931 | staId) { |
| 3932 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3933 | sessionId = |
| 3934 | pRoamInfo->sessionId; |
| 3935 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3936 | staId = pRoamInfo->staId; |
| 3937 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3938 | hdd_debug("TDLS: STA IDX at %d is %d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3939 | "of mac " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3940 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3941 | staIdx, |
| 3942 | pHddCtx-> |
| 3943 | tdlsConnInfo[staIdx]. |
| 3944 | staId, |
| 3945 | MAC_ADDR_ARRAY |
| 3946 | (pRoamInfo->peerMac.bytes)); |
| 3947 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3948 | qdf_copy_macaddr(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3949 | tdlsConnInfo |
| 3950 | [staIdx]. |
| 3951 | peerMac, |
| 3952 | &pRoamInfo-> |
| 3953 | peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3954 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3955 | break; |
| 3956 | } |
| 3957 | } |
| 3958 | if (staIdx < pHddCtx->max_num_tdls_sta) { |
| 3959 | if (-1 == |
| 3960 | wlan_hdd_tdls_set_sta_id(pAdapter, |
| 3961 | pRoamInfo-> |
| 3962 | peerMac.bytes, |
| 3963 | pRoamInfo-> |
| 3964 | staId)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3965 | hdd_err("wlan_hdd_tdls_set_sta_id() failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3966 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3967 | } |
| 3968 | |
| 3969 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 3970 | sta_to_adapter[pRoamInfo->staId] = |
| 3971 | pAdapter; |
| 3972 | /* |
| 3973 | * store the ucast signature, |
| 3974 | * if required for further reference. |
| 3975 | */ |
| 3976 | |
| 3977 | wlan_hdd_tdls_set_signature(pAdapter, |
| 3978 | pRoamInfo-> |
| 3979 | peerMac.bytes, |
| 3980 | pRoamInfo-> |
| 3981 | ucastSig); |
| 3982 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3983 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3984 | 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] | 3985 | pRoamInfo->staId); |
| 3986 | } |
| 3987 | pAdapter->tdlsAddStaStatus = status; |
| 3988 | } |
| 3989 | complete(&pAdapter->tdls_add_station_comp); |
| 3990 | break; |
| 3991 | } |
| 3992 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3993 | { |
| 3994 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3995 | hdd_err("Add Sta failed. status code: %d", |
Varun Reddy Yeturu | ed1215e | 2017-07-07 16:40:28 -0700 | [diff] [blame] | 3996 | pRoamInfo->statusCode); |
| 3997 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
| 3998 | } else { |
| 3999 | pAdapter->tdlsAddStaStatus = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4000 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4001 | complete(&pAdapter->tdls_add_station_comp); |
| 4002 | break; |
| 4003 | } |
| 4004 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 4005 | { |
| 4006 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4007 | hdd_err("Link Establish Request failed. status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4008 | pRoamInfo->statusCode); |
| 4009 | } |
| 4010 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 4011 | break; |
| 4012 | } |
| 4013 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
| 4014 | { |
| 4015 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 4016 | staIdx++) { |
| 4017 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 4018 | pRoamInfo->sessionId) |
| 4019 | && pRoamInfo->staId == |
| 4020 | pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4021 | hdd_debug("HDD: del STA IDX = %x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4022 | pRoamInfo->staId); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4023 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4024 | curr_peer = |
| 4025 | wlan_hdd_tdls_find_peer(pAdapter, |
| 4026 | pRoamInfo-> |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4027 | peerMac.bytes); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4028 | if (NULL != curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4029 | hdd_debug("Current status for peer " MAC_ADDRESS_STR " is %d", |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4030 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4031 | curr_peer->link_status); |
| 4032 | if (TDLS_IS_CONNECTED(curr_peer)) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4033 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4034 | hdd_roam_deregister_tdlssta |
| 4035 | (pAdapter, |
| 4036 | pRoamInfo->staId); |
| 4037 | wlan_hdd_tdls_decrement_peer_count |
| 4038 | (pAdapter); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4039 | } else if (eTDLS_LINK_CONNECTING == |
| 4040 | curr_peer->link_status) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4041 | mutex_unlock(&pHddCtx->tdls_lock); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4042 | hdd_roam_deregister_tdlssta |
| 4043 | (pAdapter, |
| 4044 | pRoamInfo->staId); |
Nitesh Shah | 0bf768f | 2017-03-31 15:01:37 +0530 | [diff] [blame] | 4045 | } else |
| 4046 | mutex_unlock(&pHddCtx->tdls_lock); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4047 | } else |
| 4048 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4049 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4050 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4051 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4052 | pRoamInfo-> |
| 4053 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4054 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4055 | |
| 4056 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4057 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4058 | sessionId = 255; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4059 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4060 | tdlsConnInfo[staIdx]. |
| 4061 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4062 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4063 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4064 | break; |
| 4065 | } |
| 4066 | } |
| 4067 | complete(&pAdapter->tdls_del_station_comp); |
| 4068 | } |
| 4069 | break; |
| 4070 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 4071 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4072 | hdd_debug("Sending teardown to supplicant with reason code %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4073 | pRoamInfo->reasonCode); |
| 4074 | |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4075 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4076 | curr_peer = |
| 4077 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4078 | pRoamInfo->peerMac.bytes); |
Ganesh Kondabattini | 9c8dc46 | 2017-04-19 10:52:54 +0530 | [diff] [blame] | 4079 | |
| 4080 | if (!curr_peer) { |
| 4081 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4082 | hdd_debug("peer doesn't exists"); |
| 4083 | status = QDF_STATUS_SUCCESS; |
| 4084 | break; |
| 4085 | } |
| 4086 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4087 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4088 | pRoamInfo->reasonCode); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4089 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4090 | curr_peer->peerMac); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4091 | mutex_unlock(&pHddCtx->tdls_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4092 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4093 | break; |
| 4094 | } |
| 4095 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 4096 | { |
| 4097 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
| 4098 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 4099 | staIdx++) { |
| 4100 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 4101 | pRoamInfo->sessionId) |
| 4102 | && pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4103 | hdd_debug("hdd_tdlsStatusUpdate: staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4104 | MAC_ADDRESS_STR, |
| 4105 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4106 | staId, |
| 4107 | MAC_ADDR_ARRAY(pHddCtx-> |
| 4108 | tdlsConnInfo |
| 4109 | [staIdx]. |
| 4110 | peerMac. |
| 4111 | bytes)); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4112 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4113 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4114 | pHddCtx-> |
| 4115 | tdlsConnInfo |
| 4116 | [staIdx]. |
| 4117 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4118 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4119 | hdd_roam_deregister_tdlssta(pAdapter, |
| 4120 | pHddCtx-> |
| 4121 | tdlsConnInfo |
| 4122 | [staIdx]. |
| 4123 | staId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4124 | qdf_mem_zero(&smeTdlsPeerStateParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4125 | sizeof |
| 4126 | (smeTdlsPeerStateParams)); |
| 4127 | smeTdlsPeerStateParams.vdevId = |
| 4128 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4129 | sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4130 | qdf_mem_copy(&smeTdlsPeerStateParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4131 | peerMacAddr, |
| 4132 | &pHddCtx-> |
| 4133 | tdlsConnInfo[staIdx]. |
| 4134 | peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4135 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4136 | smeTdlsPeerStateParams.peerState = |
| 4137 | eSME_TDLS_PEER_STATE_TEARDOWN; |
| 4138 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4139 | hdd_debug("calling sme_update_tdls_peer_state for staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4140 | MAC_ADDRESS_STR, |
| 4141 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4142 | staId, |
| 4143 | MAC_ADDR_ARRAY(pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4144 | tdlsConnInfo |
| 4145 | [staIdx]. |
| 4146 | peerMac. |
| 4147 | bytes)); |
| 4148 | status = |
| 4149 | sme_update_tdls_peer_state( |
| 4150 | pHddCtx->hHal, |
| 4151 | &smeTdlsPeerStateParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4152 | if (QDF_STATUS_SUCCESS != status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4153 | hdd_err("sme_update_tdls_peer_state failed for " |
| 4154 | MAC_ADDRESS_STR, |
| 4155 | MAC_ADDR_ARRAY |
| 4156 | (pHddCtx-> |
| 4157 | tdlsConnInfo[staIdx]. |
| 4158 | peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4159 | } |
| 4160 | wlan_hdd_tdls_decrement_peer_count |
| 4161 | (pAdapter); |
| 4162 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4163 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4164 | tdlsConnInfo[staIdx]. |
| 4165 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4166 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4167 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4168 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4169 | sessionId = 255; |
| 4170 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4171 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4172 | } |
| 4173 | } |
| 4174 | break; |
| 4175 | } |
| 4176 | case eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER: |
| 4177 | { |
| 4178 | /* ignore TDLS_SHOULD_DISCOVER if any concurrency detected */ |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 4179 | if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { |
| 4180 | hdd_err("TDLS not allowed, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4181 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4182 | break; |
| 4183 | } |
| 4184 | |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4185 | if (pHddCtx->tdls_nss_switch_in_progress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4186 | hdd_debug("TDLS antenna switch is in progress, ignore SHOULD_DISCOVER"); |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4187 | status = QDF_STATUS_SUCCESS; |
| 4188 | break; |
| 4189 | } |
| 4190 | |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4191 | mutex_lock(&pHddCtx->tdls_lock); |
| 4192 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4193 | if (!pHddTdlsCtx) { |
| 4194 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4195 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4196 | roamResult); |
| 4197 | status = QDF_STATUS_E_FAILURE; |
| 4198 | break; |
| 4199 | } |
| 4200 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4201 | curr_peer = |
| 4202 | wlan_hdd_tdls_get_peer(pAdapter, |
Nitesh Shah | 379449e | 2017-01-31 19:11:29 +0530 | [diff] [blame] | 4203 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4204 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4205 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4206 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4207 | } else { |
| 4208 | if (eTDLS_LINK_CONNECTED == |
| 4209 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4210 | hdd_debug("TDLS link status is connected, ignore SHOULD_DISCOVER"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4211 | } else { |
| 4212 | /* |
| 4213 | * If external control is enabled then initiate |
| 4214 | * TDLS only if forced peer is set otherwise |
| 4215 | * ignore should Discover trigger from fw. |
| 4216 | */ |
| 4217 | if (pHddCtx->config-> |
| 4218 | fTDLSExternalControl |
| 4219 | && (false == |
| 4220 | curr_peer->isForcedPeer)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4221 | 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] | 4222 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4223 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4224 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4225 | 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] | 4226 | pHddCtx->config-> |
| 4227 | fTDLSExternalControl, |
| 4228 | curr_peer->isForcedPeer, |
| 4229 | pRoamInfo->reasonCode); |
Nitesh Shah | 983e8f5 | 2016-11-25 12:36:29 +0530 | [diff] [blame] | 4230 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 4231 | wlan_hdd_tdls_implicit_send_discovery_request( |
| 4232 | pHddTdlsCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4233 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4234 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4235 | } |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4236 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4237 | break; |
| 4238 | } |
| 4239 | |
| 4240 | case eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN: |
| 4241 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4242 | mutex_lock(&pHddCtx->tdls_lock); |
| 4243 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4244 | if (!pHddTdlsCtx) { |
| 4245 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4246 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4247 | roamResult); |
| 4248 | status = QDF_STATUS_E_FAILURE; |
| 4249 | break; |
| 4250 | } |
| 4251 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4252 | curr_peer = |
| 4253 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4254 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4255 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4256 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4257 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4258 | } else { |
| 4259 | if (eTDLS_LINK_CONNECTED == |
| 4260 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4261 | hdd_debug("Received SHOULD_TEARDOWN for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4262 | MAC_ADDRESS_STR |
| 4263 | " staId: %d, reason: %d", |
| 4264 | MAC_ADDR_ARRAY(pRoamInfo-> |
| 4265 | peerMac.bytes), |
| 4266 | pRoamInfo->staId, |
| 4267 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4268 | |
| 4269 | if (pRoamInfo->reasonCode == |
| 4270 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4271 | pRoamInfo->reasonCode == |
| 4272 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4273 | pRoamInfo->reasonCode == |
| 4274 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4275 | pRoamInfo->reasonCode == |
| 4276 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4277 | reason = |
| 4278 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4279 | } else |
| 4280 | reason = |
| 4281 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4282 | |
| 4283 | wlan_hdd_tdls_indicate_teardown |
| 4284 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4285 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4286 | hdd_send_wlan_tdls_teardown_event( |
| 4287 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4288 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4289 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4290 | hdd_debug("TDLS link is not connected, ignore SHOULD_TEARDOWN, reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4291 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4292 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4293 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4294 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4295 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4296 | break; |
| 4297 | } |
| 4298 | |
| 4299 | case eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED: |
| 4300 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4301 | mutex_lock(&pHddCtx->tdls_lock); |
| 4302 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4303 | if (!pHddTdlsCtx) { |
| 4304 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4305 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4306 | roamResult); |
| 4307 | status = QDF_STATUS_E_FAILURE; |
| 4308 | break; |
| 4309 | } |
| 4310 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4311 | curr_peer = |
| 4312 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4313 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4314 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4315 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4316 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4317 | } else { |
| 4318 | if (eTDLS_LINK_CONNECTED == |
| 4319 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4320 | hdd_debug("Received SHOULD_PEER_DISCONNECTED for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4321 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4322 | " staId: %d reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4323 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4324 | pRoamInfo->staId, |
| 4325 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4326 | |
| 4327 | if (pRoamInfo->reasonCode == |
| 4328 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4329 | pRoamInfo->reasonCode == |
| 4330 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4331 | pRoamInfo->reasonCode == |
| 4332 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4333 | pRoamInfo->reasonCode == |
| 4334 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4335 | reason = |
| 4336 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4337 | } else |
| 4338 | reason = |
| 4339 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4340 | |
| 4341 | wlan_hdd_tdls_indicate_teardown |
| 4342 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4343 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4344 | hdd_send_wlan_tdls_teardown_event( |
| 4345 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4346 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4347 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4348 | 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] | 4349 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4350 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4351 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4352 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4353 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4354 | break; |
| 4355 | } |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4356 | |
| 4357 | case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4358 | mutex_lock(&pHddCtx->tdls_lock); |
| 4359 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4360 | if (!pHddTdlsCtx) { |
| 4361 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4362 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4363 | roamResult); |
| 4364 | status = QDF_STATUS_E_FAILURE; |
| 4365 | break; |
| 4366 | } |
| 4367 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4368 | status = hdd_tdls_connection_tracker_update(pAdapter, |
| 4369 | pRoamInfo, |
| 4370 | pHddTdlsCtx); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4371 | mutex_unlock(&pHddCtx->tdls_lock); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4372 | break; |
| 4373 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4374 | default: |
| 4375 | { |
| 4376 | break; |
| 4377 | } |
| 4378 | } |
| 4379 | |
| 4380 | return status; |
| 4381 | } |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4382 | #else |
| 4383 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4384 | inline QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4385 | uint8_t staId) |
| 4386 | { |
| 4387 | return QDF_STATUS_SUCCESS; |
| 4388 | } |
| 4389 | |
| 4390 | static inline QDF_STATUS |
| 4391 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 4392 | tCsrRoamInfo *pRoamInfo, |
| 4393 | uint32_t roamId, |
| 4394 | eRoamCmdStatus roamStatus, |
| 4395 | eCsrRoamResult roamResult) |
| 4396 | { |
| 4397 | return QDF_STATUS_SUCCESS; |
| 4398 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4399 | #endif |
| 4400 | |
| 4401 | #ifdef WLAN_FEATURE_11W |
| 4402 | /** |
| 4403 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
| 4404 | * @pAdapter: pointer to the adapter |
| 4405 | * @nFrameLength: Length of the unprotected frame being passed |
| 4406 | * @pbFrames: Pointer to the frame buffer |
| 4407 | * @frameType: 802.11 frame type |
| 4408 | * |
| 4409 | * This function forwards the unprotected management frame to the supplicant. |
| 4410 | * |
| 4411 | * Return: nothing |
| 4412 | */ |
| 4413 | static void |
| 4414 | hdd_indicate_unprot_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, |
| 4415 | uint8_t *pbFrames, uint8_t frameType) |
| 4416 | { |
| 4417 | uint8_t type = 0; |
| 4418 | uint8_t subType = 0; |
| 4419 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4420 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4421 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4422 | |
| 4423 | /* Sanity Checks */ |
| 4424 | if (NULL == pAdapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4425 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4426 | return; |
| 4427 | } |
| 4428 | |
| 4429 | if (NULL == pAdapter->dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4430 | hdd_err("pAdapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4431 | return; |
| 4432 | } |
| 4433 | |
| 4434 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4435 | hdd_err("pAdapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4436 | return; |
| 4437 | } |
| 4438 | |
| 4439 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4440 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4441 | return; |
| 4442 | } |
| 4443 | |
| 4444 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4445 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4446 | return; |
| 4447 | } |
| 4448 | |
| 4449 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4450 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4451 | |
| 4452 | /* Get pAdapter from Destination mac address of the frame */ |
| 4453 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4454 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4455 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4456 | nFrameLength); |
| 4457 | #else |
| 4458 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, |
| 4459 | nFrameLength); |
| 4460 | #endif |
| 4461 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4462 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4463 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4464 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4465 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4466 | nFrameLength); |
| 4467 | #else |
| 4468 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, |
| 4469 | nFrameLength); |
| 4470 | #endif |
| 4471 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4472 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4473 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4474 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4475 | return; |
| 4476 | } |
| 4477 | } |
| 4478 | #endif |
| 4479 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4480 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4481 | /** |
| 4482 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
| 4483 | * @pAdapter: pointer to adapter |
| 4484 | * @tid: traffic identifier |
| 4485 | * @state: state |
| 4486 | * @measInterval: measurement interval |
| 4487 | * |
| 4488 | * This function sends traffic stream metrics IE information to |
| 4489 | * the supplicant via wireless event. |
| 4490 | * |
| 4491 | * Return: none |
| 4492 | */ |
| 4493 | static void |
| 4494 | hdd_indicate_tsm_ie(hdd_adapter_t *pAdapter, uint8_t tid, |
| 4495 | uint8_t state, uint16_t measInterval) |
| 4496 | { |
| 4497 | union iwreq_data wrqu; |
| 4498 | char buf[IW_CUSTOM_MAX + 1]; |
| 4499 | int nBytes = 0; |
| 4500 | |
| 4501 | if (NULL == pAdapter) |
| 4502 | return; |
| 4503 | |
| 4504 | /* create the event */ |
| 4505 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4506 | memset(buf, '\0', sizeof(buf)); |
| 4507 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4508 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4509 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4510 | |
| 4511 | nBytes = |
| 4512 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4513 | measInterval); |
| 4514 | |
| 4515 | wrqu.data.pointer = buf; |
| 4516 | wrqu.data.length = nBytes; |
| 4517 | /* send the event */ |
| 4518 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4519 | } |
| 4520 | |
| 4521 | /** |
| 4522 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
| 4523 | * @pAdapter: pointer to adapter |
| 4524 | * @pRoamInfo: pointer to roam info |
| 4525 | * |
| 4526 | * This function sends cckm preauth indication to the supplicant |
| 4527 | * via wireless custom event. |
| 4528 | * |
| 4529 | * Return: none |
| 4530 | */ |
| 4531 | static void |
| 4532 | hdd_indicate_cckm_pre_auth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4533 | { |
| 4534 | union iwreq_data wrqu; |
| 4535 | char buf[IW_CUSTOM_MAX + 1]; |
| 4536 | char *pos = buf; |
| 4537 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4538 | |
| 4539 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4540 | return; |
| 4541 | |
| 4542 | /* create the event */ |
| 4543 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4544 | memset(buf, '\0', sizeof(buf)); |
| 4545 | |
| 4546 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4547 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4548 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 4549 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4550 | |
| 4551 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4552 | pos += nBytes; |
| 4553 | freeBytes -= nBytes; |
| 4554 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4555 | qdf_mem_copy(pos, pRoamInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4556 | pos += QDF_MAC_ADDR_SIZE; |
| 4557 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4558 | |
| 4559 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
| 4560 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4561 | freeBytes -= nBytes; |
| 4562 | |
| 4563 | wrqu.data.pointer = buf; |
| 4564 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4565 | |
| 4566 | /* send the event */ |
| 4567 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4568 | } |
| 4569 | |
| 4570 | /** |
| 4571 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
| 4572 | * @pAdapter: pointer to adapter |
| 4573 | * @pRoamInfo: pointer to roam info |
| 4574 | * |
| 4575 | * Return: none |
| 4576 | */ |
| 4577 | static void |
| 4578 | hdd_indicate_ese_adj_ap_rep_ind(hdd_adapter_t *pAdapter, |
| 4579 | tCsrRoamInfo *pRoamInfo) |
| 4580 | { |
| 4581 | union iwreq_data wrqu; |
| 4582 | char buf[IW_CUSTOM_MAX + 1]; |
| 4583 | int nBytes = 0; |
| 4584 | |
| 4585 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4586 | return; |
| 4587 | |
| 4588 | /* create the event */ |
| 4589 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4590 | memset(buf, '\0', sizeof(buf)); |
| 4591 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4592 | hdd_debug("CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4593 | |
| 4594 | nBytes = |
| 4595 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
| 4596 | pRoamInfo->tsmRoamDelay); |
| 4597 | |
| 4598 | wrqu.data.pointer = buf; |
| 4599 | wrqu.data.length = nBytes; |
| 4600 | |
| 4601 | /* send the event */ |
| 4602 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4603 | } |
| 4604 | |
| 4605 | /** |
| 4606 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
| 4607 | * @pAdapter: pointer to adapter |
| 4608 | * @measurementToken: measurement token |
| 4609 | * @flag: flag |
| 4610 | * @numBss: number of bss |
| 4611 | * |
| 4612 | * If the measurement is none and no scan results found, |
| 4613 | * indicate the supplicant about measurement done. |
| 4614 | * |
| 4615 | * Return: none |
| 4616 | */ |
| 4617 | void |
| 4618 | hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter, |
| 4619 | const uint16_t measurementToken, |
| 4620 | const bool flag, const uint8_t numBss) |
| 4621 | { |
| 4622 | union iwreq_data wrqu; |
| 4623 | char buf[IW_CUSTOM_MAX]; |
| 4624 | char *pos = buf; |
| 4625 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4626 | |
| 4627 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4628 | memset(buf, '\0', sizeof(buf)); |
| 4629 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4630 | hdd_debug("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4631 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4632 | |
| 4633 | nBytes = |
| 4634 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4635 | flag, numBss); |
| 4636 | |
| 4637 | wrqu.data.pointer = buf; |
| 4638 | wrqu.data.length = nBytes; |
| 4639 | /* send the event */ |
| 4640 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4641 | } |
| 4642 | |
| 4643 | /** |
| 4644 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
| 4645 | * @pAdapter: pointer to adapter |
| 4646 | * @pRoamInfo: pointer to roam info |
| 4647 | * |
| 4648 | * If the measurement is none and no scan results found, |
| 4649 | * indicate the supplicant about measurement done. |
| 4650 | * |
| 4651 | * Return: none |
| 4652 | */ |
| 4653 | static void |
| 4654 | hdd_indicate_ese_bcn_report_ind(const hdd_adapter_t *pAdapter, |
| 4655 | const tCsrRoamInfo *pRoamInfo) |
| 4656 | { |
| 4657 | union iwreq_data wrqu; |
| 4658 | char buf[IW_CUSTOM_MAX]; |
| 4659 | char *pos = buf; |
| 4660 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4661 | uint8_t i = 0, len = 0; |
| 4662 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4663 | uint8_t lastSent = 0, sendBss = 0; |
| 4664 | int bcnRepFieldSize = |
| 4665 | sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0]. |
| 4666 | bcnReportFields); |
| 4667 | uint8_t ieLenByte = 1; |
| 4668 | /* |
| 4669 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4670 | */ |
| 4671 | #define ESEBCNREPHEADER_LEN (18) |
| 4672 | |
| 4673 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4674 | return; |
| 4675 | |
| 4676 | /* |
| 4677 | * Custom event can pass maximum of 256 bytes of data, |
| 4678 | * based on the IE len we need to identify how many BSS info can |
| 4679 | * be filled in to custom event data. |
| 4680 | */ |
| 4681 | /* |
| 4682 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4683 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4684 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4685 | */ |
| 4686 | |
| 4687 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) |
| 4688 | && (!pRoamInfo->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4689 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4690 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4691 | * indicate the supplicant about measurement done |
| 4692 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4693 | hdd_indicate_ese_bcn_report_no_results( |
| 4694 | pAdapter, |
| 4695 | pRoamInfo->pEseBcnReportRsp-> |
| 4696 | measurementToken, |
| 4697 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4698 | pRoamInfo->pEseBcnReportRsp->numBss); |
| 4699 | } else { |
| 4700 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) { |
| 4701 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4702 | memset(buf, '\0', sizeof(buf)); |
| 4703 | tot_bcn_ieLen = 0; |
| 4704 | sendBss = 0; |
| 4705 | pos = buf; |
| 4706 | freeBytes = IW_CUSTOM_MAX; |
| 4707 | |
| 4708 | for (i = lastSent; |
| 4709 | i < pRoamInfo->pEseBcnReportRsp->numBss; i++) { |
| 4710 | len = |
| 4711 | bcnRepFieldSize + ieLenByte + |
| 4712 | pRoamInfo->pEseBcnReportRsp-> |
| 4713 | bcnRepBssInfo[i].ieLen; |
| 4714 | if ((len + tot_bcn_ieLen) > |
| 4715 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4716 | break; |
| 4717 | } |
| 4718 | tot_bcn_ieLen += len; |
| 4719 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4720 | 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] | 4721 | i, bcnRepFieldSize, 1, |
| 4722 | pRoamInfo->pEseBcnReportRsp-> |
| 4723 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4724 | } |
| 4725 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4726 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4727 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4728 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4729 | pRoamInfo->pEseBcnReportRsp->flag, sendBss, |
| 4730 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4731 | |
| 4732 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
| 4733 | pRoamInfo->pEseBcnReportRsp-> |
| 4734 | measurementToken, |
| 4735 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4736 | sendBss); |
| 4737 | pos += nBytes; |
| 4738 | freeBytes -= nBytes; |
| 4739 | |
| 4740 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4741 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4742 | sizeof(tot_bcn_ieLen)); |
| 4743 | pos += sizeof(tot_bcn_ieLen); |
| 4744 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4745 | |
| 4746 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4747 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4748 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4749 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4750 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
| 4751 | pRoamInfo->pEseBcnReportRsp-> |
| 4752 | bcnRepBssInfo[i + |
| 4753 | lastSent].bcnReportFields. |
| 4754 | ChanNum, |
| 4755 | pRoamInfo->pEseBcnReportRsp-> |
| 4756 | bcnRepBssInfo[i + |
| 4757 | lastSent].bcnReportFields. |
| 4758 | Spare, |
| 4759 | pRoamInfo->pEseBcnReportRsp-> |
| 4760 | bcnRepBssInfo[i + |
| 4761 | lastSent].bcnReportFields. |
| 4762 | MeasDuration, |
| 4763 | pRoamInfo->pEseBcnReportRsp-> |
| 4764 | bcnRepBssInfo[i + |
| 4765 | lastSent].bcnReportFields. |
| 4766 | PhyType, |
| 4767 | pRoamInfo->pEseBcnReportRsp-> |
| 4768 | bcnRepBssInfo[i + |
| 4769 | lastSent].bcnReportFields. |
| 4770 | RecvSigPower, |
| 4771 | pRoamInfo->pEseBcnReportRsp-> |
| 4772 | bcnRepBssInfo[i + |
| 4773 | lastSent].bcnReportFields. |
| 4774 | ParentTsf, |
| 4775 | pRoamInfo->pEseBcnReportRsp-> |
| 4776 | bcnRepBssInfo[i + |
| 4777 | lastSent].bcnReportFields. |
| 4778 | TargetTsf[0], |
| 4779 | pRoamInfo->pEseBcnReportRsp-> |
| 4780 | bcnRepBssInfo[i + |
| 4781 | lastSent].bcnReportFields. |
| 4782 | TargetTsf[1], |
| 4783 | pRoamInfo->pEseBcnReportRsp-> |
| 4784 | bcnRepBssInfo[i + |
| 4785 | lastSent].bcnReportFields. |
| 4786 | BcnInterval, |
| 4787 | pRoamInfo->pEseBcnReportRsp-> |
| 4788 | bcnRepBssInfo[i + |
| 4789 | lastSent].bcnReportFields. |
| 4790 | CapabilityInfo, |
| 4791 | pRoamInfo->pEseBcnReportRsp-> |
| 4792 | bcnRepBssInfo[i + |
| 4793 | lastSent].bcnReportFields. |
| 4794 | Bssid[0], |
| 4795 | pRoamInfo->pEseBcnReportRsp-> |
| 4796 | bcnRepBssInfo[i + |
| 4797 | lastSent].bcnReportFields. |
| 4798 | Bssid[1], |
| 4799 | pRoamInfo->pEseBcnReportRsp-> |
| 4800 | bcnRepBssInfo[i + |
| 4801 | lastSent].bcnReportFields. |
| 4802 | Bssid[2], |
| 4803 | pRoamInfo->pEseBcnReportRsp-> |
| 4804 | bcnRepBssInfo[i + |
| 4805 | lastSent].bcnReportFields. |
| 4806 | Bssid[3], |
| 4807 | pRoamInfo->pEseBcnReportRsp-> |
| 4808 | bcnRepBssInfo[i + |
| 4809 | lastSent].bcnReportFields. |
| 4810 | Bssid[4], |
| 4811 | pRoamInfo->pEseBcnReportRsp-> |
| 4812 | bcnRepBssInfo[i + |
| 4813 | lastSent].bcnReportFields. |
| 4814 | Bssid[5]); |
| 4815 | |
| 4816 | /* bcn report fields are copied */ |
| 4817 | len = |
| 4818 | sizeof(pRoamInfo->pEseBcnReportRsp-> |
| 4819 | bcnRepBssInfo[i + |
| 4820 | lastSent]. |
| 4821 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4822 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4823 | (char *)&pRoamInfo-> |
| 4824 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4825 | lastSent]. |
| 4826 | bcnReportFields, len); |
| 4827 | pos += len; |
| 4828 | freeBytes -= len; |
| 4829 | |
| 4830 | /* Add 1 byte of ie len */ |
| 4831 | len = |
| 4832 | pRoamInfo->pEseBcnReportRsp-> |
| 4833 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4834 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4835 | pos += sizeof(len); |
| 4836 | freeBytes -= sizeof(len); |
| 4837 | |
| 4838 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4839 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4840 | (char *)pRoamInfo-> |
| 4841 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4842 | lastSent]. |
| 4843 | pBuf, len); |
| 4844 | pos += len; |
| 4845 | freeBytes -= len; |
| 4846 | } |
| 4847 | |
| 4848 | wrqu.data.pointer = buf; |
| 4849 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4850 | |
| 4851 | /* send the event */ |
| 4852 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, |
| 4853 | buf); |
| 4854 | lastSent += sendBss; |
| 4855 | } |
| 4856 | } |
| 4857 | } |
| 4858 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4859 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4860 | |
| 4861 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4862 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
| 4863 | * @pHddStaCtx: Station Context |
| 4864 | * |
| 4865 | * API to check if the connection authentication type is 8021x_sha256. |
| 4866 | * |
| 4867 | * Return: bool |
| 4868 | */ |
| 4869 | #ifdef WLAN_FEATURE_11W |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 4870 | static inline bool hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *pHddStaCtx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4871 | { |
| 4872 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 4873 | pHddStaCtx->conn_info.authType; |
| 4874 | } |
| 4875 | #else |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 4876 | static inline bool hdd_is_8021x_sha256_auth_type(struct hdd_station_ctx *pHddStaCtx) |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4877 | { |
| 4878 | return false; |
| 4879 | } |
| 4880 | #endif |
| 4881 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4882 | /* |
| 4883 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4884 | * @adapter: Pointer to adapter context |
| 4885 | * @roam_info: Pointer to roam info |
| 4886 | * |
| 4887 | * Return: None |
| 4888 | */ |
| 4889 | static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter, |
| 4890 | tCsrRoamInfo *roam_info) |
| 4891 | { |
| 4892 | struct hdd_chan_change_params chan_change; |
| 4893 | struct cfg80211_bss *bss; |
| 4894 | struct net_device *dev = adapter->dev; |
| 4895 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4896 | struct wiphy *wiphy = wdev->wiphy; |
| 4897 | QDF_STATUS status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4898 | struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4899 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4900 | hdd_debug("channel switch for session:%d to channel:%d", |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4901 | adapter->sessionId, roam_info->chan_info.chan_id); |
| 4902 | |
| 4903 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4904 | chan_change.chan_params.ch_width = |
| 4905 | roam_info->chan_info.ch_width; |
| 4906 | chan_change.chan_params.sec_ch_offset = |
| 4907 | roam_info->chan_info.sec_ch_offset; |
| 4908 | chan_change.chan_params.center_freq_seg0 = |
| 4909 | roam_info->chan_info.band_center_freq1; |
| 4910 | chan_change.chan_params.center_freq_seg1 = |
| 4911 | roam_info->chan_info.band_center_freq2; |
| 4912 | |
| 4913 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4914 | if (NULL == bss) |
| 4915 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4916 | else |
| 4917 | cfg80211_put_bss(wiphy, bss); |
| 4918 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4919 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4920 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4921 | if (QDF_IS_STATUS_ERROR(status)) |
| 4922 | hdd_err("channel change notification failed"); |
| 4923 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4924 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->hdd_psoc, |
| 4925 | adapter->sessionId); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4926 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4927 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4928 | } |
| 4929 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4930 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4931 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4932 | * @pContext: pointer to adapter context |
| 4933 | * @pRoamInfo: pointer to roam info |
| 4934 | * @roamId: roam id |
| 4935 | * @roamStatus: roam status |
| 4936 | * @roamResult: roam result |
| 4937 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4938 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4939 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4940 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4941 | hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 4942 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4943 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4944 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4945 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 4946 | hdd_wext_state_t *pWextState = NULL; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 4947 | struct hdd_station_ctx *pHddStaCtx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4948 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4949 | struct cfg80211_bss *bss_status; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 4950 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4951 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4952 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4953 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4954 | |
| 4955 | /* Sanity check */ |
| 4956 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4957 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4958 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4959 | } |
| 4960 | |
| 4961 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4962 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4963 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4964 | |
Sreelakshmi Konamki | 075431a | 2017-03-16 15:23:30 +0530 | [diff] [blame] | 4965 | /* Omitting eCSR_ROAM_UPDATE_SCAN_RESULT as this is too frequent */ |
| 4966 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4967 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4968 | pAdapter->sessionId, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4969 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4970 | switch (roamStatus) { |
| 4971 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 6f3a865 | 2015-09-25 10:58:15 +0530 | [diff] [blame] | 4972 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4973 | complete(&pAdapter->session_open_comp_var); |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 4974 | hdd_debug("session %d opened", pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4975 | break; |
| 4976 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4977 | /* |
| 4978 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4979 | * reassoc failed due to failure, timeout, reject from ap |
| 4980 | * in any case tell the OS, our carrier is off and mark |
| 4981 | * interface down. |
| 4982 | */ |
| 4983 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4984 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
| 4985 | roamStatus, roamResult, pAdapter->sessionId); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4986 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4987 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4988 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4989 | pHddStaCtx->ft_carrier_on = false; |
| 4990 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4991 | hdd_debug("hdd_ReassocScenario set to: %d, ReAssoc Failed, session: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4992 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4993 | break; |
| 4994 | |
| 4995 | case eCSR_ROAM_FT_START: |
| 4996 | /* |
| 4997 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4998 | * informed that the link is down. So mark the link ready for |
| 4999 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 5000 | * be received. Where in we will not mark the link down |
| 5001 | * Also we want to stop tx at this point when we will be |
| 5002 | * doing disassoc at this time. This saves 30-60 msec |
| 5003 | * after reassoc. |
| 5004 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5005 | hdd_info("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5006 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5007 | hdd_napi_serialize(1); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 5008 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5009 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 5010 | WLAN_CONTROL_PATH); |
| 5011 | status = hdd_roam_deregister_sta(pAdapter, |
| 5012 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5013 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5014 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5015 | pHddStaCtx->ft_carrier_on = true; |
| 5016 | pHddStaCtx->hdd_ReassocScenario = true; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5017 | hdd_info("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
| 5018 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5019 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5020 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5021 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5022 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5023 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5024 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
| 5025 | pAdapter->roam_ho_fail = true; |
| 5026 | else |
| 5027 | pAdapter->roam_ho_fail = false; |
| 5028 | complete(&pAdapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5029 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5030 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5031 | /* notify apps that we can't pass traffic anymore */ |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 5032 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5033 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5034 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5035 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5036 | if (pHddStaCtx->ft_carrier_on == false) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5037 | wlan_hdd_netif_queue_control(pAdapter, |
| 5038 | WLAN_NETIF_CARRIER_OFF, |
| 5039 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5040 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5041 | break; |
| 5042 | case eCSR_ROAM_LOSTLINK: |
| 5043 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5044 | hdd_debug("Roaming started due to connection lost"); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5045 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5046 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5047 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5048 | WLAN_CONTROL_PATH); |
| 5049 | break; |
| 5050 | } |
| 5051 | case eCSR_ROAM_DISASSOCIATED: |
| 5052 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5053 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5054 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 5055 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5056 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5057 | pAdapter->roam_ho_fail = false; |
| 5058 | complete(&pAdapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5059 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5060 | /* Call to clear any MC Addr List filter applied after |
| 5061 | * successful connection. |
| 5062 | */ |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 5063 | hdd_disable_and_flush_mc_addr_list(pAdapter, |
| 5064 | pmo_peer_disconnect); |
| 5065 | qdf_ret_status = |
| 5066 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 5067 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5068 | } |
| 5069 | break; |
| 5070 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5071 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
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_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 5074 | roamStatus, roamResult); |
| 5075 | break; |
| 5076 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5077 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5078 | /* |
| 5079 | * To Do - address probable memory leak with WEP encryption upon |
| 5080 | * successful association. |
| 5081 | */ |
| 5082 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 5083 | /* Clear saved connection information in HDD */ |
| 5084 | hdd_conn_remove_connect_info( |
| 5085 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 5086 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5087 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5088 | hdd_association_completion_handler(pAdapter, pRoamInfo, |
| 5089 | roamId, roamStatus, |
| 5090 | roamResult); |
| 5091 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5092 | if (pRoamInfo) |
| 5093 | pRoamInfo->roamSynchInProgress = false; |
| 5094 | #endif |
| 5095 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 5096 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5097 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5098 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5099 | qdf_ret_status = hdd_association_completion_handler(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5100 | pRoamInfo, |
| 5101 | roamId, |
| 5102 | roamStatus, |
| 5103 | roamResult); |
| 5104 | break; |
| 5105 | case eCSR_ROAM_IBSS_IND: |
| 5106 | hdd_roam_ibss_indication_handler(pAdapter, pRoamInfo, roamId, |
| 5107 | roamStatus, roamResult); |
| 5108 | break; |
| 5109 | |
| 5110 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5111 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5112 | roam_roam_connect_status_update_handler(pAdapter, |
| 5113 | pRoamInfo, |
| 5114 | roamId, |
| 5115 | roamStatus, |
| 5116 | roamResult); |
| 5117 | break; |
| 5118 | |
| 5119 | case eCSR_ROAM_MIC_ERROR_IND: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5120 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5121 | hdd_roam_mic_error_indication_handler(pAdapter, |
| 5122 | pRoamInfo, |
| 5123 | roamId, |
| 5124 | roamStatus, |
| 5125 | roamResult); |
| 5126 | break; |
| 5127 | |
| 5128 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 5129 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5130 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5131 | hdd_roam_set_key_complete_handler(pAdapter, pRoamInfo, |
| 5132 | roamId, roamStatus, |
| 5133 | roamResult); |
| 5134 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
| 5135 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5136 | hdd_debug("hdd_ReassocScenario set to: %d, set key complete, session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5137 | pHddStaCtx->hdd_ReassocScenario, |
| 5138 | pAdapter->sessionId); |
| 5139 | } |
| 5140 | } |
| 5141 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5142 | if (pRoamInfo != NULL) |
| 5143 | pRoamInfo->roamSynchInProgress = false; |
| 5144 | #endif |
| 5145 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5146 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5147 | case eCSR_ROAM_FT_RESPONSE: |
| 5148 | hdd_send_ft_event(pAdapter); |
| 5149 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5150 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5151 | case eCSR_ROAM_PMK_NOTIFY: |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 5152 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType |
| 5153 | || hdd_is_8021x_sha256_auth_type(pHddStaCtx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5154 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5155 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5156 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
| 5157 | pAdapter, pRoamInfo, 1, false); |
| 5158 | } |
| 5159 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5160 | |
| 5161 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 5162 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 5163 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5164 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5165 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, |
| 5166 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5167 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5168 | } |
| 5169 | break; |
| 5170 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 5171 | /* |
| 5172 | * This event will notify pre-auth completion in case of success |
| 5173 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5174 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5175 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5176 | pRoamInfo, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5177 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5178 | } |
| 5179 | break; |
| 5180 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 5181 | /* |
| 5182 | * This event will notify pre-auth completion incase of failure. |
| 5183 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5184 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5185 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5186 | pRoamInfo, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5187 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5188 | } |
| 5189 | break; |
| 5190 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 5191 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 5192 | * It will be only invoked on success |
| 5193 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5194 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5195 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, |
| 5196 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5197 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5198 | } |
| 5199 | break; |
| 5200 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5201 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 5202 | hdd_remain_chan_ready_handler(pAdapter, pRoamInfo->roc_scan_id); |
| 5203 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5204 | #ifdef FEATURE_WLAN_TDLS |
| 5205 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5206 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5207 | hdd_roam_tdls_status_update_handler(pAdapter, pRoamInfo, |
| 5208 | roamId, |
| 5209 | roamStatus, |
| 5210 | roamResult); |
| 5211 | break; |
| 5212 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 5213 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, |
| 5214 | pRoamInfo->reasonCode); |
| 5215 | break; |
| 5216 | #endif |
| 5217 | #ifdef WLAN_FEATURE_11W |
| 5218 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 5219 | hdd_indicate_unprot_mgmt_frame(pAdapter, |
| 5220 | pRoamInfo->nFrameLength, |
| 5221 | pRoamInfo->pbFrames, |
| 5222 | pRoamInfo->frameType); |
| 5223 | break; |
| 5224 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5225 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5226 | case eCSR_ROAM_TSM_IE_IND: |
| 5227 | hdd_indicate_tsm_ie(pAdapter, pRoamInfo->tsmIe.tsid, |
| 5228 | pRoamInfo->tsmIe.state, |
| 5229 | pRoamInfo->tsmIe.msmt_interval); |
| 5230 | break; |
| 5231 | |
| 5232 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 5233 | { |
| 5234 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
| 5235 | pHddStaCtx->conn_info.authType |
| 5236 | || eCSR_AUTH_TYPE_CCKM_RSN == |
| 5237 | pHddStaCtx->conn_info.authType) { |
| 5238 | hdd_indicate_cckm_pre_auth(pAdapter, pRoamInfo); |
| 5239 | } |
| 5240 | break; |
| 5241 | } |
| 5242 | |
| 5243 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 5244 | { |
| 5245 | hdd_indicate_ese_adj_ap_rep_ind(pAdapter, pRoamInfo); |
| 5246 | break; |
| 5247 | } |
| 5248 | |
| 5249 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 5250 | { |
| 5251 | hdd_indicate_ese_bcn_report_ind(pAdapter, pRoamInfo); |
| 5252 | break; |
| 5253 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5254 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5255 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5256 | hdd_roam_channel_switch_handler(pAdapter, pRoamInfo); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5257 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5258 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5259 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 5260 | if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { |
| 5261 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
| 5262 | pAdapter, pRoamInfo->pBssDesc); |
| 5263 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5264 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5265 | else |
| 5266 | cfg80211_put_bss( |
| 5267 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 5268 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 5269 | #endif |
| 5270 | bss_status); |
| 5271 | } |
| 5272 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 5273 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
| 5274 | hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, |
| 5275 | roamResult); |
| 5276 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5277 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5278 | hdd_debug("Process ROAM_START from firmware"); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5279 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5280 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5281 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5282 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5283 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5284 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 5285 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5286 | break; |
| 5287 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5288 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5289 | hdd_napi_serialize(0); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5290 | wlan_hdd_netif_queue_control(pAdapter, |
| 5291 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 5292 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5293 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5294 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5295 | pAdapter->roam_ho_fail = false; |
| 5296 | complete(&pAdapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5297 | break; |
| 5298 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5299 | default: |
| 5300 | break; |
| 5301 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5302 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5303 | } |
| 5304 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5305 | #ifdef WLAN_FEATURE_FILS_SK |
| 5306 | /** |
| 5307 | * hdd_translate_fils_rsn_to_csr_auth() - Translate FILS RSN to CSR auth type |
| 5308 | * @auth_suite: auth suite |
| 5309 | * @auth_type: pointer to eCsrAuthType |
| 5310 | * |
| 5311 | * Return: None |
| 5312 | */ |
| 5313 | static void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5314 | eCsrAuthType *auth_type) |
| 5315 | { |
| 5316 | if (!memcmp(auth_suite, ccp_rsn_oui_0e, 4)) |
| 5317 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA256; |
| 5318 | else if (!memcmp(auth_suite, ccp_rsn_oui_0f, 4)) |
| 5319 | *auth_type = eCSR_AUTH_TYPE_FILS_SHA384; |
| 5320 | else if (!memcmp(auth_suite, ccp_rsn_oui_10, 4)) |
| 5321 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA256; |
| 5322 | else if (!memcmp(auth_suite, ccp_rsn_oui_11, 4)) |
| 5323 | *auth_type = eCSR_AUTH_TYPE_FT_FILS_SHA384; |
| 5324 | } |
| 5325 | #else |
| 5326 | static inline void hdd_translate_fils_rsn_to_csr_auth(int8_t auth_suite[4], |
| 5327 | eCsrAuthType *auth_type) |
| 5328 | { |
| 5329 | } |
| 5330 | #endif |
| 5331 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5332 | /** |
| 5333 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5334 | * @auth_suite: auth suite |
| 5335 | * |
| 5336 | * Return: eCsrAuthType enumeration |
| 5337 | */ |
| 5338 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5339 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5340 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5341 | /* is the auth type supported? */ |
| 5342 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5343 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5344 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5345 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5346 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5347 | /* Check for 11r FT Authentication with PSK */ |
| 5348 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5349 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5350 | /* Check for 11R FT Authentication with 802.1X */ |
| 5351 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5352 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5353 | #ifdef FEATURE_WLAN_ESE |
| 5354 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5355 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5356 | } else |
| 5357 | #endif /* FEATURE_WLAN_ESE */ |
| 5358 | #ifdef WLAN_FEATURE_11W |
| 5359 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5360 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5361 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5362 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5363 | } else |
| 5364 | #endif |
| 5365 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5366 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5367 | } |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5368 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5369 | return auth_type; |
| 5370 | } |
| 5371 | |
| 5372 | /** |
| 5373 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5374 | * @auth_suite: auth suite |
| 5375 | * |
| 5376 | * Return: eCsrAuthType enumeration |
| 5377 | */ |
| 5378 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5379 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5380 | eCsrAuthType auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5381 | /* is the auth type supported? */ |
| 5382 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5383 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5384 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5385 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5386 | } else |
| 5387 | #ifdef FEATURE_WLAN_ESE |
| 5388 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5389 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5390 | } else |
| 5391 | #endif /* FEATURE_WLAN_ESE */ |
| 5392 | { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5393 | hdd_translate_fils_rsn_to_csr_auth(auth_suite, &auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5394 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5395 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5396 | return auth_type; |
| 5397 | } |
| 5398 | |
| 5399 | /** |
| 5400 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5401 | * Translate RSN to CSR encryption type |
| 5402 | * @cipher_suite: cipher suite |
| 5403 | * |
| 5404 | * Return: eCsrEncryptionType enumeration |
| 5405 | */ |
| 5406 | eCsrEncryptionType |
| 5407 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5408 | { |
| 5409 | eCsrEncryptionType cipher_type; |
| 5410 | |
| 5411 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5412 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5413 | else if (memcmp(cipher_suite, ccp_rsn_oui09, 4) == 0) |
| 5414 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP; |
| 5415 | else if (memcmp(cipher_suite, ccp_rsn_oui0a, 4) == 0) |
| 5416 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5417 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5418 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5419 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5420 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5421 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5422 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5423 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5424 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5425 | else |
| 5426 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5427 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5428 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5429 | return cipher_type; |
| 5430 | } |
| 5431 | |
| 5432 | /** |
| 5433 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5434 | * Translate WPA to CSR encryption type |
| 5435 | * @cipher_suite: cipher suite |
| 5436 | * |
| 5437 | * Return: eCsrEncryptionType enumeration |
| 5438 | */ |
| 5439 | eCsrEncryptionType |
| 5440 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5441 | { |
| 5442 | eCsrEncryptionType cipher_type; |
| 5443 | |
| 5444 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5445 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5446 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5447 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5448 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5449 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5450 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5451 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5452 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5453 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5454 | else |
| 5455 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5456 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5457 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5458 | return cipher_type; |
| 5459 | } |
| 5460 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5461 | #ifdef WLAN_FEATURE_FILS_SK |
| 5462 | /* |
| 5463 | * hdd_is_fils_connection: API to determine if connection is FILS |
| 5464 | * @adapter: hdd adapter |
| 5465 | * |
| 5466 | * Return: true if fils connection else false |
| 5467 | */ |
| 5468 | static inline bool hdd_is_fils_connection(hdd_adapter_t *adapter) |
| 5469 | { |
| 5470 | hdd_wext_state_t *wext_state = WLAN_HDD_GET_WEXT_STATE_PTR(adapter); |
| 5471 | |
| 5472 | if (wext_state->roamProfile.fils_con_info) |
| 5473 | return wext_state->roamProfile. |
| 5474 | fils_con_info->is_fils_connection; |
| 5475 | } |
| 5476 | #else |
| 5477 | static inline bool hdd_is_fils_connection(hdd_adapter_t *adapter) |
| 5478 | { |
| 5479 | return false; |
| 5480 | } |
| 5481 | #endif |
| 5482 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5483 | /** |
| 5484 | * hdd_process_genie() - process gen ie |
| 5485 | * @pAdapter: pointer to adapter |
| 5486 | * @bssid: pointer to mac address |
| 5487 | * @pEncryptType: pointer to encryption type |
| 5488 | * @mcEncryptType: pointer to multicast encryption type |
| 5489 | * @pAuthType: pointer to auth type |
| 5490 | * |
| 5491 | * Return: 0 on success, error number otherwise |
| 5492 | */ |
| 5493 | static int32_t hdd_process_genie(hdd_adapter_t *pAdapter, |
| 5494 | u8 *bssid, |
| 5495 | eCsrEncryptionType *pEncryptType, |
| 5496 | eCsrEncryptionType *mcEncryptType, |
| 5497 | eCsrAuthType *pAuthType, |
| 5498 | #ifdef WLAN_FEATURE_11W |
| 5499 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5500 | #endif |
| 5501 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5502 | { |
| 5503 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5504 | tDot11fIERSN dot11RSNIE; |
| 5505 | tDot11fIEWPA dot11WPAIE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5506 | uint8_t *pRsnIe; |
| 5507 | uint16_t RSNIeLen; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5508 | |
| 5509 | /* |
| 5510 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5511 | * setting present flag to 0. |
| 5512 | */ |
| 5513 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5514 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5515 | |
| 5516 | /* Type check */ |
| 5517 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5518 | /* Validity checks */ |
| 5519 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5520 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5521 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5522 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5523 | return -EINVAL; |
| 5524 | } |
| 5525 | /* Skip past the EID byte and length byte */ |
| 5526 | pRsnIe = gen_ie + 2; |
| 5527 | RSNIeLen = gen_ie_len - 2; |
| 5528 | /* Unpack the RSN IE */ |
| 5529 | dot11f_unpack_ie_rsn((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5530 | pRsnIe, RSNIeLen, &dot11RSNIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5531 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5532 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5533 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5534 | hdd_debug("authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5535 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5536 | /* dot11RSNIE.akm_suite_count */ |
| 5537 | /* Just translate the FIRST one */ |
| 5538 | *pAuthType = |
| 5539 | hdd_translate_rsn_to_csr_auth_type( |
| 5540 | dot11RSNIE.akm_suites[0]); |
| 5541 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5542 | *pEncryptType = |
| 5543 | hdd_translate_rsn_to_csr_encryption_type( |
| 5544 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5545 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5546 | *mcEncryptType = |
| 5547 | hdd_translate_rsn_to_csr_encryption_type( |
| 5548 | dot11RSNIE.gp_cipher_suite); |
| 5549 | #ifdef WLAN_FEATURE_11W |
| 5550 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 5551 | *pMfpCapable = csr_is_mfpc_capable(&dot11RSNIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5552 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5553 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5554 | /* Validity checks */ |
| 5555 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5556 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5557 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5558 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5559 | return -EINVAL; |
| 5560 | } |
| 5561 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5562 | pRsnIe = gen_ie + 2 + 4; |
| 5563 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5564 | /* Unpack the WPA IE */ |
| 5565 | dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5566 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5567 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5568 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5569 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5570 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5571 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5572 | /* dot11WPAIE.auth_suite_count */ |
| 5573 | /* Just translate the FIRST one */ |
| 5574 | *pAuthType = |
| 5575 | hdd_translate_wpa_to_csr_auth_type( |
| 5576 | dot11WPAIE.auth_suites[0]); |
| 5577 | /* dot11WPAIE.unicast_cipher_count */ |
| 5578 | *pEncryptType = |
| 5579 | hdd_translate_wpa_to_csr_encryption_type( |
| 5580 | dot11WPAIE.unicast_ciphers[0]); |
| 5581 | /* dot11WPAIE.unicast_cipher_count */ |
| 5582 | *mcEncryptType = |
| 5583 | hdd_translate_wpa_to_csr_encryption_type( |
| 5584 | dot11WPAIE.multicast_cipher); |
| 5585 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5586 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5587 | return -EINVAL; |
| 5588 | } |
| 5589 | return 0; |
| 5590 | } |
| 5591 | |
| 5592 | /** |
| 5593 | * hdd_set_genie_to_csr() - set genie to csr |
| 5594 | * @pAdapter: pointer to adapter |
| 5595 | * @RSNAuthType: pointer to auth type |
| 5596 | * |
| 5597 | * Return: 0 on success, error number otherwise |
| 5598 | */ |
| 5599 | int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 5600 | { |
| 5601 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5602 | uint32_t status = 0; |
| 5603 | eCsrEncryptionType RSNEncryptType; |
| 5604 | eCsrEncryptionType mcRSNEncryptType; |
| 5605 | #ifdef WLAN_FEATURE_11W |
| 5606 | uint8_t RSNMfpRequired = 0; |
| 5607 | uint8_t RSNMfpCapable = 0; |
| 5608 | #endif |
| 5609 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5610 | /* MAC address of assoc peer */ |
| 5611 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5612 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5613 | pWextState->roamProfile.BSSIDs.bssid, |
| 5614 | sizeof(bssid)); |
| 5615 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5616 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5617 | /* continue */ |
| 5618 | } else { |
| 5619 | return 0; |
| 5620 | } |
| 5621 | /* The actual processing may eventually be more extensive than this. */ |
| 5622 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
| 5623 | status = hdd_process_genie(pAdapter, bssid, |
| 5624 | &RSNEncryptType, |
| 5625 | &mcRSNEncryptType, RSNAuthType, |
| 5626 | #ifdef WLAN_FEATURE_11W |
| 5627 | &RSNMfpRequired, &RSNMfpCapable, |
| 5628 | #endif |
| 5629 | pWextState->WPARSNIE[1] + 2, |
| 5630 | pWextState->WPARSNIE); |
| 5631 | if (status == 0) { |
| 5632 | /* |
| 5633 | * Now copy over all the security attributes |
| 5634 | * you have parsed out. |
| 5635 | */ |
| 5636 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5637 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5638 | |
| 5639 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; /* Use the cipher type in the RSN IE */ |
| 5640 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5641 | mcRSNEncryptType; |
| 5642 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5643 | if ((QDF_IBSS_MODE == pAdapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5644 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5645 | (eCSR_ENCRYPT_TYPE_AES_GCMP == mcRSNEncryptType) || |
| 5646 | (eCSR_ENCRYPT_TYPE_AES_GCMP_256 == mcRSNEncryptType) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5647 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5648 | /* |
| 5649 | * For wpa none supplicant sends the WPA IE with unicast |
| 5650 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5651 | * multicast cipher as either AES/TKIP based on group |
| 5652 | * cipher configuration mentioned in the |
| 5653 | * wpa_supplicant.conf. |
| 5654 | */ |
| 5655 | |
| 5656 | /* Set the unicast cipher same as multicast cipher */ |
| 5657 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5658 | = mcRSNEncryptType; |
| 5659 | } |
| 5660 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5661 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5662 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5663 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5664 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5665 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5666 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5667 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5668 | } |
| 5669 | return 0; |
| 5670 | } |
| 5671 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5672 | #ifdef WLAN_FEATURE_FILS_SK |
| 5673 | /** |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5674 | * hdd_check_fils_rsn_n_set_auth_type() - This API checks whether a give |
| 5675 | * auth type is fils if yes, sets it in profile. |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5676 | * @rsn_auth_type: auth type |
| 5677 | * |
| 5678 | * Return: true if FILS auth else false |
| 5679 | */ |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5680 | static bool hdd_check_fils_rsn_n_set_auth_type(tCsrRoamProfile *roam_profile, |
| 5681 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5682 | { |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5683 | bool is_fils_rsn = false; |
| 5684 | |
| 5685 | if (!roam_profile->fils_con_info) |
| 5686 | return false; |
| 5687 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5688 | if ((rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA256) || |
| 5689 | (rsn_auth_type == eCSR_AUTH_TYPE_FILS_SHA384) || |
| 5690 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA256) || |
| 5691 | (rsn_auth_type == eCSR_AUTH_TYPE_FT_FILS_SHA384)) |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5692 | is_fils_rsn = true; |
| 5693 | if (is_fils_rsn) |
| 5694 | roam_profile->fils_con_info->akm_type = rsn_auth_type; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5695 | |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5696 | return is_fils_rsn; |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5697 | } |
| 5698 | #else |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5699 | static bool hdd_check_fils_rsn_n_set_auth_type(tCsrRoamProfile *roam_profile, |
| 5700 | eCsrAuthType rsn_auth_type) |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5701 | { |
| 5702 | return false; |
| 5703 | } |
| 5704 | #endif |
| 5705 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5706 | /** |
| 5707 | * hdd_set_csr_auth_type() - set csr auth type |
| 5708 | * @pAdapter: pointer to adapter |
| 5709 | * @RSNAuthType: auth type |
| 5710 | * |
| 5711 | * Return: 0 on success, error number otherwise |
| 5712 | */ |
| 5713 | int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 5714 | { |
| 5715 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5716 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 5717 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5718 | |
| 5719 | pRoamProfile->AuthType.numEntries = 1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5720 | hdd_debug("pHddStaCtx->conn_info.authType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5721 | pHddStaCtx->conn_info.authType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5722 | |
| 5723 | switch (pHddStaCtx->conn_info.authType) { |
| 5724 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5725 | #ifdef FEATURE_WLAN_ESE |
| 5726 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5727 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5728 | #endif |
| 5729 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 5730 | |
| 5731 | pRoamProfile->AuthType.authType[0] = |
| 5732 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5733 | } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 5734 | |
| 5735 | #ifdef FEATURE_WLAN_ESE |
| 5736 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5737 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5738 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5739 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5740 | pRoamProfile->AuthType.authType[0] = |
| 5741 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5742 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5743 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5744 | pRoamProfile->AuthType.authType[0] = |
| 5745 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5746 | } else |
| 5747 | #endif |
| 5748 | if ((pWextState-> |
| 5749 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5750 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5751 | pRoamProfile->AuthType.authType[0] = |
| 5752 | eCSR_AUTH_TYPE_WPA; |
| 5753 | } else |
| 5754 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5755 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5756 | pRoamProfile->AuthType.authType[0] = |
| 5757 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5758 | } else { |
| 5759 | pRoamProfile->AuthType.authType[0] = |
| 5760 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5761 | } |
| 5762 | } |
| 5763 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 5764 | #ifdef FEATURE_WLAN_ESE |
| 5765 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5766 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5767 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5768 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5769 | pRoamProfile->AuthType.authType[0] = |
| 5770 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5771 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5772 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5773 | pRoamProfile->AuthType.authType[0] = |
| 5774 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5775 | } else |
| 5776 | #endif |
| 5777 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5778 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 5779 | ((pWextState-> |
| 5780 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5781 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5782 | pRoamProfile->AuthType.authType[0] = |
| 5783 | eCSR_AUTH_TYPE_FT_RSN; |
| 5784 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5785 | && |
| 5786 | ((pWextState-> |
| 5787 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5788 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 5789 | pRoamProfile->AuthType.authType[0] = |
| 5790 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5791 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5792 | |
| 5793 | #ifdef WLAN_FEATURE_11W |
| 5794 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5795 | pRoamProfile->AuthType.authType[0] = |
| 5796 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5797 | } else if (RSNAuthType == |
| 5798 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5799 | pRoamProfile->AuthType.authType[0] = |
| 5800 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5801 | } else |
| 5802 | #endif |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5803 | if (hdd_check_fils_rsn_n_set_auth_type(pRoamProfile, |
| 5804 | RSNAuthType)) { |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5805 | pRoamProfile->AuthType.authType[0] = |
| 5806 | RSNAuthType; |
Sridhar Selvaraj | 8c6f5e8 | 2017-08-21 14:53:46 +0530 | [diff] [blame] | 5807 | hdd_info("updated profile authtype as %d", |
| 5808 | RSNAuthType); |
| 5809 | |
Sridhar Selvaraj | 6cf642f | 2017-08-21 14:28:10 +0530 | [diff] [blame] | 5810 | } else if ((pWextState-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5811 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5812 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5813 | pRoamProfile->AuthType.authType[0] = |
| 5814 | eCSR_AUTH_TYPE_RSN; |
| 5815 | } else |
| 5816 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5817 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5818 | pRoamProfile->AuthType.authType[0] = |
| 5819 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5820 | } else { |
| 5821 | pRoamProfile->AuthType.authType[0] = |
| 5822 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5823 | } |
| 5824 | } |
| 5825 | break; |
| 5826 | |
| 5827 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5828 | |
| 5829 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5830 | break; |
| 5831 | default: |
| 5832 | |
| 5833 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5834 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5835 | #endif /* FEATURE_WLAN_ESE */ |
| 5836 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5837 | break; |
| 5838 | } |
| 5839 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5840 | hdd_debug("Set roam Authtype to %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5841 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5842 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5843 | return 0; |
| 5844 | } |
| 5845 | |
| 5846 | /** |
| 5847 | * __iw_set_essid() - This function sets the ssid received from wpa_supplicant |
| 5848 | * to the CSR roam profile. |
| 5849 | * |
| 5850 | * @dev: Pointer to the net device. |
| 5851 | * @info: Pointer to the iw_request_info. |
| 5852 | * @wrqu: Pointer to the iwreq_data. |
| 5853 | * @extra: Pointer to the data. |
| 5854 | * |
| 5855 | * Return: 0 for success, error number on failure |
| 5856 | */ |
| 5857 | static int __iw_set_essid(struct net_device *dev, |
| 5858 | struct iw_request_info *info, |
| 5859 | union iwreq_data *wrqu, char *extra) |
| 5860 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5861 | uint32_t status = 0; |
| 5862 | hdd_wext_state_t *pWextState; |
| 5863 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 5864 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5865 | uint32_t roamId; |
| 5866 | tCsrRoamProfile *pRoamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5867 | eCsrAuthType RSNAuthType; |
| 5868 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5869 | int ret; |
| 5870 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5871 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5872 | |
| 5873 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5874 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5875 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5876 | return ret; |
| 5877 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5878 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5879 | if (0 != ret) |
| 5880 | return ret; |
| 5881 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5882 | if (pAdapter->device_mode != QDF_STA_MODE && |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5883 | pAdapter->device_mode != QDF_IBSS_MODE && |
| 5884 | pAdapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5885 | hdd_warn("device mode %s(%d) is not allowed", |
| 5886 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 5887 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5888 | return -EINVAL; |
| 5889 | } |
| 5890 | |
| 5891 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5892 | |
| 5893 | if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5894 | hdd_warn("Counter measure is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5895 | return -EBUSY; |
| 5896 | } |
| 5897 | if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length) |
| 5898 | return -EINVAL; |
| 5899 | |
| 5900 | pRoamProfile = &pWextState->roamProfile; |
Agrawal Ashish | 3d000b4 | 2017-02-07 13:44:50 +0530 | [diff] [blame] | 5901 | /*Try disconnecting if already in connected state*/ |
| 5902 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5903 | if (0 > status) { |
Srinivas Girigowda | 576b235 | 2017-08-25 14:44:26 -0700 | [diff] [blame] | 5904 | hdd_err("Failed to disconnect the existing connection"); |
| 5905 | return -EALREADY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5906 | } |
| 5907 | |
| 5908 | /* |
| 5909 | * when cfg80211 defined, wpa_supplicant wext driver uses |
| 5910 | * zero-length, null-string ssid for force disconnection. |
| 5911 | * after disconnection (if previously connected) and cleaning ssid, |
| 5912 | * driver MUST return success. |
| 5913 | */ |
| 5914 | if (0 == wrqu->essid.length) |
| 5915 | return 0; |
| 5916 | |
| 5917 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5918 | &pWextState->roamProfile.uapsd_mask); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5919 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5920 | pWextState->roamProfile.uapsd_mask = 0; |
| 5921 | |
| 5922 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 5923 | |
| 5924 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = |
| 5925 | wrqu->essid.length; |
| 5926 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5927 | qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5928 | sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5929 | qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5930 | ssId), extra, wrqu->essid.length); |
| 5931 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion |
| 5932 | || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { |
| 5933 | |
| 5934 | /* set gen ie */ |
| 5935 | hdd_set_genie_to_csr(pAdapter, &RSNAuthType); |
| 5936 | |
| 5937 | /* set auth */ |
| 5938 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5939 | } |
| 5940 | #ifdef FEATURE_WLAN_WAPI |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5941 | hdd_debug("Setting WAPI AUTH Type and Encryption Mode values"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5942 | if (pAdapter->wapi_info.nWapiMode) { |
| 5943 | switch (pAdapter->wapi_info.wapiAuthMode) { |
| 5944 | case WAPI_AUTH_MODE_PSK: |
| 5945 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5946 | hdd_debug("WAPI AUTH TYPE: PSK: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5947 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5948 | pRoamProfile->AuthType.numEntries = 1; |
| 5949 | pRoamProfile->AuthType.authType[0] = |
| 5950 | eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5951 | break; |
| 5952 | } |
| 5953 | case WAPI_AUTH_MODE_CERT: |
| 5954 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5955 | hdd_debug("WAPI AUTH TYPE: CERT: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5956 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5957 | pRoamProfile->AuthType.numEntries = 1; |
| 5958 | pRoamProfile->AuthType.authType[0] = |
| 5959 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5960 | break; |
| 5961 | } |
| 5962 | } /* End of switch */ |
| 5963 | if (pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5964 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5965 | hdd_debug("WAPI PAIRWISE/GROUP ENCRYPTION: WPI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5966 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5967 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5968 | eCSR_ENCRYPT_TYPE_WPI; |
| 5969 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5970 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5971 | eCSR_ENCRYPT_TYPE_WPI; |
| 5972 | } |
| 5973 | } |
| 5974 | #endif /* FEATURE_WLAN_WAPI */ |
| 5975 | /* if previous genIE is not NULL, update AssocIE */ |
| 5976 | if (0 != pWextState->genIE.length) { |
| 5977 | memset(&pWextState->assocAddIE, 0, |
| 5978 | sizeof(pWextState->assocAddIE)); |
| 5979 | memcpy(pWextState->assocAddIE.addIEdata, |
| 5980 | pWextState->genIE.addIEdata, pWextState->genIE.length); |
| 5981 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5982 | pWextState->roamProfile.pAddIEAssoc = |
| 5983 | pWextState->assocAddIE.addIEdata; |
| 5984 | pWextState->roamProfile.nAddIEAssocLength = |
| 5985 | pWextState->assocAddIE.length; |
| 5986 | |
| 5987 | /* clear previous genIE after use it */ |
| 5988 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 5989 | } |
| 5990 | |
| 5991 | /* |
| 5992 | * Assumes it is not WPS Association by default, except when |
| 5993 | * pAddIEAssoc has WPS IE. |
| 5994 | */ |
| 5995 | pWextState->roamProfile.bWPSAssociation = false; |
| 5996 | |
| 5997 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5998 | pWextState->roamProfile. |
| 5999 | nAddIEAssocLength)) |
| 6000 | pWextState->roamProfile.bWPSAssociation = true; |
| 6001 | |
| 6002 | /* Disable auto BMPS entry by PMC until DHCP is done */ |
| 6003 | sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 6004 | true); |
| 6005 | |
| 6006 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 6007 | |
| 6008 | if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) { |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 6009 | pRoamProfile->ch_params.ch_width = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6010 | hdd_select_cbmode(pAdapter, |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 6011 | (WLAN_HDD_GET_CTX(pAdapter))->config->AdHocChannel5G, |
| 6012 | &pRoamProfile->ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6013 | } |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 6014 | |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6015 | /* |
| 6016 | * Change conn_state to connecting before sme_roam_connect(), |
| 6017 | * because sme_roam_connect() has a direct path to call |
| 6018 | * hdd_sme_roam_callback(), which will change the conn_state |
| 6019 | * If direct path, conn_state will be accordingly changed to |
| 6020 | * NotConnected or Associated by either |
| 6021 | * hdd_association_completion_handler() or hdd_dis_connect_handler() |
| 6022 | * in sme_RoamCallback()if sme_RomConnect is to be queued, |
| 6023 | * Connecting state will remain until it is completed. |
| 6024 | * |
| 6025 | * If connection state is not changed, |
| 6026 | * connection state will remain in eConnectionState_NotConnected state. |
| 6027 | * In hdd_association_completion_handler, "hddDisconInProgress" is |
| 6028 | * set to true if conn state is eConnectionState_NotConnected. |
| 6029 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 6030 | * informed of connect result indication which is an issue. |
| 6031 | */ |
| 6032 | if (QDF_STA_MODE == pAdapter->device_mode || |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6033 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode) |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6034 | hdd_conn_set_connection_state(pAdapter, |
| 6035 | eConnectionState_Connecting); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6036 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6037 | status = sme_roam_connect(hHal, pAdapter->sessionId, |
| 6038 | &(pWextState->roamProfile), &roamId); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6039 | if ((QDF_STATUS_SUCCESS != status) && |
| 6040 | (QDF_STA_MODE == pAdapter->device_mode || |
| 6041 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6042 | hdd_err("sme_roam_connect failed session_id: %d status %d -> NotConnected", |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 6043 | pAdapter->sessionId, status); |
| 6044 | /* change back to NotAssociated */ |
| 6045 | hdd_conn_set_connection_state(pAdapter, |
| 6046 | eConnectionState_NotConnected); |
| 6047 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6048 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 6049 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 6050 | |
| 6051 | EXIT(); |
| 6052 | return status; |
| 6053 | } |
| 6054 | |
| 6055 | /** |
| 6056 | * iw_set_essid() - set essid handler function |
| 6057 | * @dev: Pointer to the net device. |
| 6058 | * @info: Pointer to the iw_request_info. |
| 6059 | * @wrqu: Pointer to the iwreq_data. |
| 6060 | * @extra: Pointer to the data. |
| 6061 | * |
| 6062 | * Return: 0 for success, error number on failure |
| 6063 | */ |
| 6064 | int iw_set_essid(struct net_device *dev, |
| 6065 | struct iw_request_info *info, |
| 6066 | union iwreq_data *wrqu, char *extra) |
| 6067 | { |
| 6068 | int ret; |
| 6069 | |
| 6070 | cds_ssr_protect(__func__); |
| 6071 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 6072 | cds_ssr_unprotect(__func__); |
| 6073 | |
| 6074 | return ret; |
| 6075 | } |
| 6076 | |
| 6077 | /** |
| 6078 | * __iw_get_essid() - This function returns the essid to the wpa_supplicant |
| 6079 | * @dev: pointer to the net device |
| 6080 | * @info: pointer to the iw request info |
| 6081 | * @dwrq: pointer to iw_point |
| 6082 | * @extra: pointer to the data |
| 6083 | * |
| 6084 | * Return: 0 on success, error number otherwise |
| 6085 | */ |
| 6086 | static int __iw_get_essid(struct net_device *dev, |
| 6087 | struct iw_request_info *info, |
| 6088 | struct iw_point *dwrq, char *extra) |
| 6089 | { |
| 6090 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 6091 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6092 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 6093 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6094 | int ret; |
| 6095 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6096 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6097 | |
| 6098 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6099 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6100 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6101 | return ret; |
| 6102 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6103 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6104 | if (0 != ret) |
| 6105 | return ret; |
| 6106 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6107 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 6108 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 6109 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected |
| 6110 | || pHddStaCtx->conn_info.connState == |
| 6111 | eConnectionState_IbssDisconnected) |
| 6112 | && wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) { |
| 6113 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 6114 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 6115 | dwrq->length); |
| 6116 | dwrq->flags = 1; |
| 6117 | } else { |
| 6118 | memset(extra, 0, dwrq->length); |
| 6119 | dwrq->length = 0; |
| 6120 | dwrq->flags = 0; |
| 6121 | } |
| 6122 | EXIT(); |
| 6123 | return 0; |
| 6124 | } |
| 6125 | |
| 6126 | /** |
| 6127 | * iw_get_essid() - get essid handler function |
| 6128 | * @dev: Pointer to the net device. |
| 6129 | * @info: Pointer to the iw_request_info. |
| 6130 | * @wrqu: Pointer to the iwreq_data. |
| 6131 | * @extra: Pointer to the data. |
| 6132 | * |
| 6133 | * Return: 0 for success, error number on failure |
| 6134 | */ |
| 6135 | int iw_get_essid(struct net_device *dev, |
| 6136 | struct iw_request_info *info, |
| 6137 | struct iw_point *wrqu, char *extra) |
| 6138 | { |
| 6139 | int ret; |
| 6140 | |
| 6141 | cds_ssr_protect(__func__); |
| 6142 | ret = __iw_get_essid(dev, info, wrqu, extra); |
| 6143 | cds_ssr_unprotect(__func__); |
| 6144 | |
| 6145 | return ret; |
| 6146 | } |
| 6147 | |
| 6148 | /** |
| 6149 | * __iw_set_auth() - |
| 6150 | * This function sets the auth type received from the wpa_supplicant |
| 6151 | * @dev: pointer to the net device |
| 6152 | * @info: pointer to the iw request info |
| 6153 | * @wrqu: pointer to iwreq_data |
| 6154 | * @extra: pointer to the data |
| 6155 | * |
| 6156 | * Return: 0 on success, error number otherwise |
| 6157 | */ |
| 6158 | static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6159 | union iwreq_data *wrqu, char *extra) |
| 6160 | { |
| 6161 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 6162 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6163 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 6164 | struct hdd_station_ctx *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6165 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6166 | eCsrEncryptionType mcEncryptionType; |
| 6167 | eCsrEncryptionType ucEncryptionType; |
| 6168 | int ret; |
| 6169 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6170 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6171 | |
| 6172 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6173 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6174 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6175 | return ret; |
| 6176 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6177 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6178 | if (0 != ret) |
| 6179 | return ret; |
| 6180 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6181 | switch (wrqu->param.flags & IW_AUTH_INDEX) { |
| 6182 | case IW_AUTH_WPA_VERSION: |
| 6183 | pWextState->wpaVersion = wrqu->param.value; |
| 6184 | break; |
| 6185 | |
| 6186 | case IW_AUTH_CIPHER_PAIRWISE: |
| 6187 | { |
| 6188 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6189 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6190 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6191 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6192 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6193 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6194 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6195 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6196 | == |
| 6197 | (pWextState-> |
| 6198 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6199 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6200 | pHddStaCtx->conn_info.authType)) |
| 6201 | /*Dynamic WEP key */ |
| 6202 | ucEncryptionType = |
| 6203 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6204 | else |
| 6205 | /*Static WEP key */ |
| 6206 | ucEncryptionType = |
| 6207 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6208 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6209 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6210 | == |
| 6211 | (pWextState-> |
| 6212 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6213 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6214 | pHddStaCtx->conn_info.authType)) |
| 6215 | /*Dynamic WEP key */ |
| 6216 | ucEncryptionType = |
| 6217 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6218 | else |
| 6219 | /*Static WEP key */ |
| 6220 | ucEncryptionType = |
| 6221 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6222 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6223 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
| 6224 | wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6225 | return -EINVAL; |
| 6226 | } |
| 6227 | |
| 6228 | pRoamProfile->EncryptionType.numEntries = 1; |
| 6229 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 6230 | ucEncryptionType; |
| 6231 | } |
| 6232 | break; |
| 6233 | case IW_AUTH_CIPHER_GROUP: |
| 6234 | { |
| 6235 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6236 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6237 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6238 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6239 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6240 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6241 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6242 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6243 | == |
| 6244 | (pWextState-> |
| 6245 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6246 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6247 | pHddStaCtx->conn_info.authType)) |
| 6248 | mcEncryptionType = |
| 6249 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6250 | else |
| 6251 | mcEncryptionType = |
| 6252 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6253 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6254 | /* Dynamic WEP keys won't work with shared keys */ |
| 6255 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6256 | == |
| 6257 | (pWextState-> |
| 6258 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6259 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6260 | pHddStaCtx->conn_info.authType)) { |
| 6261 | mcEncryptionType = |
| 6262 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6263 | } else { |
| 6264 | mcEncryptionType = |
| 6265 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6266 | } |
| 6267 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6268 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6269 | wrqu->param.value); |
| 6270 | return -EINVAL; |
| 6271 | } |
| 6272 | |
| 6273 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 6274 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 6275 | mcEncryptionType; |
| 6276 | } |
| 6277 | break; |
| 6278 | |
| 6279 | case IW_AUTH_80211_AUTH_ALG: |
| 6280 | { |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 6281 | /* Save the auth algo here and set auth type to SME |
| 6282 | * Roam profile in the iw_set_ap_address |
| 6283 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6284 | if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 6285 | pHddStaCtx->conn_info.authType = |
| 6286 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6287 | |
| 6288 | else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 6289 | pHddStaCtx->conn_info.authType = |
| 6290 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 6291 | |
| 6292 | else if (wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 6293 | /*Not supported */ |
| 6294 | pHddStaCtx->conn_info.authType = |
| 6295 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6296 | pWextState->roamProfile.AuthType.authType[0] = |
| 6297 | pHddStaCtx->conn_info.authType; |
| 6298 | } |
| 6299 | break; |
| 6300 | |
| 6301 | case IW_AUTH_KEY_MGMT: |
| 6302 | { |
| 6303 | #ifdef FEATURE_WLAN_ESE |
| 6304 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 6305 | /*Check for CCKM AKM type */ |
| 6306 | if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6307 | hdd_debug("CCKM AKM Set %d", wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6308 | /* Set the CCKM bit in authKeyMgmt */ |
| 6309 | /* |
| 6310 | * Right now, this breaks all ref to authKeyMgmt because |
| 6311 | * our code doesn't realize it is a "bitfield" |
| 6312 | */ |
Jeff Johnson | d084adb | 2017-08-16 11:19:52 -0700 | [diff] [blame] | 6313 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6314 | } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 6315 | /* Save the key management */ |
| 6316 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
Jeff Johnson | 3474602 | 2017-02-07 16:32:57 -0800 | [diff] [blame] | 6317 | } else if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6318 | /* Save the key management anyway */ |
| 6319 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6320 | } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */ |
| 6321 | /* Save the key management */ |
| 6322 | pWextState->authKeyMgmt |= |
| 6323 | IW_AUTH_KEY_MGMT_802_1X; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6324 | } |
| 6325 | #else |
| 6326 | /* Save the key management */ |
| 6327 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6328 | #endif /* FEATURE_WLAN_ESE */ |
| 6329 | } |
| 6330 | break; |
| 6331 | |
| 6332 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 6333 | { |
| 6334 | if (wrqu->param.value) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6335 | hdd_debug("Counter Measure started %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6336 | wrqu->param.value); |
| 6337 | pWextState->mTKIPCounterMeasures = |
| 6338 | TKIP_COUNTER_MEASURE_STARTED; |
| 6339 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6340 | hdd_debug("Counter Measure stopped=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6341 | wrqu->param.value); |
| 6342 | pWextState->mTKIPCounterMeasures = |
| 6343 | TKIP_COUNTER_MEASURE_STOPED; |
| 6344 | } |
| 6345 | } |
| 6346 | break; |
| 6347 | case IW_AUTH_DROP_UNENCRYPTED: |
| 6348 | case IW_AUTH_WPA_ENABLED: |
| 6349 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 6350 | case IW_AUTH_ROAMING_CONTROL: |
| 6351 | case IW_AUTH_PRIVACY_INVOKED: |
| 6352 | |
| 6353 | default: |
| 6354 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6355 | hdd_warn("called with unsupported auth type %d", |
| 6356 | wrqu->param.flags & IW_AUTH_INDEX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6357 | break; |
| 6358 | } |
| 6359 | |
| 6360 | EXIT(); |
| 6361 | return 0; |
| 6362 | } |
| 6363 | |
| 6364 | /** |
| 6365 | * iw_set_auth() - set auth callback function |
| 6366 | * @dev: Pointer to the net device. |
| 6367 | * @info: Pointer to the iw_request_info. |
| 6368 | * @wrqu: Pointer to the iwreq_data. |
| 6369 | * @extra: Pointer to the data. |
| 6370 | * |
| 6371 | * Return: 0 for success, error number on failure. |
| 6372 | */ |
| 6373 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6374 | union iwreq_data *wrqu, char *extra) |
| 6375 | { |
| 6376 | int ret; |
| 6377 | |
| 6378 | cds_ssr_protect(__func__); |
| 6379 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 6380 | cds_ssr_unprotect(__func__); |
| 6381 | |
| 6382 | return ret; |
| 6383 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6384 | /** |
| 6385 | * __iw_get_auth() - |
| 6386 | * This function returns the auth type to the wpa_supplicant |
| 6387 | * @dev: pointer to the net device |
| 6388 | * @info: pointer to the iw request info |
| 6389 | * @wrqu: pointer to iwreq_data |
| 6390 | * @extra: pointer to the data |
| 6391 | * |
| 6392 | * Return: 0 on success, error number otherwise |
| 6393 | */ |
| 6394 | static int __iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6395 | union iwreq_data *wrqu, char *extra) |
| 6396 | { |
| 6397 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 6398 | struct hdd_context *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6399 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6400 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6401 | int ret; |
| 6402 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6403 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6404 | |
| 6405 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6406 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6407 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6408 | return ret; |
| 6409 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6410 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6411 | if (0 != ret) |
| 6412 | return ret; |
| 6413 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6414 | switch (pRoamProfile->negotiatedAuthType) { |
| 6415 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 6416 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6417 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 6418 | break; |
| 6419 | case eCSR_AUTH_TYPE_WPA: |
| 6420 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6421 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 6422 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6423 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6424 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6425 | case eCSR_AUTH_TYPE_RSN: |
| 6426 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6427 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 6428 | break; |
| 6429 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 6430 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6431 | break; |
| 6432 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 6433 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 6434 | break; |
| 6435 | case eCSR_AUTH_TYPE_UNKNOWN: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6436 | hdd_debug("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6437 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6438 | break; |
| 6439 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 6440 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6441 | break; |
| 6442 | case eCSR_AUTH_TYPE_WPA_PSK: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6443 | hdd_debug("called with WPA PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6444 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6445 | return -EIO; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6446 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6447 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6448 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 6449 | #ifdef WLAN_FEATURE_11W |
| 6450 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 6451 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 6452 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6453 | hdd_debug("called with RSN PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6454 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6455 | return -EIO; |
| 6456 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6457 | hdd_warn("Unknown auth type: %d", |
| 6458 | pRoamProfile->negotiatedAuthType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6459 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6460 | return -EIO; |
| 6461 | } |
| 6462 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) { |
| 6463 | switch (pRoamProfile->negotiatedUCEncryptionType) { |
| 6464 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6465 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6466 | break; |
| 6467 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6468 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6469 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6470 | break; |
| 6471 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6472 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6473 | break; |
| 6474 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6475 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6476 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6477 | break; |
| 6478 | case eCSR_ENCRYPT_TYPE_AES: |
| 6479 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6480 | break; |
| 6481 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6482 | hdd_warn("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6483 | pRoamProfile->negotiatedUCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6484 | return -EIO; |
| 6485 | } |
| 6486 | } |
| 6487 | |
| 6488 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) { |
| 6489 | switch (pRoamProfile->negotiatedMCEncryptionType) { |
| 6490 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6491 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6492 | break; |
| 6493 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6494 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6495 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6496 | break; |
| 6497 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6498 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6499 | break; |
| 6500 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6501 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6502 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6503 | break; |
| 6504 | case eCSR_ENCRYPT_TYPE_AES: |
| 6505 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6506 | break; |
| 6507 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6508 | hdd_err("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6509 | pRoamProfile->negotiatedMCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6510 | return -EIO; |
| 6511 | } |
| 6512 | } |
| 6513 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6514 | hdd_debug("called with auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6515 | pRoamProfile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6516 | EXIT(); |
| 6517 | return 0; |
| 6518 | } |
| 6519 | |
| 6520 | /** |
| 6521 | * iw_get_auth() - get auth callback function |
| 6522 | * @dev: Pointer to the net device. |
| 6523 | * @info: Pointer to the iw_request_info. |
| 6524 | * @wrqu: Pointer to the iwreq_data. |
| 6525 | * @extra: Pointer to the data. |
| 6526 | * |
| 6527 | * Return: 0 for success, error number on failure. |
| 6528 | */ |
| 6529 | int iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6530 | union iwreq_data *wrqu, char *extra) |
| 6531 | { |
| 6532 | int ret; |
| 6533 | |
| 6534 | cds_ssr_protect(__func__); |
| 6535 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 6536 | cds_ssr_unprotect(__func__); |
| 6537 | |
| 6538 | return ret; |
| 6539 | } |
| 6540 | |
| 6541 | /** |
| 6542 | * __iw_set_ap_address() - set ap address |
| 6543 | * @dev: pointer to the net device |
| 6544 | * @info: pointer to the iw request info |
| 6545 | * @wrqu: pointer to iwreq_data |
| 6546 | * @extra: pointer to the data |
| 6547 | * |
| 6548 | * This function updates the HDD global station context connection info |
| 6549 | * BSSID with the MAC address received from the wpa_supplicant. |
| 6550 | * |
| 6551 | * Return: 0 on success, error number otherwise |
| 6552 | */ |
| 6553 | static int __iw_set_ap_address(struct net_device *dev, |
| 6554 | struct iw_request_info *info, |
| 6555 | union iwreq_data *wrqu, char *extra) |
| 6556 | { |
| 6557 | |
| 6558 | hdd_adapter_t *adapter; |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 6559 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 6560 | struct hdd_station_ctx *pHddStaCtx = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6561 | WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 6562 | uint8_t *pMacAddress = NULL; |
| 6563 | int ret; |
| 6564 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6565 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6566 | |
| 6567 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6568 | |
| 6569 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6570 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6571 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6572 | return ret; |
| 6573 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6574 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6575 | if (0 != ret) |
| 6576 | return ret; |
| 6577 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6578 | pMacAddress = (uint8_t *) wrqu->ap_addr.sa_data; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6579 | hdd_debug(" " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMacAddress)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6580 | qdf_mem_copy(pHddStaCtx->conn_info.bssId.bytes, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6581 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6582 | EXIT(); |
| 6583 | |
| 6584 | return 0; |
| 6585 | } |
| 6586 | |
| 6587 | /** |
| 6588 | * iw_set_ap_address() - set ap addresses callback function |
| 6589 | * @dev: Pointer to the net device. |
| 6590 | * @info: Pointer to the iw_request_info. |
| 6591 | * @wrqu: Pointer to the iwreq_data. |
| 6592 | * @extra: Pointer to the data. |
| 6593 | * |
| 6594 | * Return: 0 for success, error number on failure. |
| 6595 | */ |
| 6596 | int iw_set_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6597 | union iwreq_data *wrqu, char *extra) |
| 6598 | { |
| 6599 | int ret; |
| 6600 | |
| 6601 | cds_ssr_protect(__func__); |
| 6602 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 6603 | cds_ssr_unprotect(__func__); |
| 6604 | |
| 6605 | return ret; |
| 6606 | } |
| 6607 | |
| 6608 | /** |
| 6609 | * __iw_get_ap_address() - get ap address |
| 6610 | * @dev: pointer to the net device |
| 6611 | * @info: pointer to the iw request info |
| 6612 | * @wrqu: pointer to iwreq_data |
| 6613 | * @extra: pointer to the data |
| 6614 | * |
| 6615 | * This function returns currently associated BSSID. |
| 6616 | * |
| 6617 | * Return: 0 on success, error number otherwise |
| 6618 | */ |
| 6619 | static int __iw_get_ap_address(struct net_device *dev, |
| 6620 | struct iw_request_info *info, |
| 6621 | union iwreq_data *wrqu, char *extra) |
| 6622 | { |
| 6623 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
Jeff Johnson | 4943206 | 2017-08-28 12:08:45 -0700 | [diff] [blame] | 6624 | struct hdd_context *hdd_ctx; |
Jeff Johnson | 40dae4e | 2017-08-29 14:00:25 -0700 | [diff] [blame] | 6625 | struct hdd_station_ctx *pHddStaCtx = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6626 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6627 | int ret; |
| 6628 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6629 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6630 | |
| 6631 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6632 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6633 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6634 | return ret; |
| 6635 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6636 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6637 | if (0 != ret) |
| 6638 | return ret; |
| 6639 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6640 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated || |
| 6641 | eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6642 | qdf_mem_copy(wrqu->ap_addr.sa_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6643 | pHddStaCtx->conn_info.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6644 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6645 | } else { |
| 6646 | memset(wrqu->ap_addr.sa_data, 0, sizeof(wrqu->ap_addr.sa_data)); |
| 6647 | } |
| 6648 | EXIT(); |
| 6649 | return 0; |
| 6650 | } |
| 6651 | |
| 6652 | /** |
| 6653 | * iw_get_ap_address() - get ap addresses callback function |
| 6654 | * @dev: Pointer to the net device. |
| 6655 | * @info: Pointer to the iw_request_info. |
| 6656 | * @wrqu: Pointer to the iwreq_data. |
| 6657 | * @extra: Pointer to the data. |
| 6658 | * |
| 6659 | * Return: 0 for success, error number on failure. |
| 6660 | */ |
| 6661 | int iw_get_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6662 | union iwreq_data *wrqu, char *extra) |
| 6663 | { |
| 6664 | int ret; |
| 6665 | |
| 6666 | cds_ssr_protect(__func__); |
| 6667 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 6668 | cds_ssr_unprotect(__func__); |
| 6669 | |
| 6670 | return ret; |
| 6671 | } |