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 }; |
| 117 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 118 | /* Offset where the EID-Len-IE, start. */ |
| 119 | #define FT_ASSOC_RSP_IES_OFFSET 6 /* Capability(2) + AID(2) + Status Code(2) */ |
| 120 | #define FT_ASSOC_REQ_IES_OFFSET 4 /* Capability(2) + LI(2) */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 121 | |
| 122 | #define BEACON_FRAME_IES_OFFSET 12 |
| 123 | #define HDD_PEER_AUTHORIZE_WAIT 10 |
| 124 | |
| 125 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 126 | * beacon_filter_table - table of IEs used for beacon filtering |
| 127 | */ |
| 128 | static const int beacon_filter_table[] = { |
| 129 | SIR_MAC_DS_PARAM_SET_EID, |
| 130 | SIR_MAC_ERP_INFO_EID, |
| 131 | SIR_MAC_EDCA_PARAM_SET_EID, |
| 132 | SIR_MAC_QOS_CAPABILITY_EID, |
| 133 | SIR_MAC_HT_INFO_EID, |
| 134 | SIR_MAC_VHT_OPMODE_EID, |
| 135 | SIR_MAC_VHT_OPERATION_EID, |
Krunal Soni | b7f2043 | 2017-04-27 13:01:02 -0700 | [diff] [blame] | 136 | #ifdef WLAN_FEATURE_11AX_BSS_COLOR |
| 137 | /* |
| 138 | * EID: 221 vendor IE is being used temporarily by 11AX |
| 139 | * bss-color-change IE till it gets any fixed number. This |
| 140 | * vendor EID needs to be replaced with bss-color-change IE |
| 141 | * number. |
| 142 | */ |
| 143 | SIR_MAC_EID_VENDOR, |
| 144 | #endif |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 145 | }; |
| 146 | |
| 147 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 148 | * hdd_conn_set_authenticated() - set authentication state |
| 149 | * @pAdapter: pointer to the adapter |
| 150 | * @authState: authentication state |
| 151 | * |
| 152 | * This function updates the global HDD station context |
| 153 | * authentication state. |
| 154 | * |
| 155 | * Return: none |
| 156 | */ |
| 157 | static void |
| 158 | hdd_conn_set_authenticated(hdd_adapter_t *pAdapter, uint8_t authState) |
| 159 | { |
| 160 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 161 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 162 | |
| 163 | /* save the new connection state */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 164 | hdd_debug("Authenticated state Changed from oldState:%d to State:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 165 | pHddStaCtx->conn_info.uIsAuthenticated, authState); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 166 | pHddStaCtx->conn_info.uIsAuthenticated = authState; |
| 167 | |
| 168 | /* Check is pending ROC request or not when auth state changed */ |
| 169 | schedule_delayed_work(&pHddCtx->roc_req_work, 0); |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * hdd_conn_set_connection_state() - set connection state |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 174 | * @adapter: pointer to the adapter |
| 175 | * @conn_state: connection state |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 176 | * |
| 177 | * This function updates the global HDD station context connection state. |
| 178 | * |
| 179 | * Return: none |
| 180 | */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 181 | void hdd_conn_set_connection_state(hdd_adapter_t *adapter, |
| 182 | eConnectionState conn_state) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 183 | { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 184 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 185 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 186 | |
| 187 | /* save the new connection state */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 188 | hdd_debug("%pS Changed conn state from old:%d to new:%d for dev %s", |
| 189 | (void *)_RET_IP_, hdd_sta_ctx->conn_info.connState, |
| 190 | conn_state, adapter->dev->name); |
Yu Wang | 000dc2f | 2017-05-26 17:38:48 +0800 | [diff] [blame] | 191 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 192 | hdd_tsf_notify_wlan_state_change(adapter, |
| 193 | hdd_sta_ctx->conn_info.connState, |
| 194 | conn_state); |
| 195 | hdd_sta_ctx->conn_info.connState = conn_state; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 196 | |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 197 | schedule_delayed_work(&hdd_ctx->roc_req_work, 0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | /** |
| 201 | * hdd_conn_get_connection_state() - get connection state |
| 202 | * @pAdapter: pointer to the adapter |
| 203 | * @pConnState: pointer to connection state |
| 204 | * |
| 205 | * This function updates the global HDD station context connection state. |
| 206 | * |
| 207 | * Return: true if (Infra Associated or IBSS Connected) |
| 208 | * and sets output parameter pConnState; |
| 209 | * false otherwise |
| 210 | */ |
| 211 | static inline bool hdd_conn_get_connection_state(hdd_station_ctx_t *pHddStaCtx, |
| 212 | eConnectionState *pConnState) |
| 213 | { |
| 214 | bool fConnected = false; |
| 215 | eConnectionState connState; |
| 216 | |
| 217 | /* get the connection state. */ |
| 218 | connState = pHddStaCtx->conn_info.connState; |
| 219 | |
| 220 | if (eConnectionState_Associated == connState || |
| 221 | eConnectionState_IbssConnected == connState || |
| 222 | eConnectionState_IbssDisconnected == connState) { |
| 223 | fConnected = true; |
| 224 | } |
| 225 | |
| 226 | if (pConnState) |
| 227 | *pConnState = connState; |
| 228 | |
| 229 | return fConnected; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * hdd_is_connecting() - Function to check connection progress |
| 234 | * @hdd_sta_ctx: pointer to global HDD Station context |
| 235 | * |
| 236 | * Return: true if connecting, false otherwise |
| 237 | */ |
| 238 | bool hdd_is_connecting(hdd_station_ctx_t *hdd_sta_ctx) |
| 239 | { |
| 240 | return hdd_sta_ctx->conn_info.connState == |
| 241 | eConnectionState_Connecting; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * hdd_conn_is_connected() - Function to check connection status |
| 246 | * @pHddStaCtx: pointer to global HDD Station context |
| 247 | * |
| 248 | * Return: false if any errors encountered, true otherwise |
| 249 | */ |
| 250 | bool hdd_conn_is_connected(hdd_station_ctx_t *pHddStaCtx) |
| 251 | { |
| 252 | return hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * hdd_conn_get_connected_band() - get current connection radio band |
| 257 | * @pHddStaCtx: pointer to global HDD Station context |
| 258 | * |
| 259 | * Return: eCSR_BAND_24 or eCSR_BAND_5G based on current AP connection |
| 260 | * eCSR_BAND_ALL if not connected |
| 261 | */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 262 | enum band_info hdd_conn_get_connected_band(hdd_station_ctx_t *pHddStaCtx) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 263 | { |
| 264 | uint8_t staChannel = 0; |
| 265 | |
| 266 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) |
| 267 | staChannel = pHddStaCtx->conn_info.operationChannel; |
| 268 | |
| 269 | if (staChannel > 0 && staChannel < 14) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 270 | return BAND_2G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 271 | else if (staChannel >= 36 && staChannel <= 184) |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 272 | return BAND_5G; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 273 | else /* If station is not connected return as eCSR_BAND_ALL */ |
Kiran Kumar Lokere | b1d412e | 2017-04-23 17:19:43 -0700 | [diff] [blame] | 274 | return BAND_ALL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | /** |
| 278 | * hdd_conn_get_connected_cipher_algo() - get current connection cipher type |
| 279 | * @pHddStaCtx: pointer to global HDD Station context |
| 280 | * @pConnectedCipherAlgo: pointer to connected cipher algo |
| 281 | * |
| 282 | * Return: false if any errors encountered, true otherwise |
| 283 | */ |
| 284 | static inline bool |
| 285 | hdd_conn_get_connected_cipher_algo(hdd_station_ctx_t *pHddStaCtx, |
| 286 | eCsrEncryptionType *pConnectedCipherAlgo) |
| 287 | { |
| 288 | bool fConnected = false; |
| 289 | |
| 290 | fConnected = hdd_conn_get_connection_state(pHddStaCtx, NULL); |
| 291 | |
| 292 | if (pConnectedCipherAlgo) |
| 293 | *pConnectedCipherAlgo = pHddStaCtx->conn_info.ucEncryptionType; |
| 294 | |
| 295 | return fConnected; |
| 296 | } |
| 297 | |
| 298 | /** |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 299 | * hdd_remove_beacon_filter() - remove beacon filter |
| 300 | * @adapter: Pointer to the hdd adapter |
| 301 | * |
| 302 | * Return: 0 on success and errno on failure |
| 303 | */ |
| 304 | static int hdd_remove_beacon_filter(hdd_adapter_t *adapter) |
| 305 | { |
| 306 | QDF_STATUS status; |
| 307 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 308 | |
| 309 | status = sme_remove_beacon_filter(hdd_ctx->hHal, |
| 310 | adapter->sessionId); |
| 311 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 312 | hdd_err("sme_remove_beacon_filter() failed"); |
| 313 | return -EFAULT; |
| 314 | } |
| 315 | |
| 316 | return 0; |
| 317 | } |
| 318 | |
| 319 | /** |
| 320 | * hdd_add_beacon_filter() - add beacon filter |
| 321 | * @adapter: Pointer to the hdd adapter |
| 322 | * |
| 323 | * Return: 0 on success and errno on failure |
| 324 | */ |
| 325 | static int hdd_add_beacon_filter(hdd_adapter_t *adapter) |
| 326 | { |
| 327 | int i; |
| 328 | uint32_t ie_map[SIR_BCN_FLT_MAX_ELEMS_IE_LIST] = {0}; |
| 329 | QDF_STATUS status; |
| 330 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 331 | |
| 332 | for (i = 0; i < ARRAY_SIZE(beacon_filter_table); i++) |
Kapil Gupta | 80f4a8d | 2016-09-22 16:54:35 +0530 | [diff] [blame] | 333 | qdf_set_bit((beacon_filter_table[i]), |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 334 | (unsigned long int *)ie_map); |
| 335 | |
| 336 | status = sme_add_beacon_filter(hdd_ctx->hHal, |
| 337 | adapter->sessionId, ie_map); |
| 338 | if (!QDF_IS_STATUS_SUCCESS(status)) { |
| 339 | hdd_err("sme_add_beacon_filter() failed"); |
| 340 | return -EFAULT; |
| 341 | } |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 346 | * hdd_copy_vht_caps()- copy vht caps info from roam info to |
| 347 | * hdd station context. |
| 348 | * @hdd_sta_ctx: pointer to hdd station context |
| 349 | * @roam_info: pointer to roam info |
| 350 | * |
| 351 | * Return: None |
| 352 | */ |
| 353 | static void hdd_copy_ht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 354 | tCsrRoamInfo *roam_info) |
| 355 | { |
| 356 | tDot11fIEHTCaps *roam_ht_cap = &roam_info->ht_caps; |
| 357 | struct ieee80211_ht_cap *hdd_ht_cap = &hdd_sta_ctx->conn_info.ht_caps; |
| 358 | uint32_t i, temp_ht_cap; |
| 359 | |
| 360 | qdf_mem_zero(hdd_ht_cap, sizeof(struct ieee80211_ht_cap)); |
| 361 | |
| 362 | if (roam_ht_cap->advCodingCap) |
| 363 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LDPC_CODING; |
| 364 | if (roam_ht_cap->supportedChannelWidthSet) |
| 365 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; |
| 366 | temp_ht_cap = roam_ht_cap->mimoPowerSave & |
| 367 | (IEEE80211_HT_CAP_SM_PS >> IEEE80211_HT_CAP_SM_PS_SHIFT); |
| 368 | if (temp_ht_cap) |
| 369 | hdd_ht_cap->cap_info |= |
| 370 | temp_ht_cap << IEEE80211_HT_CAP_SM_PS_SHIFT; |
| 371 | if (roam_ht_cap->greenField) |
| 372 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_GRN_FLD; |
| 373 | if (roam_ht_cap->shortGI20MHz) |
| 374 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_20; |
| 375 | if (roam_ht_cap->shortGI40MHz) |
| 376 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_SGI_40; |
| 377 | if (roam_ht_cap->txSTBC) |
| 378 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_TX_STBC; |
| 379 | temp_ht_cap = roam_ht_cap->rxSTBC & (IEEE80211_HT_CAP_RX_STBC >> |
| 380 | IEEE80211_HT_CAP_RX_STBC_SHIFT); |
| 381 | if (temp_ht_cap) |
| 382 | hdd_ht_cap->cap_info |= |
| 383 | temp_ht_cap << IEEE80211_HT_CAP_RX_STBC_SHIFT; |
| 384 | if (roam_ht_cap->delayedBA) |
| 385 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DELAY_BA; |
| 386 | if (roam_ht_cap->maximalAMSDUsize) |
| 387 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_MAX_AMSDU; |
| 388 | if (roam_ht_cap->dsssCckMode40MHz) |
| 389 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_DSSSCCK40; |
| 390 | if (roam_ht_cap->psmp) |
| 391 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_RESERVED; |
| 392 | if (roam_ht_cap->stbcControlFrame) |
| 393 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; |
| 394 | if (roam_ht_cap->lsigTXOPProtection) |
| 395 | hdd_ht_cap->cap_info |= IEEE80211_HT_CAP_LSIG_TXOP_PROT; |
| 396 | |
| 397 | /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */ |
| 398 | if (roam_ht_cap->maxRxAMPDUFactor) |
| 399 | hdd_ht_cap->ampdu_params_info |= |
| 400 | IEEE80211_HT_AMPDU_PARM_FACTOR; |
| 401 | temp_ht_cap = roam_ht_cap->mpduDensity & |
| 402 | (IEEE80211_HT_AMPDU_PARM_DENSITY >> |
| 403 | IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT); |
| 404 | if (temp_ht_cap) |
| 405 | hdd_ht_cap->ampdu_params_info |= |
| 406 | temp_ht_cap << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT; |
| 407 | |
| 408 | /* 802.11n HT extended capabilities masks */ |
| 409 | if (roam_ht_cap->pco) |
| 410 | hdd_ht_cap->extended_ht_cap_info |= |
| 411 | IEEE80211_HT_EXT_CAP_PCO; |
| 412 | temp_ht_cap = roam_ht_cap->transitionTime & |
| 413 | (IEEE80211_HT_EXT_CAP_PCO_TIME >> |
| 414 | IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT); |
| 415 | if (temp_ht_cap) |
| 416 | hdd_ht_cap->extended_ht_cap_info |= |
| 417 | temp_ht_cap << IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT; |
| 418 | temp_ht_cap = roam_ht_cap->mcsFeedback & |
| 419 | (IEEE80211_HT_EXT_CAP_MCS_FB >> IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT); |
| 420 | if (temp_ht_cap) |
| 421 | hdd_ht_cap->extended_ht_cap_info |= |
| 422 | temp_ht_cap << IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT; |
| 423 | |
| 424 | /* tx_bf_cap_info capabilities */ |
| 425 | if (roam_ht_cap->txBF) |
| 426 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_BF; |
| 427 | if (roam_ht_cap->rxStaggeredSounding) |
| 428 | hdd_ht_cap->tx_BF_cap_info |= |
| 429 | TX_BF_CAP_INFO_RX_STAG_RED_SOUNDING; |
| 430 | if (roam_ht_cap->txStaggeredSounding) |
| 431 | hdd_ht_cap->tx_BF_cap_info |= |
| 432 | TX_BF_CAP_INFO_TX_STAG_RED_SOUNDING; |
| 433 | if (roam_ht_cap->rxZLF) |
| 434 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_RX_ZFL; |
| 435 | if (roam_ht_cap->txZLF) |
| 436 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_TX_ZFL; |
| 437 | if (roam_ht_cap->implicitTxBF) |
| 438 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_IMP_TX_BF; |
| 439 | temp_ht_cap = roam_ht_cap->calibration & |
| 440 | (TX_BF_CAP_INFO_CALIBRATION >> TX_BF_CAP_INFO_CALIBRATION_SHIFT); |
| 441 | if (temp_ht_cap) |
| 442 | hdd_ht_cap->tx_BF_cap_info |= |
| 443 | temp_ht_cap << TX_BF_CAP_INFO_CALIBRATION_SHIFT; |
| 444 | if (roam_ht_cap->explicitCSITxBF) |
| 445 | hdd_ht_cap->tx_BF_cap_info |= TX_BF_CAP_INFO_EXP_CSIT_BF; |
| 446 | if (roam_ht_cap->explicitUncompressedSteeringMatrix) |
| 447 | hdd_ht_cap->tx_BF_cap_info |= |
| 448 | TX_BF_CAP_INFO_EXP_UNCOMP_STEER_MAT; |
| 449 | temp_ht_cap = roam_ht_cap->explicitBFCSIFeedback & |
| 450 | (TX_BF_CAP_INFO_EXP_BF_CSI_FB >> |
| 451 | TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT); |
| 452 | if (temp_ht_cap) |
| 453 | hdd_ht_cap->tx_BF_cap_info |= |
| 454 | temp_ht_cap << TX_BF_CAP_INFO_EXP_BF_CSI_FB_SHIFT; |
| 455 | temp_ht_cap = |
| 456 | roam_ht_cap->explicitUncompressedSteeringMatrixFeedback & |
| 457 | (TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT >> |
| 458 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT); |
| 459 | if (temp_ht_cap) |
| 460 | hdd_ht_cap->tx_BF_cap_info |= |
| 461 | temp_ht_cap << |
| 462 | TX_BF_CAP_INFO_EXP_UNCMP_STEER_MAT_SHIFT; |
| 463 | temp_ht_cap = |
| 464 | roam_ht_cap->explicitCompressedSteeringMatrixFeedback & |
| 465 | (TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB >> |
| 466 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT); |
| 467 | if (temp_ht_cap) |
| 468 | hdd_ht_cap->tx_BF_cap_info |= |
| 469 | temp_ht_cap << |
| 470 | TX_BF_CAP_INFO_EXP_CMP_STEER_MAT_FB_SHIFT; |
| 471 | temp_ht_cap = roam_ht_cap->csiNumBFAntennae & |
| 472 | (TX_BF_CAP_INFO_CSI_NUM_BF_ANT >> |
| 473 | TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT); |
| 474 | if (temp_ht_cap) |
| 475 | hdd_ht_cap->tx_BF_cap_info |= |
| 476 | temp_ht_cap << TX_BF_CAP_INFO_CSI_NUM_BF_ANT_SHIFT; |
| 477 | temp_ht_cap = roam_ht_cap->uncompressedSteeringMatrixBFAntennae & |
| 478 | (TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT >> |
| 479 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT); |
| 480 | if (temp_ht_cap) |
| 481 | hdd_ht_cap->tx_BF_cap_info |= |
| 482 | temp_ht_cap << |
| 483 | TX_BF_CAP_INFO_UNCOMP_STEER_MAT_BF_ANT_SHIFT; |
| 484 | temp_ht_cap = roam_ht_cap->compressedSteeringMatrixBFAntennae & |
| 485 | (TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT >> |
| 486 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT); |
| 487 | if (temp_ht_cap) |
| 488 | hdd_ht_cap->tx_BF_cap_info |= |
| 489 | temp_ht_cap << |
| 490 | TX_BF_CAP_INFO_COMP_STEER_MAT_BF_ANT_SHIFT; |
| 491 | |
| 492 | /* antenna selection */ |
| 493 | if (roam_ht_cap->antennaSelection) |
| 494 | hdd_ht_cap->antenna_selection_info |= ANTENNA_SEL_INFO; |
| 495 | if (roam_ht_cap->explicitCSIFeedbackTx) |
| 496 | hdd_ht_cap->antenna_selection_info |= |
| 497 | ANTENNA_SEL_INFO_EXP_CSI_FB_TX; |
| 498 | if (roam_ht_cap->antennaIndicesFeedbackTx) |
| 499 | hdd_ht_cap->antenna_selection_info |= |
| 500 | ANTENNA_SEL_INFO_ANT_ID_FB_TX; |
| 501 | if (roam_ht_cap->explicitCSIFeedback) |
| 502 | hdd_ht_cap->antenna_selection_info |= |
| 503 | ANTENNA_SEL_INFO_EXP_CSI_FB; |
| 504 | if (roam_ht_cap->antennaIndicesFeedback) |
| 505 | hdd_ht_cap->antenna_selection_info |= |
| 506 | ANTENNA_SEL_INFO_ANT_ID_FB; |
| 507 | if (roam_ht_cap->rxAS) |
| 508 | hdd_ht_cap->antenna_selection_info |= |
| 509 | ANTENNA_SEL_INFO_RX_AS; |
| 510 | if (roam_ht_cap->txSoundingPPDUs) |
| 511 | hdd_ht_cap->antenna_selection_info |= |
| 512 | ANTENNA_SEL_INFO_TX_SOUNDING_PPDU; |
| 513 | |
| 514 | /* mcs data rate */ |
| 515 | for (i = 0; i < IEEE80211_HT_MCS_MASK_LEN; ++i) |
| 516 | hdd_ht_cap->mcs.rx_mask[i] = |
| 517 | roam_ht_cap->supportedMCSSet[i]; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 518 | hdd_ht_cap->mcs.rx_highest = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 519 | ((short) (roam_ht_cap->supportedMCSSet[11]) << 8) | |
| 520 | ((short) (roam_ht_cap->supportedMCSSet[10])); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 521 | hdd_ht_cap->mcs.tx_params = |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 522 | roam_ht_cap->supportedMCSSet[12]; |
| 523 | } |
| 524 | |
| 525 | #define VHT_CAP_MAX_MPDU_LENGTH_MASK 0x00000003 |
| 526 | #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT 2 |
| 527 | #define VHT_CAP_RXSTBC_MASK_SHIFT 8 |
| 528 | #define VHT_CAP_BEAMFORMEE_STS_SHIFT 13 |
| 529 | #define VHT_CAP_BEAMFORMEE_STS_MASK \ |
| 530 | (0x0000e000 >> VHT_CAP_BEAMFORMEE_STS_SHIFT) |
| 531 | #define VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 |
| 532 | #define VHT_CAP_SOUNDING_DIMENSIONS_MASK \ |
| 533 | (0x00070000 >> VHT_CAP_SOUNDING_DIMENSIONS_SHIFT) |
| 534 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT 23 |
| 535 | #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ |
| 536 | (0x03800000 >> VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT) |
| 537 | #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT 26 |
| 538 | |
| 539 | /** |
| 540 | * hdd_copy_ht_caps()- copy ht caps info from roam info to |
| 541 | * hdd station context. |
| 542 | * @hdd_sta_ctx: pointer to hdd station context |
| 543 | * @roam_info: pointer to roam info |
| 544 | * |
| 545 | * Return: None |
| 546 | */ |
| 547 | static void hdd_copy_vht_caps(hdd_station_ctx_t *hdd_sta_ctx, |
| 548 | tCsrRoamInfo *roam_info) |
| 549 | { |
| 550 | tDot11fIEVHTCaps *roam_vht_cap = &roam_info->vht_caps; |
| 551 | struct ieee80211_vht_cap *hdd_vht_cap = |
| 552 | &hdd_sta_ctx->conn_info.vht_caps; |
| 553 | uint32_t temp_vht_cap; |
| 554 | |
| 555 | qdf_mem_zero(hdd_vht_cap, sizeof(struct ieee80211_vht_cap)); |
| 556 | |
| 557 | temp_vht_cap = roam_vht_cap->maxMPDULen & VHT_CAP_MAX_MPDU_LENGTH_MASK; |
| 558 | hdd_vht_cap->vht_cap_info |= temp_vht_cap; |
| 559 | temp_vht_cap = roam_vht_cap->supportedChannelWidthSet & |
| 560 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK >> |
| 561 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT); |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 562 | if (temp_vht_cap) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 563 | if (roam_vht_cap->supportedChannelWidthSet & |
| 564 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ >> |
| 565 | VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT)) |
| 566 | hdd_vht_cap->vht_cap_info |= |
| 567 | temp_vht_cap << |
| 568 | IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; |
| 569 | if (roam_vht_cap->supportedChannelWidthSet & |
| 570 | (IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ >> |
| 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_160_80PLUS80MHZ; |
wadesong | 42968e9 | 2017-06-08 14:11:21 +0800 | [diff] [blame] | 575 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 576 | if (roam_vht_cap->ldpcCodingCap) |
| 577 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_RXLDPC; |
| 578 | if (roam_vht_cap->shortGI80MHz) |
| 579 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_80; |
| 580 | if (roam_vht_cap->shortGI160and80plus80MHz) |
| 581 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_SHORT_GI_160; |
| 582 | if (roam_vht_cap->txSTBC) |
| 583 | hdd_vht_cap->vht_cap_info |= IEEE80211_VHT_CAP_TXSTBC; |
| 584 | temp_vht_cap = roam_vht_cap->rxSTBC & (IEEE80211_VHT_CAP_RXSTBC_MASK >> |
| 585 | VHT_CAP_RXSTBC_MASK_SHIFT); |
| 586 | if (temp_vht_cap) |
| 587 | hdd_vht_cap->vht_cap_info |= |
| 588 | temp_vht_cap << VHT_CAP_RXSTBC_MASK_SHIFT; |
| 589 | if (roam_vht_cap->suBeamFormerCap) |
| 590 | hdd_vht_cap->vht_cap_info |= |
| 591 | IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; |
| 592 | if (roam_vht_cap->suBeamformeeCap) |
| 593 | hdd_vht_cap->vht_cap_info |= |
| 594 | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; |
| 595 | temp_vht_cap = roam_vht_cap->csnofBeamformerAntSup & |
| 596 | (VHT_CAP_BEAMFORMEE_STS_MASK); |
| 597 | if (temp_vht_cap) |
| 598 | hdd_vht_cap->vht_cap_info |= |
| 599 | temp_vht_cap << VHT_CAP_BEAMFORMEE_STS_SHIFT; |
| 600 | temp_vht_cap = roam_vht_cap->numSoundingDim & |
| 601 | (VHT_CAP_SOUNDING_DIMENSIONS_MASK); |
| 602 | if (temp_vht_cap) |
| 603 | hdd_vht_cap->vht_cap_info |= |
| 604 | temp_vht_cap << VHT_CAP_SOUNDING_DIMENSIONS_SHIFT; |
| 605 | if (roam_vht_cap->muBeamformerCap) |
| 606 | hdd_vht_cap->vht_cap_info |= |
| 607 | IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; |
| 608 | if (roam_vht_cap->muBeamformeeCap) |
| 609 | hdd_vht_cap->vht_cap_info |= |
| 610 | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; |
| 611 | if (roam_vht_cap->vhtTXOPPS) |
| 612 | hdd_vht_cap->vht_cap_info |= |
| 613 | IEEE80211_VHT_CAP_VHT_TXOP_PS; |
| 614 | if (roam_vht_cap->htcVHTCap) |
| 615 | hdd_vht_cap->vht_cap_info |= |
| 616 | IEEE80211_VHT_CAP_HTC_VHT; |
| 617 | temp_vht_cap = roam_vht_cap->maxAMPDULenExp & |
| 618 | (VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK); |
| 619 | if (temp_vht_cap) |
| 620 | hdd_vht_cap->vht_cap_info |= |
| 621 | temp_vht_cap << |
| 622 | VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK_SHIFT; |
| 623 | temp_vht_cap = roam_vht_cap->vhtLinkAdaptCap & |
| 624 | (IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB >> |
| 625 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT); |
| 626 | if (temp_vht_cap) |
| 627 | hdd_vht_cap->vht_cap_info |= temp_vht_cap << |
| 628 | VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB_SHIFT; |
| 629 | if (roam_vht_cap->rxAntPattern) |
| 630 | hdd_vht_cap->vht_cap_info |= |
| 631 | IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN; |
| 632 | if (roam_vht_cap->txAntPattern) |
| 633 | hdd_vht_cap->vht_cap_info |= |
| 634 | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN; |
| 635 | hdd_vht_cap->supp_mcs.rx_mcs_map = roam_vht_cap->rxMCSMap; |
| 636 | hdd_vht_cap->supp_mcs.rx_highest = |
| 637 | ((uint16_t)roam_vht_cap->rxHighSupDataRate); |
| 638 | hdd_vht_cap->supp_mcs.tx_mcs_map = roam_vht_cap->txMCSMap; |
| 639 | hdd_vht_cap->supp_mcs.tx_highest = |
| 640 | ((uint16_t)roam_vht_cap->txSupDataRate); |
| 641 | } |
| 642 | |
| 643 | /* ht param */ |
| 644 | #define HT_PARAM_CONTROLLED_ACCESS_ONLY 0x10 |
| 645 | #define HT_PARAM_SERVICE_INT_GRAN 0xe0 |
| 646 | #define HT_PARAM_SERVICE_INT_GRAN_SHIFT 5 |
| 647 | |
| 648 | /* operatinon mode */ |
| 649 | #define HT_OP_MODE_TX_BURST_LIMIT 0x0008 |
| 650 | |
| 651 | /* stbc_param */ |
| 652 | #define HT_STBC_PARAM_MCS 0x007f |
| 653 | |
| 654 | /** |
| 655 | * hdd_copy_ht_operation()- copy HT operation element from roam info to |
| 656 | * hdd station context. |
| 657 | * @hdd_sta_ctx: pointer to hdd station context |
| 658 | * @roam_info: pointer to roam info |
| 659 | * |
| 660 | * Return: None |
| 661 | */ |
| 662 | static void hdd_copy_ht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 663 | tCsrRoamInfo *roam_info) |
| 664 | { |
| 665 | tDot11fIEHTInfo *roam_ht_ops = &roam_info->ht_operation; |
| 666 | struct ieee80211_ht_operation *hdd_ht_ops = |
| 667 | &hdd_sta_ctx->conn_info.ht_operation; |
| 668 | uint32_t i, temp_ht_ops; |
| 669 | |
| 670 | qdf_mem_zero(hdd_ht_ops, sizeof(struct ieee80211_ht_operation)); |
| 671 | |
| 672 | hdd_ht_ops->primary_chan = roam_ht_ops->primaryChannel; |
| 673 | |
| 674 | /* HT_PARAMS */ |
| 675 | temp_ht_ops = roam_ht_ops->secondaryChannelOffset & |
| 676 | IEEE80211_HT_PARAM_CHA_SEC_OFFSET; |
| 677 | if (temp_ht_ops) |
| 678 | hdd_ht_ops->ht_param |= temp_ht_ops; |
| 679 | else |
| 680 | hdd_ht_ops->ht_param = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
| 681 | if (roam_ht_ops->recommendedTxWidthSet) |
| 682 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_CHAN_WIDTH_ANY; |
| 683 | if (roam_ht_ops->rifsMode) |
| 684 | hdd_ht_ops->ht_param |= IEEE80211_HT_PARAM_RIFS_MODE; |
| 685 | if (roam_ht_ops->controlledAccessOnly) |
| 686 | hdd_ht_ops->ht_param |= HT_PARAM_CONTROLLED_ACCESS_ONLY; |
| 687 | temp_ht_ops = roam_ht_ops->serviceIntervalGranularity & |
| 688 | (HT_PARAM_SERVICE_INT_GRAN >> HT_PARAM_SERVICE_INT_GRAN_SHIFT); |
| 689 | if (temp_ht_ops) |
| 690 | hdd_ht_ops->ht_param |= temp_ht_ops << |
| 691 | HT_PARAM_SERVICE_INT_GRAN_SHIFT; |
| 692 | |
| 693 | /* operation mode */ |
| 694 | temp_ht_ops = roam_ht_ops->opMode & |
| 695 | IEEE80211_HT_OP_MODE_PROTECTION; |
| 696 | switch (temp_ht_ops) { |
| 697 | case IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER: |
| 698 | hdd_ht_ops->operation_mode |= |
| 699 | IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER; |
| 700 | break; |
| 701 | case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: |
| 702 | hdd_ht_ops->operation_mode |= |
| 703 | IEEE80211_HT_OP_MODE_PROTECTION_20MHZ; |
| 704 | break; |
| 705 | case IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED: |
| 706 | hdd_ht_ops->operation_mode |= |
| 707 | IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED; |
| 708 | break; |
| 709 | case IEEE80211_HT_OP_MODE_PROTECTION_NONE: |
| 710 | default: |
| 711 | hdd_ht_ops->operation_mode |= |
| 712 | IEEE80211_HT_OP_MODE_PROTECTION_NONE; |
| 713 | } |
| 714 | if (roam_ht_ops->nonGFDevicesPresent) |
| 715 | hdd_ht_ops->operation_mode |= |
| 716 | IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT; |
| 717 | if (roam_ht_ops->transmitBurstLimit) |
| 718 | hdd_ht_ops->operation_mode |= |
| 719 | HT_OP_MODE_TX_BURST_LIMIT; |
| 720 | if (roam_ht_ops->obssNonHTStaPresent) |
| 721 | hdd_ht_ops->operation_mode |= |
| 722 | IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT; |
| 723 | |
| 724 | /* stbc_param */ |
| 725 | temp_ht_ops = roam_ht_ops->basicSTBCMCS & |
| 726 | HT_STBC_PARAM_MCS; |
| 727 | if (temp_ht_ops) |
| 728 | hdd_ht_ops->stbc_param |= temp_ht_ops; |
| 729 | if (roam_ht_ops->dualCTSProtection) |
| 730 | hdd_ht_ops->stbc_param |= |
| 731 | IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT; |
| 732 | if (roam_ht_ops->secondaryBeacon) |
| 733 | hdd_ht_ops->stbc_param |= |
| 734 | IEEE80211_HT_STBC_PARAM_STBC_BEACON; |
| 735 | if (roam_ht_ops->lsigTXOPProtectionFullSupport) |
| 736 | hdd_ht_ops->stbc_param |= |
| 737 | IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT; |
| 738 | if (roam_ht_ops->pcoActive) |
| 739 | hdd_ht_ops->stbc_param |= |
| 740 | IEEE80211_HT_STBC_PARAM_PCO_ACTIVE; |
| 741 | if (roam_ht_ops->pcoPhase) |
| 742 | hdd_ht_ops->stbc_param |= |
| 743 | IEEE80211_HT_STBC_PARAM_PCO_PHASE; |
| 744 | |
| 745 | /* basic MCs set */ |
| 746 | for (i = 0; i < 16; ++i) |
| 747 | hdd_ht_ops->basic_set[i] = |
| 748 | roam_ht_ops->basicMCSSet[i]; |
| 749 | } |
| 750 | |
| 751 | /** |
| 752 | * hdd_copy_vht_operation()- copy VHT operations element from roam info to |
| 753 | * hdd station context. |
| 754 | * @hdd_sta_ctx: pointer to hdd station context |
| 755 | * @roam_info: pointer to roam info |
| 756 | * |
| 757 | * Return: None |
| 758 | */ |
| 759 | static void hdd_copy_vht_operation(hdd_station_ctx_t *hdd_sta_ctx, |
| 760 | tCsrRoamInfo *roam_info) |
| 761 | { |
| 762 | tDot11fIEVHTOperation *roam_vht_ops = &roam_info->vht_operation; |
| 763 | struct ieee80211_vht_operation *hdd_vht_ops = |
| 764 | &hdd_sta_ctx->conn_info.vht_operation; |
| 765 | |
| 766 | qdf_mem_zero(hdd_vht_ops, sizeof(struct ieee80211_vht_operation)); |
| 767 | |
| 768 | hdd_vht_ops->chan_width = roam_vht_ops->chanWidth; |
| 769 | hdd_vht_ops->center_freq_seg1_idx = roam_vht_ops->chanCenterFreqSeg1; |
| 770 | hdd_vht_ops->center_freq_seg2_idx = roam_vht_ops->chanCenterFreqSeg2; |
| 771 | hdd_vht_ops->basic_mcs_set = roam_vht_ops->basicMCSSet; |
| 772 | } |
| 773 | |
| 774 | |
| 775 | /** |
| 776 | * hdd_save_bss_info() - save connection info in hdd sta ctx |
| 777 | * @adapter: Pointer to adapter |
| 778 | * @roam_info: pointer to roam info |
| 779 | * |
| 780 | * Return: None |
| 781 | */ |
| 782 | static void hdd_save_bss_info(hdd_adapter_t *adapter, |
| 783 | tCsrRoamInfo *roam_info) |
| 784 | { |
| 785 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 786 | |
| 787 | hdd_sta_ctx->conn_info.freq = cds_chan_to_freq( |
| 788 | hdd_sta_ctx->conn_info.operationChannel); |
| 789 | if (roam_info->vht_caps.present) { |
| 790 | hdd_sta_ctx->conn_info.conn_flag.vht_present = true; |
| 791 | hdd_copy_vht_caps(hdd_sta_ctx, roam_info); |
| 792 | } else { |
| 793 | hdd_sta_ctx->conn_info.conn_flag.vht_present = false; |
| 794 | } |
| 795 | if (roam_info->ht_caps.present) { |
| 796 | hdd_sta_ctx->conn_info.conn_flag.ht_present = true; |
| 797 | hdd_copy_ht_caps(hdd_sta_ctx, roam_info); |
| 798 | } else { |
| 799 | hdd_sta_ctx->conn_info.conn_flag.ht_present = false; |
| 800 | } |
| 801 | if (roam_info->reassoc) |
| 802 | hdd_sta_ctx->conn_info.roam_count++; |
| 803 | if (roam_info->hs20vendor_ie.present) { |
| 804 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = true; |
| 805 | qdf_mem_copy(&hdd_sta_ctx->conn_info.hs20vendor_ie, |
| 806 | &roam_info->hs20vendor_ie, |
| 807 | sizeof(roam_info->hs20vendor_ie)); |
| 808 | } else { |
| 809 | hdd_sta_ctx->conn_info.conn_flag.hs20_present = false; |
| 810 | } |
| 811 | if (roam_info->ht_operation.present) { |
| 812 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = true; |
| 813 | hdd_copy_ht_operation(hdd_sta_ctx, roam_info); |
| 814 | } else { |
| 815 | hdd_sta_ctx->conn_info.conn_flag.ht_op_present = false; |
| 816 | } |
| 817 | if (roam_info->vht_operation.present) { |
| 818 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = true; |
| 819 | hdd_copy_vht_operation(hdd_sta_ctx, roam_info); |
| 820 | } else { |
| 821 | hdd_sta_ctx->conn_info.conn_flag.vht_op_present = false; |
| 822 | } |
| 823 | } |
| 824 | |
| 825 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 826 | * hdd_conn_save_connect_info() - save current connection information |
| 827 | * @pAdapter: pointer to adapter |
| 828 | * @pRoamInfo: pointer to roam info |
| 829 | * @eBssType: bss type |
| 830 | * |
| 831 | * Return: none |
| 832 | */ |
| 833 | static void |
| 834 | hdd_conn_save_connect_info(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo, |
| 835 | eCsrRoamBssType eBssType) |
| 836 | { |
| 837 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 838 | eCsrEncryptionType encryptType = eCSR_ENCRYPT_TYPE_NONE; |
| 839 | |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 840 | QDF_ASSERT(pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 841 | |
| 842 | if (pRoamInfo) { |
| 843 | /* Save the BSSID for the connection */ |
| 844 | if (eCSR_BSS_TYPE_INFRASTRUCTURE == eBssType) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 845 | QDF_ASSERT(pRoamInfo->pBssDesc); |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 846 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 847 | &pRoamInfo->bssid); |
| 848 | |
| 849 | /* |
| 850 | * Save the Station ID for this station from |
| 851 | * the 'Roam Info'. For IBSS mode, staId is |
| 852 | * assigned in NEW_PEER_IND. For reassoc, |
| 853 | * the staID doesn't change and it may be invalid |
| 854 | * in this structure so no change here. |
| 855 | */ |
| 856 | if (!pRoamInfo->fReassocReq) { |
| 857 | pHddStaCtx->conn_info.staId[0] = |
| 858 | pRoamInfo->staId; |
| 859 | } |
| 860 | } else if (eCSR_BSS_TYPE_IBSS == eBssType) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 861 | qdf_copy_macaddr(&pHddStaCtx->conn_info.bssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 862 | &pRoamInfo->bssid); |
| 863 | } else { |
| 864 | /* |
| 865 | * can't happen. We need a valid IBSS or Infra setting |
| 866 | * in the BSSDescription or we can't function. |
| 867 | */ |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 868 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 869 | } |
| 870 | |
| 871 | /* notify WMM */ |
| 872 | hdd_wmm_connect(pAdapter, pRoamInfo, eBssType); |
| 873 | |
| 874 | if (!pRoamInfo->u.pConnectedProfile) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 875 | QDF_ASSERT(pRoamInfo->u.pConnectedProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 876 | } else { |
| 877 | /* Get Multicast Encryption Type */ |
| 878 | encryptType = |
| 879 | pRoamInfo->u.pConnectedProfile->mcEncryptionType; |
| 880 | pHddStaCtx->conn_info.mcEncryptionType = encryptType; |
| 881 | /* Get Unicast Encryption Type */ |
| 882 | encryptType = |
| 883 | pRoamInfo->u.pConnectedProfile->EncryptionType; |
| 884 | pHddStaCtx->conn_info.ucEncryptionType = encryptType; |
| 885 | |
| 886 | pHddStaCtx->conn_info.authType = |
| 887 | pRoamInfo->u.pConnectedProfile->AuthType; |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 888 | pHddStaCtx->conn_info.last_auth_type = |
| 889 | pHddStaCtx->conn_info.authType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 890 | |
| 891 | pHddStaCtx->conn_info.operationChannel = |
| 892 | pRoamInfo->u.pConnectedProfile->operationChannel; |
| 893 | |
| 894 | /* Save the ssid for the connection */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 895 | qdf_mem_copy(&pHddStaCtx->conn_info.SSID.SSID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 896 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 897 | sizeof(tSirMacSSid)); |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 898 | qdf_mem_copy(&pHddStaCtx->conn_info.last_ssid.SSID, |
| 899 | &pRoamInfo->u.pConnectedProfile->SSID, |
| 900 | sizeof(tSirMacSSid)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 901 | |
| 902 | /* Save dot11mode in which STA associated to AP */ |
| 903 | pHddStaCtx->conn_info.dot11Mode = |
| 904 | pRoamInfo->u.pConnectedProfile->dot11Mode; |
| 905 | |
| 906 | pHddStaCtx->conn_info.proxyARPService = |
| 907 | pRoamInfo->u.pConnectedProfile->proxyARPService; |
Kanchanapally, Vidyullatha | e306281 | 2015-05-22 17:28:57 +0530 | [diff] [blame] | 908 | |
| 909 | pHddStaCtx->conn_info.nss = pRoamInfo->chan_info.nss; |
| 910 | |
| 911 | pHddStaCtx->conn_info.rate_flags = |
| 912 | pRoamInfo->chan_info.rate_flags; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 913 | } |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 914 | hdd_save_bss_info(pAdapter, pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 915 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 916 | } |
| 917 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 918 | /** |
| 919 | * hdd_send_ft_assoc_response() - send fast transition assoc response |
| 920 | * @dev: pointer to net device |
| 921 | * @pAdapter: pointer to adapter |
| 922 | * @pCsrRoamInfo: pointer to roam info |
| 923 | * |
| 924 | * Send the 11R key information to the supplicant. Only then can the supplicant |
| 925 | * generate the PMK-R1. (BTW, the ESE supplicant also needs the Assoc Resp IEs |
| 926 | * for the same purpose.) |
| 927 | * |
| 928 | * Mainly the Assoc Rsp IEs are passed here. For the IMDA this contains the |
| 929 | * R1KHID, R0KHID and the MDID. For FT, this consists of the Reassoc Rsp FTIEs. |
| 930 | * This is the Assoc Response. |
| 931 | * |
| 932 | * Return: none |
| 933 | */ |
| 934 | static void |
| 935 | hdd_send_ft_assoc_response(struct net_device *dev, |
| 936 | hdd_adapter_t *pAdapter, |
| 937 | tCsrRoamInfo *pCsrRoamInfo) |
| 938 | { |
| 939 | union iwreq_data wrqu; |
| 940 | char *buff; |
| 941 | unsigned int len = 0; |
| 942 | u8 *pFTAssocRsp = NULL; |
| 943 | |
| 944 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 945 | hdd_debug("assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 946 | return; |
| 947 | } |
| 948 | |
| 949 | pFTAssocRsp = |
| 950 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 951 | pCsrRoamInfo->nAssocReqLength); |
| 952 | if (pFTAssocRsp == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 953 | hdd_debug("AssocReq or AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 954 | return; |
| 955 | } |
| 956 | /* pFTAssocRsp needs to point to the IEs */ |
| 957 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 958 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 959 | (unsigned int)pFTAssocRsp[0], |
| 960 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 961 | |
| 962 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 963 | buff = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 964 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 965 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 966 | return; |
| 967 | } |
| 968 | /* Send the Assoc Resp, the supplicant needs this for initial Auth. */ |
| 969 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 970 | wrqu.data.length = len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 971 | memcpy(buff, pFTAssocRsp, len); |
| 972 | wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, buff); |
| 973 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 974 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 975 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 976 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 977 | /** |
| 978 | * hdd_send_ft_event() - send fast transition event |
| 979 | * @pAdapter: pointer to adapter |
| 980 | * |
| 981 | * Send the FTIEs, RIC IEs during FT. This is eventually used to send the |
| 982 | * FT events to the supplicant. At the reception of Auth2 we send the RIC |
| 983 | * followed by the auth response IEs to the supplicant. |
| 984 | * Once both are received in the supplicant, an FT event is generated |
| 985 | * to the supplicant. |
| 986 | * |
| 987 | * Return: none |
| 988 | */ |
| 989 | static void hdd_send_ft_event(hdd_adapter_t *pAdapter) |
| 990 | { |
| 991 | uint16_t auth_resp_len = 0; |
| 992 | uint32_t ric_ies_length = 0; |
| 993 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 994 | |
| 995 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
| 996 | struct cfg80211_ft_event_params ftEvent; |
| 997 | uint8_t ftIe[DOT11F_IE_FTINFO_MAX_LEN]; |
| 998 | uint8_t ricIe[DOT11F_IE_RICDESCRIPTOR_MAX_LEN]; |
| 999 | struct net_device *dev = pAdapter->dev; |
| 1000 | #else |
| 1001 | char *buff; |
| 1002 | union iwreq_data wrqu; |
| 1003 | uint16_t str_len; |
| 1004 | #endif |
| 1005 | |
| 1006 | #if defined(KERNEL_SUPPORT_11R_CFG80211) |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1007 | qdf_mem_zero(ftIe, DOT11F_IE_FTINFO_MAX_LEN); |
| 1008 | qdf_mem_zero(ricIe, DOT11F_IE_RICDESCRIPTOR_MAX_LEN); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1009 | |
| 1010 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, (u8 *) ricIe, |
| 1011 | DOT11F_IE_RICDESCRIPTOR_MAX_LEN, &ric_ies_length); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1012 | if (ric_ies_length == 0) |
| 1013 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1014 | |
| 1015 | ftEvent.ric_ies = ricIe; |
| 1016 | ftEvent.ric_ies_len = ric_ies_length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1017 | hdd_debug("RIC IEs is of length %d", (int)ric_ies_length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1018 | |
| 1019 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1020 | (u8 *) ftIe, DOT11F_IE_FTINFO_MAX_LEN, |
| 1021 | &auth_resp_len); |
| 1022 | |
| 1023 | if (auth_resp_len == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1024 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1025 | return; |
| 1026 | } |
| 1027 | |
| 1028 | sme_set_ft_pre_auth_state(pHddCtx->hHal, pAdapter->sessionId, true); |
| 1029 | |
| 1030 | ftEvent.target_ap = ftIe; |
| 1031 | |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1032 | ftEvent.ies = (u8 *) (ftIe + QDF_MAC_ADDR_SIZE); |
| 1033 | ftEvent.ies_len = auth_resp_len - QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1034 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1035 | hdd_debug("ftEvent.ies_len %zu", ftEvent.ies_len); |
| 1036 | hdd_debug("ftEvent.ric_ies_len %zu", ftEvent.ric_ies_len); |
| 1037 | hdd_debug("ftEvent.target_ap %2x-%2x-%2x-%2x-%2x-%2x", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1038 | ftEvent.target_ap[0], ftEvent.target_ap[1], |
| 1039 | ftEvent.target_ap[2], ftEvent.target_ap[3], ftEvent.target_ap[4], |
| 1040 | ftEvent.target_ap[5]); |
| 1041 | |
| 1042 | (void)cfg80211_ft_event(dev, &ftEvent); |
| 1043 | |
| 1044 | #else |
| 1045 | /* We need to send the IEs to the supplicant */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1046 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1047 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1048 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1049 | return; |
| 1050 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1051 | |
| 1052 | /* Sme needs to send the RIC IEs first */ |
| 1053 | str_len = strlcpy(buff, "RIC=", IW_CUSTOM_MAX); |
| 1054 | sme_get_rici_es(pHddCtx->hHal, pAdapter->sessionId, |
| 1055 | (u8 *) &(buff[str_len]), (IW_CUSTOM_MAX - str_len), |
| 1056 | &ric_ies_length); |
| 1057 | if (ric_ies_length == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1058 | hdd_warn("Do not send RIC IEs as length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1059 | } else { |
| 1060 | wrqu.data.length = str_len + ric_ies_length; |
| 1061 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1062 | } |
| 1063 | |
| 1064 | /* Sme needs to provide the Auth Resp */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1065 | qdf_mem_zero(buff, IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1066 | str_len = strlcpy(buff, "AUTH=", IW_CUSTOM_MAX); |
| 1067 | sme_get_ft_pre_auth_response(pHddCtx->hHal, pAdapter->sessionId, |
| 1068 | (u8 *) &buff[str_len], |
| 1069 | (IW_CUSTOM_MAX - str_len), &auth_resp_len); |
| 1070 | |
| 1071 | if (auth_resp_len == 0) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1072 | qdf_mem_free(buff); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1073 | hdd_debug("AuthRsp FTIES is of length 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1074 | return; |
| 1075 | } |
| 1076 | |
| 1077 | wrqu.data.length = str_len + auth_resp_len; |
| 1078 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1079 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1080 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1081 | #endif |
| 1082 | } |
| 1083 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1084 | #ifdef FEATURE_WLAN_ESE |
| 1085 | /** |
| 1086 | * hdd_send_new_ap_channel_info() - send new ap channel info |
| 1087 | * @dev: pointer to net device |
| 1088 | * @pAdapter: pointer to adapter |
| 1089 | * @pCsrRoamInfo: pointer to roam info |
| 1090 | * |
| 1091 | * Send the ESE required "new AP Channel info" to the supplicant. |
| 1092 | * (This keeps the supplicant "up to date" on the current channel.) |
| 1093 | * |
| 1094 | * The current (new AP) channel information is passed in. |
| 1095 | * |
| 1096 | * Return: none |
| 1097 | */ |
| 1098 | static void |
| 1099 | hdd_send_new_ap_channel_info(struct net_device *dev, hdd_adapter_t *pAdapter, |
| 1100 | tCsrRoamInfo *pCsrRoamInfo) |
| 1101 | { |
| 1102 | union iwreq_data wrqu; |
| 1103 | tSirBssDescription *descriptor = pCsrRoamInfo->pBssDesc; |
| 1104 | |
| 1105 | if (descriptor == NULL) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1106 | hdd_err("bss descriptor is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1107 | return; |
| 1108 | } |
| 1109 | /* |
| 1110 | * Send the Channel event, the supplicant needs this to generate |
| 1111 | * the Adjacent AP report. |
| 1112 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1113 | hdd_debug("Sending up an SIOCGIWFREQ, channelId: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1114 | descriptor->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1115 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1116 | wrqu.freq.m = descriptor->channelId; |
| 1117 | wrqu.freq.e = 0; |
| 1118 | wrqu.freq.i = 0; |
| 1119 | wireless_send_event(pAdapter->dev, SIOCGIWFREQ, &wrqu, NULL); |
| 1120 | } |
| 1121 | |
| 1122 | #endif /* FEATURE_WLAN_ESE */ |
| 1123 | |
| 1124 | /** |
| 1125 | * hdd_send_update_beacon_ies_event() - send update beacons ie event |
| 1126 | * @pAdapter: pointer to adapter |
| 1127 | * @pCsrRoamInfo: pointer to roam info |
| 1128 | * |
| 1129 | * Return: none |
| 1130 | */ |
| 1131 | static void |
| 1132 | hdd_send_update_beacon_ies_event(hdd_adapter_t *pAdapter, |
| 1133 | tCsrRoamInfo *pCsrRoamInfo) |
| 1134 | { |
| 1135 | union iwreq_data wrqu; |
| 1136 | u8 *pBeaconIes; |
| 1137 | u8 currentLen = 0; |
| 1138 | char *buff; |
| 1139 | int totalIeLen = 0, currentOffset = 0, strLen; |
| 1140 | |
| 1141 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1142 | |
| 1143 | if (0 == pCsrRoamInfo->nBeaconLength) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1144 | hdd_debug("beacon frame length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1145 | return; |
| 1146 | } |
| 1147 | pBeaconIes = (u8 *) (pCsrRoamInfo->pbFrames + BEACON_FRAME_IES_OFFSET); |
| 1148 | if (pBeaconIes == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1149 | hdd_warn("Beacon IEs is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1150 | return; |
| 1151 | } |
| 1152 | /* pBeaconIes needs to point to the IEs */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1153 | hdd_debug("Beacon IEs is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1154 | (unsigned int)pBeaconIes[0], |
| 1155 | (unsigned int)pBeaconIes[1]); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1156 | hdd_debug("Beacon IEs length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1157 | pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1158 | |
| 1159 | /* We need to send the IEs to the supplicant. */ |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1160 | buff = qdf_mem_malloc(IW_CUSTOM_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1161 | if (buff == NULL) { |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1162 | hdd_err("unable to allocate memory"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1163 | return; |
| 1164 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1165 | |
| 1166 | strLen = strlcpy(buff, "BEACONIEs=", IW_CUSTOM_MAX); |
| 1167 | currentLen = strLen + 1; |
| 1168 | |
| 1169 | totalIeLen = pCsrRoamInfo->nBeaconLength - BEACON_FRAME_IES_OFFSET; |
| 1170 | do { |
| 1171 | /* |
| 1172 | * If the beacon size exceeds max CUSTOM event size, break it |
| 1173 | * into chunks of CUSTOM event max size and send it to |
| 1174 | * supplicant. Changes are done in supplicant to handle this. |
| 1175 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1176 | qdf_mem_zero(&buff[strLen + 1], IW_CUSTOM_MAX - (strLen + 1)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1177 | currentLen = |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1178 | QDF_MIN(totalIeLen, IW_CUSTOM_MAX - (strLen + 1) - 1); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1179 | qdf_mem_copy(&buff[strLen + 1], pBeaconIes + currentOffset, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1180 | currentLen); |
| 1181 | currentOffset += currentLen; |
| 1182 | totalIeLen -= currentLen; |
| 1183 | wrqu.data.length = strLen + 1 + currentLen; |
| 1184 | if (totalIeLen) |
| 1185 | buff[strLen] = 1; /* more chunks pending */ |
| 1186 | else |
| 1187 | buff[strLen] = 0; /* last chunk */ |
| 1188 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1189 | hdd_debug("Beacon IEs length to supplicant = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1190 | currentLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1191 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buff); |
| 1192 | } while (totalIeLen > 0); |
| 1193 | |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 1194 | qdf_mem_free(buff); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1195 | } |
| 1196 | |
| 1197 | /** |
| 1198 | * hdd_send_association_event() - send association event |
| 1199 | * @dev: pointer to net device |
| 1200 | * @pCsrRoamInfo: pointer to roam info |
| 1201 | * |
| 1202 | * Return: none |
| 1203 | */ |
| 1204 | static void hdd_send_association_event(struct net_device *dev, |
| 1205 | tCsrRoamInfo *pCsrRoamInfo) |
| 1206 | { |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1207 | int ret; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1208 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 1209 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1210 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1211 | union iwreq_data wrqu; |
| 1212 | int we_event; |
| 1213 | char *msg; |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1214 | struct qdf_mac_addr peerMacAddr; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1215 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1216 | /* Added to find the auth type on the fly at run time */ |
| 1217 | /* rather than with cfg to see if FT is enabled */ |
| 1218 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 1219 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1220 | |
| 1221 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 1222 | wrqu.ap_addr.sa_family = ARPHRD_ETHER; |
| 1223 | we_event = SIOCGIWAP; |
| 1224 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1225 | if (NULL != pCsrRoamInfo) |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1226 | if (pCsrRoamInfo->roamSynchInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1227 | /* change logging before release */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1228 | hdd_debug("LFR3:hdd_send_association_event"); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1229 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1230 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1231 | true, pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1232 | wlan_hdd_tdls_notify_disconnect(pAdapter, true); |
Nitesh Shah | d11bfa2 | 2016-12-22 12:06:23 +0530 | [diff] [blame] | 1233 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1234 | #endif |
| 1235 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) { |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1236 | tSirSmeChanInfo chan_info = {0}; |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1237 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1238 | if (!pCsrRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1239 | hdd_warn("STA in associated state but pCsrRoamInfo is null"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1240 | return; |
| 1241 | } |
| 1242 | |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 1243 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1244 | policy_mgr_incr_active_session(pHddCtx->hdd_psoc, |
| 1245 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1246 | memcpy(wrqu.ap_addr.sa_data, pCsrRoamInfo->pBssDesc->bssId, |
| 1247 | sizeof(pCsrRoamInfo->pBssDesc->bssId)); |
| 1248 | |
| 1249 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1250 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1251 | if (global_p2p_connection_status == |
| 1252 | P2P_CLIENT_CONNECTING_STATE_1) { |
| 1253 | global_p2p_connection_status = |
| 1254 | P2P_CLIENT_CONNECTED_STATE_1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1255 | 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] | 1256 | } else if (global_p2p_connection_status == |
| 1257 | P2P_CLIENT_CONNECTING_STATE_2) { |
| 1258 | global_p2p_connection_status = |
| 1259 | P2P_CLIENT_COMPLETED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1260 | 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] | 1261 | } |
| 1262 | } |
| 1263 | #endif |
| 1264 | pr_info("wlan: " MAC_ADDRESS_STR " connected to " |
| 1265 | MAC_ADDRESS_STR "\n", |
| 1266 | MAC_ADDR_ARRAY(pAdapter->macAddressCurrent.bytes), |
| 1267 | MAC_ADDR_ARRAY(wrqu.ap_addr.sa_data)); |
| 1268 | hdd_send_update_beacon_ies_event(pAdapter, pCsrRoamInfo); |
| 1269 | |
| 1270 | /* |
| 1271 | * Send IWEVASSOCRESPIE Event if WLAN_FEATURE_CIQ_METRICS |
| 1272 | * is Enabled Or Send IWEVASSOCRESPIE Event if |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 1273 | * fFTEnable is true. |
| 1274 | * Send FT Keys to the supplicant when FT is enabled |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1275 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1276 | if ((pRoamProfile->AuthType.authType[0] == |
| 1277 | eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 1278 | || (pRoamProfile->AuthType.authType[0] == |
| 1279 | eCSR_AUTH_TYPE_FT_RSN) |
| 1280 | #ifdef FEATURE_WLAN_ESE |
| 1281 | || (pRoamProfile->AuthType.authType[0] == |
| 1282 | eCSR_AUTH_TYPE_CCKM_RSN) |
| 1283 | || (pRoamProfile->AuthType.authType[0] == |
| 1284 | eCSR_AUTH_TYPE_CCKM_WPA) |
| 1285 | #endif |
| 1286 | ) { |
| 1287 | hdd_send_ft_assoc_response(dev, pAdapter, pCsrRoamInfo); |
| 1288 | } |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1289 | qdf_copy_macaddr(&peerMacAddr, |
| 1290 | &pHddStaCtx->conn_info.bssId); |
| 1291 | chan_info.chan_id = pCsrRoamInfo->chan_info.chan_id; |
| 1292 | chan_info.mhz = pCsrRoamInfo->chan_info.mhz; |
| 1293 | chan_info.info = pCsrRoamInfo->chan_info.info; |
| 1294 | chan_info.band_center_freq1 = |
| 1295 | pCsrRoamInfo->chan_info.band_center_freq1; |
| 1296 | chan_info.band_center_freq2 = |
| 1297 | pCsrRoamInfo->chan_info.band_center_freq2; |
| 1298 | chan_info.reg_info_1 = |
| 1299 | pCsrRoamInfo->chan_info.reg_info_1; |
| 1300 | chan_info.reg_info_2 = |
| 1301 | pCsrRoamInfo->chan_info.reg_info_2; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1302 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1303 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1304 | pAdapter->device_mode, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1305 | peerMacAddr.bytes, |
| 1306 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1307 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1308 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1309 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1310 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1311 | WLAN_ASSOC_STATE); |
Mukul Sharma | 5678be4 | 2017-01-24 12:20:01 +0530 | [diff] [blame] | 1312 | if (ret) |
| 1313 | hdd_err("Peer object %pM fail to set associated state", |
| 1314 | peerMacAddr.bytes); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1315 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1316 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1317 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
| 1318 | ePeerConnected, |
| 1319 | pCsrRoamInfo->timingMeasCap, |
| 1320 | pAdapter->sessionId, &chan_info, |
| 1321 | pAdapter->device_mode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1322 | /* Update tdls module about connection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1323 | hdd_notify_sta_connect(pAdapter->sessionId, |
| 1324 | pCsrRoamInfo->tdls_chan_swit_prohibited, |
| 1325 | pCsrRoamInfo->tdls_prohibited, |
| 1326 | pAdapter->hdd_vdev); |
| 1327 | |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1328 | wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo); |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 1329 | |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1330 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1331 | #ifdef MSM_PLATFORM |
Ravi Joshi | ae8e9a7 | 2016-08-03 17:38:03 -0700 | [diff] [blame] | 1332 | #if defined(CONFIG_ICNSS) || defined(CONFIG_CNSS) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1333 | /* start timer in sta/p2p_cli */ |
| 1334 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1335 | pAdapter->prev_tx_packets = pAdapter->stats.tx_packets; |
| 1336 | pAdapter->prev_rx_packets = pAdapter->stats.rx_packets; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1337 | cdp_get_intra_bss_fwd_pkts_count( |
| 1338 | cds_get_context(QDF_MODULE_ID_SOC), pAdapter->sessionId, |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1339 | &pAdapter->prev_fwd_tx_packets, |
| 1340 | &pAdapter->prev_fwd_rx_packets); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1341 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1342 | hdd_bus_bw_compute_timer_start(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1343 | #endif |
| 1344 | #endif |
| 1345 | } else if (eConnectionState_IbssConnected == /* IBss Associated */ |
| 1346 | pHddStaCtx->conn_info.connState) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1347 | policy_mgr_update_connection_info(pHddCtx->hdd_psoc, |
| 1348 | pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1349 | memcpy(wrqu.ap_addr.sa_data, pHddStaCtx->conn_info.bssId.bytes, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1350 | ETH_ALEN); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1351 | hdd_info("wlan: new IBSS connection to " MAC_ADDRESS_STR, |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1352 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes)); |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1353 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1354 | ret = hdd_objmgr_add_peer_object(pAdapter->hdd_vdev, |
| 1355 | QDF_IBSS_MODE, |
Rachit Kankane | 2487f8f | 2017-04-19 14:30:19 +0530 | [diff] [blame] | 1356 | pCsrRoamInfo->bssid.bytes, |
| 1357 | false); |
Rajeev Kumar | 7842768 | 2017-01-13 16:13:11 -0800 | [diff] [blame] | 1358 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1359 | hdd_err("Peer object "MAC_ADDRESS_STR" add fails!", |
| 1360 | MAC_ADDR_ARRAY(pCsrRoamInfo->bssid.bytes)); |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1361 | ret = hdd_objmgr_set_peer_mlme_state(pAdapter->hdd_vdev, |
| 1362 | WLAN_ASSOC_STATE); |
Mukul Sharma | eb01e13 | 2017-02-16 13:01:03 +0530 | [diff] [blame] | 1363 | if (ret) |
| 1364 | hdd_err("Peer object %pM fail to set associated state", |
| 1365 | peerMacAddr.bytes); |
| 1366 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1367 | } else { /* Not Associated */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1368 | hdd_info("wlan: disconnected"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1369 | memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 1370 | policy_mgr_decr_session_set_pcl(pHddCtx->hdd_psoc, |
| 1371 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1372 | |
| 1373 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1374 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1375 | #endif |
| 1376 | |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1377 | if ((pAdapter->device_mode == QDF_STA_MODE) || |
| 1378 | (pAdapter->device_mode == QDF_P2P_CLIENT_MODE)) { |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 1379 | qdf_copy_macaddr(&peerMacAddr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1380 | &pHddStaCtx->conn_info.bssId); |
| 1381 | |
| 1382 | /* send peer status indication to oem app */ |
Naveen Rawat | 910726a | 2017-03-06 11:42:51 -0800 | [diff] [blame] | 1383 | hdd_send_peer_status_ind_to_app(&peerMacAddr, |
Abhishek Singh | 1c67622 | 2016-05-09 14:20:28 +0530 | [diff] [blame] | 1384 | ePeerDisconnected, 0, |
| 1385 | pAdapter->sessionId, |
| 1386 | NULL, |
| 1387 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1388 | } |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1389 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1390 | ret = hdd_objmgr_remove_peer_object(pAdapter->hdd_vdev, |
| 1391 | peerMacAddr.bytes); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 1392 | if (ret) |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 1393 | hdd_err("Peer obj "MAC_ADDRESS_STR" delete fails", |
| 1394 | MAC_ADDR_ARRAY(peerMacAddr.bytes)); |
| 1395 | |
Jeff Johnson | cef59bb | 2016-09-23 15:28:47 -0700 | [diff] [blame] | 1396 | hdd_lpass_notify_disconnect(pAdapter); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1397 | /* Update tdls module about the disconnection event */ |
Kabilan Kannan | 1c1c402 | 2017-04-06 22:49:26 -0700 | [diff] [blame] | 1398 | hdd_notify_sta_disconnect(pAdapter->sessionId, |
| 1399 | false, |
| 1400 | pAdapter->hdd_vdev); |
Nitesh Shah | b9d3dbb | 2017-01-16 16:37:20 +0530 | [diff] [blame] | 1401 | wlan_hdd_tdls_notify_disconnect(pAdapter, false); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 1402 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1403 | #ifdef MSM_PLATFORM |
| 1404 | /* stop timer in sta/p2p_cli */ |
| 1405 | spin_lock_bh(&pHddCtx->bus_bw_lock); |
| 1406 | pAdapter->prev_tx_packets = 0; |
| 1407 | pAdapter->prev_rx_packets = 0; |
Himanshu Agarwal | 5ac2f7b | 2016-05-06 20:08:10 +0530 | [diff] [blame] | 1408 | pAdapter->prev_fwd_tx_packets = 0; |
| 1409 | pAdapter->prev_fwd_rx_packets = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1410 | spin_unlock_bh(&pHddCtx->bus_bw_lock); |
Dustin Brown | 5ec6b55 | 2017-03-31 12:11:40 -0700 | [diff] [blame] | 1411 | hdd_bus_bw_compute_timer_try_stop(pHddCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1412 | #endif |
| 1413 | } |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 1414 | hdd_ipa_set_tx_flow_info(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1415 | /* Send SCC/MCC Switching event to IPA */ |
| 1416 | hdd_ipa_send_mcc_scc_msg(pHddCtx, pHddCtx->mcc_mode); |
| 1417 | |
| 1418 | msg = NULL; |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 1419 | /* During the WLAN uninitialization,supplicant is stopped before the |
| 1420 | * driver so not sending the status of the connection to supplicant |
| 1421 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1422 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1423 | wireless_send_event(dev, we_event, &wrqu, msg); |
| 1424 | #ifdef FEATURE_WLAN_ESE |
| 1425 | if (eConnectionState_Associated == |
| 1426 | pHddStaCtx->conn_info.connState) { |
| 1427 | if ((pRoamProfile->AuthType.authType[0] == |
| 1428 | eCSR_AUTH_TYPE_CCKM_RSN) || |
| 1429 | (pRoamProfile->AuthType.authType[0] == |
| 1430 | eCSR_AUTH_TYPE_CCKM_WPA)) |
| 1431 | hdd_send_new_ap_channel_info(dev, pAdapter, |
| 1432 | pCsrRoamInfo); |
| 1433 | } |
| 1434 | #endif |
| 1435 | } |
| 1436 | } |
| 1437 | |
| 1438 | /** |
| 1439 | * hdd_conn_remove_connect_info() - remove connection info |
| 1440 | * @pHddStaCtx: pointer to global HDD station context |
| 1441 | * @pCsrRoamInfo: pointer to roam info |
| 1442 | * |
| 1443 | * Return: none |
| 1444 | */ |
| 1445 | static void hdd_conn_remove_connect_info(hdd_station_ctx_t *pHddStaCtx) |
| 1446 | { |
| 1447 | /* Remove staId, bssId and peerMacAddress */ |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1448 | pHddStaCtx->conn_info.staId[0] = HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1449 | qdf_mem_zero(&pHddStaCtx->conn_info.bssId, QDF_MAC_ADDR_SIZE); |
| 1450 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[0], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1451 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1452 | |
| 1453 | /* Clear all security settings */ |
| 1454 | pHddStaCtx->conn_info.authType = eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 1455 | pHddStaCtx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1456 | pHddStaCtx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 1457 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1458 | qdf_mem_zero(&pHddStaCtx->conn_info.Keys, sizeof(tCsrKeys)); |
| 1459 | qdf_mem_zero(&pHddStaCtx->ibss_enc_key, sizeof(tCsrRoamSetKey)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1460 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1461 | pHddStaCtx->conn_info.proxyARPService = 0; |
| 1462 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1463 | qdf_mem_zero(&pHddStaCtx->conn_info.SSID, sizeof(tCsrSSIDInfo)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1464 | } |
| 1465 | |
| 1466 | /** |
| 1467 | * hdd_roam_deregister_sta() - deregister station |
| 1468 | * @pAdapter: pointer to adapter |
| 1469 | * @staId: station identifier |
| 1470 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1471 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1472 | */ |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1473 | 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] | 1474 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1475 | QDF_STATUS qdf_status; |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1476 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 1477 | int ret = 0; |
| 1478 | uint8_t *peer_mac = NULL; |
| 1479 | struct qdf_mac_addr broadcastMacAddr = |
| 1480 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1481 | if (eConnectionState_IbssDisconnected == |
| 1482 | pHddStaCtx->conn_info.connState) { |
| 1483 | /* |
| 1484 | * Do not set the carrier off when the last peer leaves. |
| 1485 | * We will set the carrier off while stopping the IBSS. |
| 1486 | */ |
| 1487 | } |
| 1488 | |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 1489 | 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] | 1490 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1491 | staid); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1492 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1493 | hdd_err("cdp_clear_peer() failed for staid %d. Status(%d) [0x%08X]", |
| 1494 | staid, qdf_status, qdf_status); |
| 1495 | } |
| 1496 | |
| 1497 | if (adapter->device_mode == QDF_STA_MODE) { |
| 1498 | peer_mac = pHddStaCtx->conn_info.bssId.bytes; |
| 1499 | } else if (adapter->device_mode == QDF_IBSS_MODE) { |
| 1500 | if (pHddStaCtx->broadcast_staid == staid) |
| 1501 | peer_mac = broadcastMacAddr.bytes; |
| 1502 | else |
| 1503 | peer_mac = pHddStaCtx->conn_info. |
| 1504 | peerMacAddress[staid].bytes; |
| 1505 | } |
| 1506 | |
Dustin Brown | 7d043f6 | 2017-03-27 12:07:36 -0700 | [diff] [blame] | 1507 | ret = hdd_objmgr_remove_peer_object(adapter->hdd_vdev, peer_mac); |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 1508 | if (ret) { |
| 1509 | hdd_err("Peer obj %pM delete fails", peer_mac); |
| 1510 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1511 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1512 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1513 | } |
| 1514 | |
| 1515 | /** |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1516 | * hdd_print_bss_info() - print bss info |
| 1517 | * @hdd_sta_ctx: pointer to hdd station context |
| 1518 | * |
| 1519 | * Return: None |
| 1520 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1521 | static void hdd_print_bss_info(hdd_station_ctx_t *hdd_sta_ctx) |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1522 | { |
| 1523 | uint32_t *cap_info; |
| 1524 | |
| 1525 | hdd_info("WIFI DATA LOGGER"); |
| 1526 | hdd_info("channel: %d", |
| 1527 | hdd_sta_ctx->conn_info.freq); |
| 1528 | hdd_info("dot11mode: %d", |
| 1529 | hdd_sta_ctx->conn_info.dot11Mode); |
| 1530 | hdd_info("AKM: %d", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1531 | hdd_sta_ctx->conn_info.last_auth_type); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1532 | hdd_info("ssid: %.*s", |
Zhang Qian | 32fd43e | 2017-08-24 18:36:28 +0800 | [diff] [blame] | 1533 | hdd_sta_ctx->conn_info.last_ssid.SSID.length, |
| 1534 | hdd_sta_ctx->conn_info.last_ssid.SSID.ssId); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1535 | hdd_info("roam count: %d", |
| 1536 | hdd_sta_ctx->conn_info.roam_count); |
| 1537 | hdd_info("ant_info: %d", |
| 1538 | hdd_sta_ctx->conn_info.txrate.nss); |
| 1539 | hdd_info("datarate legacy %d", |
| 1540 | hdd_sta_ctx->conn_info.txrate.legacy); |
| 1541 | hdd_info("datarate mcs: %d", |
| 1542 | hdd_sta_ctx->conn_info.txrate.mcs); |
| 1543 | if (hdd_sta_ctx->conn_info.conn_flag.ht_present) { |
| 1544 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.ht_caps; |
| 1545 | hdd_info("ht caps: %x", *cap_info); |
| 1546 | } |
| 1547 | if (hdd_sta_ctx->conn_info.conn_flag.vht_present) { |
| 1548 | cap_info = (uint32_t *)&hdd_sta_ctx->conn_info.vht_caps; |
| 1549 | hdd_info("vht caps: %x", *cap_info); |
| 1550 | } |
| 1551 | if (hdd_sta_ctx->conn_info.conn_flag.hs20_present) |
| 1552 | hdd_info("hs20 info: %x", |
| 1553 | hdd_sta_ctx->conn_info.hs20vendor_ie.release_num); |
| 1554 | hdd_info("signal: %d", |
| 1555 | hdd_sta_ctx->conn_info.signal); |
| 1556 | hdd_info("noise: %d", |
| 1557 | hdd_sta_ctx->conn_info.noise); |
| 1558 | } |
| 1559 | |
| 1560 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1561 | * hdd_dis_connect_handler() - disconnect event handler |
| 1562 | * @pAdapter: pointer to adapter |
| 1563 | * @pRoamInfo: pointer to roam info |
| 1564 | * @roamId: roam identifier |
| 1565 | * @roamStatus: roam status |
| 1566 | * @roamResult: roam result |
| 1567 | * |
| 1568 | * This function handles disconnect event: |
| 1569 | * 1. Disable transmit queues; |
| 1570 | * 2. Clean up internal connection states and data structures; |
| 1571 | * 3. Send disconnect indication to supplicant. |
| 1572 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1573 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1574 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1575 | static QDF_STATUS hdd_dis_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1576 | tCsrRoamInfo *pRoamInfo, |
| 1577 | uint32_t roamId, |
| 1578 | eRoamCmdStatus roamStatus, |
| 1579 | eCsrRoamResult roamResult) |
| 1580 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1581 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1582 | QDF_STATUS vstatus; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1583 | struct net_device *dev = pAdapter->dev; |
| 1584 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 1585 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 1586 | uint8_t sta_id; |
| 1587 | bool sendDisconInd = true; |
| 1588 | |
| 1589 | if (dev == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1590 | hdd_err("net_dev is released return"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1591 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1592 | } |
| 1593 | /* notify apps that we can't pass traffic anymore */ |
Varun Reddy Yeturu | 8a5d3d4 | 2017-08-02 13:03:27 -0700 | [diff] [blame] | 1594 | hdd_debug("Disabling queues"); |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 1595 | wlan_hdd_netif_queue_control(pAdapter, |
| 1596 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
| 1597 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1598 | |
| 1599 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 1600 | hdd_ipa_wlan_evt(pAdapter, pHddStaCtx->conn_info.staId[0], |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 1601 | HDD_IPA_STA_DISCONNECT, |
| 1602 | pHddStaCtx->conn_info.bssId.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1603 | |
| 1604 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 1605 | wlan_hdd_auto_shutdown_enable(pHddCtx, true); |
| 1606 | #endif |
| 1607 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1608 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 1609 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 1610 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 1611 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_DISASSOC)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1612 | |
| 1613 | /* HDD has initiated disconnect, do not send disconnect indication |
| 1614 | * to kernel. Sending disconnected event to kernel for userspace |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1615 | * initiated disconnect will be handled by disconnect handler call |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1616 | * to cfg80211_disconnected. |
| 1617 | */ |
| 1618 | if ((eConnectionState_Disconnecting == |
| 1619 | pHddStaCtx->conn_info.connState) || |
| 1620 | (eConnectionState_NotConnected == |
| 1621 | pHddStaCtx->conn_info.connState)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1622 | 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] | 1623 | sendDisconInd = false; |
| 1624 | } |
| 1625 | |
| 1626 | if (pHddStaCtx->conn_info.connState != eConnectionState_Disconnecting) { |
| 1627 | INIT_COMPLETION(pAdapter->disconnect_comp_var); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1628 | hdd_conn_set_connection_state(pAdapter, |
| 1629 | eConnectionState_Disconnecting); |
| 1630 | } |
| 1631 | |
| 1632 | hdd_clear_roam_profile_ie(pAdapter); |
| 1633 | hdd_wmm_init(pAdapter); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1634 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 1635 | wlan_deregister_txrx_packetdump(); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1636 | |
| 1637 | /* indicate 'disconnect' status to wpa_supplicant... */ |
| 1638 | hdd_send_association_event(dev, pRoamInfo); |
| 1639 | /* indicate disconnected event to nl80211 */ |
| 1640 | if (roamStatus != eCSR_ROAM_IBSS_LEAVE) { |
| 1641 | /* |
| 1642 | * Only send indication to kernel if not initiated |
| 1643 | * by kernel |
| 1644 | */ |
| 1645 | if (sendDisconInd) { |
| 1646 | /* |
| 1647 | * To avoid wpa_supplicant sending "HANGED" CMD |
| 1648 | * to ICS UI. |
| 1649 | */ |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1650 | if (eCSR_ROAM_LOSTLINK == roamStatus) { |
| 1651 | if (pRoamInfo->reasonCode == |
| 1652 | eSIR_MAC_PEER_STA_REQ_LEAVING_BSS_REASON) |
| 1653 | 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] | 1654 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1655 | dev, false, |
| 1656 | pRoamInfo->reasonCode); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1657 | } else { |
Mahesh A Saptasagar | c35e8bf | 2016-06-17 20:03:46 +0530 | [diff] [blame] | 1658 | wlan_hdd_cfg80211_indicate_disconnect( |
| 1659 | dev, false, |
| 1660 | WLAN_REASON_UNSPECIFIED |
| 1661 | ); |
Kiran Kumar Lokere | 37d3aa2 | 2015-11-03 14:58:26 -0800 | [diff] [blame] | 1662 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1663 | |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 1664 | hdd_info("sent disconnected event to nl80211, reason code %d", |
| 1665 | (eCSR_ROAM_LOSTLINK == roamStatus) ? |
| 1666 | pRoamInfo->reasonCode : |
| 1667 | WLAN_REASON_UNSPECIFIED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1668 | } |
| 1669 | /* |
| 1670 | * During the WLAN uninitialization,supplicant is stopped |
| 1671 | * before the driver so not sending the status of the |
| 1672 | * connection to supplicant. |
| 1673 | */ |
Rajeev Kumar | fec3dbe | 2016-01-19 15:23:52 -0800 | [diff] [blame] | 1674 | if (cds_is_load_or_unload_in_progress()) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1675 | #ifdef WLAN_FEATURE_P2P_DEBUG |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1676 | if (pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1677 | if (global_p2p_connection_status == |
| 1678 | P2P_CLIENT_CONNECTED_STATE_1) { |
| 1679 | global_p2p_connection_status = |
| 1680 | P2P_CLIENT_DISCONNECTED_STATE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1681 | 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] | 1682 | } else if (global_p2p_connection_status == |
| 1683 | P2P_CLIENT_COMPLETED_STATE) { |
| 1684 | global_p2p_connection_status = |
| 1685 | P2P_NOT_ACTIVE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1686 | 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] | 1687 | } |
| 1688 | } |
| 1689 | #endif |
| 1690 | |
| 1691 | } |
| 1692 | } |
| 1693 | |
| 1694 | hdd_wmm_adapter_clear(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1695 | sme_ft_reset(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 1696 | if (hdd_remove_beacon_filter(pAdapter) != 0) |
| 1697 | hdd_err("hdd_remove_beacon_filter() failed"); |
| 1698 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1699 | if (eCSR_ROAM_IBSS_LEAVE == roamStatus) { |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1700 | uint8_t i; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1701 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 1702 | sta_id = pHddStaCtx->broadcast_staid; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1703 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1704 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1705 | 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] | 1706 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1707 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1708 | } |
| 1709 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1710 | /* Clear all the peer sta register with TL. */ |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 1711 | for (i = 0; i < MAX_PEERS; i++) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 1712 | if (HDD_WLAN_INVALID_STA_ID == |
| 1713 | pHddStaCtx->conn_info.staId[i]) |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1714 | continue; |
| 1715 | sta_id = pHddStaCtx->conn_info.staId[i]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1716 | hdd_debug("Deregister StaID %d", sta_id); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1717 | vstatus = hdd_roam_deregister_sta(pAdapter, sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1718 | if (!QDF_IS_STATUS_SUCCESS(vstatus)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1719 | 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] | 1720 | sta_id, status, status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1721 | status = QDF_STATUS_E_FAILURE; |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1722 | } |
| 1723 | /* set the staid and peer mac as 0, all other |
| 1724 | * reset are done in hdd_connRemoveConnectInfo. |
| 1725 | */ |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 1726 | pHddStaCtx->conn_info.staId[i] = |
| 1727 | HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 1728 | qdf_mem_zero(&pHddStaCtx->conn_info.peerMacAddress[i], |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1729 | sizeof(struct qdf_mac_addr)); |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1730 | if (sta_id < (WLAN_MAX_STA_COUNT + 3)) |
| 1731 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
| 1732 | } |
| 1733 | } else { |
| 1734 | sta_id = pHddStaCtx->conn_info.staId[0]; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1735 | hdd_debug("roamResult: %d", roamResult); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1736 | |
| 1737 | /* clear scan cache for Link Lost */ |
Sandeep Puligilla | f0b3058 | 2017-01-12 08:39:41 -0800 | [diff] [blame] | 1738 | if (eCSR_ROAM_RESULT_DEAUTH_IND == roamResult || |
| 1739 | eCSR_ROAM_RESULT_DISASSOC_IND == roamResult || |
yeshwanth sriram guntuka | 951725a | 2017-03-15 19:33:04 +0530 | [diff] [blame] | 1740 | eCSR_ROAM_LOSTLINK == roamStatus) { |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 1741 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 1742 | pHddStaCtx->conn_info.bssId.bytes); |
| 1743 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 1744 | pHddStaCtx->conn_info.bssId.bytes); |
| 1745 | } |
Sreelakshmi Konamki | 32eadb1 | 2015-09-02 15:18:32 +0530 | [diff] [blame] | 1746 | pHddCtx->sta_to_adapter[sta_id] = NULL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1747 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1748 | /* Clear saved connection information in HDD */ |
| 1749 | hdd_conn_remove_connect_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1750 | hdd_conn_set_connection_state(pAdapter, eConnectionState_NotConnected); |
Mukul Sharma | 3d36c39 | 2017-01-18 18:39:12 +0530 | [diff] [blame] | 1751 | pmo_ucfg_flush_gtk_offload_req(pAdapter->hdd_vdev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1752 | |
| 1753 | #ifdef FEATURE_WLAN_TDLS |
| 1754 | if (eCSR_ROAM_IBSS_LEAVE != roamStatus) |
| 1755 | wlan_hdd_tdls_disconnection_callback(pAdapter); |
| 1756 | #endif |
| 1757 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1758 | if ((QDF_STA_MODE == pAdapter->device_mode) || |
| 1759 | (QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1760 | sme_ps_disable_auto_ps_timer(WLAN_HDD_GET_HAL_CTX |
| 1761 | (pAdapter), |
| 1762 | pAdapter->sessionId); |
| 1763 | } |
Mahesh A Saptasagar | 6dda202 | 2016-09-03 12:59:09 +0530 | [diff] [blame] | 1764 | wlan_hdd_clear_link_layer_stats(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1765 | /* Unblock anyone waiting for disconnect to complete */ |
| 1766 | complete(&pAdapter->disconnect_comp_var); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 1767 | hdd_print_bss_info(pHddStaCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1768 | return status; |
| 1769 | } |
| 1770 | |
| 1771 | /** |
| 1772 | * hdd_set_peer_authorized_event() - set peer_authorized_event |
| 1773 | * @vdev_id: vdevid |
| 1774 | * |
| 1775 | * Return: None |
| 1776 | */ |
Jeff Johnson | 018d7d3 | 2016-10-05 14:31:11 -0700 | [diff] [blame] | 1777 | static void hdd_set_peer_authorized_event(uint32_t vdev_id) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1778 | { |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1779 | hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1780 | hdd_adapter_t *adapter = NULL; |
| 1781 | |
| 1782 | adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id); |
| 1783 | if (adapter == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1784 | hdd_err("Invalid vdev_id"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1785 | return; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1786 | } |
| 1787 | complete(&adapter->sta_authorized_event); |
| 1788 | } |
| 1789 | |
| 1790 | /** |
| 1791 | * hdd_change_peer_state() - change peer state |
| 1792 | * @pAdapter: HDD adapter |
| 1793 | * @sta_state: peer state |
| 1794 | * @roam_synch_in_progress: roam synch in progress |
| 1795 | * |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 1796 | * Return: QDF status |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1797 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1798 | QDF_STATUS hdd_change_peer_state(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1799 | uint8_t sta_id, |
| 1800 | enum ol_txrx_peer_state sta_state, |
| 1801 | bool roam_synch_in_progress) |
| 1802 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1803 | QDF_STATUS err; |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1804 | uint8_t *peer_mac_addr; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1805 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
| 1806 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1807 | void *peer; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1808 | |
| 1809 | if (!pdev) { |
| 1810 | hdd_err("Failed to get txrx context"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1811 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1812 | } |
| 1813 | |
| 1814 | if (sta_id >= WLAN_MAX_STA_COUNT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1815 | hdd_err("Invalid sta id: %d", sta_id); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1816 | return QDF_STATUS_E_INVAL; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1817 | } |
| 1818 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1819 | peer = cdp_peer_find_by_local_id(soc, |
| 1820 | (struct cdp_pdev *)pdev, sta_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1821 | if (!peer) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1822 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1823 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1824 | peer_mac_addr = cdp_peer_get_peer_mac_addr(soc, peer); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1825 | if (peer_mac_addr == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1826 | hdd_err("peer mac addr is NULL"); |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1827 | return QDF_STATUS_E_FAULT; |
| 1828 | } |
| 1829 | |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1830 | err = cdp_peer_state_update(soc, pdev, peer_mac_addr, sta_state); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1831 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1832 | hdd_err("peer state update failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1833 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1834 | } |
| 1835 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1836 | if (roam_synch_in_progress) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1837 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1838 | #endif |
| 1839 | |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1840 | if (sta_state == OL_TXRX_PEER_STATE_AUTH) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1841 | #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL |
| 1842 | /* make sure event is reset */ |
| 1843 | INIT_COMPLETION(pAdapter->sta_authorized_event); |
| 1844 | #endif |
| 1845 | |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1846 | err = sme_set_peer_authorized(peer_mac_addr, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1847 | hdd_set_peer_authorized_event, |
| 1848 | pAdapter->sessionId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1849 | if (err != QDF_STATUS_SUCCESS) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1850 | hdd_err("Failed to set the peer state to authorized"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1851 | return QDF_STATUS_E_FAULT; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1852 | } |
| 1853 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 1854 | if (pAdapter->device_mode == QDF_STA_MODE || |
| 1855 | pAdapter->device_mode == QDF_P2P_CLIENT_MODE) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1856 | #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] | 1857 | void *vdev; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1858 | unsigned long rc; |
| 1859 | |
| 1860 | /* wait for event from firmware to set the event */ |
| 1861 | rc = wait_for_completion_timeout( |
| 1862 | &pAdapter->sta_authorized_event, |
| 1863 | msecs_to_jiffies(HDD_PEER_AUTHORIZE_WAIT)); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1864 | if (!rc) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1865 | hdd_debug("timeout waiting for sta_authorized_event"); |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 1866 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1867 | vdev = (void *)cdp_peer_get_vdev(soc, peer); |
| 1868 | cdp_fc_vdev_unpause(soc, (struct cdp_vdev *)vdev, |
Manjunathappa Prakash | 10d357a | 2016-03-31 19:20:49 -0700 | [diff] [blame] | 1869 | OL_TXQ_PAUSE_REASON_PEER_UNAUTHORIZED); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1870 | #endif |
| 1871 | } |
| 1872 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1873 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1874 | } |
| 1875 | |
| 1876 | /** |
Kabilan Kannan | 256e318 | 2017-05-02 16:02:37 -0700 | [diff] [blame] | 1877 | * hdd_update_dp_vdev_flags() - update datapath vdev flags |
| 1878 | * @cbk_data: callback data |
| 1879 | * @sta_id: station id |
| 1880 | * @vdev_param: vdev parameter |
| 1881 | * @is_link_up: link state up or down |
| 1882 | * |
| 1883 | * Return: QDF status |
| 1884 | */ |
| 1885 | QDF_STATUS hdd_update_dp_vdev_flags(void *cbk_data, |
| 1886 | uint8_t sta_id, |
| 1887 | uint32_t vdev_param, |
| 1888 | bool is_link_up) |
| 1889 | { |
| 1890 | struct cdp_vdev *data_vdev; |
| 1891 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
| 1892 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1893 | hdd_context_t *hdd_ctx; |
| 1894 | struct wlan_objmgr_psoc **psoc; |
| 1895 | |
| 1896 | if (!cbk_data) |
| 1897 | return status; |
| 1898 | |
| 1899 | psoc = cbk_data; |
| 1900 | hdd_ctx = container_of(psoc, hdd_context_t, hdd_psoc); |
| 1901 | |
| 1902 | if (!hdd_ctx->tdls_nap_active) |
| 1903 | return status; |
| 1904 | |
| 1905 | data_vdev = cdp_peer_get_vdev_by_sta_id(soc, sta_id); |
| 1906 | if (NULL == data_vdev) { |
| 1907 | status = QDF_STATUS_E_FAILURE; |
| 1908 | return status; |
| 1909 | } |
| 1910 | |
| 1911 | cdp_txrx_set_vdev_param(soc, data_vdev, vdev_param, is_link_up); |
| 1912 | |
| 1913 | return status; |
| 1914 | } |
| 1915 | |
| 1916 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1917 | * hdd_roam_register_sta() - register station |
| 1918 | * @pAdapter: pointer to adapter |
| 1919 | * @pRoamInfo: pointer to roam info |
| 1920 | * @staId: station identifier |
| 1921 | * @pPeerMacAddress: peer MAC address |
| 1922 | * @pBssDesc: pointer to BSS description |
| 1923 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1924 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1925 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 1926 | QDF_STATUS hdd_roam_register_sta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1927 | tCsrRoamInfo *pRoamInfo, |
| 1928 | uint8_t staId, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 1929 | struct qdf_mac_addr *pPeerMacAddress, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1930 | tSirBssDescription *pBssDesc) |
| 1931 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1932 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1933 | struct ol_txrx_desc_type staDesc = { 0 }; |
| 1934 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 1935 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1936 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 1937 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1938 | |
| 1939 | if (NULL == pBssDesc) |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1940 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1941 | |
| 1942 | /* Get the Station ID from the one saved during the association */ |
| 1943 | staDesc.sta_id = staId; |
| 1944 | |
| 1945 | /* set the QoS field appropriately */ |
| 1946 | if (hdd_wmm_is_active(pAdapter)) |
| 1947 | staDesc.is_qos_enabled = 1; |
| 1948 | else |
| 1949 | staDesc.is_qos_enabled = 0; |
| 1950 | |
| 1951 | #ifdef FEATURE_WLAN_WAPI |
Varun Reddy Yeturu | dd51e8d | 2017-05-14 14:51:13 -0700 | [diff] [blame] | 1952 | hdd_debug("WAPI STA Registered: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1953 | pAdapter->wapi_info.fIsWapiSta); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1954 | if (pAdapter->wapi_info.fIsWapiSta) |
| 1955 | staDesc.is_wapi_supported = 1; |
| 1956 | else |
| 1957 | staDesc.is_wapi_supported = 0; |
| 1958 | #endif /* FEATURE_WLAN_WAPI */ |
| 1959 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1960 | /* Register the vdev transmit and receive functions */ |
| 1961 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 1962 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1963 | |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1964 | pAdapter->txrx_vdev = (void *)cdp_get_vdev_from_vdev_id(soc, |
| 1965 | (struct cdp_pdev *)pdev, |
| 1966 | pAdapter->sessionId); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1967 | if (!pAdapter->txrx_vdev) { |
| 1968 | hdd_err("%s find vdev fail", __func__); |
| 1969 | return QDF_STATUS_E_FAILURE; |
| 1970 | } |
| 1971 | |
| 1972 | txrx_ops.tx.tx = NULL; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1973 | cdp_vdev_register(soc, |
| 1974 | (struct cdp_vdev *)pAdapter->txrx_vdev, pAdapter, &txrx_ops); |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 1975 | if (!txrx_ops.tx.tx) { |
| 1976 | hdd_err("%s vdev register fail", __func__); |
| 1977 | return QDF_STATUS_E_FAILURE; |
| 1978 | } |
| 1979 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 1980 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 1981 | qdf_status = cdp_peer_register(soc, |
| 1982 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1983 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 1984 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 1985 | qdf_status, qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1986 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1987 | } |
| 1988 | |
| 1989 | if (!pRoamInfo->fAuthRequired) { |
| 1990 | /* |
| 1991 | * Connections that do not need Upper layer auth, transition |
| 1992 | * TLSHIM directly to 'Authenticated' state |
| 1993 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 1994 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1995 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 1996 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1997 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 1998 | pRoamInfo->roamSynchInProgress |
| 1999 | #else |
| 2000 | false |
| 2001 | #endif |
| 2002 | ); |
| 2003 | |
| 2004 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2005 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2006 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2007 | 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] | 2008 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2009 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2010 | hdd_change_peer_state(pAdapter, staDesc.sta_id, |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2011 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2012 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2013 | pRoamInfo->roamSynchInProgress |
| 2014 | #else |
| 2015 | false |
| 2016 | #endif |
| 2017 | ); |
| 2018 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2019 | hdd_objmgr_set_peer_mlme_auth_state(pAdapter->hdd_vdev, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2020 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2021 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2022 | } |
| 2023 | |
| 2024 | /** |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2025 | * hdd_send_roamed_ind() - send roamed indication to cfg80211 |
| 2026 | * @dev: network device |
| 2027 | * @bss: cfg80211 roamed bss pointer |
| 2028 | * @req_ie: IEs used in reassociation request |
| 2029 | * @req_ie_len: Length of the @req_ie |
| 2030 | * @resp_ie: IEs received in successful reassociation response |
| 2031 | * @resp_ie_len: Length of @resp_ie |
| 2032 | * |
| 2033 | * Return: none |
| 2034 | */ |
| 2035 | #if defined CFG80211_ROAMED_API_UNIFIED || \ |
| 2036 | (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) |
| 2037 | static void hdd_send_roamed_ind(struct net_device *dev, |
| 2038 | struct cfg80211_bss *bss, const uint8_t *req_ie, |
| 2039 | size_t req_ie_len, const uint8_t *resp_ie, |
| 2040 | size_t resp_ie_len) |
| 2041 | { |
| 2042 | struct cfg80211_roam_info info = {0}; |
| 2043 | |
| 2044 | info.bss = bss; |
| 2045 | info.req_ie = req_ie; |
| 2046 | info.req_ie_len = req_ie_len; |
| 2047 | info.resp_ie = resp_ie; |
| 2048 | info.resp_ie_len = resp_ie_len; |
| 2049 | cfg80211_roamed(dev, &info, GFP_KERNEL); |
| 2050 | } |
| 2051 | #else |
| 2052 | static inline void hdd_send_roamed_ind(struct net_device *dev, |
| 2053 | struct cfg80211_bss *bss, |
| 2054 | const uint8_t *req_ie, size_t req_ie_len, |
| 2055 | const uint8_t *resp_ie, |
| 2056 | size_t resp_ie_len) |
| 2057 | { |
| 2058 | cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len, |
| 2059 | GFP_KERNEL); |
| 2060 | } |
| 2061 | #endif |
| 2062 | |
| 2063 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2064 | * hdd_send_re_assoc_event() - send reassoc event |
| 2065 | * @dev: pointer to net device |
| 2066 | * @pAdapter: pointer to adapter |
| 2067 | * @pCsrRoamInfo: pointer to roam info |
| 2068 | * @reqRsnIe: pointer to RSN Information element |
| 2069 | * @reqRsnLength: length of RSN IE |
| 2070 | * |
| 2071 | * Return: none |
| 2072 | */ |
| 2073 | static void hdd_send_re_assoc_event(struct net_device *dev, |
| 2074 | hdd_adapter_t *pAdapter, tCsrRoamInfo *pCsrRoamInfo, |
| 2075 | uint8_t *reqRsnIe, uint32_t reqRsnLength) |
| 2076 | { |
| 2077 | unsigned int len = 0; |
| 2078 | u8 *pFTAssocRsp = NULL; |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2079 | uint8_t *rspRsnIe = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
| 2080 | uint8_t *assoc_req_ies = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2081 | uint32_t rspRsnLength = 0; |
| 2082 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2083 | uint8_t buf_ssid_ie[2 + SIR_MAC_SSID_EID_MAX]; /* 2 bytes-EID and len */ |
| 2084 | uint8_t *buf_ptr, ssid_ie_len; |
| 2085 | struct cfg80211_bss *bss = NULL; |
| 2086 | uint8_t *final_req_ie = NULL; |
| 2087 | tCsrRoamConnectedProfile roam_profile; |
| 2088 | tHalHandle hal_handle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2089 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2090 | |
Jeff Johnson | fdb7343 | 2016-10-11 08:07:27 -0700 | [diff] [blame] | 2091 | qdf_mem_zero(&roam_profile, sizeof(roam_profile)); |
| 2092 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2093 | if (!rspRsnIe) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2094 | hdd_err("Unable to allocate RSN IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2095 | goto done; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2096 | } |
| 2097 | |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2098 | if (!assoc_req_ies) { |
| 2099 | hdd_err("Unable to allocate Assoc Req IE"); |
Naveen Rawat | dafda29 | 2016-01-06 18:32:14 -0800 | [diff] [blame] | 2100 | goto done; |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2101 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2102 | if (pCsrRoamInfo == NULL) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2103 | hdd_err("Invalid CSR roam info"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2104 | goto done; |
| 2105 | } |
| 2106 | |
| 2107 | if (pCsrRoamInfo->nAssocRspLength == 0) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2108 | hdd_err("Assoc rsp length is 0"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2109 | goto done; |
| 2110 | } |
| 2111 | |
| 2112 | pFTAssocRsp = |
| 2113 | (u8 *) (pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength + |
| 2114 | pCsrRoamInfo->nAssocReqLength); |
| 2115 | if (pFTAssocRsp == NULL) |
| 2116 | goto done; |
| 2117 | |
| 2118 | /* pFTAssocRsp needs to point to the IEs */ |
| 2119 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2120 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2121 | (unsigned int)pFTAssocRsp[0], (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2122 | |
| 2123 | /* |
| 2124 | * Active session count is decremented upon disconnection, but during |
| 2125 | * roaming, there is no disconnect indication and hence active session |
| 2126 | * count is not decremented. |
| 2127 | * After roaming is completed, active session count is incremented |
| 2128 | * as a part of connect indication but effectively after roaming the |
| 2129 | * active session count should still be the same and hence upon |
| 2130 | * successful reassoc decrement the active session count here. |
| 2131 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2132 | if (!hdd_is_roam_sync_in_progress(pCsrRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2133 | policy_mgr_decr_session_set_pcl(hdd_ctx->hdd_psoc, |
| 2134 | pAdapter->device_mode, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2135 | |
| 2136 | /* Send the Assoc Resp, the supplicant needs this for initial Auth */ |
| 2137 | len = pCsrRoamInfo->nAssocRspLength - FT_ASSOC_RSP_IES_OFFSET; |
| 2138 | rspRsnLength = len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2139 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2140 | qdf_mem_zero(rspRsnIe + len, IW_GENERIC_IE_MAX - len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2141 | |
| 2142 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2143 | (int)pCsrRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2144 | sme_roam_get_connect_profile(hal_handle, pAdapter->sessionId, |
| 2145 | &roam_profile); |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2146 | |
| 2147 | bss = hdd_cfg80211_get_bss(pAdapter->wdev.wiphy, |
| 2148 | chan, pCsrRoamInfo->bssid.bytes, |
| 2149 | &roam_profile.SSID.ssId[0], |
| 2150 | roam_profile.SSID.length); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2151 | |
| 2152 | if (bss == NULL) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2153 | hdd_warn("Get BSS returned NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2154 | buf_ptr = buf_ssid_ie; |
| 2155 | *buf_ptr = SIR_MAC_SSID_EID; |
| 2156 | buf_ptr++; |
| 2157 | *buf_ptr = roam_profile.SSID.length; /*len of ssid*/ |
| 2158 | buf_ptr++; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2159 | qdf_mem_copy(buf_ptr, &roam_profile.SSID.ssId[0], |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2160 | roam_profile.SSID.length); |
| 2161 | ssid_ie_len = 2 + roam_profile.SSID.length; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2162 | hdd_debug("SSIDIE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2163 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2164 | buf_ssid_ie, ssid_ie_len); |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2165 | final_req_ie = qdf_mem_malloc(IW_GENERIC_IE_MAX); |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2166 | if (final_req_ie == NULL) { |
| 2167 | if (bss) |
| 2168 | cfg80211_put_bss(pAdapter->wdev.wiphy, bss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2169 | goto done; |
Kapil Gupta | 8731e81 | 2017-07-11 18:42:39 +0530 | [diff] [blame] | 2170 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2171 | buf_ptr = final_req_ie; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2172 | qdf_mem_copy(buf_ptr, buf_ssid_ie, ssid_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2173 | buf_ptr += ssid_ie_len; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2174 | qdf_mem_copy(buf_ptr, reqRsnIe, reqRsnLength); |
| 2175 | qdf_mem_copy(rspRsnIe, pFTAssocRsp, len); |
| 2176 | qdf_mem_zero(final_req_ie + (ssid_ie_len + reqRsnLength), |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2177 | IW_GENERIC_IE_MAX - (ssid_ie_len + reqRsnLength)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2178 | hdd_debug("Req RSN IE:"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2179 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Jeff Johnson | 9991f47 | 2016-01-06 16:02:31 -0800 | [diff] [blame] | 2180 | final_req_ie, (ssid_ie_len + reqRsnLength)); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2181 | hdd_send_roamed_ind(dev, bss, final_req_ie, |
| 2182 | (ssid_ie_len + reqRsnLength), rspRsnIe, |
| 2183 | rspRsnLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2184 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2185 | qdf_mem_copy(assoc_req_ies, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2186 | (u8 *)pCsrRoamInfo->pbFrames + pCsrRoamInfo->nBeaconLength, |
| 2187 | pCsrRoamInfo->nAssocReqLength); |
| 2188 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2189 | hdd_debug("ReAssoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2190 | QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2191 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength); |
| 2192 | |
Prakash Dhavali | 989127d | 2016-11-29 14:56:44 +0530 | [diff] [blame] | 2193 | wlan_hdd_send_roam_auth_event(pAdapter, pCsrRoamInfo->bssid.bytes, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2194 | assoc_req_ies, pCsrRoamInfo->nAssocReqLength, |
| 2195 | rspRsnIe, rspRsnLength, |
Prashanth Bhatta | bfc2529 | 2015-11-05 11:16:21 -0800 | [diff] [blame] | 2196 | pCsrRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2197 | done: |
Naveen Rawat | df0a7e7 | 2016-01-06 18:35:53 -0800 | [diff] [blame] | 2198 | sme_roam_free_connect_profile(&roam_profile); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2199 | if (final_req_ie) |
Mahesh Kumar Kalikot Veetil | 9c65618 | 2016-11-02 10:28:03 -0700 | [diff] [blame] | 2200 | qdf_mem_free(final_req_ie); |
| 2201 | qdf_mem_free(rspRsnIe); |
| 2202 | qdf_mem_free(assoc_req_ies); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2203 | } |
| 2204 | |
| 2205 | /** |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2206 | * hdd_is_roam_sync_in_progress()- Check if roam offloaded |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2207 | * @roaminfo - Roaming Information |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2208 | * |
| 2209 | * Return: roam sync status if roaming offloaded else false |
| 2210 | */ |
| 2211 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2212 | bool hdd_is_roam_sync_in_progress(tCsrRoamInfo *roaminfo) |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2213 | { |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2214 | if (roaminfo) |
| 2215 | return roaminfo->roamSynchInProgress; |
| 2216 | else |
| 2217 | return false; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2218 | } |
| 2219 | #endif |
| 2220 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2221 | /** |
| 2222 | * hdd_get_ibss_peer_staid() - get sta id for IBSS peer |
| 2223 | * @hddstactx: pointer to HDD sta context |
| 2224 | * @roaminfo: pointer to roaminfo structure |
| 2225 | * |
| 2226 | * This function returns staid for IBSS peer. If peer is broadcast |
| 2227 | * MAC address return self staid(0) else find the peer sta id of |
| 2228 | * the peer. |
| 2229 | * |
| 2230 | * Return: sta_id (HDD_WLAN_INVALID_STA_ID if peer not found). |
| 2231 | */ |
| 2232 | static uint8_t hdd_get_ibss_peer_staid(hdd_station_ctx_t *hddstactx, |
| 2233 | tCsrRoamInfo *roaminfo) |
| 2234 | { |
| 2235 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
| 2236 | QDF_STATUS status; |
| 2237 | |
| 2238 | if (qdf_is_macaddr_broadcast(&roaminfo->peerMac)) { |
| 2239 | staid = 0; |
| 2240 | } else { |
| 2241 | status = hdd_get_peer_sta_id(hddstactx, |
| 2242 | &roaminfo->peerMac, &staid); |
| 2243 | if (status != QDF_STATUS_SUCCESS) { |
| 2244 | hdd_err("Unable to find staid for " MAC_ADDRESS_STR, |
| 2245 | MAC_ADDR_ARRAY(roaminfo->peerMac.bytes)); |
| 2246 | } |
| 2247 | } |
| 2248 | |
| 2249 | return staid; |
| 2250 | } |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2251 | |
| 2252 | /** |
| 2253 | * hdd_change_sta_state_authenticated()- |
| 2254 | * This function changes STA state to authenticated |
| 2255 | * @adapter: pointer to the adapter structure. |
| 2256 | * @roaminfo: pointer to the RoamInfo structure. |
| 2257 | * |
| 2258 | * This is called from hdd_RoamSetKeyCompleteHandler |
| 2259 | * in context to eCSR_ROAM_SET_KEY_COMPLETE event from fw. |
| 2260 | * |
| 2261 | * Return: 0 on success and errno on failure |
| 2262 | */ |
| 2263 | static int hdd_change_sta_state_authenticated(hdd_adapter_t *adapter, |
| 2264 | tCsrRoamInfo *roaminfo) |
| 2265 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2266 | QDF_STATUS status; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2267 | uint32_t timeout; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2268 | uint8_t staid = HDD_WLAN_INVALID_STA_ID; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2269 | hdd_station_ctx_t *hddstactx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2270 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2271 | |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2272 | timeout = hddstactx->hdd_ReassocScenario ? |
| 2273 | AUTO_PS_ENTRY_TIMER_DEFAULT_VALUE : |
Kiran Kumar Lokere | 0ac679c | 2016-11-17 17:43:36 -0800 | [diff] [blame] | 2274 | hdd_ctx->config->auto_bmps_timer_val * 1000; |
Dustin Brown | f660fb4 | 2016-09-09 12:04:00 -0700 | [diff] [blame] | 2275 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2276 | if (QDF_IBSS_MODE == adapter->device_mode) |
| 2277 | staid = hdd_get_ibss_peer_staid(hddstactx, roaminfo); |
| 2278 | else |
| 2279 | staid = hddstactx->conn_info.staId[0]; |
| 2280 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2281 | hdd_debug("Changing Peer state to AUTHENTICATED for StaId = %d", staid); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2282 | |
| 2283 | /* Connections that do not need Upper layer authentication, |
| 2284 | * transition TL to 'Authenticated' state after the keys are set |
| 2285 | */ |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2286 | status = hdd_change_peer_state(adapter, staid, OL_TXRX_PEER_STATE_AUTH, |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2287 | hdd_is_roam_sync_in_progress(roaminfo)); |
| 2288 | hdd_conn_set_authenticated(adapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2289 | hdd_objmgr_set_peer_mlme_auth_state(adapter->hdd_vdev, true); |
| 2290 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 2291 | if ((QDF_STA_MODE == adapter->device_mode) || |
| 2292 | (QDF_P2P_CLIENT_MODE == adapter->device_mode)) { |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2293 | sme_ps_enable_auto_ps_timer( |
| 2294 | WLAN_HDD_GET_HAL_CTX(adapter), |
| 2295 | adapter->sessionId, |
Dustin Brown | 84411b0 | 2017-07-21 16:44:44 -0700 | [diff] [blame] | 2296 | timeout); |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2297 | } |
| 2298 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2299 | return qdf_status_to_os_return(status); |
| 2300 | } |
| 2301 | |
| 2302 | /** |
| 2303 | * hdd_is_key_install_required_for_ibss() - check encryption type to identify |
| 2304 | * if key installation is required |
| 2305 | * @encr_type: encryption type |
| 2306 | * |
| 2307 | * Return: true if key installation is required and false otherwise. |
| 2308 | */ |
| 2309 | static inline bool hdd_is_key_install_required_for_ibss( |
| 2310 | eCsrEncryptionType encr_type) |
| 2311 | { |
| 2312 | if (eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == encr_type || |
| 2313 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == encr_type || |
| 2314 | eCSR_ENCRYPT_TYPE_TKIP == encr_type || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 2315 | eCSR_ENCRYPT_TYPE_AES_GCMP == encr_type || |
| 2316 | eCSR_ENCRYPT_TYPE_AES_GCMP_256 == encr_type || |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2317 | eCSR_ENCRYPT_TYPE_AES == encr_type) |
| 2318 | return true; |
| 2319 | else |
| 2320 | return false; |
| 2321 | } |
| 2322 | |
| 2323 | /** |
| 2324 | * hdd_change_peer_state_after_set_key() - change the peer state on set key |
| 2325 | * complete |
| 2326 | * @adapter: pointer to HDD adapter |
| 2327 | * @roaminfo: pointer to roam info |
| 2328 | * @roam_result: roam result |
| 2329 | * |
| 2330 | * Peer state will be OL_TXRX_PEER_STATE_CONN until set key is complete. |
| 2331 | * This function checks for the successful set key completion and update |
| 2332 | * the peer state to OL_TXRX_PEER_STATE_AUTH. |
| 2333 | * |
| 2334 | * Return: None |
| 2335 | */ |
| 2336 | static void hdd_change_peer_state_after_set_key(hdd_adapter_t *adapter, |
| 2337 | tCsrRoamInfo *roaminfo, eCsrRoamResult roam_result) |
| 2338 | { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2339 | hdd_station_ctx_t *hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 2340 | eCsrEncryptionType encr_type = hdd_sta_ctx->conn_info.ucEncryptionType; |
| 2341 | |
| 2342 | /* |
| 2343 | * If the security mode is one of the following, IBSS peer will be |
| 2344 | * waiting in CONN state and we will move the peer state to AUTH |
| 2345 | * here. For non-secure connection, no need to wait for set-key complete |
| 2346 | * peer will be moved to AUTH in hdd_roam_register_sta. |
| 2347 | */ |
| 2348 | if (QDF_IBSS_MODE == adapter->device_mode) { |
| 2349 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 2350 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2351 | |
| 2352 | return; |
| 2353 | } |
| 2354 | |
| 2355 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roam_result) { |
| 2356 | hdd_sta_ctx->conn_info.gtk_installed = true; |
| 2357 | /* |
| 2358 | * PTK exchange happens in preauthentication itself if key_mgmt |
| 2359 | * is FT-PSK, ptk_installed was false as there is no set PTK |
| 2360 | * after roaming. STA TL state moves to authenticated only if |
| 2361 | * ptk_installed is true. So, make ptk_installed to true in |
| 2362 | * case of 11R roaming. |
| 2363 | */ |
yeshwanth sriram guntuka | a1ba9a2 | 2017-02-28 16:17:32 +0530 | [diff] [blame] | 2364 | if (sme_neighbor_roam_is11r_assoc(WLAN_HDD_GET_HAL_CTX(adapter), |
| 2365 | adapter->sessionId)) |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2366 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2367 | } else { |
| 2368 | hdd_sta_ctx->conn_info.ptk_installed = true; |
| 2369 | } |
| 2370 | |
| 2371 | /* In WPA case move STA to authenticated when ptk is installed. Earlier |
| 2372 | * in WEP case STA was moved to AUTHENTICATED prior to setting the |
| 2373 | * unicast key and it was resulting in sending few un-encrypted packet. |
| 2374 | * Now in WEP case STA state will be moved to AUTHENTICATED after we |
| 2375 | * set the unicast and broadcast key. |
| 2376 | */ |
| 2377 | if ((encr_type == eCSR_ENCRYPT_TYPE_WEP40) || |
| 2378 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104) || |
| 2379 | (encr_type == eCSR_ENCRYPT_TYPE_WEP40_STATICKEY) || |
| 2380 | (encr_type == eCSR_ENCRYPT_TYPE_WEP104_STATICKEY)) { |
| 2381 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2382 | hdd_sta_ctx->conn_info.ptk_installed) |
| 2383 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2384 | } else if (hdd_sta_ctx->conn_info.ptk_installed) { |
| 2385 | hdd_change_sta_state_authenticated(adapter, roaminfo); |
| 2386 | } |
| 2387 | |
| 2388 | if (hdd_sta_ctx->conn_info.gtk_installed && |
| 2389 | hdd_sta_ctx->conn_info.ptk_installed) { |
| 2390 | hdd_sta_ctx->conn_info.gtk_installed = false; |
| 2391 | hdd_sta_ctx->conn_info.ptk_installed = false; |
| 2392 | } |
| 2393 | |
| 2394 | hdd_sta_ctx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2395 | |
| 2396 | return; |
Govind Singh | edc5cda | 2015-10-23 17:11:35 +0530 | [diff] [blame] | 2397 | } |
| 2398 | |
| 2399 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2400 | * hdd_roam_set_key_complete_handler() - Update the security parameters |
| 2401 | * @pAdapter: pointer to adapter |
| 2402 | * @pRoamInfo: pointer to roam info |
| 2403 | * @roamId: roam id |
| 2404 | * @roamStatus: roam status |
| 2405 | * @roamResult: roam result |
| 2406 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2407 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2408 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2409 | 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] | 2410 | tCsrRoamInfo *pRoamInfo, |
| 2411 | uint32_t roamId, |
| 2412 | eRoamCmdStatus roamStatus, |
| 2413 | eCsrRoamResult roamResult) |
| 2414 | { |
| 2415 | eCsrEncryptionType connectedCipherAlgo; |
| 2416 | bool fConnected = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2417 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Sreelakshmi Konamki | 720f2b7 | 2016-02-26 16:44:04 +0530 | [diff] [blame] | 2418 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2419 | ENTER(); |
| 2420 | |
| 2421 | if (NULL == pRoamInfo) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2422 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2423 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2424 | } |
| 2425 | /* |
| 2426 | * if (WPA), tell TL to go to 'authenticated' after the keys are set. |
| 2427 | * then go to 'authenticated'. For all other authentication types |
| 2428 | * (those that do not require upper layer authentication) we can put TL |
| 2429 | * directly into 'authenticated' state. |
| 2430 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2431 | hdd_info("Set Key completion roamStatus =%d roamResult=%d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2432 | MAC_ADDRESS_STR, roamStatus, roamResult, |
| 2433 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 2434 | |
| 2435 | fConnected = hdd_conn_get_connected_cipher_algo(pHddStaCtx, |
| 2436 | &connectedCipherAlgo); |
| 2437 | if (fConnected) { |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 2438 | hdd_change_peer_state_after_set_key(pAdapter, pRoamInfo, |
| 2439 | roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2440 | } else { |
| 2441 | /* |
| 2442 | * possible disassoc after issuing set key and waiting |
| 2443 | * set key complete. |
| 2444 | */ |
| 2445 | pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE; |
| 2446 | } |
| 2447 | |
| 2448 | EXIT(); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2449 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2450 | } |
| 2451 | |
| 2452 | /** |
| 2453 | * hdd_perform_roam_set_key_complete() - perform set key complete |
| 2454 | * @pAdapter: pointer to adapter |
| 2455 | * |
| 2456 | * Return: none |
| 2457 | */ |
| 2458 | void hdd_perform_roam_set_key_complete(hdd_adapter_t *pAdapter) |
| 2459 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2460 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2461 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 2462 | tCsrRoamInfo roamInfo; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 2463 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2464 | roamInfo.fAuthRequired = false; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2465 | qdf_mem_copy(roamInfo.bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2466 | pHddStaCtx->roam_info.bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2467 | qdf_mem_copy(roamInfo.peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2468 | pHddStaCtx->roam_info.peerMac, QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2469 | |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2470 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2471 | hdd_roam_set_key_complete_handler(pAdapter, |
| 2472 | &roamInfo, |
| 2473 | pHddStaCtx->roam_info.roamId, |
| 2474 | pHddStaCtx->roam_info.roamStatus, |
| 2475 | eCSR_ROAM_RESULT_AUTHENTICATED); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 2476 | if (qdf_ret_status != QDF_STATUS_SUCCESS) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2477 | hdd_err("Set Key complete failure"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2478 | |
| 2479 | pHddStaCtx->roam_info.deferKeyComplete = false; |
| 2480 | } |
| 2481 | |
| 2482 | /** |
| 2483 | * hdd_association_completion_handler() - association completion handler |
| 2484 | * @pAdapter: pointer to adapter |
| 2485 | * @pRoamInfo: pointer to roam info |
| 2486 | * @roamId: roam id |
| 2487 | * @roamStatus: roam status |
| 2488 | * @roamResult: roam result |
| 2489 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2490 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2491 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2492 | static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2493 | tCsrRoamInfo *pRoamInfo, |
| 2494 | uint32_t roamId, |
| 2495 | eRoamCmdStatus roamStatus, |
| 2496 | eCsrRoamResult roamResult) |
| 2497 | { |
| 2498 | struct net_device *dev = pAdapter->dev; |
| 2499 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
| 2500 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2501 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2502 | uint8_t reqRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2503 | uint32_t reqRsnLength = DOT11F_IE_RSN_MAX_LEN, ie_len; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2504 | int ft_carrier_on = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2505 | bool hddDisconInProgress = false; |
| 2506 | unsigned long rc; |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2507 | tSirResultCodes timeout_reason = 0; |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2508 | bool ok; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2509 | |
| 2510 | if (!pHddCtx) { |
| 2511 | hdd_err("HDD context is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2512 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2513 | } |
| 2514 | |
Anurag Chouhan | 2c4e0a1 | 2016-09-12 14:52:45 +0530 | [diff] [blame] | 2515 | /* validate config */ |
| 2516 | if (!pHddCtx->config) { |
| 2517 | hdd_err("config is NULL"); |
| 2518 | return QDF_STATUS_E_NULL_VALUE; |
| 2519 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2520 | /* HDD has initiated disconnect, do not send connect result indication |
| 2521 | * to kernel as it will be handled by __cfg80211_disconnect. |
| 2522 | */ |
Edhar, Mahesh Kumar | 732f698 | 2016-07-01 11:23:06 +0530 | [diff] [blame] | 2523 | if (((eConnectionState_Disconnecting == |
| 2524 | pHddStaCtx->conn_info.connState) || |
| 2525 | (eConnectionState_NotConnected == |
| 2526 | pHddStaCtx->conn_info.connState)) && |
| 2527 | ((eCSR_ROAM_RESULT_ASSOCIATED == roamResult) || |
| 2528 | (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus))) { |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 2529 | hdd_info("hddDisconInProgress state=%d, result=%d, status=%d", |
| 2530 | pHddStaCtx->conn_info.connState, |
| 2531 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2532 | hddDisconInProgress = true; |
| 2533 | } |
| 2534 | |
| 2535 | if (eCSR_ROAM_RESULT_ASSOCIATED == roamResult) { |
| 2536 | if (NULL == pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2537 | hdd_err("pRoamInfo is NULL"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2538 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2539 | } |
| 2540 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2541 | hdd_conn_set_connection_state(pAdapter, |
| 2542 | eConnectionState_Associated); |
| 2543 | } |
Abhishek Singh | 07c627e | 2017-03-20 17:56:34 +0530 | [diff] [blame] | 2544 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2545 | /* Save the connection info from CSR... */ |
| 2546 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, |
| 2547 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
Gupta, Kapil | 4cb1d7d | 2016-04-16 18:16:25 -0700 | [diff] [blame] | 2548 | |
| 2549 | if (hdd_add_beacon_filter(pAdapter) != 0) |
| 2550 | hdd_err("hdd_add_beacon_filter() failed"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2551 | #ifdef FEATURE_WLAN_WAPI |
| 2552 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2553 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE |
| 2554 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2555 | eCSR_AUTH_TYPE_WAPI_WAI_PSK) { |
| 2556 | pAdapter->wapi_info.fIsWapiSta = 1; |
| 2557 | } else { |
| 2558 | pAdapter->wapi_info.fIsWapiSta = 0; |
| 2559 | } |
| 2560 | #endif /* FEATURE_WLAN_WAPI */ |
Krunal Soni | 364e087 | 2017-05-10 21:24:34 -0700 | [diff] [blame] | 2561 | hdd_debug("bss_descr[%d] devicemode[%d]", !!pRoamInfo->pBssDesc, |
| 2562 | pAdapter->device_mode); |
| 2563 | if ((QDF_STA_MODE == pAdapter->device_mode) && |
| 2564 | pRoamInfo->pBssDesc) { |
| 2565 | ie_len = GET_IE_LEN_IN_BSS(pRoamInfo->pBssDesc->length); |
| 2566 | pHddStaCtx->ap_supports_immediate_power_save = |
| 2567 | wlan_hdd_is_ap_supports_immediate_power_save( |
| 2568 | (uint8_t *) pRoamInfo->pBssDesc->ieFields, |
| 2569 | ie_len); |
| 2570 | hdd_debug("ap_supports_immediate_power_save flag [%d]", |
| 2571 | pHddStaCtx->ap_supports_immediate_power_save); |
| 2572 | } |
| 2573 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2574 | /* Indicate 'connect' status to user space */ |
| 2575 | hdd_send_association_event(dev, pRoamInfo); |
| 2576 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2577 | if (policy_mgr_is_mcc_in_24G(pHddCtx->hdd_psoc)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2578 | if (pHddCtx->miracast_value) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2579 | wlan_hdd_set_mas(pAdapter, |
| 2580 | pHddCtx->miracast_value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2581 | } |
| 2582 | |
| 2583 | /* Initialize the Linkup event completion variable */ |
| 2584 | INIT_COMPLETION(pAdapter->linkup_event_var); |
| 2585 | |
| 2586 | /* |
| 2587 | * Sometimes Switching ON the Carrier is taking time to activate |
| 2588 | * the device properly. Before allowing any packet to go up to |
| 2589 | * the application, device activation has to be ensured for |
| 2590 | * proper queue mapping by the kernel. we have registered net |
| 2591 | * device notifier for device change notification. With this we |
| 2592 | * will come to know that the device is getting |
| 2593 | * activated properly. |
| 2594 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2595 | if (pHddStaCtx->ft_carrier_on == false) { |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2596 | /* |
| 2597 | * Enable Linkup Event Servicing which allows the net |
| 2598 | * device notifier to set the linkup event variable. |
| 2599 | */ |
| 2600 | pAdapter->isLinkUpSvcNeeded = true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2601 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2602 | /* Switch on the Carrier to activate the device */ |
| 2603 | wlan_hdd_netif_queue_control(pAdapter, |
| 2604 | WLAN_NETIF_CARRIER_ON, |
| 2605 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2606 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2607 | /* |
| 2608 | * Wait for the Link to up to ensure all the queues |
| 2609 | * are set properly by the kernel. |
| 2610 | */ |
| 2611 | rc = wait_for_completion_timeout( |
| 2612 | &pAdapter->linkup_event_var, |
| 2613 | msecs_to_jiffies(ASSOC_LINKUP_TIMEOUT) |
| 2614 | ); |
| 2615 | if (!rc) |
| 2616 | hdd_warn("Warning:ASSOC_LINKUP_TIMEOUT"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2617 | |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2618 | /* |
| 2619 | * Disable Linkup Event Servicing - no more service |
| 2620 | * required from the net device notifier call. |
| 2621 | */ |
| 2622 | pAdapter->isLinkUpSvcNeeded = false; |
| 2623 | } else { |
| 2624 | pHddStaCtx->ft_carrier_on = false; |
| 2625 | ft_carrier_on = true; |
| 2626 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2627 | if ((WLAN_MAX_STA_COUNT + 3) > pRoamInfo->staId) |
| 2628 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2629 | else |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2630 | hdd_err("Wrong Staid: %d", pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2631 | |
| 2632 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 2633 | |
| 2634 | if (hdd_ipa_is_enabled(pHddCtx)) |
| 2635 | hdd_ipa_wlan_evt(pAdapter, pRoamInfo->staId, |
Mohit Khanna | fa99aea | 2016-05-12 21:43:13 -0700 | [diff] [blame] | 2636 | HDD_IPA_STA_CONNECT, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2637 | pRoamInfo->bssid.bytes); |
| 2638 | |
| 2639 | #ifdef FEATURE_WLAN_AUTO_SHUTDOWN |
| 2640 | wlan_hdd_auto_shutdown_enable(pHddCtx, false); |
| 2641 | #endif |
| 2642 | |
Ajit Pal Singh | 7983af6 | 2017-04-18 16:54:09 +0530 | [diff] [blame] | 2643 | hdd_debug("check if STA chan ok for DNBS"); |
| 2644 | if (policy_mgr_is_chan_ok_for_dnbs(pHddCtx->hdd_psoc, |
| 2645 | pHddStaCtx->conn_info.operationChannel, |
| 2646 | &ok)) { |
| 2647 | hdd_err("Unable to check DNBS eligibility for chan:%d", |
| 2648 | pHddStaCtx->conn_info.operationChannel); |
| 2649 | return QDF_STATUS_E_FAILURE; |
| 2650 | } |
| 2651 | |
| 2652 | if (!ok) { |
| 2653 | hdd_err("Chan:%d not suitable for DNBS", |
| 2654 | pHddStaCtx->conn_info.operationChannel); |
| 2655 | wlan_hdd_netif_queue_control(pAdapter, |
| 2656 | WLAN_NETIF_CARRIER_OFF, |
| 2657 | WLAN_CONTROL_PATH); |
| 2658 | if (!hddDisconInProgress) { |
| 2659 | hdd_err("Disconnecting..."); |
| 2660 | sme_roam_disconnect( |
| 2661 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2662 | pAdapter->sessionId, |
| 2663 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2664 | } |
| 2665 | return QDF_STATUS_E_FAILURE; |
| 2666 | } |
| 2667 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2668 | hdd_debug("check for SAP restart"); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2669 | policy_mgr_check_concurrent_intf_and_restart_sap( |
| 2670 | pHddCtx->hdd_psoc); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2671 | |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2672 | DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD, |
| 2673 | pAdapter->sessionId, |
Venkata Sharath Chandra Manchala | 0b9fc63 | 2017-05-15 14:35:15 -0700 | [diff] [blame] | 2674 | QDF_TRACE_DEFAULT_PDEV_ID, |
Nirav Shah | 1da7768 | 2016-05-03 20:16:39 +0530 | [diff] [blame] | 2675 | QDF_PROTO_TYPE_MGMT, QDF_PROTO_MGMT_ASSOC)); |
| 2676 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2677 | /* |
| 2678 | * For reassoc, the station is already registered, all we need |
| 2679 | * is to change the state of the STA in TL. |
| 2680 | * If authentication is required (WPA/WPA2/DWEP), change TL to |
| 2681 | * CONNECTED instead of AUTHENTICATED. |
| 2682 | */ |
| 2683 | if (!pRoamInfo->fReassocReq) { |
| 2684 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2685 | u8 *pFTAssocRsp = NULL; |
| 2686 | unsigned int assocRsplen = 0; |
| 2687 | u8 *pFTAssocReq = NULL; |
| 2688 | unsigned int assocReqlen = 0; |
| 2689 | struct ieee80211_channel *chan; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2690 | uint8_t rspRsnIe[DOT11F_IE_RSN_MAX_LEN]; |
| 2691 | uint32_t rspRsnLength = DOT11F_IE_RSN_MAX_LEN; |
| 2692 | |
| 2693 | /* add bss_id to cfg80211 data base */ |
| 2694 | bss = |
| 2695 | wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 2696 | pRoamInfo); |
| 2697 | if (NULL == bss) { |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2698 | hdd_err("wlan: Not able to create BSS entry"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2699 | wlan_hdd_netif_queue_control(pAdapter, |
| 2700 | WLAN_NETIF_CARRIER_OFF, |
| 2701 | WLAN_CONTROL_PATH); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2702 | if (!hddDisconInProgress) { |
| 2703 | /* |
| 2704 | * Here driver was not able to add bss |
| 2705 | * in cfg80211 database this can happen |
| 2706 | * if connected channel is not valid, |
| 2707 | * i.e reg domain was changed during |
| 2708 | * connection. Queue disconnect for the |
| 2709 | * session if disconnect is not in |
| 2710 | * progress. |
| 2711 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2712 | hdd_debug("Disconnecting..."); |
Abhishek Singh | cdcc5e7 | 2016-09-13 12:45:10 +0530 | [diff] [blame] | 2713 | sme_roam_disconnect( |
| 2714 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2715 | pAdapter->sessionId, |
| 2716 | eCSR_DISCONNECT_REASON_UNSPECIFIED); |
| 2717 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2718 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2719 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2720 | if (pRoamInfo->u.pConnectedProfile->AuthType == |
| 2721 | eCSR_AUTH_TYPE_FT_RSN |
| 2722 | || pRoamInfo->u.pConnectedProfile->AuthType == |
| 2723 | eCSR_AUTH_TYPE_FT_RSN_PSK) { |
| 2724 | |
| 2725 | /* Association Response */ |
| 2726 | pFTAssocRsp = |
| 2727 | (u8 *) (pRoamInfo->pbFrames + |
| 2728 | pRoamInfo->nBeaconLength + |
| 2729 | pRoamInfo->nAssocReqLength); |
| 2730 | if (pFTAssocRsp != NULL) { |
| 2731 | /* |
| 2732 | * pFTAssocRsp needs to point to the IEs |
| 2733 | */ |
| 2734 | pFTAssocRsp += FT_ASSOC_RSP_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2735 | hdd_debug("AssocRsp is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2736 | (unsigned int)pFTAssocRsp[0], |
| 2737 | (unsigned int)pFTAssocRsp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2738 | assocRsplen = |
| 2739 | pRoamInfo->nAssocRspLength - |
| 2740 | FT_ASSOC_RSP_IES_OFFSET; |
| 2741 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2742 | hdd_debug("AssocRsp is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2743 | assocRsplen = 0; |
| 2744 | } |
| 2745 | |
| 2746 | /* Association Request */ |
| 2747 | pFTAssocReq = (u8 *) (pRoamInfo->pbFrames + |
| 2748 | pRoamInfo->nBeaconLength); |
| 2749 | if (pFTAssocReq != NULL) { |
| 2750 | if (!ft_carrier_on) { |
| 2751 | /* |
| 2752 | * pFTAssocReq needs to point to |
| 2753 | * the IEs |
| 2754 | */ |
| 2755 | pFTAssocReq += |
| 2756 | FT_ASSOC_REQ_IES_OFFSET; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2757 | hdd_debug("pFTAssocReq is now at %02x%02x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2758 | (unsigned int) |
| 2759 | pFTAssocReq[0], |
| 2760 | (unsigned int) |
| 2761 | pFTAssocReq[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2762 | assocReqlen = |
| 2763 | pRoamInfo->nAssocReqLength - |
| 2764 | FT_ASSOC_REQ_IES_OFFSET; |
| 2765 | } else { |
| 2766 | /* |
| 2767 | * This should contain only the |
| 2768 | * FTIEs |
| 2769 | */ |
| 2770 | assocReqlen = |
| 2771 | pRoamInfo->nAssocReqLength; |
| 2772 | } |
| 2773 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2774 | hdd_debug("AssocReq is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2775 | assocReqlen = 0; |
| 2776 | } |
| 2777 | |
| 2778 | if (ft_carrier_on) { |
Will Huang | 03b54ee | 2017-06-21 10:57:05 +0800 | [diff] [blame] | 2779 | if (!hddDisconInProgress && |
| 2780 | pRoamInfo->pBssDesc) { |
Abhishek Singh | b5e38ef | 2017-01-02 12:09:34 +0530 | [diff] [blame] | 2781 | struct cfg80211_bss *roam_bss; |
| 2782 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2783 | /* |
| 2784 | * After roaming is completed, |
| 2785 | * active session count is |
| 2786 | * incremented as a part of |
| 2787 | * connect indication but |
| 2788 | * effectively the active |
| 2789 | * session count should still |
| 2790 | * be the same and hence upon |
| 2791 | * successful reassoc |
| 2792 | * decrement the active session |
| 2793 | * count here. |
| 2794 | */ |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2795 | if (!hdd_is_roam_sync_in_progress |
| 2796 | (pRoamInfo)) |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 2797 | policy_mgr_decr_session_set_pcl( |
| 2798 | pHddCtx->hdd_psoc, |
| 2799 | pAdapter->device_mode, |
| 2800 | pAdapter->sessionId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2801 | hdd_debug("ft_carrier_on is %d, sending roamed indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2802 | ft_carrier_on); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2803 | chan = |
| 2804 | ieee80211_get_channel |
| 2805 | (pAdapter->wdev.wiphy, |
| 2806 | (int)pRoamInfo->pBssDesc-> |
| 2807 | channelId); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2808 | hdd_debug( |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2809 | "assocReqlen %d assocRsplen %d", |
| 2810 | assocReqlen, |
| 2811 | assocRsplen); |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2812 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2813 | hdd_debug( |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2814 | "Reassoc Req IE dump"); |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2815 | QDF_TRACE_HEX_DUMP( |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2816 | QDF_MODULE_ID_HDD, |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 2817 | QDF_TRACE_LEVEL_DEBUG, |
Naveen Rawat | 14298b9 | 2015-11-25 16:27:41 -0800 | [diff] [blame] | 2818 | pFTAssocReq, |
| 2819 | assocReqlen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2820 | roam_bss = |
| 2821 | hdd_cfg80211_get_bss( |
| 2822 | pAdapter->wdev.wiphy, |
| 2823 | chan, |
| 2824 | pRoamInfo->bssid.bytes, |
| 2825 | pRoamInfo->u. |
| 2826 | pConnectedProfile->SSID.ssId, |
| 2827 | pRoamInfo->u. |
| 2828 | pConnectedProfile->SSID.length); |
Vidyullatha Kanchanapally | f9a0c38 | 2017-07-26 17:55:59 +0530 | [diff] [blame] | 2829 | hdd_send_roamed_ind( |
| 2830 | dev, |
| 2831 | roam_bss, |
| 2832 | pFTAssocReq, |
| 2833 | assocReqlen, |
| 2834 | pFTAssocRsp, |
| 2835 | assocRsplen); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 2836 | wlan_hdd_send_roam_auth_event( |
| 2837 | pAdapter, |
| 2838 | pRoamInfo->bssid.bytes, |
| 2839 | pFTAssocReq, |
| 2840 | assocReqlen, |
| 2841 | pFTAssocRsp, |
| 2842 | assocRsplen, |
| 2843 | pRoamInfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2844 | } |
| 2845 | if (sme_get_ftptk_state |
| 2846 | (WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2847 | pAdapter->sessionId)) { |
| 2848 | sme_set_ftptk_state |
| 2849 | (WLAN_HDD_GET_HAL_CTX |
| 2850 | (pAdapter), |
| 2851 | pAdapter->sessionId, |
| 2852 | false); |
| 2853 | pRoamInfo->fAuthRequired = |
| 2854 | false; |
| 2855 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2856 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2857 | roam_info.bssid, |
| 2858 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2859 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 2860 | qdf_mem_copy(pHddStaCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2861 | roam_info.peerMac, |
| 2862 | pRoamInfo->peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 2863 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2864 | pHddStaCtx->roam_info.roamId = |
| 2865 | roamId; |
| 2866 | pHddStaCtx->roam_info. |
| 2867 | roamStatus = roamStatus; |
| 2868 | pHddStaCtx->roam_info. |
| 2869 | deferKeyComplete = true; |
| 2870 | } |
| 2871 | } else if (!hddDisconInProgress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2872 | hdd_debug("ft_carrier_on is %d, sending connect indication", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2873 | ft_carrier_on); |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2874 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2875 | pRoamInfo-> |
| 2876 | bssid.bytes, |
| 2877 | pRoamInfo, |
| 2878 | pFTAssocReq, |
| 2879 | assocReqlen, |
| 2880 | pFTAssocRsp, |
| 2881 | assocRsplen, |
| 2882 | WLAN_STATUS_SUCCESS, |
| 2883 | GFP_KERNEL, |
| 2884 | false, |
| 2885 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2886 | } |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 2887 | } else { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2888 | /* |
| 2889 | * wpa supplicant expecting WPA/RSN IE in |
| 2890 | * connect result. |
| 2891 | */ |
| 2892 | csr_roam_get_wpa_rsn_req_ie(WLAN_HDD_GET_HAL_CTX |
| 2893 | (pAdapter), |
| 2894 | pAdapter->sessionId, |
| 2895 | &reqRsnLength, |
| 2896 | reqRsnIe); |
| 2897 | |
| 2898 | csr_roam_get_wpa_rsn_rsp_ie(WLAN_HDD_GET_HAL_CTX |
| 2899 | (pAdapter), |
| 2900 | pAdapter->sessionId, |
| 2901 | &rspRsnLength, |
| 2902 | rspRsnIe); |
| 2903 | if (!hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2904 | if (ft_carrier_on) |
| 2905 | hdd_send_re_assoc_event(dev, |
| 2906 | pAdapter, |
| 2907 | pRoamInfo, |
| 2908 | reqRsnIe, |
| 2909 | reqRsnLength); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 2910 | else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2911 | hdd_debug("sending connect indication to nl80211:for bssid " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2912 | MAC_ADDRESS_STR |
| 2913 | " result:%d and Status:%d", |
| 2914 | MAC_ADDR_ARRAY |
| 2915 | (pRoamInfo->bssid.bytes), |
| 2916 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2917 | |
| 2918 | /* inform connect result to nl80211 */ |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 2919 | hdd_connect_result(dev, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 2920 | pRoamInfo-> |
| 2921 | bssid.bytes, |
| 2922 | pRoamInfo, |
| 2923 | reqRsnIe, |
| 2924 | reqRsnLength, |
| 2925 | rspRsnIe, |
| 2926 | rspRsnLength, |
| 2927 | WLAN_STATUS_SUCCESS, |
| 2928 | GFP_KERNEL, |
| 2929 | false, |
| 2930 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2931 | } |
| 2932 | } |
| 2933 | } |
| 2934 | if (!hddDisconInProgress) { |
| 2935 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2936 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2937 | bss); |
| 2938 | |
| 2939 | /* |
| 2940 | * Perform any WMM-related association |
| 2941 | * processing. |
| 2942 | */ |
| 2943 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 2944 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 2945 | |
| 2946 | /* |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2947 | * Register the Station with DP after associated |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2948 | */ |
Krishna Kumaar Natarajan | 6736d81 | 2017-02-01 16:36:30 -0800 | [diff] [blame] | 2949 | qdf_status = hdd_roam_register_sta(pAdapter, |
| 2950 | pRoamInfo, |
| 2951 | pHddStaCtx->conn_info.staId[0], |
| 2952 | NULL, pRoamInfo->pBssDesc); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2953 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2954 | wlan_hdd_netif_queue_control(pAdapter, |
| 2955 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 2956 | WLAN_CONTROL_PATH); |
| 2957 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2958 | } |
| 2959 | } else { |
| 2960 | /* |
| 2961 | * wpa supplicant expecting WPA/RSN IE in connect result |
| 2962 | * in case of reassociation also need to indicate it to |
| 2963 | * supplicant. |
| 2964 | */ |
| 2965 | csr_roam_get_wpa_rsn_req_ie( |
| 2966 | WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 2967 | pAdapter->sessionId, |
| 2968 | &reqRsnLength, reqRsnIe); |
| 2969 | |
| 2970 | hdd_send_re_assoc_event(dev, pAdapter, pRoamInfo, |
| 2971 | reqRsnIe, reqRsnLength); |
| 2972 | /* Reassoc successfully */ |
| 2973 | if (pRoamInfo->fAuthRequired) { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2974 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2975 | hdd_change_peer_state(pAdapter, |
| 2976 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2977 | OL_TXRX_PEER_STATE_CONN, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2978 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2979 | pRoamInfo->roamSynchInProgress |
| 2980 | #else |
| 2981 | false |
| 2982 | #endif |
| 2983 | ); |
| 2984 | hdd_conn_set_authenticated(pAdapter, false); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 2985 | hdd_objmgr_set_peer_mlme_auth_state( |
| 2986 | pAdapter->hdd_vdev, |
| 2987 | false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2988 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 2989 | hdd_debug("staId: %d Changing TL state to AUTHENTICATED", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 2990 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 2991 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2992 | hdd_change_peer_state(pAdapter, |
| 2993 | pHddStaCtx->conn_info.staId[0], |
Dhanashri Atre | b08959a | 2016-03-01 17:28:03 -0800 | [diff] [blame] | 2994 | OL_TXRX_PEER_STATE_AUTH, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 2995 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 2996 | pRoamInfo->roamSynchInProgress |
| 2997 | #else |
| 2998 | false |
| 2999 | #endif |
| 3000 | ); |
| 3001 | hdd_conn_set_authenticated(pAdapter, true); |
Kabilan Kannan | f56f9d5 | 2017-04-05 03:31:34 -0700 | [diff] [blame] | 3002 | hdd_objmgr_set_peer_mlme_auth_state( |
| 3003 | pAdapter->hdd_vdev, |
| 3004 | true); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3005 | } |
| 3006 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3007 | if (QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3008 | /* |
| 3009 | * Perform any WMM-related association |
| 3010 | * processing |
| 3011 | */ |
| 3012 | hdd_wmm_assoc(pAdapter, pRoamInfo, |
| 3013 | eCSR_BSS_TYPE_INFRASTRUCTURE); |
| 3014 | } |
| 3015 | |
| 3016 | /* Start the tx queues */ |
| 3017 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 3018 | if (pRoamInfo->roamSynchInProgress) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3019 | hdd_debug("LFR3:netif_tx_wake_all_queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3020 | #endif |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3021 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3022 | wlan_hdd_netif_queue_control(pAdapter, |
| 3023 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 3024 | WLAN_CONTROL_PATH); |
| 3025 | } |
| 3026 | |
Padma, Santhosh Kumar | 724f63d | 2016-08-09 16:04:31 +0530 | [diff] [blame] | 3027 | #ifdef FEATURE_WLAN_TDLS |
| 3028 | wlan_hdd_tdls_connection_callback(pAdapter); |
| 3029 | #endif |
| 3030 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3031 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3032 | hdd_err("STA register with TL failed status: %d [%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3033 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3034 | } |
| 3035 | #ifdef WLAN_FEATURE_11W |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 3036 | qdf_mem_zero(&pAdapter->hdd_stats.hddPmfStats, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3037 | sizeof(pAdapter->hdd_stats.hddPmfStats)); |
| 3038 | #endif |
| 3039 | } else { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3040 | bool connect_timeout = false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3041 | hdd_wext_state_t *pWextState = |
| 3042 | WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 3043 | if (pRoamInfo) |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3044 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3045 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3046 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3047 | roamResult, roamStatus); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3048 | else |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3049 | hdd_err("wlan: connection failed with " MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3050 | " result: %d and Status: %d", |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3051 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3052 | roamResult, roamStatus); |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3053 | |
| 3054 | if ((eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE == roamResult) || |
| 3055 | (pRoamInfo && |
| 3056 | ((eSIR_SME_JOIN_TIMEOUT_RESULT_CODE == |
| 3057 | pRoamInfo->statusCode) || |
| 3058 | (eSIR_SME_AUTH_TIMEOUT_RESULT_CODE == |
| 3059 | pRoamInfo->statusCode) || |
| 3060 | (eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE == |
| 3061 | pRoamInfo->statusCode)))) { |
| 3062 | wlan_hdd_cfg80211_update_bss_list(pAdapter, |
| 3063 | pRoamInfo ? |
| 3064 | pRoamInfo->bssid.bytes : |
| 3065 | pWextState->req_bssId.bytes); |
| 3066 | sme_remove_bssid_from_scan_list(pHddCtx->hHal, |
| 3067 | pRoamInfo ? |
| 3068 | pRoamInfo->bssid.bytes : |
| 3069 | pWextState->req_bssId.bytes); |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3070 | connect_timeout = true; |
Abhishek Singh | c994160 | 2016-08-09 16:06:22 +0530 | [diff] [blame] | 3071 | } |
| 3072 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3073 | /* |
| 3074 | * CR465478: Only send up a connection failure result when CSR |
| 3075 | * has completed operation - with a ASSOCIATION_FAILURE status. |
| 3076 | */ |
| 3077 | if (eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus |
| 3078 | && !hddDisconInProgress) { |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3079 | if (pRoamInfo) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3080 | hdd_err("send connect failure to nl80211: for bssid " |
| 3081 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3082 | " result: %d and Status: %d reasoncode: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3083 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 3084 | roamResult, roamStatus, |
| 3085 | pRoamInfo->reasonCode); |
Anurag Chouhan | 5de8d17 | 2016-07-13 14:44:28 +0530 | [diff] [blame] | 3086 | pHddStaCtx->conn_info.assoc_status_code = |
| 3087 | pRoamInfo->statusCode; |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3088 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3089 | hdd_err("connect failed: for bssid " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3090 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3091 | " result: %d and status: %d ", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3092 | MAC_ADDR_ARRAY(pWextState->req_bssId.bytes), |
| 3093 | roamResult, roamStatus); |
Jeff Johnson | 03294f1 | 2016-12-09 17:10:24 -0800 | [diff] [blame] | 3094 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3095 | hdd_debug("Invoking packetdump deregistration API"); |
Himanshu Agarwal | f65bd4c | 2016-12-05 17:21:12 +0530 | [diff] [blame] | 3096 | wlan_deregister_txrx_packetdump(); |
| 3097 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3098 | /* inform association failure event to nl80211 */ |
| 3099 | if (eCSR_ROAM_RESULT_ASSOC_FAIL_CON_CHANNEL == |
| 3100 | roamResult) { |
| 3101 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3102 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3103 | pRoamInfo->bssid.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3104 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3105 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3106 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3107 | connect_timeout, |
| 3108 | pRoamInfo->statusCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3109 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3110 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3111 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3112 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3113 | WLAN_STATUS_ASSOC_DENIED_UNSPEC, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3114 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3115 | connect_timeout, |
| 3116 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3117 | } else { |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3118 | if (pRoamInfo) |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3119 | hdd_connect_result(dev, |
| 3120 | pRoamInfo->bssid.bytes, |
| 3121 | NULL, NULL, 0, NULL, 0, |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3122 | pRoamInfo->reasonCode ? |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3123 | pRoamInfo->reasonCode : |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3124 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3125 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3126 | connect_timeout, |
| 3127 | pRoamInfo->statusCode); |
Wu Gao | 77d2835 | 2016-11-23 17:50:56 +0800 | [diff] [blame] | 3128 | else |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3129 | hdd_connect_result(dev, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3130 | pWextState->req_bssId.bytes, |
Anurag Chouhan | c409292 | 2016-09-08 15:56:11 +0530 | [diff] [blame] | 3131 | NULL, NULL, 0, NULL, 0, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3132 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3133 | GFP_KERNEL, |
yeshwanth sriram guntuka | af7b73f | 2017-02-22 17:35:32 +0530 | [diff] [blame] | 3134 | connect_timeout, |
| 3135 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3136 | } |
Abhishek Singh | ac2be14 | 2015-12-03 16:16:25 +0530 | [diff] [blame] | 3137 | hdd_clear_roam_profile_ie(pAdapter); |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3138 | } else if ((eCSR_ROAM_CANCELLED == roamStatus |
| 3139 | && !hddDisconInProgress)) { |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3140 | hdd_connect_result(dev, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3141 | pWextState->req_bssId.bytes, |
Abhishek Singh | a84d395 | 2016-09-13 13:45:05 +0530 | [diff] [blame] | 3142 | NULL, NULL, 0, NULL, 0, |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3143 | WLAN_STATUS_UNSPECIFIED_FAILURE, |
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 | timeout_reason); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3147 | } |
| 3148 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3149 | /* |
| 3150 | * Set connection state to eConnectionState_NotConnected only |
| 3151 | * when CSR has completed operation - with a |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3152 | * ASSOCIATION_FAILURE or eCSR_ROAM_CANCELLED status. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3153 | */ |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 3154 | if (((eCSR_ROAM_ASSOCIATION_FAILURE == roamStatus) || |
| 3155 | (eCSR_ROAM_CANCELLED == roamStatus)) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3156 | && !hddDisconInProgress) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3157 | hdd_conn_set_connection_state(pAdapter, |
| 3158 | eConnectionState_NotConnected); |
| 3159 | } |
| 3160 | hdd_wmm_init(pAdapter); |
| 3161 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3162 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3163 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3164 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3165 | WLAN_CONTROL_PATH); |
| 3166 | } |
| 3167 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3168 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3169 | } |
| 3170 | |
| 3171 | /** |
| 3172 | * hdd_roam_ibss_indication_handler() - update the status of the IBSS |
| 3173 | * @pAdapter: pointer to adapter |
| 3174 | * @pRoamInfo: pointer to roam info |
| 3175 | * @roamId: roam id |
| 3176 | * @roamStatus: roam status |
| 3177 | * @roamResult: roam result |
| 3178 | * |
| 3179 | * Here we update the status of the Ibss when we receive information that we |
| 3180 | * have started/joined an ibss session. |
| 3181 | * |
| 3182 | * Return: none |
| 3183 | */ |
| 3184 | static void hdd_roam_ibss_indication_handler(hdd_adapter_t *pAdapter, |
| 3185 | tCsrRoamInfo *pRoamInfo, |
| 3186 | uint32_t roamId, |
| 3187 | eRoamCmdStatus roamStatus, |
| 3188 | eCsrRoamResult roamResult) |
| 3189 | { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3190 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 3191 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3192 | hdd_debug("%s: id %d, status %d, result %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3193 | pAdapter->dev->name, roamId, |
| 3194 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3195 | |
| 3196 | switch (roamResult) { |
| 3197 | /* both IBSS Started and IBSS Join should come in here. */ |
| 3198 | case eCSR_ROAM_RESULT_IBSS_STARTED: |
| 3199 | case eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS: |
| 3200 | case eCSR_ROAM_RESULT_IBSS_COALESCED: |
| 3201 | { |
| 3202 | hdd_context_t *pHddCtx = |
| 3203 | (hdd_context_t *) pAdapter->pHddCtx; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3204 | hdd_station_ctx_t *hdd_sta_ctx = |
| 3205 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 3206 | struct qdf_mac_addr broadcastMacAddr = |
| 3207 | QDF_MAC_ADDR_BROADCAST_INITIALIZER; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3208 | |
| 3209 | if (NULL == pRoamInfo) { |
Anurag Chouhan | b2dc16f | 2016-02-25 11:47:37 +0530 | [diff] [blame] | 3210 | QDF_ASSERT(0); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3211 | return; |
| 3212 | } |
| 3213 | |
| 3214 | /* When IBSS Started comes from CSR, we need to move |
| 3215 | * connection state to IBSS Disconnected (meaning no peers |
| 3216 | * are in the IBSS). |
| 3217 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3218 | hdd_conn_set_connection_state(pAdapter, |
| 3219 | eConnectionState_IbssDisconnected); |
| 3220 | /* notify wmm */ |
| 3221 | hdd_wmm_connect(pAdapter, pRoamInfo, |
| 3222 | eCSR_BSS_TYPE_IBSS); |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3223 | |
Rakesh Sunki | cf1c9ab | 2016-08-25 14:11:25 -0700 | [diff] [blame] | 3224 | hdd_sta_ctx->broadcast_staid = pRoamInfo->staId; |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3225 | |
| 3226 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3227 | pAdapter; |
| 3228 | hdd_roam_register_sta(pAdapter, pRoamInfo, |
Chandrasekaran, Manishekar | 34e325a | 2015-12-18 12:07:22 +0530 | [diff] [blame] | 3229 | pRoamInfo->staId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3230 | &broadcastMacAddr, |
| 3231 | pRoamInfo->pBssDesc); |
| 3232 | |
| 3233 | if (pRoamInfo->pBssDesc) { |
| 3234 | struct cfg80211_bss *bss; |
| 3235 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3236 | struct ieee80211_channel *chan; |
| 3237 | int chan_no; |
| 3238 | unsigned int freq; |
| 3239 | #endif |
| 3240 | /* we created the IBSS, notify supplicant */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3241 | hdd_info("%s: created ibss " MAC_ADDRESS_STR, |
| 3242 | pAdapter->dev->name, |
| 3243 | MAC_ADDR_ARRAY( |
| 3244 | pRoamInfo->pBssDesc->bssId)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3245 | |
| 3246 | /* we must first give cfg80211 the BSS information */ |
| 3247 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, |
| 3248 | pRoamInfo); |
| 3249 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3250 | hdd_err("%s: unable to create IBSS entry", |
| 3251 | pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3252 | return; |
| 3253 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3254 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3255 | wlan_hdd_netif_queue_control(pAdapter, |
| 3256 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3257 | WLAN_CONTROL_PATH); |
| 3258 | |
| 3259 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 15, 0)) |
| 3260 | chan_no = pRoamInfo->pBssDesc->channelId; |
| 3261 | |
| 3262 | if (chan_no <= 14) |
| 3263 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3264 | HDD_NL80211_BAND_2GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3265 | else |
| 3266 | freq = ieee80211_channel_to_frequency(chan_no, |
Srinivas Girigowda | 38f1ded | 2017-06-12 23:00:38 -0700 | [diff] [blame] | 3267 | HDD_NL80211_BAND_5GHZ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3268 | |
| 3269 | chan = ieee80211_get_channel(pAdapter->wdev.wiphy, freq); |
| 3270 | |
| 3271 | if (chan) |
| 3272 | cfg80211_ibss_joined(pAdapter->dev, |
| 3273 | bss->bssid, chan, |
| 3274 | GFP_KERNEL); |
| 3275 | else |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3276 | hdd_warn("%s: chanId: %d, can't find channel", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3277 | pAdapter->dev->name, |
| 3278 | (int)pRoamInfo->pBssDesc->channelId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3279 | #else |
| 3280 | cfg80211_ibss_joined(pAdapter->dev, bss->bssid, |
| 3281 | GFP_KERNEL); |
| 3282 | #endif |
| 3283 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3284 | pHddCtx->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3285 | bss); |
| 3286 | } |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3287 | if (eCSR_ROAM_RESULT_IBSS_STARTED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3288 | policy_mgr_incr_active_session(hdd_ctx->hdd_psoc, |
| 3289 | pAdapter->device_mode, pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3290 | } else if (eCSR_ROAM_RESULT_IBSS_JOIN_SUCCESS == roamResult || |
| 3291 | eCSR_ROAM_RESULT_IBSS_COALESCED == roamResult) { |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 3292 | policy_mgr_update_connection_info(hdd_ctx->hdd_psoc, |
| 3293 | pAdapter->sessionId); |
Krunal Soni | 2c68f23 | 2015-10-26 20:52:51 -0700 | [diff] [blame] | 3294 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3295 | break; |
| 3296 | } |
| 3297 | |
| 3298 | case eCSR_ROAM_RESULT_IBSS_START_FAILED: |
| 3299 | { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3300 | hdd_err("%s: unable to create IBSS", pAdapter->dev->name); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3301 | break; |
| 3302 | } |
| 3303 | |
| 3304 | default: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3305 | hdd_err("%s: unexpected result %d", |
| 3306 | pAdapter->dev->name, (int)roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3307 | break; |
| 3308 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3309 | } |
| 3310 | |
| 3311 | /** |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3312 | * hdd_save_peer() - Save peer MAC address in adapter peer table. |
| 3313 | * @sta_ctx: pointer to hdd station context |
| 3314 | * @sta_id: station ID |
| 3315 | * @peer_mac_addr: mac address of new peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3316 | * |
| 3317 | * This information is passed to iwconfig later. The peer that joined |
| 3318 | * last is passed as information to iwconfig. |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3319 | |
| 3320 | * Return: true if success, false otherwise |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3321 | */ |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3322 | bool hdd_save_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id, |
| 3323 | struct qdf_mac_addr *peer_mac_addr) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3324 | { |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3325 | int idx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3326 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3327 | for (idx = 0; idx < SIR_MAX_NUM_STA_IN_IBSS; idx++) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3328 | if (HDD_WLAN_INVALID_STA_ID == sta_ctx->conn_info.staId[idx]) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3329 | hdd_debug("adding peer: %pM, sta_id: %d, at idx: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3330 | peer_mac_addr, sta_id, idx); |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3331 | sta_ctx->conn_info.staId[idx] = sta_id; |
| 3332 | qdf_copy_macaddr( |
| 3333 | &sta_ctx->conn_info.peerMacAddress[idx], |
| 3334 | peer_mac_addr); |
| 3335 | return true; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3336 | } |
| 3337 | } |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3338 | return false; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3339 | } |
| 3340 | |
| 3341 | /** |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3342 | * hdd_delete_peer() - removes peer from hdd station context peer table |
| 3343 | * @sta_ctx: pointer to hdd station context |
| 3344 | * @sta_id: station ID |
| 3345 | * |
| 3346 | * Return: None |
| 3347 | */ |
| 3348 | void hdd_delete_peer(hdd_station_ctx_t *sta_ctx, uint8_t sta_id) |
| 3349 | { |
| 3350 | int i; |
| 3351 | |
| 3352 | for (i = 0; i < SIR_MAX_NUM_STA_IN_IBSS; i++) { |
| 3353 | if (sta_id == sta_ctx->conn_info.staId[i]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3354 | sta_ctx->conn_info.staId[i] = HDD_WLAN_INVALID_STA_ID; |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3355 | return; |
| 3356 | } |
| 3357 | } |
Deepak Dhamdhere | a6d2f4c | 2016-06-04 00:24:52 -0700 | [diff] [blame] | 3358 | } |
| 3359 | |
| 3360 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3361 | * roam_remove_ibss_station() - Remove the IBSS peer MAC address in the adapter |
| 3362 | * @pAdapter: pointer to adapter |
| 3363 | * @staId: station id |
| 3364 | * |
| 3365 | * Return: |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3366 | * true if we remove MAX_PEERS or less STA |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3367 | * false otherwise. |
| 3368 | */ |
| 3369 | static bool roam_remove_ibss_station(hdd_adapter_t *pAdapter, uint8_t staId) |
| 3370 | { |
| 3371 | bool fSuccess = false; |
| 3372 | int idx = 0; |
| 3373 | uint8_t valid_idx = 0; |
| 3374 | uint8_t del_idx = 0; |
| 3375 | uint8_t empty_slots = 0; |
| 3376 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3377 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3378 | for (idx = 0; idx < MAX_PEERS; idx++) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3379 | if (staId == pHddStaCtx->conn_info.staId[idx]) { |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3380 | pHddStaCtx->conn_info.staId[idx] = |
| 3381 | HDD_WLAN_INVALID_STA_ID; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3382 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3383 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3384 | peerMacAddress[idx]); |
| 3385 | |
| 3386 | fSuccess = true; |
| 3387 | |
| 3388 | /* |
| 3389 | * Note the deleted Index, if its 0 we need special |
| 3390 | * handling. |
| 3391 | */ |
| 3392 | del_idx = idx; |
| 3393 | |
| 3394 | empty_slots++; |
| 3395 | } else { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3396 | if (pHddStaCtx->conn_info.staId[idx] != |
| 3397 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3398 | valid_idx = idx; |
| 3399 | } else { |
| 3400 | /* Found an empty slot */ |
| 3401 | empty_slots++; |
| 3402 | } |
| 3403 | } |
| 3404 | } |
| 3405 | |
Naveen Rawat | c45d162 | 2016-07-05 12:20:09 -0700 | [diff] [blame] | 3406 | if (MAX_PEERS == empty_slots) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3407 | /* Last peer departed, set the IBSS state appropriately */ |
Varun Reddy Yeturu | 9e0032c | 2017-07-12 18:39:59 -0700 | [diff] [blame] | 3408 | hdd_conn_set_connection_state(pAdapter, |
| 3409 | eConnectionState_IbssDisconnected); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3410 | hdd_debug("Last IBSS Peer Departed!!!"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3411 | } |
| 3412 | /* Find next active staId, to have a valid sta trigger for TL. */ |
| 3413 | if (fSuccess == true) { |
| 3414 | if (del_idx == 0) { |
Naveen Rawat | ac027cb | 2017-04-27 15:02:42 -0700 | [diff] [blame] | 3415 | if (pHddStaCtx->conn_info.staId[valid_idx] != |
| 3416 | HDD_WLAN_INVALID_STA_ID) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3417 | pHddStaCtx->conn_info.staId[0] = |
| 3418 | pHddStaCtx->conn_info.staId[valid_idx]; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3419 | qdf_copy_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3420 | peerMacAddress[0], |
| 3421 | &pHddStaCtx->conn_info. |
| 3422 | peerMacAddress[valid_idx]); |
| 3423 | |
Hanumanth Reddy Pothula | 18553ae | 2017-04-28 15:03:10 +0530 | [diff] [blame] | 3424 | pHddStaCtx->conn_info.staId[valid_idx] = |
| 3425 | HDD_WLAN_INVALID_STA_ID; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3426 | qdf_zero_macaddr(&pHddStaCtx->conn_info. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3427 | peerMacAddress[valid_idx]); |
| 3428 | } |
| 3429 | } |
| 3430 | } |
| 3431 | return fSuccess; |
| 3432 | } |
| 3433 | |
| 3434 | /** |
| 3435 | * roam_ibss_connect_handler() - IBSS connection handler |
| 3436 | * @pAdapter: pointer to adapter |
| 3437 | * @pRoamInfo: pointer to roam info |
| 3438 | * |
| 3439 | * We update the status of the IBSS to connected in this function. |
| 3440 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3441 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3442 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3443 | static QDF_STATUS roam_ibss_connect_handler(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3444 | tCsrRoamInfo *pRoamInfo) |
| 3445 | { |
| 3446 | struct cfg80211_bss *bss; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3447 | /* |
| 3448 | * Set the internal connection state to show 'IBSS Connected' (IBSS with |
| 3449 | * a partner stations). |
| 3450 | */ |
| 3451 | hdd_conn_set_connection_state(pAdapter, eConnectionState_IbssConnected); |
| 3452 | |
| 3453 | /* Save the connection info from CSR... */ |
| 3454 | hdd_conn_save_connect_info(pAdapter, pRoamInfo, eCSR_BSS_TYPE_IBSS); |
| 3455 | |
| 3456 | /* Send the bssid address to the wext. */ |
| 3457 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3458 | /* add bss_id to cfg80211 data base */ |
| 3459 | bss = wlan_hdd_cfg80211_update_bss_db(pAdapter, pRoamInfo); |
| 3460 | if (NULL == bss) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3461 | hdd_err("%s: unable to create IBSS entry", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3462 | pAdapter->dev->name); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3463 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3464 | } |
| 3465 | cfg80211_put_bss( |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3466 | WLAN_HDD_GET_CTX(pAdapter)->wiphy, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3467 | bss); |
| 3468 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3469 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3470 | } |
| 3471 | |
| 3472 | /** |
| 3473 | * hdd_roam_mic_error_indication_handler() - MIC error indication handler |
| 3474 | * @pAdapter: pointer to adapter |
| 3475 | * @pRoamInfo: pointer to roam info |
| 3476 | * @roamId: roam id |
| 3477 | * @roamStatus: roam status |
| 3478 | * @roamResult: roam result |
| 3479 | * |
| 3480 | * This function indicates the Mic failure to the supplicant |
| 3481 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3482 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3483 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3484 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3485 | hdd_roam_mic_error_indication_handler(hdd_adapter_t *pAdapter, |
| 3486 | tCsrRoamInfo *pRoamInfo, |
| 3487 | uint32_t roamId, |
| 3488 | eRoamCmdStatus roamStatus, |
| 3489 | eCsrRoamResult roamResult) |
| 3490 | { |
| 3491 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3492 | |
| 3493 | if (eConnectionState_Associated == pHddStaCtx->conn_info.connState && |
| 3494 | TKIP_COUNTER_MEASURE_STOPED == |
| 3495 | pHddStaCtx->WextState.mTKIPCounterMeasures) { |
| 3496 | struct iw_michaelmicfailure msg; |
| 3497 | union iwreq_data wreq; |
Srinivas Girigowda | 0325c59 | 2017-03-25 16:11:25 -0700 | [diff] [blame] | 3498 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3499 | memset(&msg, '\0', sizeof(msg)); |
| 3500 | msg.src_addr.sa_family = ARPHRD_ETHER; |
| 3501 | memcpy(msg.src_addr.sa_data, |
| 3502 | pRoamInfo->u.pMICFailureInfo->taMacAddr, |
| 3503 | sizeof(pRoamInfo->u.pMICFailureInfo->taMacAddr)); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3504 | hdd_debug("MIC MAC " MAC_ADDRESS_STR, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3505 | MAC_ADDR_ARRAY(msg.src_addr.sa_data)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3506 | |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3507 | if (pRoamInfo->u.pMICFailureInfo->multicast == true) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3508 | msg.flags = IW_MICFAILURE_GROUP; |
| 3509 | else |
| 3510 | msg.flags = IW_MICFAILURE_PAIRWISE; |
| 3511 | memset(&wreq, 0, sizeof(wreq)); |
| 3512 | wreq.data.length = sizeof(msg); |
| 3513 | wireless_send_event(pAdapter->dev, IWEVMICHAELMICFAILURE, &wreq, |
| 3514 | (char *)&msg); |
| 3515 | /* inform mic failure to nl80211 */ |
| 3516 | cfg80211_michael_mic_failure(pAdapter->dev, |
| 3517 | pRoamInfo->u.pMICFailureInfo-> |
| 3518 | taMacAddr, |
| 3519 | ((pRoamInfo->u.pMICFailureInfo-> |
| 3520 | multicast == |
Srinivas Girigowda | 74a66d6 | 2017-06-21 23:28:25 -0700 | [diff] [blame] | 3521 | true) ? |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3522 | NL80211_KEYTYPE_GROUP : |
| 3523 | NL80211_KEYTYPE_PAIRWISE), |
| 3524 | pRoamInfo->u.pMICFailureInfo-> |
| 3525 | keyId, |
| 3526 | pRoamInfo->u.pMICFailureInfo->TSC, |
| 3527 | GFP_KERNEL); |
| 3528 | |
| 3529 | } |
| 3530 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3531 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3532 | } |
| 3533 | |
| 3534 | /** |
| 3535 | * roam_roam_connect_status_update_handler() - IBSS connect status update |
| 3536 | * @pAdapter: pointer to adapter |
| 3537 | * @pRoamInfo: pointer to roam info |
| 3538 | * @roamId: roam id |
| 3539 | * @roamStatus: roam status |
| 3540 | * @roamResult: roam result |
| 3541 | * |
| 3542 | * The Ibss connection status is updated regularly here in this function. |
| 3543 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3544 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3545 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3546 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3547 | roam_roam_connect_status_update_handler(hdd_adapter_t *pAdapter, |
| 3548 | tCsrRoamInfo *pRoamInfo, |
| 3549 | uint32_t roamId, |
| 3550 | eRoamCmdStatus roamStatus, |
| 3551 | eCsrRoamResult roamResult) |
| 3552 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3553 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Rajeev Kumar | dfa3707 | 2017-01-13 16:27:22 -0800 | [diff] [blame] | 3554 | QDF_STATUS qdf_status; |
Selvaraj, Sridhar | 0672a12 | 2016-12-29 16:11:48 +0530 | [diff] [blame] | 3555 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3556 | switch (roamResult) { |
| 3557 | case eCSR_ROAM_RESULT_IBSS_NEW_PEER: |
| 3558 | { |
| 3559 | hdd_station_ctx_t *pHddStaCtx = |
| 3560 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3561 | struct station_info *stainfo; |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3562 | eCsrEncryptionType encr_type = pHddStaCtx->ibss_enc_key.encType; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3563 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3564 | hdd_info("IBSS New Peer indication from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3565 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3566 | MAC_ADDRESS_STR " and stationID= %d", |
| 3567 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3568 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3569 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3570 | |
Deepak Dhamdhere | 0f076bd | 2016-06-02 11:29:21 -0700 | [diff] [blame] | 3571 | if (!hdd_save_peer |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3572 | (WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), |
| 3573 | pRoamInfo->staId, |
| 3574 | &pRoamInfo->peerMac)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3575 | hdd_warn("Max reached: Can't register new IBSS peer"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3576 | break; |
| 3577 | } |
| 3578 | |
| 3579 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = pAdapter; |
| 3580 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3581 | if (hdd_is_key_install_required_for_ibss(encr_type)) |
| 3582 | pRoamInfo->fAuthRequired = true; |
| 3583 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3584 | /* Register the Station with TL for the new peer. */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3585 | qdf_status = hdd_roam_register_sta(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3586 | pRoamInfo, |
| 3587 | pRoamInfo->staId, |
| 3588 | &pRoamInfo->peerMac, |
| 3589 | pRoamInfo->pBssDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3590 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3591 | 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] | 3592 | qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3593 | } |
| 3594 | pHddStaCtx->ibss_sta_generation++; |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3595 | stainfo = qdf_mem_malloc(sizeof(*stainfo)); |
| 3596 | if (stainfo == NULL) { |
| 3597 | hdd_err("memory allocation for station_info failed"); |
| 3598 | return QDF_STATUS_E_NOMEM; |
| 3599 | } |
| 3600 | stainfo->filled = 0; |
| 3601 | stainfo->generation = pHddStaCtx->ibss_sta_generation; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3602 | |
| 3603 | cfg80211_new_sta(pAdapter->dev, |
| 3604 | (const u8 *)pRoamInfo->peerMac.bytes, |
Kai Liu | 7400c5b | 2016-09-29 15:28:36 +0800 | [diff] [blame] | 3605 | stainfo, GFP_KERNEL); |
| 3606 | qdf_mem_free(stainfo); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3607 | |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3608 | if (hdd_is_key_install_required_for_ibss(encr_type)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3609 | pHddStaCtx->ibss_enc_key.keyDirection = |
| 3610 | eSIR_TX_RX; |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3611 | qdf_copy_macaddr(&pHddStaCtx->ibss_enc_key.peerMac, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3612 | &pRoamInfo->peerMac); |
| 3613 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3614 | hdd_info("New peer joined set PTK encType=%d", |
Krishna Kumaar Natarajan | 5554cec | 2017-01-12 19:38:55 -0800 | [diff] [blame] | 3615 | encr_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3616 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3617 | qdf_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3618 | sme_roam_set_key(WLAN_HDD_GET_HAL_CTX |
| 3619 | (pAdapter), |
| 3620 | pAdapter->sessionId, |
| 3621 | &pHddStaCtx->ibss_enc_key, |
| 3622 | &roamId); |
| 3623 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3624 | if (QDF_STATUS_SUCCESS != qdf_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3625 | hdd_err("sme_roam_set_key failed, status: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3626 | qdf_status); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3627 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3628 | } |
| 3629 | } |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3630 | hdd_info("Enabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3631 | wlan_hdd_netif_queue_control(pAdapter, |
| 3632 | WLAN_START_ALL_NETIF_QUEUE_N_CARRIER, |
| 3633 | WLAN_CONTROL_PATH); |
| 3634 | break; |
| 3635 | } |
| 3636 | |
| 3637 | case eCSR_ROAM_RESULT_IBSS_CONNECT: |
| 3638 | { |
| 3639 | |
| 3640 | roam_ibss_connect_handler(pAdapter, pRoamInfo); |
| 3641 | |
| 3642 | break; |
| 3643 | } |
| 3644 | case eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED: |
| 3645 | { |
| 3646 | hdd_station_ctx_t *pHddStaCtx = |
| 3647 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 3648 | |
| 3649 | if (!roam_remove_ibss_station(pAdapter, pRoamInfo->staId)) |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3650 | 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] | 3651 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3652 | hdd_info("IBSS Peer Departed from SME " |
Gowri, Deepthi | 07ac993 | 2016-09-02 15:19:32 +0530 | [diff] [blame] | 3653 | "with peerMac " MAC_ADDRESS_STR " BSSID: " |
| 3654 | MAC_ADDRESS_STR " and stationID= %d", |
| 3655 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3656 | MAC_ADDR_ARRAY(pHddStaCtx->conn_info.bssId.bytes), |
| 3657 | pRoamInfo->staId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3658 | |
| 3659 | hdd_roam_deregister_sta(pAdapter, pRoamInfo->staId); |
| 3660 | |
| 3661 | pHddCtx->sta_to_adapter[pRoamInfo->staId] = NULL; |
| 3662 | pHddStaCtx->ibss_sta_generation++; |
| 3663 | |
| 3664 | cfg80211_del_sta(pAdapter->dev, |
| 3665 | (const u8 *)&pRoamInfo->peerMac.bytes, |
| 3666 | GFP_KERNEL); |
| 3667 | break; |
| 3668 | } |
| 3669 | case eCSR_ROAM_RESULT_IBSS_INACTIVE: |
| 3670 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3671 | hdd_debug("Received eCSR_ROAM_RESULT_IBSS_INACTIVE from SME"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3672 | /* Stop only when we are inactive */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3673 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3674 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 3675 | WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3676 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3677 | hdd_conn_set_connection_state(pAdapter, |
| 3678 | eConnectionState_NotConnected); |
| 3679 | |
| 3680 | /* Send the bssid address to the wext. */ |
| 3681 | hdd_send_association_event(pAdapter->dev, pRoamInfo); |
| 3682 | break; |
| 3683 | } |
| 3684 | default: |
| 3685 | break; |
| 3686 | |
| 3687 | } |
| 3688 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3689 | return QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3690 | } |
| 3691 | |
| 3692 | #ifdef FEATURE_WLAN_TDLS |
| 3693 | /** |
| 3694 | * hdd_roam_register_tdlssta() - register new TDLS station |
| 3695 | * @pAdapter: pointer to adapter |
| 3696 | * @peerMac: pointer to peer MAC address |
| 3697 | * @staId: station identifier |
| 3698 | * @ucastSig: unicast signature |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3699 | * @qos: QOS capability of TDLS station/link |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3700 | * |
| 3701 | * Construct the staDesc and register with TL the new STA. |
| 3702 | * This is called as part of ADD_STA in the TDLS setup. |
| 3703 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3704 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3705 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3706 | QDF_STATUS hdd_roam_register_tdlssta(hdd_adapter_t *pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3707 | const uint8_t *peerMac, uint16_t staId, |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3708 | uint8_t ucastSig, uint8_t qos) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3709 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3710 | QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3711 | struct ol_txrx_desc_type staDesc = { 0 }; |
Dhanashri Atre | 182b027 | 2016-02-17 15:35:07 -0800 | [diff] [blame] | 3712 | struct ol_txrx_ops txrx_ops; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3713 | void *soc = cds_get_context(QDF_MODULE_ID_SOC); |
| 3714 | void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3715 | |
| 3716 | /* |
| 3717 | * TDLS sta in BSS should be set as STA type TDLS and STA MAC should |
| 3718 | * be peer MAC, here we are working on direct Link |
| 3719 | */ |
| 3720 | staDesc.sta_id = staId; |
| 3721 | |
| 3722 | /* set the QoS field appropriately .. */ |
Agrawal Ashish | d3f22f6 | 2016-09-04 13:46:15 +0530 | [diff] [blame] | 3723 | staDesc.is_qos_enabled = qos; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3724 | |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3725 | /* Register the vdev transmit and receive functions */ |
| 3726 | qdf_mem_zero(&txrx_ops, sizeof(txrx_ops)); |
| 3727 | txrx_ops.rx.rx = hdd_rx_packet_cbk; |
Leo Chang | fdb45c3 | 2016-10-28 11:09:23 -0700 | [diff] [blame] | 3728 | cdp_vdev_register(soc, |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3729 | (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, |
| 3730 | (struct cdp_pdev *)pdev, pAdapter->sessionId), |
Dhanashri Atre | 50141c5 | 2016-04-07 13:15:29 -0700 | [diff] [blame] | 3731 | pAdapter, &txrx_ops); |
| 3732 | pAdapter->tx_fn = txrx_ops.tx.tx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3733 | |
| 3734 | /* Register the Station with TL... */ |
Venkata Sharath Chandra Manchala | 0d44d45 | 2016-11-23 17:48:15 -0800 | [diff] [blame] | 3735 | qdf_status = cdp_peer_register(soc, |
| 3736 | (struct cdp_pdev *)pdev, &staDesc); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3737 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3738 | hdd_err("cdp_peer_register() failed Status: %d [0x%08X]", |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3739 | qdf_status, qdf_status); |
| 3740 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3741 | } |
| 3742 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3743 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3744 | } |
| 3745 | |
| 3746 | /** |
| 3747 | * hdd_roam_deregister_tdlssta() - deregister new TDLS station |
| 3748 | * @pAdapter: pointer to adapter |
| 3749 | * @staId: station identifier |
| 3750 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3751 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3752 | */ |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 3753 | 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] | 3754 | { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3755 | QDF_STATUS qdf_status; |
Krishna Kumaar Natarajan | e58b409 | 2017-01-25 15:47:35 -0800 | [diff] [blame] | 3756 | 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] | 3757 | (struct cdp_pdev *)cds_get_context(QDF_MODULE_ID_TXRX), |
| 3758 | staId); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3759 | if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3760 | 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] | 3761 | staId, qdf_status, qdf_status); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3762 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3763 | return qdf_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3764 | } |
| 3765 | |
| 3766 | /** |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3767 | * hdd_tdls_connection_tracker_update() - update connection tracker state |
| 3768 | * @adapter: pointer to adapter |
| 3769 | * @roam_info: pointer to roam info |
| 3770 | * @hdd_tdls_ctx: tdls context |
| 3771 | * |
| 3772 | * Return: QDF_STATUS enumeration |
| 3773 | */ |
| 3774 | static QDF_STATUS hdd_tdls_connection_tracker_update(hdd_adapter_t *adapter, |
| 3775 | tCsrRoamInfo *roam_info, |
| 3776 | tdlsCtx_t *hdd_tdls_ctx) |
| 3777 | { |
| 3778 | hddTdlsPeer_t *curr_peer; |
| 3779 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 3780 | |
| 3781 | curr_peer = wlan_hdd_tdls_find_peer(adapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3782 | roam_info->peerMac.bytes); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3783 | |
| 3784 | if (!curr_peer) { |
| 3785 | hdd_err("curr_peer is null"); |
| 3786 | return QDF_STATUS_E_FAILURE; |
| 3787 | } |
| 3788 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3789 | if (eTDLS_LINK_CONNECTED == |
| 3790 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3791 | hdd_debug("Received CONNECTION_TRACKER_NOTIFICATION " |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3792 | MAC_ADDRESS_STR |
| 3793 | " staId: %d, reason: %d", |
| 3794 | MAC_ADDR_ARRAY(roam_info->peerMac.bytes), |
| 3795 | roam_info->staId, |
| 3796 | roam_info->reasonCode); |
| 3797 | |
| 3798 | if (roam_info->reasonCode == |
| 3799 | eWNI_TDLS_PEER_ENTER_BUF_STA || |
| 3800 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3801 | eWNI_TDLS_ENTER_BT_BUSY_MODE || |
| 3802 | roam_info->reasonCode == |
| 3803 | eWMI_TDLS_SCAN_STARTED_EVENT) |
| 3804 | hdd_ctx->enable_tdls_connection_tracker = false; |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3805 | else if (roam_info->reasonCode == |
| 3806 | eWNI_TDLS_PEER_EXIT_BUF_STA || |
| 3807 | roam_info->reasonCode == |
Kabilan Kannan | 21eafc2 | 2016-11-04 16:33:52 -0700 | [diff] [blame] | 3808 | eWNI_TDLS_EXIT_BT_BUSY_MODE || |
| 3809 | roam_info->reasonCode == |
| 3810 | eWMI_TDLS_SCAN_COMPLETED_EVENT) |
| 3811 | hdd_ctx->enable_tdls_connection_tracker = true; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3812 | hdd_debug("hdd_ctx->enable_tdls_connection_tracker %d", |
Nitesh Shah | c549dd5 | 2017-02-23 16:45:44 +0530 | [diff] [blame] | 3813 | hdd_ctx->enable_tdls_connection_tracker); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3814 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3815 | hdd_debug("TDLS not connected, ignore notification, reason: %d", |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3816 | roam_info->reasonCode); |
| 3817 | } |
| 3818 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 3819 | return QDF_STATUS_SUCCESS; |
| 3820 | } |
| 3821 | |
| 3822 | |
| 3823 | |
| 3824 | |
| 3825 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3826 | * hdd_roam_tdls_status_update_handler() - TDLS status update handler |
| 3827 | * @pAdapter: pointer to adapter |
| 3828 | * @pRoamInfo: pointer to roam info |
| 3829 | * @roamId: roam id |
| 3830 | * @roamStatus: roam status |
| 3831 | * @roamResult: roam result |
| 3832 | * |
| 3833 | * HDD interface between SME and TL to ensure TDLS client registration with |
| 3834 | * TL in case of new TDLS client is added and deregistration at the time |
| 3835 | * TDLS client is deleted. |
| 3836 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3837 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3838 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3839 | static QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3840 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 3841 | tCsrRoamInfo *pRoamInfo, |
| 3842 | uint32_t roamId, |
| 3843 | eRoamCmdStatus roamStatus, |
| 3844 | eCsrRoamResult roamResult) |
| 3845 | { |
| 3846 | hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 3847 | tdlsCtx_t *pHddTdlsCtx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3848 | tSmeTdlsPeerStateParams smeTdlsPeerStateParams; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3849 | QDF_STATUS status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3850 | uint8_t staIdx; |
| 3851 | hddTdlsPeer_t *curr_peer; |
| 3852 | uint32_t reason; |
| 3853 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3854 | hdd_debug("hdd_tdlsStatusUpdate: %s staIdx %d " MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3855 | roamResult == |
| 3856 | eCSR_ROAM_RESULT_ADD_TDLS_PEER ? "ADD_TDLS_PEER" : roamResult |
| 3857 | == |
| 3858 | eCSR_ROAM_RESULT_DELETE_TDLS_PEER ? "DEL_TDLS_PEER" : |
| 3859 | roamResult == |
| 3860 | eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND ? "DEL_TDLS_PEER_IND" |
| 3861 | : roamResult == |
| 3862 | eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND ? |
| 3863 | "DEL_ALL_TDLS_PEER_IND" : roamResult == |
| 3864 | eCSR_ROAM_RESULT_UPDATE_TDLS_PEER ? "UPDATE_TDLS_PEER" : |
| 3865 | roamResult == |
| 3866 | eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP ? |
| 3867 | "LINK_ESTABLISH_REQ_RSP" : roamResult == |
| 3868 | eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER ? "TDLS_SHOULD_DISCOVER" |
| 3869 | : roamResult == |
| 3870 | eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN ? "TDLS_SHOULD_TEARDOWN" |
| 3871 | : roamResult == |
| 3872 | eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED ? |
| 3873 | "TDLS_SHOULD_PEER_DISCONNECTED" : "UNKNOWN", pRoamInfo->staId, |
| 3874 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes)); |
| 3875 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3876 | switch (roamResult) { |
| 3877 | case eCSR_ROAM_RESULT_ADD_TDLS_PEER: |
| 3878 | { |
| 3879 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3880 | hdd_err("Add Sta failed. status code: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3881 | pRoamInfo->statusCode); |
Selvaraj, Sridhar | 5d95e63 | 2016-09-14 17:00:38 +0530 | [diff] [blame] | 3882 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3883 | } else { |
| 3884 | /* |
| 3885 | * Check if there is available index for this new TDLS |
| 3886 | * STA. |
| 3887 | */ |
| 3888 | for (staIdx = 0; |
| 3889 | staIdx < pHddCtx->max_num_tdls_sta; |
| 3890 | staIdx++) { |
| 3891 | if (0 == |
| 3892 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3893 | staId) { |
| 3894 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3895 | sessionId = |
| 3896 | pRoamInfo->sessionId; |
| 3897 | pHddCtx->tdlsConnInfo[staIdx]. |
| 3898 | staId = pRoamInfo->staId; |
| 3899 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3900 | hdd_debug("TDLS: STA IDX at %d is %d " |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3901 | "of mac " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3902 | MAC_ADDRESS_STR, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3903 | staIdx, |
| 3904 | pHddCtx-> |
| 3905 | tdlsConnInfo[staIdx]. |
| 3906 | staId, |
| 3907 | MAC_ADDR_ARRAY |
| 3908 | (pRoamInfo->peerMac.bytes)); |
| 3909 | |
Anurag Chouhan | c554842 | 2016-02-24 18:33:27 +0530 | [diff] [blame] | 3910 | qdf_copy_macaddr(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3911 | tdlsConnInfo |
| 3912 | [staIdx]. |
| 3913 | peerMac, |
| 3914 | &pRoamInfo-> |
| 3915 | peerMac); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3916 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3917 | break; |
| 3918 | } |
| 3919 | } |
| 3920 | if (staIdx < pHddCtx->max_num_tdls_sta) { |
| 3921 | if (-1 == |
| 3922 | wlan_hdd_tdls_set_sta_id(pAdapter, |
| 3923 | pRoamInfo-> |
| 3924 | peerMac.bytes, |
| 3925 | pRoamInfo-> |
| 3926 | staId)) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3927 | hdd_err("wlan_hdd_tdls_set_sta_id() failed"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3928 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3929 | } |
| 3930 | |
| 3931 | (WLAN_HDD_GET_CTX(pAdapter))-> |
| 3932 | sta_to_adapter[pRoamInfo->staId] = |
| 3933 | pAdapter; |
| 3934 | /* |
| 3935 | * store the ucast signature, |
| 3936 | * if required for further reference. |
| 3937 | */ |
| 3938 | |
| 3939 | wlan_hdd_tdls_set_signature(pAdapter, |
| 3940 | pRoamInfo-> |
| 3941 | peerMac.bytes, |
| 3942 | pRoamInfo-> |
| 3943 | ucastSig); |
| 3944 | } else { |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 3945 | status = QDF_STATUS_E_FAILURE; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3946 | 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] | 3947 | pRoamInfo->staId); |
| 3948 | } |
| 3949 | pAdapter->tdlsAddStaStatus = status; |
| 3950 | } |
| 3951 | complete(&pAdapter->tdls_add_station_comp); |
| 3952 | break; |
| 3953 | } |
| 3954 | case eCSR_ROAM_RESULT_UPDATE_TDLS_PEER: |
| 3955 | { |
| 3956 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3957 | hdd_err("Add Sta failed. status code: %d", |
Varun Reddy Yeturu | ed1215e | 2017-07-07 16:40:28 -0700 | [diff] [blame] | 3958 | pRoamInfo->statusCode); |
| 3959 | pAdapter->tdlsAddStaStatus = QDF_STATUS_E_FAILURE; |
| 3960 | } else { |
| 3961 | pAdapter->tdlsAddStaStatus = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3962 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3963 | complete(&pAdapter->tdls_add_station_comp); |
| 3964 | break; |
| 3965 | } |
| 3966 | case eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP: |
| 3967 | { |
| 3968 | if (eSIR_SME_SUCCESS != pRoamInfo->statusCode) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3969 | hdd_err("Link Establish Request failed. status: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3970 | pRoamInfo->statusCode); |
| 3971 | } |
| 3972 | complete(&pAdapter->tdls_link_establish_req_comp); |
| 3973 | break; |
| 3974 | } |
| 3975 | case eCSR_ROAM_RESULT_DELETE_TDLS_PEER: |
| 3976 | { |
| 3977 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 3978 | staIdx++) { |
| 3979 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 3980 | pRoamInfo->sessionId) |
| 3981 | && pRoamInfo->staId == |
| 3982 | pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3983 | hdd_debug("HDD: del STA IDX = %x", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 3984 | pRoamInfo->staId); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3985 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3986 | curr_peer = |
| 3987 | wlan_hdd_tdls_find_peer(pAdapter, |
| 3988 | pRoamInfo-> |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 3989 | peerMac.bytes); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3990 | if (NULL != curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 3991 | hdd_debug("Current status for peer " MAC_ADDRESS_STR " is %d", |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 3992 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 3993 | curr_peer->link_status); |
| 3994 | if (TDLS_IS_CONNECTED(curr_peer)) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 3995 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 3996 | hdd_roam_deregister_tdlssta |
| 3997 | (pAdapter, |
| 3998 | pRoamInfo->staId); |
| 3999 | wlan_hdd_tdls_decrement_peer_count |
| 4000 | (pAdapter); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4001 | } else if (eTDLS_LINK_CONNECTING == |
| 4002 | curr_peer->link_status) { |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4003 | mutex_unlock(&pHddCtx->tdls_lock); |
Agrawal Ashish | dd2075b | 2015-10-30 13:05:27 +0530 | [diff] [blame] | 4004 | hdd_roam_deregister_tdlssta |
| 4005 | (pAdapter, |
| 4006 | pRoamInfo->staId); |
Nitesh Shah | 0bf768f | 2017-03-31 15:01:37 +0530 | [diff] [blame] | 4007 | } else |
| 4008 | mutex_unlock(&pHddCtx->tdls_lock); |
Nitesh Shah | 3dea672 | 2017-02-01 14:35:57 +0530 | [diff] [blame] | 4009 | } else |
| 4010 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4011 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4012 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4013 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4014 | pRoamInfo-> |
| 4015 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4016 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4017 | |
| 4018 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4019 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4020 | sessionId = 255; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4021 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4022 | tdlsConnInfo[staIdx]. |
| 4023 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4024 | QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4025 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4026 | break; |
| 4027 | } |
| 4028 | } |
| 4029 | complete(&pAdapter->tdls_del_station_comp); |
| 4030 | } |
| 4031 | break; |
| 4032 | case eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND: |
| 4033 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4034 | hdd_debug("Sending teardown to supplicant with reason code %u", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4035 | pRoamInfo->reasonCode); |
| 4036 | |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4037 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4038 | curr_peer = |
| 4039 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4040 | pRoamInfo->peerMac.bytes); |
Ganesh Kondabattini | 9c8dc46 | 2017-04-19 10:52:54 +0530 | [diff] [blame] | 4041 | |
| 4042 | if (!curr_peer) { |
| 4043 | mutex_unlock(&pHddCtx->tdls_lock); |
| 4044 | hdd_debug("peer doesn't exists"); |
| 4045 | status = QDF_STATUS_SUCCESS; |
| 4046 | break; |
| 4047 | } |
| 4048 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4049 | wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4050 | pRoamInfo->reasonCode); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4051 | hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4052 | curr_peer->peerMac); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4053 | mutex_unlock(&pHddCtx->tdls_lock); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4054 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4055 | break; |
| 4056 | } |
| 4057 | case eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND: |
| 4058 | { |
| 4059 | /* 0 staIdx is assigned to AP we dont want to touch that */ |
| 4060 | for (staIdx = 0; staIdx < pHddCtx->max_num_tdls_sta; |
| 4061 | staIdx++) { |
| 4062 | if ((pHddCtx->tdlsConnInfo[staIdx].sessionId == |
| 4063 | pRoamInfo->sessionId) |
| 4064 | && pHddCtx->tdlsConnInfo[staIdx].staId) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4065 | hdd_debug("hdd_tdlsStatusUpdate: staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4066 | MAC_ADDRESS_STR, |
| 4067 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4068 | staId, |
| 4069 | MAC_ADDR_ARRAY(pHddCtx-> |
| 4070 | tdlsConnInfo |
| 4071 | [staIdx]. |
| 4072 | peerMac. |
| 4073 | bytes)); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4074 | mutex_lock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4075 | wlan_hdd_tdls_reset_peer(pAdapter, |
| 4076 | pHddCtx-> |
| 4077 | tdlsConnInfo |
| 4078 | [staIdx]. |
| 4079 | peerMac.bytes); |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4080 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4081 | hdd_roam_deregister_tdlssta(pAdapter, |
| 4082 | pHddCtx-> |
| 4083 | tdlsConnInfo |
| 4084 | [staIdx]. |
| 4085 | staId); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4086 | qdf_mem_zero(&smeTdlsPeerStateParams, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4087 | sizeof |
| 4088 | (smeTdlsPeerStateParams)); |
| 4089 | smeTdlsPeerStateParams.vdevId = |
| 4090 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4091 | sessionId; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4092 | qdf_mem_copy(&smeTdlsPeerStateParams. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4093 | peerMacAddr, |
| 4094 | &pHddCtx-> |
| 4095 | tdlsConnInfo[staIdx]. |
| 4096 | peerMac.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4097 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4098 | smeTdlsPeerStateParams.peerState = |
| 4099 | eSME_TDLS_PEER_STATE_TEARDOWN; |
| 4100 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4101 | hdd_debug("calling sme_update_tdls_peer_state for staIdx %d " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4102 | MAC_ADDRESS_STR, |
| 4103 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4104 | staId, |
| 4105 | MAC_ADDR_ARRAY(pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4106 | tdlsConnInfo |
| 4107 | [staIdx]. |
| 4108 | peerMac. |
| 4109 | bytes)); |
| 4110 | status = |
| 4111 | sme_update_tdls_peer_state( |
| 4112 | pHddCtx->hHal, |
| 4113 | &smeTdlsPeerStateParams); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4114 | if (QDF_STATUS_SUCCESS != status) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4115 | hdd_err("sme_update_tdls_peer_state failed for " |
| 4116 | MAC_ADDRESS_STR, |
| 4117 | MAC_ADDR_ARRAY |
| 4118 | (pHddCtx-> |
| 4119 | tdlsConnInfo[staIdx]. |
| 4120 | peerMac.bytes)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4121 | } |
| 4122 | wlan_hdd_tdls_decrement_peer_count |
| 4123 | (pAdapter); |
| 4124 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4125 | qdf_mem_zero(&pHddCtx-> |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4126 | tdlsConnInfo[staIdx]. |
| 4127 | peerMac, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4128 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4129 | pHddCtx->tdlsConnInfo[staIdx].staId = 0; |
| 4130 | pHddCtx->tdlsConnInfo[staIdx]. |
| 4131 | sessionId = 255; |
| 4132 | |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4133 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4134 | } |
| 4135 | } |
| 4136 | break; |
| 4137 | } |
| 4138 | case eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER: |
| 4139 | { |
| 4140 | /* ignore TDLS_SHOULD_DISCOVER if any concurrency detected */ |
Kabilan Kannan | 163fd0b | 2016-06-08 15:21:51 -0700 | [diff] [blame] | 4141 | if (!cds_check_is_tdls_allowed(pAdapter->device_mode)) { |
| 4142 | hdd_err("TDLS not allowed, ignore SHOULD_DISCOVER"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4143 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4144 | break; |
| 4145 | } |
| 4146 | |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4147 | if (pHddCtx->tdls_nss_switch_in_progress) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4148 | hdd_debug("TDLS antenna switch is in progress, ignore SHOULD_DISCOVER"); |
Archana Ramachandran | 7ba24ff | 2016-04-26 12:29:04 -0700 | [diff] [blame] | 4149 | status = QDF_STATUS_SUCCESS; |
| 4150 | break; |
| 4151 | } |
| 4152 | |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4153 | mutex_lock(&pHddCtx->tdls_lock); |
| 4154 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4155 | if (!pHddTdlsCtx) { |
| 4156 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4157 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4158 | roamResult); |
| 4159 | status = QDF_STATUS_E_FAILURE; |
| 4160 | break; |
| 4161 | } |
| 4162 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4163 | curr_peer = |
| 4164 | wlan_hdd_tdls_get_peer(pAdapter, |
Nitesh Shah | 379449e | 2017-01-31 19:11:29 +0530 | [diff] [blame] | 4165 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4166 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4167 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4168 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4169 | } else { |
| 4170 | if (eTDLS_LINK_CONNECTED == |
| 4171 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4172 | hdd_debug("TDLS link status is connected, ignore SHOULD_DISCOVER"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4173 | } else { |
| 4174 | /* |
| 4175 | * If external control is enabled then initiate |
| 4176 | * TDLS only if forced peer is set otherwise |
| 4177 | * ignore should Discover trigger from fw. |
| 4178 | */ |
| 4179 | if (pHddCtx->config-> |
| 4180 | fTDLSExternalControl |
| 4181 | && (false == |
| 4182 | curr_peer->isForcedPeer)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4183 | 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] | 4184 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4185 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4186 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4187 | 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] | 4188 | pHddCtx->config-> |
| 4189 | fTDLSExternalControl, |
| 4190 | curr_peer->isForcedPeer, |
| 4191 | pRoamInfo->reasonCode); |
Nitesh Shah | 983e8f5 | 2016-11-25 12:36:29 +0530 | [diff] [blame] | 4192 | pHddTdlsCtx->curr_candidate = curr_peer; |
| 4193 | wlan_hdd_tdls_implicit_send_discovery_request( |
| 4194 | pHddTdlsCtx); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4195 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4196 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4197 | } |
Nitesh Shah | 8e86664 | 2017-01-31 15:43:31 +0530 | [diff] [blame] | 4198 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4199 | break; |
| 4200 | } |
| 4201 | |
| 4202 | case eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN: |
| 4203 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4204 | mutex_lock(&pHddCtx->tdls_lock); |
| 4205 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4206 | if (!pHddTdlsCtx) { |
| 4207 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4208 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4209 | roamResult); |
| 4210 | status = QDF_STATUS_E_FAILURE; |
| 4211 | break; |
| 4212 | } |
| 4213 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4214 | curr_peer = |
| 4215 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4216 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4217 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4218 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4219 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4220 | } else { |
| 4221 | if (eTDLS_LINK_CONNECTED == |
| 4222 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4223 | hdd_debug("Received SHOULD_TEARDOWN for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4224 | MAC_ADDRESS_STR |
| 4225 | " staId: %d, reason: %d", |
| 4226 | MAC_ADDR_ARRAY(pRoamInfo-> |
| 4227 | peerMac.bytes), |
| 4228 | pRoamInfo->staId, |
| 4229 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4230 | |
| 4231 | if (pRoamInfo->reasonCode == |
| 4232 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4233 | pRoamInfo->reasonCode == |
| 4234 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4235 | pRoamInfo->reasonCode == |
| 4236 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4237 | pRoamInfo->reasonCode == |
| 4238 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4239 | reason = |
| 4240 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4241 | } else |
| 4242 | reason = |
| 4243 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4244 | |
| 4245 | wlan_hdd_tdls_indicate_teardown |
| 4246 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4247 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4248 | hdd_send_wlan_tdls_teardown_event( |
| 4249 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4250 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4251 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4252 | hdd_debug("TDLS link is not connected, ignore SHOULD_TEARDOWN, reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4253 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4254 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4255 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4256 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4257 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4258 | break; |
| 4259 | } |
| 4260 | |
| 4261 | case eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED: |
| 4262 | { |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4263 | mutex_lock(&pHddCtx->tdls_lock); |
| 4264 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4265 | if (!pHddTdlsCtx) { |
| 4266 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4267 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4268 | roamResult); |
| 4269 | status = QDF_STATUS_E_FAILURE; |
| 4270 | break; |
| 4271 | } |
| 4272 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4273 | curr_peer = |
| 4274 | wlan_hdd_tdls_find_peer(pAdapter, |
Nitesh Shah | 90a02e9 | 2017-02-01 15:28:03 +0530 | [diff] [blame] | 4275 | pRoamInfo->peerMac.bytes); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4276 | if (!curr_peer) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4277 | hdd_debug("curr_peer is null"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4278 | status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4279 | } else { |
| 4280 | if (eTDLS_LINK_CONNECTED == |
| 4281 | curr_peer->link_status) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4282 | hdd_debug("Received SHOULD_PEER_DISCONNECTED for peer " |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4283 | MAC_ADDRESS_STR |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4284 | " staId: %d reason: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4285 | MAC_ADDR_ARRAY(pRoamInfo->peerMac.bytes), |
| 4286 | pRoamInfo->staId, |
| 4287 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4288 | |
| 4289 | if (pRoamInfo->reasonCode == |
| 4290 | eWNI_TDLS_TEARDOWN_REASON_RSSI || |
| 4291 | pRoamInfo->reasonCode == |
| 4292 | eWNI_TDLS_DISCONNECTED_REASON_PEER_DELETE || |
| 4293 | pRoamInfo->reasonCode == |
| 4294 | eWNI_TDLS_TEARDOWN_REASON_PTR_TIMEOUT || |
| 4295 | pRoamInfo->reasonCode == |
| 4296 | eWNI_TDLS_TEARDOWN_REASON_NO_RESPONSE) { |
| 4297 | reason = |
| 4298 | eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE; |
| 4299 | } else |
| 4300 | reason = |
| 4301 | eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON; |
| 4302 | |
| 4303 | wlan_hdd_tdls_indicate_teardown |
| 4304 | (pHddTdlsCtx->pAdapter, curr_peer, |
Nitesh Shah | 8816f57 | 2017-01-31 17:56:28 +0530 | [diff] [blame] | 4305 | reason); |
Abhishek Singh | 4ef5fe0 | 2016-04-27 12:21:24 +0530 | [diff] [blame] | 4306 | hdd_send_wlan_tdls_teardown_event( |
| 4307 | eTDLS_TEARDOWN_BSS_DISCONNECT, |
| 4308 | curr_peer->peerMac); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4309 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4310 | 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] | 4311 | pRoamInfo->reasonCode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4312 | } |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4313 | status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4314 | } |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4315 | mutex_unlock(&pHddCtx->tdls_lock); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4316 | break; |
| 4317 | } |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4318 | |
| 4319 | case eCSR_ROAM_RESULT_TDLS_CONNECTION_TRACKER_NOTIFICATION: |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4320 | mutex_lock(&pHddCtx->tdls_lock); |
| 4321 | pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter); |
| 4322 | if (!pHddTdlsCtx) { |
| 4323 | mutex_unlock(&pHddCtx->tdls_lock); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4324 | hdd_debug("TDLS ctx is null, ignore roamResult (%d)", |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4325 | roamResult); |
| 4326 | status = QDF_STATUS_E_FAILURE; |
| 4327 | break; |
| 4328 | } |
| 4329 | |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4330 | status = hdd_tdls_connection_tracker_update(pAdapter, |
| 4331 | pRoamInfo, |
| 4332 | pHddTdlsCtx); |
Nitesh Shah | f1f3899 | 2017-01-31 16:40:16 +0530 | [diff] [blame] | 4333 | mutex_unlock(&pHddCtx->tdls_lock); |
Kabilan Kannan | 14ec97f | 2016-05-16 23:48:25 -0700 | [diff] [blame] | 4334 | break; |
| 4335 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4336 | default: |
| 4337 | { |
| 4338 | break; |
| 4339 | } |
| 4340 | } |
| 4341 | |
| 4342 | return status; |
| 4343 | } |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4344 | #else |
| 4345 | |
Nitesh Shah | 99dd955 | 2017-03-20 19:27:47 +0530 | [diff] [blame] | 4346 | inline QDF_STATUS hdd_roam_deregister_tdlssta(hdd_adapter_t *pAdapter, |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 4347 | uint8_t staId) |
| 4348 | { |
| 4349 | return QDF_STATUS_SUCCESS; |
| 4350 | } |
| 4351 | |
| 4352 | static inline QDF_STATUS |
| 4353 | hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter, |
| 4354 | tCsrRoamInfo *pRoamInfo, |
| 4355 | uint32_t roamId, |
| 4356 | eRoamCmdStatus roamStatus, |
| 4357 | eCsrRoamResult roamResult) |
| 4358 | { |
| 4359 | return QDF_STATUS_SUCCESS; |
| 4360 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4361 | #endif |
| 4362 | |
| 4363 | #ifdef WLAN_FEATURE_11W |
| 4364 | /** |
| 4365 | * hdd_indicate_unprot_mgmt_frame() - indicate unprotected management frame |
| 4366 | * @pAdapter: pointer to the adapter |
| 4367 | * @nFrameLength: Length of the unprotected frame being passed |
| 4368 | * @pbFrames: Pointer to the frame buffer |
| 4369 | * @frameType: 802.11 frame type |
| 4370 | * |
| 4371 | * This function forwards the unprotected management frame to the supplicant. |
| 4372 | * |
| 4373 | * Return: nothing |
| 4374 | */ |
| 4375 | static void |
| 4376 | hdd_indicate_unprot_mgmt_frame(hdd_adapter_t *pAdapter, uint32_t nFrameLength, |
| 4377 | uint8_t *pbFrames, uint8_t frameType) |
| 4378 | { |
| 4379 | uint8_t type = 0; |
| 4380 | uint8_t subType = 0; |
| 4381 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4382 | hdd_debug("Frame Type = %d Frame Length = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4383 | frameType, nFrameLength); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4384 | |
| 4385 | /* Sanity Checks */ |
| 4386 | if (NULL == pAdapter) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4387 | hdd_err("pAdapter is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4388 | return; |
| 4389 | } |
| 4390 | |
| 4391 | if (NULL == pAdapter->dev) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4392 | hdd_err("pAdapter->dev is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4393 | return; |
| 4394 | } |
| 4395 | |
| 4396 | if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4397 | hdd_err("pAdapter has invalid magic"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4398 | return; |
| 4399 | } |
| 4400 | |
| 4401 | if (!nFrameLength) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4402 | hdd_err("Frame Length is Invalid ZERO"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4403 | return; |
| 4404 | } |
| 4405 | |
| 4406 | if (NULL == pbFrames) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4407 | hdd_err("pbFrames is NULL"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4408 | return; |
| 4409 | } |
| 4410 | |
| 4411 | type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); |
| 4412 | subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); |
| 4413 | |
| 4414 | /* Get pAdapter from Destination mac address of the frame */ |
| 4415 | if (type == SIR_MAC_MGMT_FRAME && subType == SIR_MAC_MGMT_DISASSOC) { |
| 4416 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4417 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4418 | nFrameLength); |
| 4419 | #else |
| 4420 | cfg80211_send_unprot_disassoc(pAdapter->dev, pbFrames, |
| 4421 | nFrameLength); |
| 4422 | #endif |
| 4423 | pAdapter->hdd_stats.hddPmfStats.numUnprotDisassocRx++; |
| 4424 | } else if (type == SIR_MAC_MGMT_FRAME && |
| 4425 | subType == SIR_MAC_MGMT_DEAUTH) { |
| 4426 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) |
| 4427 | cfg80211_rx_unprot_mlme_mgmt(pAdapter->dev, pbFrames, |
| 4428 | nFrameLength); |
| 4429 | #else |
| 4430 | cfg80211_send_unprot_deauth(pAdapter->dev, pbFrames, |
| 4431 | nFrameLength); |
| 4432 | #endif |
| 4433 | pAdapter->hdd_stats.hddPmfStats.numUnprotDeauthRx++; |
| 4434 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4435 | hdd_warn("Frame type %d and subtype %d are not valid", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4436 | type, subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4437 | return; |
| 4438 | } |
| 4439 | } |
| 4440 | #endif |
| 4441 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4442 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4443 | /** |
| 4444 | * hdd_indicate_tsm_ie() - send traffic stream metrics ie |
| 4445 | * @pAdapter: pointer to adapter |
| 4446 | * @tid: traffic identifier |
| 4447 | * @state: state |
| 4448 | * @measInterval: measurement interval |
| 4449 | * |
| 4450 | * This function sends traffic stream metrics IE information to |
| 4451 | * the supplicant via wireless event. |
| 4452 | * |
| 4453 | * Return: none |
| 4454 | */ |
| 4455 | static void |
| 4456 | hdd_indicate_tsm_ie(hdd_adapter_t *pAdapter, uint8_t tid, |
| 4457 | uint8_t state, uint16_t measInterval) |
| 4458 | { |
| 4459 | union iwreq_data wrqu; |
| 4460 | char buf[IW_CUSTOM_MAX + 1]; |
| 4461 | int nBytes = 0; |
| 4462 | |
| 4463 | if (NULL == pAdapter) |
| 4464 | return; |
| 4465 | |
| 4466 | /* create the event */ |
| 4467 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4468 | memset(buf, '\0', sizeof(buf)); |
| 4469 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4470 | hdd_debug("TSM Ind tid(%d) state(%d) MeasInt(%d)", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4471 | tid, state, measInterval); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4472 | |
| 4473 | nBytes = |
| 4474 | snprintf(buf, IW_CUSTOM_MAX, "TSMIE=%d:%d:%d", tid, state, |
| 4475 | measInterval); |
| 4476 | |
| 4477 | wrqu.data.pointer = buf; |
| 4478 | wrqu.data.length = nBytes; |
| 4479 | /* send the event */ |
| 4480 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4481 | } |
| 4482 | |
| 4483 | /** |
| 4484 | * hdd_indicate_cckm_pre_auth() - send cckm preauth indication |
| 4485 | * @pAdapter: pointer to adapter |
| 4486 | * @pRoamInfo: pointer to roam info |
| 4487 | * |
| 4488 | * This function sends cckm preauth indication to the supplicant |
| 4489 | * via wireless custom event. |
| 4490 | * |
| 4491 | * Return: none |
| 4492 | */ |
| 4493 | static void |
| 4494 | hdd_indicate_cckm_pre_auth(hdd_adapter_t *pAdapter, tCsrRoamInfo *pRoamInfo) |
| 4495 | { |
| 4496 | union iwreq_data wrqu; |
| 4497 | char buf[IW_CUSTOM_MAX + 1]; |
| 4498 | char *pos = buf; |
| 4499 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4500 | |
| 4501 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4502 | return; |
| 4503 | |
| 4504 | /* create the event */ |
| 4505 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4506 | memset(buf, '\0', sizeof(buf)); |
| 4507 | |
| 4508 | /* Timestamp0 is lower 32 bits and Timestamp1 is upper 32 bits */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4509 | hdd_debug("CCXPREAUTHNOTIFY=" MAC_ADDRESS_STR " %d:%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4510 | MAC_ADDR_ARRAY(pRoamInfo->bssid.bytes), |
| 4511 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4512 | |
| 4513 | nBytes = snprintf(pos, freeBytes, "CCXPREAUTHNOTIFY="); |
| 4514 | pos += nBytes; |
| 4515 | freeBytes -= nBytes; |
| 4516 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4517 | qdf_mem_copy(pos, pRoamInfo->bssid.bytes, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 4518 | pos += QDF_MAC_ADDR_SIZE; |
| 4519 | freeBytes -= QDF_MAC_ADDR_SIZE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4520 | |
| 4521 | nBytes = snprintf(pos, freeBytes, " %u:%u", |
| 4522 | pRoamInfo->timestamp[0], pRoamInfo->timestamp[1]); |
| 4523 | freeBytes -= nBytes; |
| 4524 | |
| 4525 | wrqu.data.pointer = buf; |
| 4526 | wrqu.data.length = (IW_CUSTOM_MAX - freeBytes); |
| 4527 | |
| 4528 | /* send the event */ |
| 4529 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4530 | } |
| 4531 | |
| 4532 | /** |
| 4533 | * hdd_indicate_ese_adj_ap_rep_ind() - send adjacent AP report indication |
| 4534 | * @pAdapter: pointer to adapter |
| 4535 | * @pRoamInfo: pointer to roam info |
| 4536 | * |
| 4537 | * Return: none |
| 4538 | */ |
| 4539 | static void |
| 4540 | hdd_indicate_ese_adj_ap_rep_ind(hdd_adapter_t *pAdapter, |
| 4541 | tCsrRoamInfo *pRoamInfo) |
| 4542 | { |
| 4543 | union iwreq_data wrqu; |
| 4544 | char buf[IW_CUSTOM_MAX + 1]; |
| 4545 | int nBytes = 0; |
| 4546 | |
| 4547 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4548 | return; |
| 4549 | |
| 4550 | /* create the event */ |
| 4551 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4552 | memset(buf, '\0', sizeof(buf)); |
| 4553 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4554 | hdd_debug("CCXADJAPREP=%u", pRoamInfo->tsmRoamDelay); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4555 | |
| 4556 | nBytes = |
| 4557 | snprintf(buf, IW_CUSTOM_MAX, "CCXADJAPREP=%u", |
| 4558 | pRoamInfo->tsmRoamDelay); |
| 4559 | |
| 4560 | wrqu.data.pointer = buf; |
| 4561 | wrqu.data.length = nBytes; |
| 4562 | |
| 4563 | /* send the event */ |
| 4564 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4565 | } |
| 4566 | |
| 4567 | /** |
| 4568 | * hdd_indicate_ese_bcn_report_no_results() - beacon report no scan results |
| 4569 | * @pAdapter: pointer to adapter |
| 4570 | * @measurementToken: measurement token |
| 4571 | * @flag: flag |
| 4572 | * @numBss: number of bss |
| 4573 | * |
| 4574 | * If the measurement is none and no scan results found, |
| 4575 | * indicate the supplicant about measurement done. |
| 4576 | * |
| 4577 | * Return: none |
| 4578 | */ |
| 4579 | void |
| 4580 | hdd_indicate_ese_bcn_report_no_results(const hdd_adapter_t *pAdapter, |
| 4581 | const uint16_t measurementToken, |
| 4582 | const bool flag, const uint8_t numBss) |
| 4583 | { |
| 4584 | union iwreq_data wrqu; |
| 4585 | char buf[IW_CUSTOM_MAX]; |
| 4586 | char *pos = buf; |
| 4587 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4588 | |
| 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("CCXBCNREP=%d %d %d", measurementToken, |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4593 | flag, numBss); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4594 | |
| 4595 | nBytes = |
| 4596 | snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d", measurementToken, |
| 4597 | flag, numBss); |
| 4598 | |
| 4599 | wrqu.data.pointer = buf; |
| 4600 | wrqu.data.length = nBytes; |
| 4601 | /* send the event */ |
| 4602 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, buf); |
| 4603 | } |
| 4604 | |
| 4605 | /** |
| 4606 | * hdd_indicate_ese_bcn_report_ind() - send beacon report indication |
| 4607 | * @pAdapter: pointer to adapter |
| 4608 | * @pRoamInfo: pointer to roam info |
| 4609 | * |
| 4610 | * If the measurement is none and no scan results found, |
| 4611 | * indicate the supplicant about measurement done. |
| 4612 | * |
| 4613 | * Return: none |
| 4614 | */ |
| 4615 | static void |
| 4616 | hdd_indicate_ese_bcn_report_ind(const hdd_adapter_t *pAdapter, |
| 4617 | const tCsrRoamInfo *pRoamInfo) |
| 4618 | { |
| 4619 | union iwreq_data wrqu; |
| 4620 | char buf[IW_CUSTOM_MAX]; |
| 4621 | char *pos = buf; |
| 4622 | int nBytes = 0, freeBytes = IW_CUSTOM_MAX; |
| 4623 | uint8_t i = 0, len = 0; |
| 4624 | uint8_t tot_bcn_ieLen = 0; /* total size of the beacon report data */ |
| 4625 | uint8_t lastSent = 0, sendBss = 0; |
| 4626 | int bcnRepFieldSize = |
| 4627 | sizeof(pRoamInfo->pEseBcnReportRsp->bcnRepBssInfo[0]. |
| 4628 | bcnReportFields); |
| 4629 | uint8_t ieLenByte = 1; |
| 4630 | /* |
| 4631 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4632 | */ |
| 4633 | #define ESEBCNREPHEADER_LEN (18) |
| 4634 | |
| 4635 | if ((NULL == pAdapter) || (NULL == pRoamInfo)) |
| 4636 | return; |
| 4637 | |
| 4638 | /* |
| 4639 | * Custom event can pass maximum of 256 bytes of data, |
| 4640 | * based on the IE len we need to identify how many BSS info can |
| 4641 | * be filled in to custom event data. |
| 4642 | */ |
| 4643 | /* |
| 4644 | * meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len bcn_rep_data |
| 4645 | * bcn_rep_data will have bcn_rep_fields,ie_len,ie without any spaces |
| 4646 | * CCXBCNREP=meas_tok<sp>flag<sp>no_of_bss<sp>tot_bcn_ie_len = 18 bytes |
| 4647 | */ |
| 4648 | |
| 4649 | if ((pRoamInfo->pEseBcnReportRsp->flag >> 1) |
| 4650 | && (!pRoamInfo->pEseBcnReportRsp->numBss)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4651 | hdd_debug("Measurement Done but no scan results"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4652 | /* If the measurement is none and no scan results found, |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 4653 | * indicate the supplicant about measurement done |
| 4654 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4655 | hdd_indicate_ese_bcn_report_no_results( |
| 4656 | pAdapter, |
| 4657 | pRoamInfo->pEseBcnReportRsp-> |
| 4658 | measurementToken, |
| 4659 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4660 | pRoamInfo->pEseBcnReportRsp->numBss); |
| 4661 | } else { |
| 4662 | while (lastSent < pRoamInfo->pEseBcnReportRsp->numBss) { |
| 4663 | memset(&wrqu, '\0', sizeof(wrqu)); |
| 4664 | memset(buf, '\0', sizeof(buf)); |
| 4665 | tot_bcn_ieLen = 0; |
| 4666 | sendBss = 0; |
| 4667 | pos = buf; |
| 4668 | freeBytes = IW_CUSTOM_MAX; |
| 4669 | |
| 4670 | for (i = lastSent; |
| 4671 | i < pRoamInfo->pEseBcnReportRsp->numBss; i++) { |
| 4672 | len = |
| 4673 | bcnRepFieldSize + ieLenByte + |
| 4674 | pRoamInfo->pEseBcnReportRsp-> |
| 4675 | bcnRepBssInfo[i].ieLen; |
| 4676 | if ((len + tot_bcn_ieLen) > |
| 4677 | (IW_CUSTOM_MAX - ESEBCNREPHEADER_LEN)) { |
| 4678 | break; |
| 4679 | } |
| 4680 | tot_bcn_ieLen += len; |
| 4681 | sendBss++; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4682 | 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] | 4683 | i, bcnRepFieldSize, 1, |
| 4684 | pRoamInfo->pEseBcnReportRsp-> |
| 4685 | bcnRepBssInfo[i].ieLen, tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4686 | } |
| 4687 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4688 | hdd_debug("Sending %d BSS Info", sendBss); |
| 4689 | hdd_debug("CCXBCNREP=%d %d %d %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4690 | pRoamInfo->pEseBcnReportRsp->measurementToken, |
| 4691 | pRoamInfo->pEseBcnReportRsp->flag, sendBss, |
| 4692 | tot_bcn_ieLen); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4693 | |
| 4694 | nBytes = snprintf(pos, freeBytes, "CCXBCNREP=%d %d %d ", |
| 4695 | pRoamInfo->pEseBcnReportRsp-> |
| 4696 | measurementToken, |
| 4697 | pRoamInfo->pEseBcnReportRsp->flag, |
| 4698 | sendBss); |
| 4699 | pos += nBytes; |
| 4700 | freeBytes -= nBytes; |
| 4701 | |
| 4702 | /* Copy total Beacon report data length */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4703 | qdf_mem_copy(pos, (char *)&tot_bcn_ieLen, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4704 | sizeof(tot_bcn_ieLen)); |
| 4705 | pos += sizeof(tot_bcn_ieLen); |
| 4706 | freeBytes -= sizeof(tot_bcn_ieLen); |
| 4707 | |
| 4708 | for (i = 0; i < sendBss; i++) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4709 | hdd_debug("ChanNum(%d) Spare(%d) MeasDuration(%d)" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4710 | " PhyType(%d) RecvSigPower(%d) ParentTSF(%u)" |
| 4711 | " TargetTSF[0](%u) TargetTSF[1](%u) BeaconInterval(%u)" |
| 4712 | " CapabilityInfo(%d) BSSID(%02X:%02X:%02X:%02X:%02X:%02X)", |
| 4713 | pRoamInfo->pEseBcnReportRsp-> |
| 4714 | bcnRepBssInfo[i + |
| 4715 | lastSent].bcnReportFields. |
| 4716 | ChanNum, |
| 4717 | pRoamInfo->pEseBcnReportRsp-> |
| 4718 | bcnRepBssInfo[i + |
| 4719 | lastSent].bcnReportFields. |
| 4720 | Spare, |
| 4721 | pRoamInfo->pEseBcnReportRsp-> |
| 4722 | bcnRepBssInfo[i + |
| 4723 | lastSent].bcnReportFields. |
| 4724 | MeasDuration, |
| 4725 | pRoamInfo->pEseBcnReportRsp-> |
| 4726 | bcnRepBssInfo[i + |
| 4727 | lastSent].bcnReportFields. |
| 4728 | PhyType, |
| 4729 | pRoamInfo->pEseBcnReportRsp-> |
| 4730 | bcnRepBssInfo[i + |
| 4731 | lastSent].bcnReportFields. |
| 4732 | RecvSigPower, |
| 4733 | pRoamInfo->pEseBcnReportRsp-> |
| 4734 | bcnRepBssInfo[i + |
| 4735 | lastSent].bcnReportFields. |
| 4736 | ParentTsf, |
| 4737 | pRoamInfo->pEseBcnReportRsp-> |
| 4738 | bcnRepBssInfo[i + |
| 4739 | lastSent].bcnReportFields. |
| 4740 | TargetTsf[0], |
| 4741 | pRoamInfo->pEseBcnReportRsp-> |
| 4742 | bcnRepBssInfo[i + |
| 4743 | lastSent].bcnReportFields. |
| 4744 | TargetTsf[1], |
| 4745 | pRoamInfo->pEseBcnReportRsp-> |
| 4746 | bcnRepBssInfo[i + |
| 4747 | lastSent].bcnReportFields. |
| 4748 | BcnInterval, |
| 4749 | pRoamInfo->pEseBcnReportRsp-> |
| 4750 | bcnRepBssInfo[i + |
| 4751 | lastSent].bcnReportFields. |
| 4752 | CapabilityInfo, |
| 4753 | pRoamInfo->pEseBcnReportRsp-> |
| 4754 | bcnRepBssInfo[i + |
| 4755 | lastSent].bcnReportFields. |
| 4756 | Bssid[0], |
| 4757 | pRoamInfo->pEseBcnReportRsp-> |
| 4758 | bcnRepBssInfo[i + |
| 4759 | lastSent].bcnReportFields. |
| 4760 | Bssid[1], |
| 4761 | pRoamInfo->pEseBcnReportRsp-> |
| 4762 | bcnRepBssInfo[i + |
| 4763 | lastSent].bcnReportFields. |
| 4764 | Bssid[2], |
| 4765 | pRoamInfo->pEseBcnReportRsp-> |
| 4766 | bcnRepBssInfo[i + |
| 4767 | lastSent].bcnReportFields. |
| 4768 | Bssid[3], |
| 4769 | pRoamInfo->pEseBcnReportRsp-> |
| 4770 | bcnRepBssInfo[i + |
| 4771 | lastSent].bcnReportFields. |
| 4772 | Bssid[4], |
| 4773 | pRoamInfo->pEseBcnReportRsp-> |
| 4774 | bcnRepBssInfo[i + |
| 4775 | lastSent].bcnReportFields. |
| 4776 | Bssid[5]); |
| 4777 | |
| 4778 | /* bcn report fields are copied */ |
| 4779 | len = |
| 4780 | sizeof(pRoamInfo->pEseBcnReportRsp-> |
| 4781 | bcnRepBssInfo[i + |
| 4782 | lastSent]. |
| 4783 | bcnReportFields); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4784 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4785 | (char *)&pRoamInfo-> |
| 4786 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4787 | lastSent]. |
| 4788 | bcnReportFields, len); |
| 4789 | pos += len; |
| 4790 | freeBytes -= len; |
| 4791 | |
| 4792 | /* Add 1 byte of ie len */ |
| 4793 | len = |
| 4794 | pRoamInfo->pEseBcnReportRsp-> |
| 4795 | bcnRepBssInfo[i + lastSent].ieLen; |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4796 | qdf_mem_copy(pos, (char *)&len, sizeof(len)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4797 | pos += sizeof(len); |
| 4798 | freeBytes -= sizeof(len); |
| 4799 | |
| 4800 | /* copy IE from scan results */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 4801 | qdf_mem_copy(pos, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4802 | (char *)pRoamInfo-> |
| 4803 | pEseBcnReportRsp->bcnRepBssInfo[i + |
| 4804 | lastSent]. |
| 4805 | pBuf, len); |
| 4806 | pos += len; |
| 4807 | freeBytes -= len; |
| 4808 | } |
| 4809 | |
| 4810 | wrqu.data.pointer = buf; |
| 4811 | wrqu.data.length = IW_CUSTOM_MAX - freeBytes; |
| 4812 | |
| 4813 | /* send the event */ |
| 4814 | wireless_send_event(pAdapter->dev, IWEVCUSTOM, &wrqu, |
| 4815 | buf); |
| 4816 | lastSent += sendBss; |
| 4817 | } |
| 4818 | } |
| 4819 | } |
| 4820 | |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 4821 | #endif /* FEATURE_WLAN_ESE */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4822 | |
| 4823 | /** |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4824 | * hdd_is_8021x_sha256_auth_type() - check authentication type to 8021x_sha256 |
| 4825 | * @pHddStaCtx: Station Context |
| 4826 | * |
| 4827 | * API to check if the connection authentication type is 8021x_sha256. |
| 4828 | * |
| 4829 | * Return: bool |
| 4830 | */ |
| 4831 | #ifdef WLAN_FEATURE_11W |
| 4832 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4833 | { |
| 4834 | return eCSR_AUTH_TYPE_RSN_8021X_SHA256 == |
| 4835 | pHddStaCtx->conn_info.authType; |
| 4836 | } |
| 4837 | #else |
| 4838 | static inline bool hdd_is_8021x_sha256_auth_type(hdd_station_ctx_t *pHddStaCtx) |
| 4839 | { |
| 4840 | return false; |
| 4841 | } |
| 4842 | #endif |
| 4843 | |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4844 | /* |
| 4845 | * hdd_roam_channel_switch_handler() - hdd channel switch handler |
| 4846 | * @adapter: Pointer to adapter context |
| 4847 | * @roam_info: Pointer to roam info |
| 4848 | * |
| 4849 | * Return: None |
| 4850 | */ |
| 4851 | static void hdd_roam_channel_switch_handler(hdd_adapter_t *adapter, |
| 4852 | tCsrRoamInfo *roam_info) |
| 4853 | { |
| 4854 | struct hdd_chan_change_params chan_change; |
| 4855 | struct cfg80211_bss *bss; |
| 4856 | struct net_device *dev = adapter->dev; |
| 4857 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
| 4858 | struct wiphy *wiphy = wdev->wiphy; |
| 4859 | QDF_STATUS status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4860 | hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4861 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4862 | hdd_debug("channel switch for session:%d to channel:%d", |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4863 | adapter->sessionId, roam_info->chan_info.chan_id); |
| 4864 | |
| 4865 | chan_change.chan = roam_info->chan_info.chan_id; |
| 4866 | chan_change.chan_params.ch_width = |
| 4867 | roam_info->chan_info.ch_width; |
| 4868 | chan_change.chan_params.sec_ch_offset = |
| 4869 | roam_info->chan_info.sec_ch_offset; |
| 4870 | chan_change.chan_params.center_freq_seg0 = |
| 4871 | roam_info->chan_info.band_center_freq1; |
| 4872 | chan_change.chan_params.center_freq_seg1 = |
| 4873 | roam_info->chan_info.band_center_freq2; |
| 4874 | |
| 4875 | bss = wlan_hdd_cfg80211_update_bss_db(adapter, roam_info); |
| 4876 | if (NULL == bss) |
| 4877 | hdd_err("%s: unable to create BSS entry", adapter->dev->name); |
| 4878 | else |
| 4879 | cfg80211_put_bss(wiphy, bss); |
| 4880 | |
bings | 58ce862 | 2017-07-10 15:55:36 +0800 | [diff] [blame] | 4881 | status = hdd_chan_change_notify(adapter, adapter->dev, chan_change, |
| 4882 | roam_info->mode == SIR_SME_PHY_MODE_LEGACY); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4883 | if (QDF_IS_STATUS_ERROR(status)) |
| 4884 | hdd_err("channel change notification failed"); |
| 4885 | |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4886 | status = policy_mgr_set_hw_mode_on_channel_switch(hdd_ctx->hdd_psoc, |
| 4887 | adapter->sessionId); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4888 | if (QDF_IS_STATUS_ERROR(status)) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4889 | hdd_debug("set hw mode change not done"); |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 4890 | } |
| 4891 | |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 4892 | /** |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4893 | * hdd_sme_roam_callback() - hdd sme roam callback |
| 4894 | * @pContext: pointer to adapter context |
| 4895 | * @pRoamInfo: pointer to roam info |
| 4896 | * @roamId: roam id |
| 4897 | * @roamStatus: roam status |
| 4898 | * @roamResult: roam result |
| 4899 | * |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4900 | * Return: QDF_STATUS enumeration |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4901 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4902 | QDF_STATUS |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4903 | hdd_sme_roam_callback(void *pContext, tCsrRoamInfo *pRoamInfo, uint32_t roamId, |
| 4904 | eRoamCmdStatus roamStatus, eCsrRoamResult roamResult) |
| 4905 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4906 | QDF_STATUS qdf_ret_status = QDF_STATUS_SUCCESS; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4907 | hdd_adapter_t *pAdapter = (hdd_adapter_t *) pContext; |
| 4908 | hdd_wext_state_t *pWextState = NULL; |
| 4909 | hdd_station_ctx_t *pHddStaCtx = NULL; |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4910 | QDF_STATUS status = QDF_STATUS_SUCCESS; |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 4911 | struct cfg80211_bss *bss_status; |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4912 | hdd_context_t *hdd_ctx; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4913 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4914 | hdd_debug("CSR Callback: status= %d result= %d roamID=%d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4915 | roamStatus, roamResult, roamId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4916 | |
| 4917 | /* Sanity check */ |
| 4918 | if ((NULL == pAdapter) || (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4919 | hdd_err("Invalid adapter or adapter has invalid magic"); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4920 | return QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4921 | } |
| 4922 | |
| 4923 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 4924 | pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 4925 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4926 | |
Sreelakshmi Konamki | 075431a | 2017-03-16 15:23:30 +0530 | [diff] [blame] | 4927 | /* Omitting eCSR_ROAM_UPDATE_SCAN_RESULT as this is too frequent */ |
| 4928 | if (eCSR_ROAM_UPDATE_SCAN_RESULT != roamStatus) |
| 4929 | MTRACE(qdf_trace(QDF_MODULE_ID_HDD, TRACE_CODE_HDD_RX_SME_MSG, |
| 4930 | pAdapter->sessionId, roamStatus)); |
Sreelakshmi Konamki | c88f537 | 2015-12-22 12:50:15 +0530 | [diff] [blame] | 4931 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4932 | switch (roamStatus) { |
| 4933 | case eCSR_ROAM_SESSION_OPENED: |
Sreelakshmi Konamki | 6f3a865 | 2015-09-25 10:58:15 +0530 | [diff] [blame] | 4934 | set_bit(SME_SESSION_OPENED, &pAdapter->event_flags); |
| 4935 | complete(&pAdapter->session_open_comp_var); |
Peng Xu | 66162de | 2016-02-11 17:01:20 -0800 | [diff] [blame] | 4936 | hdd_debug("session %d opened", pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4937 | break; |
| 4938 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4939 | /* |
| 4940 | * We did pre-auth,then we attempted a 11r or ese reassoc. |
| 4941 | * reassoc failed due to failure, timeout, reject from ap |
| 4942 | * in any case tell the OS, our carrier is off and mark |
| 4943 | * interface down. |
| 4944 | */ |
| 4945 | case eCSR_ROAM_FT_REASSOC_FAILED: |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4946 | hdd_err("Reassoc Failed with roamStatus: %d roamResult: %d SessionID: %d", |
| 4947 | roamStatus, roamResult, pAdapter->sessionId); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4948 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4949 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 4950 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4951 | pHddStaCtx->ft_carrier_on = false; |
| 4952 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4953 | hdd_debug("hdd_ReassocScenario set to: %d, ReAssoc Failed, session: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4954 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4955 | break; |
| 4956 | |
| 4957 | case eCSR_ROAM_FT_START: |
| 4958 | /* |
| 4959 | * When we roam for ESE and 11r, we dont want the OS to be |
| 4960 | * informed that the link is down. So mark the link ready for |
| 4961 | * ft_start. After this the eCSR_ROAM_SHOULD_ROAM will |
| 4962 | * be received. Where in we will not mark the link down |
| 4963 | * Also we want to stop tx at this point when we will be |
| 4964 | * doing disassoc at this time. This saves 30-60 msec |
| 4965 | * after reassoc. |
| 4966 | */ |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4967 | hdd_info("Disabling queues"); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4968 | hdd_debug("Roam Synch Ind: NAPI Serialize ON"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4969 | hdd_napi_serialize(1); |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4970 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4971 | WLAN_STOP_ALL_NETIF_QUEUE, |
Deepak Dhamdhere | a2df6bb | 2015-10-29 15:11:06 -0700 | [diff] [blame] | 4972 | WLAN_CONTROL_PATH); |
| 4973 | status = hdd_roam_deregister_sta(pAdapter, |
| 4974 | pHddStaCtx->conn_info.staId[0]); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 4975 | if (!QDF_IS_STATUS_SUCCESS(status)) |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 4976 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4977 | pHddStaCtx->ft_carrier_on = true; |
| 4978 | pHddStaCtx->hdd_ReassocScenario = true; |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 4979 | hdd_info("hdd_ReassocScenario set to: %d, due to eCSR_ROAM_FT_START, session: %d", |
| 4980 | pHddStaCtx->hdd_ReassocScenario, pAdapter->sessionId); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4981 | break; |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4982 | case eCSR_ROAM_NAPI_OFF: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 4983 | hdd_debug("After Roam Synch Comp: NAPI Serialize OFF"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4984 | hdd_napi_serialize(0); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 4985 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 4986 | if (roamResult == eCSR_ROAM_RESULT_FAILURE) |
| 4987 | pAdapter->roam_ho_fail = true; |
| 4988 | else |
| 4989 | pAdapter->roam_ho_fail = false; |
| 4990 | complete(&pAdapter->roaming_comp_var); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 4991 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4992 | case eCSR_ROAM_SHOULD_ROAM: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4993 | /* notify apps that we can't pass traffic anymore */ |
Srinivas Girigowda | 6598eea | 2017-07-06 19:26:19 -0700 | [diff] [blame] | 4994 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4995 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 4996 | WLAN_STOP_ALL_NETIF_QUEUE, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4997 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4998 | if (pHddStaCtx->ft_carrier_on == false) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 4999 | wlan_hdd_netif_queue_control(pAdapter, |
| 5000 | WLAN_NETIF_CARRIER_OFF, |
| 5001 | WLAN_CONTROL_PATH); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5002 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5003 | break; |
| 5004 | case eCSR_ROAM_LOSTLINK: |
| 5005 | if (roamResult == eCSR_ROAM_RESULT_LOSTLINK) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5006 | hdd_debug("Roaming started due to connection lost"); |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5007 | hdd_info("Disabling queues"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [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_N_CARRIER, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5010 | WLAN_CONTROL_PATH); |
| 5011 | break; |
| 5012 | } |
| 5013 | case eCSR_ROAM_DISASSOCIATED: |
| 5014 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5015 | hdd_debug("****eCSR_ROAM_DISASSOCIATED****"); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5016 | hdd_napi_serialize(0); |
Archana Ramachandran | 62886ce | 2017-03-24 14:46:32 -0700 | [diff] [blame] | 5017 | hdd_set_connection_in_progress(false); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5018 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5019 | pAdapter->roam_ho_fail = false; |
| 5020 | complete(&pAdapter->roaming_comp_var); |
Padma, Santhosh Kumar | 5b22002 | 2017-03-20 19:40:27 +0530 | [diff] [blame] | 5021 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5022 | /* Call to clear any MC Addr List filter applied after |
| 5023 | * successful connection. |
| 5024 | */ |
Mukul Sharma | ff2ac2e | 2017-01-16 15:51:29 +0530 | [diff] [blame] | 5025 | hdd_disable_and_flush_mc_addr_list(pAdapter, |
| 5026 | pmo_peer_disconnect); |
| 5027 | qdf_ret_status = |
| 5028 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 5029 | roamStatus, roamResult); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5030 | } |
| 5031 | break; |
| 5032 | case eCSR_ROAM_IBSS_LEAVE: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5033 | hdd_debug("****eCSR_ROAM_IBSS_LEAVE****"); |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5034 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5035 | hdd_dis_connect_handler(pAdapter, pRoamInfo, roamId, |
| 5036 | roamStatus, roamResult); |
| 5037 | break; |
| 5038 | case eCSR_ROAM_ASSOCIATION_COMPLETION: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5039 | hdd_debug("****eCSR_ROAM_ASSOCIATION_COMPLETION****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5040 | /* |
| 5041 | * To Do - address probable memory leak with WEP encryption upon |
| 5042 | * successful association. |
| 5043 | */ |
| 5044 | if (eCSR_ROAM_RESULT_ASSOCIATED != roamResult) { |
| 5045 | /* Clear saved connection information in HDD */ |
| 5046 | hdd_conn_remove_connect_info( |
| 5047 | WLAN_HDD_GET_STATION_CTX_PTR(pAdapter)); |
| 5048 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5049 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5050 | hdd_association_completion_handler(pAdapter, pRoamInfo, |
| 5051 | roamId, roamStatus, |
| 5052 | roamResult); |
| 5053 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5054 | if (pRoamInfo) |
| 5055 | pRoamInfo->roamSynchInProgress = false; |
| 5056 | #endif |
| 5057 | break; |
Sandeep Puligilla | 0241f01 | 2016-07-21 10:58:53 -0700 | [diff] [blame] | 5058 | case eCSR_ROAM_CANCELLED: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5059 | hdd_debug("****eCSR_ROAM_CANCELLED****"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5060 | case eCSR_ROAM_ASSOCIATION_FAILURE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5061 | qdf_ret_status = hdd_association_completion_handler(pAdapter, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5062 | pRoamInfo, |
| 5063 | roamId, |
| 5064 | roamStatus, |
| 5065 | roamResult); |
| 5066 | break; |
| 5067 | case eCSR_ROAM_IBSS_IND: |
| 5068 | hdd_roam_ibss_indication_handler(pAdapter, pRoamInfo, roamId, |
| 5069 | roamStatus, roamResult); |
| 5070 | break; |
| 5071 | |
| 5072 | case eCSR_ROAM_CONNECT_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5073 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5074 | roam_roam_connect_status_update_handler(pAdapter, |
| 5075 | pRoamInfo, |
| 5076 | roamId, |
| 5077 | roamStatus, |
| 5078 | roamResult); |
| 5079 | break; |
| 5080 | |
| 5081 | case eCSR_ROAM_MIC_ERROR_IND: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5082 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5083 | hdd_roam_mic_error_indication_handler(pAdapter, |
| 5084 | pRoamInfo, |
| 5085 | roamId, |
| 5086 | roamStatus, |
| 5087 | roamResult); |
| 5088 | break; |
| 5089 | |
| 5090 | case eCSR_ROAM_SET_KEY_COMPLETE: |
| 5091 | { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5092 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5093 | hdd_roam_set_key_complete_handler(pAdapter, pRoamInfo, |
| 5094 | roamId, roamStatus, |
| 5095 | roamResult); |
| 5096 | if (eCSR_ROAM_RESULT_AUTHENTICATED == roamResult) { |
| 5097 | pHddStaCtx->hdd_ReassocScenario = false; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5098 | hdd_debug("hdd_ReassocScenario set to: %d, set key complete, session: %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5099 | pHddStaCtx->hdd_ReassocScenario, |
| 5100 | pAdapter->sessionId); |
| 5101 | } |
| 5102 | } |
| 5103 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 5104 | if (pRoamInfo != NULL) |
| 5105 | pRoamInfo->roamSynchInProgress = false; |
| 5106 | #endif |
| 5107 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5108 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5109 | case eCSR_ROAM_FT_RESPONSE: |
| 5110 | hdd_send_ft_event(pAdapter); |
| 5111 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5112 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5113 | case eCSR_ROAM_PMK_NOTIFY: |
Komal Seelam | 98760ba | 2015-12-15 11:05:18 +0530 | [diff] [blame] | 5114 | if (eCSR_AUTH_TYPE_RSN == pHddStaCtx->conn_info.authType |
| 5115 | || hdd_is_8021x_sha256_auth_type(pHddStaCtx)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5116 | /* notify the supplicant of a new candidate */ |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5117 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5118 | wlan_hdd_cfg80211_pmksa_candidate_notify( |
| 5119 | pAdapter, pRoamInfo, 1, false); |
| 5120 | } |
| 5121 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5122 | |
| 5123 | #ifdef FEATURE_WLAN_LFR_METRICS |
| 5124 | case eCSR_ROAM_PREAUTH_INIT_NOTIFY: |
| 5125 | /* This event is to notify pre-auth initiation */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5126 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5127 | wlan_hdd_cfg80211_roam_metrics_preauth(pAdapter, |
| 5128 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5129 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5130 | } |
| 5131 | break; |
| 5132 | case eCSR_ROAM_PREAUTH_STATUS_SUCCESS: |
| 5133 | /* |
| 5134 | * This event will notify pre-auth completion in case of success |
| 5135 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5136 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5137 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5138 | pRoamInfo, 1)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5139 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5140 | } |
| 5141 | break; |
| 5142 | case eCSR_ROAM_PREAUTH_STATUS_FAILURE: |
| 5143 | /* |
| 5144 | * This event will notify pre-auth completion incase of failure. |
| 5145 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5146 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5147 | wlan_hdd_cfg80211_roam_metrics_preauth_status(pAdapter, |
| 5148 | pRoamInfo, 0)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5149 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5150 | } |
| 5151 | break; |
| 5152 | case eCSR_ROAM_HANDOVER_SUCCESS: |
| 5153 | /* This event is to notify handover success. |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 5154 | * It will be only invoked on success |
| 5155 | */ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5156 | if (QDF_STATUS_SUCCESS != |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5157 | wlan_hdd_cfg80211_roam_metrics_handover(pAdapter, |
| 5158 | pRoamInfo)) { |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5159 | qdf_ret_status = QDF_STATUS_E_FAILURE; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5160 | } |
| 5161 | break; |
| 5162 | #endif |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5163 | case eCSR_ROAM_REMAIN_CHAN_READY: |
| 5164 | hdd_remain_chan_ready_handler(pAdapter, pRoamInfo->roc_scan_id); |
| 5165 | break; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5166 | #ifdef FEATURE_WLAN_TDLS |
| 5167 | case eCSR_ROAM_TDLS_STATUS_UPDATE: |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5168 | qdf_ret_status = |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5169 | hdd_roam_tdls_status_update_handler(pAdapter, pRoamInfo, |
| 5170 | roamId, |
| 5171 | roamStatus, |
| 5172 | roamResult); |
| 5173 | break; |
| 5174 | case eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND: |
| 5175 | wlan_hdd_tdls_mgmt_completion_callback(pAdapter, |
| 5176 | pRoamInfo->reasonCode); |
| 5177 | break; |
| 5178 | #endif |
| 5179 | #ifdef WLAN_FEATURE_11W |
| 5180 | case eCSR_ROAM_UNPROT_MGMT_FRAME_IND: |
| 5181 | hdd_indicate_unprot_mgmt_frame(pAdapter, |
| 5182 | pRoamInfo->nFrameLength, |
| 5183 | pRoamInfo->pbFrames, |
| 5184 | pRoamInfo->frameType); |
| 5185 | break; |
| 5186 | #endif |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5187 | #ifdef FEATURE_WLAN_ESE |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5188 | case eCSR_ROAM_TSM_IE_IND: |
| 5189 | hdd_indicate_tsm_ie(pAdapter, pRoamInfo->tsmIe.tsid, |
| 5190 | pRoamInfo->tsmIe.state, |
| 5191 | pRoamInfo->tsmIe.msmt_interval); |
| 5192 | break; |
| 5193 | |
| 5194 | case eCSR_ROAM_CCKM_PREAUTH_NOTIFY: |
| 5195 | { |
| 5196 | if (eCSR_AUTH_TYPE_CCKM_WPA == |
| 5197 | pHddStaCtx->conn_info.authType |
| 5198 | || eCSR_AUTH_TYPE_CCKM_RSN == |
| 5199 | pHddStaCtx->conn_info.authType) { |
| 5200 | hdd_indicate_cckm_pre_auth(pAdapter, pRoamInfo); |
| 5201 | } |
| 5202 | break; |
| 5203 | } |
| 5204 | |
| 5205 | case eCSR_ROAM_ESE_ADJ_AP_REPORT_IND: |
| 5206 | { |
| 5207 | hdd_indicate_ese_adj_ap_rep_ind(pAdapter, pRoamInfo); |
| 5208 | break; |
| 5209 | } |
| 5210 | |
| 5211 | case eCSR_ROAM_ESE_BCN_REPORT_IND: |
| 5212 | { |
| 5213 | hdd_indicate_ese_bcn_report_ind(pAdapter, pRoamInfo); |
| 5214 | break; |
| 5215 | } |
Srinivas Girigowda | 515a9ef | 2015-12-11 11:00:48 -0800 | [diff] [blame] | 5216 | #endif /* FEATURE_WLAN_ESE */ |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5217 | case eCSR_ROAM_STA_CHANNEL_SWITCH: |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5218 | hdd_roam_channel_switch_handler(pAdapter, pRoamInfo); |
Manishekar Chandrasekaran | cb05217 | 2016-04-22 12:19:04 +0530 | [diff] [blame] | 5219 | break; |
Selvaraj, Sridhar | 9c47fef | 2016-12-09 12:49:53 +0530 | [diff] [blame] | 5220 | |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5221 | case eCSR_ROAM_UPDATE_SCAN_RESULT: |
| 5222 | if ((NULL != pRoamInfo) && (NULL != pRoamInfo->pBssDesc)) { |
| 5223 | bss_status = wlan_hdd_cfg80211_inform_bss_frame( |
| 5224 | pAdapter, pRoamInfo->pBssDesc); |
| 5225 | if (NULL == bss_status) |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5226 | hdd_debug("UPDATE_SCAN_RESULT returned NULL"); |
Selvaraj, Sridhar | fe696d2 | 2016-08-03 21:34:51 +0530 | [diff] [blame] | 5227 | else |
| 5228 | cfg80211_put_bss( |
| 5229 | #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)) || defined(WITH_BACKPORTS) |
| 5230 | (WLAN_HDD_GET_CTX(pAdapter))->wiphy, |
| 5231 | #endif |
| 5232 | bss_status); |
| 5233 | } |
| 5234 | break; |
Deepak Dhamdhere | 5cdce84 | 2016-05-31 10:39:12 -0700 | [diff] [blame] | 5235 | case eCSR_ROAM_NDP_STATUS_UPDATE: |
| 5236 | hdd_ndp_event_handler(pAdapter, pRoamInfo, roamId, roamStatus, |
| 5237 | roamResult); |
| 5238 | break; |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5239 | case eCSR_ROAM_START: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5240 | hdd_debug("Process ROAM_START from firmware"); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5241 | wlan_hdd_netif_queue_control(pAdapter, |
Himanshu Agarwal | 865201d | 2017-04-12 15:45:31 +0530 | [diff] [blame] | 5242 | WLAN_STOP_ALL_NETIF_QUEUE, |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5243 | WLAN_CONTROL_PATH); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5244 | hdd_napi_serialize(1); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5245 | hdd_set_connection_in_progress(true); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5246 | hdd_set_roaming_in_progress(true); |
Tushnim Bhattacharyya | 8716158 | 2017-03-09 13:03:31 -0800 | [diff] [blame] | 5247 | policy_mgr_restart_opportunistic_timer(hdd_ctx->hdd_psoc, true); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5248 | break; |
| 5249 | case eCSR_ROAM_ABORT: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5250 | hdd_debug("Firmware aborted roaming operation, previous connection is still valid"); |
Varun Reddy Yeturu | 0425186 | 2016-09-16 10:33:19 -0700 | [diff] [blame] | 5251 | hdd_napi_serialize(0); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5252 | wlan_hdd_netif_queue_control(pAdapter, |
| 5253 | WLAN_WAKE_ALL_NETIF_QUEUE, |
| 5254 | WLAN_CONTROL_PATH); |
Tushnim Bhattacharyya | 9e81b4c | 2017-02-15 17:11:14 -0800 | [diff] [blame] | 5255 | hdd_set_connection_in_progress(false); |
Varun Reddy Yeturu | dce1c56 | 2016-11-18 10:00:45 -0800 | [diff] [blame] | 5256 | hdd_set_roaming_in_progress(false); |
Abhishek Singh | 533c9da | 2017-05-04 10:23:34 +0530 | [diff] [blame] | 5257 | pAdapter->roam_ho_fail = false; |
| 5258 | complete(&pAdapter->roaming_comp_var); |
Naveen Rawat | 8cc23b0 | 2016-07-14 12:22:56 -0700 | [diff] [blame] | 5259 | break; |
| 5260 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5261 | default: |
| 5262 | break; |
| 5263 | } |
Anurag Chouhan | f04e84f | 2016-03-03 10:12:12 +0530 | [diff] [blame] | 5264 | return qdf_ret_status; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5265 | } |
| 5266 | |
| 5267 | /** |
| 5268 | * hdd_translate_rsn_to_csr_auth_type() - Translate RSN to CSR auth type |
| 5269 | * @auth_suite: auth suite |
| 5270 | * |
| 5271 | * Return: eCsrAuthType enumeration |
| 5272 | */ |
| 5273 | eCsrAuthType hdd_translate_rsn_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5274 | { |
| 5275 | eCsrAuthType auth_type; |
| 5276 | /* is the auth type supported? */ |
| 5277 | if (memcmp(auth_suite, ccp_rsn_oui01, 4) == 0) { |
| 5278 | auth_type = eCSR_AUTH_TYPE_RSN; |
| 5279 | } else if (memcmp(auth_suite, ccp_rsn_oui02, 4) == 0) { |
| 5280 | auth_type = eCSR_AUTH_TYPE_RSN_PSK; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 5281 | } else if (memcmp(auth_suite, ccp_rsn_oui04, 4) == 0) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5282 | /* Check for 11r FT Authentication with PSK */ |
| 5283 | auth_type = eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5284 | } else if (memcmp(auth_suite, ccp_rsn_oui03, 4) == 0) { |
| 5285 | /* Check for 11R FT Authentication with 802.1X */ |
| 5286 | auth_type = eCSR_AUTH_TYPE_FT_RSN; |
| 5287 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5288 | #ifdef FEATURE_WLAN_ESE |
| 5289 | if (memcmp(auth_suite, ccp_rsn_oui06, 4) == 0) { |
| 5290 | auth_type = eCSR_AUTH_TYPE_CCKM_RSN; |
| 5291 | } else |
| 5292 | #endif /* FEATURE_WLAN_ESE */ |
| 5293 | #ifdef WLAN_FEATURE_11W |
| 5294 | if (memcmp(auth_suite, ccp_rsn_oui07, 4) == 0) { |
| 5295 | auth_type = eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5296 | } else if (memcmp(auth_suite, ccp_rsn_oui08, 4) == 0) { |
| 5297 | auth_type = eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5298 | } else |
| 5299 | #endif |
| 5300 | { |
| 5301 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5302 | } |
| 5303 | return auth_type; |
| 5304 | } |
| 5305 | |
| 5306 | /** |
| 5307 | * hdd_translate_wpa_to_csr_auth_type() - Translate WPA to CSR auth type |
| 5308 | * @auth_suite: auth suite |
| 5309 | * |
| 5310 | * Return: eCsrAuthType enumeration |
| 5311 | */ |
| 5312 | eCsrAuthType hdd_translate_wpa_to_csr_auth_type(uint8_t auth_suite[4]) |
| 5313 | { |
| 5314 | eCsrAuthType auth_type; |
| 5315 | /* is the auth type supported? */ |
| 5316 | if (memcmp(auth_suite, ccp_wpa_oui01, 4) == 0) { |
| 5317 | auth_type = eCSR_AUTH_TYPE_WPA; |
| 5318 | } else if (memcmp(auth_suite, ccp_wpa_oui02, 4) == 0) { |
| 5319 | auth_type = eCSR_AUTH_TYPE_WPA_PSK; |
| 5320 | } else |
| 5321 | #ifdef FEATURE_WLAN_ESE |
| 5322 | if (memcmp(auth_suite, ccp_wpa_oui06, 4) == 0) { |
| 5323 | auth_type = eCSR_AUTH_TYPE_CCKM_WPA; |
| 5324 | } else |
| 5325 | #endif /* FEATURE_WLAN_ESE */ |
| 5326 | { |
| 5327 | auth_type = eCSR_AUTH_TYPE_UNKNOWN; |
| 5328 | } |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5329 | hdd_debug("auth_type: %d", auth_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5330 | return auth_type; |
| 5331 | } |
| 5332 | |
| 5333 | /** |
| 5334 | * hdd_translate_rsn_to_csr_encryption_type() - |
| 5335 | * Translate RSN to CSR encryption type |
| 5336 | * @cipher_suite: cipher suite |
| 5337 | * |
| 5338 | * Return: eCsrEncryptionType enumeration |
| 5339 | */ |
| 5340 | eCsrEncryptionType |
| 5341 | hdd_translate_rsn_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5342 | { |
| 5343 | eCsrEncryptionType cipher_type; |
| 5344 | |
| 5345 | if (memcmp(cipher_suite, ccp_rsn_oui04, 4) == 0) |
| 5346 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5347 | else if (memcmp(cipher_suite, ccp_rsn_oui09, 4) == 0) |
| 5348 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP; |
| 5349 | else if (memcmp(cipher_suite, ccp_rsn_oui0a, 4) == 0) |
| 5350 | cipher_type = eCSR_ENCRYPT_TYPE_AES_GCMP_256; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5351 | else if (memcmp(cipher_suite, ccp_rsn_oui02, 4) == 0) |
| 5352 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5353 | else if (memcmp(cipher_suite, ccp_rsn_oui00, 4) == 0) |
| 5354 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5355 | else if (memcmp(cipher_suite, ccp_rsn_oui01, 4) == 0) |
| 5356 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5357 | else if (memcmp(cipher_suite, ccp_rsn_oui05, 4) == 0) |
| 5358 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5359 | else |
| 5360 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5361 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5362 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5363 | return cipher_type; |
| 5364 | } |
| 5365 | |
| 5366 | /** |
| 5367 | * hdd_translate_wpa_to_csr_encryption_type() - |
| 5368 | * Translate WPA to CSR encryption type |
| 5369 | * @cipher_suite: cipher suite |
| 5370 | * |
| 5371 | * Return: eCsrEncryptionType enumeration |
| 5372 | */ |
| 5373 | eCsrEncryptionType |
| 5374 | hdd_translate_wpa_to_csr_encryption_type(uint8_t cipher_suite[4]) |
| 5375 | { |
| 5376 | eCsrEncryptionType cipher_type; |
| 5377 | |
| 5378 | if (memcmp(cipher_suite, ccp_wpa_oui04, 4) == 0) |
| 5379 | cipher_type = eCSR_ENCRYPT_TYPE_AES; |
| 5380 | else if (memcmp(cipher_suite, ccp_wpa_oui02, 4) == 0) |
| 5381 | cipher_type = eCSR_ENCRYPT_TYPE_TKIP; |
| 5382 | else if (memcmp(cipher_suite, ccp_wpa_oui00, 4) == 0) |
| 5383 | cipher_type = eCSR_ENCRYPT_TYPE_NONE; |
| 5384 | else if (memcmp(cipher_suite, ccp_wpa_oui01, 4) == 0) |
| 5385 | cipher_type = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 5386 | else if (memcmp(cipher_suite, ccp_wpa_oui05, 4) == 0) |
| 5387 | cipher_type = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 5388 | else |
| 5389 | cipher_type = eCSR_ENCRYPT_TYPE_FAILED; |
| 5390 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5391 | hdd_debug("cipher_type: %d", cipher_type); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5392 | return cipher_type; |
| 5393 | } |
| 5394 | |
| 5395 | /** |
| 5396 | * hdd_process_genie() - process gen ie |
| 5397 | * @pAdapter: pointer to adapter |
| 5398 | * @bssid: pointer to mac address |
| 5399 | * @pEncryptType: pointer to encryption type |
| 5400 | * @mcEncryptType: pointer to multicast encryption type |
| 5401 | * @pAuthType: pointer to auth type |
| 5402 | * |
| 5403 | * Return: 0 on success, error number otherwise |
| 5404 | */ |
| 5405 | static int32_t hdd_process_genie(hdd_adapter_t *pAdapter, |
| 5406 | u8 *bssid, |
| 5407 | eCsrEncryptionType *pEncryptType, |
| 5408 | eCsrEncryptionType *mcEncryptType, |
| 5409 | eCsrAuthType *pAuthType, |
| 5410 | #ifdef WLAN_FEATURE_11W |
| 5411 | uint8_t *pMfpRequired, uint8_t *pMfpCapable, |
| 5412 | #endif |
| 5413 | uint16_t gen_ie_len, uint8_t *gen_ie) |
| 5414 | { |
| 5415 | tHalHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5416 | QDF_STATUS result; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5417 | tDot11fIERSN dot11RSNIE; |
| 5418 | tDot11fIEWPA dot11WPAIE; |
| 5419 | uint32_t i; |
| 5420 | uint8_t *pRsnIe; |
| 5421 | uint16_t RSNIeLen; |
| 5422 | tPmkidCacheInfo PMKIDCache[4]; /* Local transfer memory */ |
| 5423 | bool updatePMKCache = false; |
| 5424 | |
| 5425 | /* |
| 5426 | * Clear struct of tDot11fIERSN and tDot11fIEWPA specifically |
| 5427 | * setting present flag to 0. |
| 5428 | */ |
| 5429 | memset(&dot11WPAIE, 0, sizeof(tDot11fIEWPA)); |
| 5430 | memset(&dot11RSNIE, 0, sizeof(tDot11fIERSN)); |
| 5431 | |
| 5432 | /* Type check */ |
| 5433 | if (gen_ie[0] == DOT11F_EID_RSN) { |
| 5434 | /* Validity checks */ |
| 5435 | if ((gen_ie_len < DOT11F_IE_RSN_MIN_LEN) || |
| 5436 | (gen_ie_len > DOT11F_IE_RSN_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5437 | hdd_err("Invalid DOT11F RSN IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5438 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5439 | return -EINVAL; |
| 5440 | } |
| 5441 | /* Skip past the EID byte and length byte */ |
| 5442 | pRsnIe = gen_ie + 2; |
| 5443 | RSNIeLen = gen_ie_len - 2; |
| 5444 | /* Unpack the RSN IE */ |
| 5445 | dot11f_unpack_ie_rsn((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5446 | pRsnIe, RSNIeLen, &dot11RSNIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5447 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5448 | hdd_debug("pairwise cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5449 | dot11RSNIE.pwise_cipher_suite_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5450 | hdd_debug("authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5451 | dot11RSNIE.akm_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5452 | /* dot11RSNIE.akm_suite_count */ |
| 5453 | /* Just translate the FIRST one */ |
| 5454 | *pAuthType = |
| 5455 | hdd_translate_rsn_to_csr_auth_type( |
| 5456 | dot11RSNIE.akm_suites[0]); |
| 5457 | /* dot11RSNIE.pwise_cipher_suite_count */ |
| 5458 | *pEncryptType = |
| 5459 | hdd_translate_rsn_to_csr_encryption_type( |
| 5460 | dot11RSNIE.pwise_cipher_suites[0]); |
| 5461 | /* dot11RSNIE.gp_cipher_suite_count */ |
| 5462 | *mcEncryptType = |
| 5463 | hdd_translate_rsn_to_csr_encryption_type( |
| 5464 | dot11RSNIE.gp_cipher_suite); |
| 5465 | #ifdef WLAN_FEATURE_11W |
| 5466 | *pMfpRequired = (dot11RSNIE.RSN_Cap[0] >> 6) & 0x1; |
Srinivas Girigowda | 6519b93 | 2017-08-03 14:10:57 -0700 | [diff] [blame] | 5467 | *pMfpCapable = csr_is_mfpc_capable(&dot11RSNIE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5468 | #endif |
| 5469 | /* Set the PMKSA ID Cache for this interface */ |
| 5470 | for (i = 0; i < dot11RSNIE.pmkid_count; i++) { |
| 5471 | if (is_zero_ether_addr(bssid)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5472 | hdd_warn("MAC address is all zeroes"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5473 | break; |
| 5474 | } |
| 5475 | updatePMKCache = true; |
| 5476 | /* |
| 5477 | * For right now, I assume setASSOCIATE() has passed |
| 5478 | * in the bssid. |
| 5479 | */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5480 | qdf_mem_copy(PMKIDCache[i].BSSID.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 5481 | bssid, QDF_MAC_ADDR_SIZE); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5482 | qdf_mem_copy(PMKIDCache[i].PMKID, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5483 | dot11RSNIE.pmkid[i], CSR_RSN_PMKID_SIZE); |
| 5484 | } |
| 5485 | |
| 5486 | if (updatePMKCache) { |
| 5487 | /* |
| 5488 | * Calling csr_roam_set_pmkid_cache to configure the |
| 5489 | * PMKIDs into the cache. |
| 5490 | */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5491 | hdd_debug("Calling sme_roam_set_pmkid_cache with cache entry %d.", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5492 | i); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5493 | /* Finally set the PMKSA ID Cache in CSR */ |
| 5494 | result = |
| 5495 | sme_roam_set_pmkid_cache(halHandle, |
| 5496 | pAdapter->sessionId, |
| 5497 | PMKIDCache, |
| 5498 | dot11RSNIE.pmkid_count, |
| 5499 | false); |
| 5500 | } |
| 5501 | } else if (gen_ie[0] == DOT11F_EID_WPA) { |
| 5502 | /* Validity checks */ |
| 5503 | if ((gen_ie_len < DOT11F_IE_WPA_MIN_LEN) || |
| 5504 | (gen_ie_len > DOT11F_IE_WPA_MAX_LEN)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5505 | hdd_err("Invalid DOT11F WPA IE length: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5506 | gen_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5507 | return -EINVAL; |
| 5508 | } |
| 5509 | /* Skip past the EID and length byte - and four byte WiFi OUI */ |
| 5510 | pRsnIe = gen_ie + 2 + 4; |
| 5511 | RSNIeLen = gen_ie_len - (2 + 4); |
| 5512 | /* Unpack the WPA IE */ |
| 5513 | dot11f_unpack_ie_wpa((tpAniSirGlobal) halHandle, |
Selvaraj, Sridhar | 75afbeb | 2017-04-03 17:08:59 +0530 | [diff] [blame] | 5514 | pRsnIe, RSNIeLen, &dot11WPAIE, false); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5515 | /* Copy out the encryption and authentication types */ |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5516 | hdd_debug("WPA unicast cipher suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5517 | dot11WPAIE.unicast_cipher_count); |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5518 | hdd_debug("WPA authentication suite count: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5519 | dot11WPAIE.auth_suite_count); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5520 | /* dot11WPAIE.auth_suite_count */ |
| 5521 | /* Just translate the FIRST one */ |
| 5522 | *pAuthType = |
| 5523 | hdd_translate_wpa_to_csr_auth_type( |
| 5524 | dot11WPAIE.auth_suites[0]); |
| 5525 | /* dot11WPAIE.unicast_cipher_count */ |
| 5526 | *pEncryptType = |
| 5527 | hdd_translate_wpa_to_csr_encryption_type( |
| 5528 | dot11WPAIE.unicast_ciphers[0]); |
| 5529 | /* dot11WPAIE.unicast_cipher_count */ |
| 5530 | *mcEncryptType = |
| 5531 | hdd_translate_wpa_to_csr_encryption_type( |
| 5532 | dot11WPAIE.multicast_cipher); |
| 5533 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5534 | hdd_warn("gen_ie[0]: %d", gen_ie[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5535 | return -EINVAL; |
| 5536 | } |
| 5537 | return 0; |
| 5538 | } |
| 5539 | |
| 5540 | /** |
| 5541 | * hdd_set_genie_to_csr() - set genie to csr |
| 5542 | * @pAdapter: pointer to adapter |
| 5543 | * @RSNAuthType: pointer to auth type |
| 5544 | * |
| 5545 | * Return: 0 on success, error number otherwise |
| 5546 | */ |
| 5547 | int hdd_set_genie_to_csr(hdd_adapter_t *pAdapter, eCsrAuthType *RSNAuthType) |
| 5548 | { |
| 5549 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5550 | uint32_t status = 0; |
| 5551 | eCsrEncryptionType RSNEncryptType; |
| 5552 | eCsrEncryptionType mcRSNEncryptType; |
| 5553 | #ifdef WLAN_FEATURE_11W |
| 5554 | uint8_t RSNMfpRequired = 0; |
| 5555 | uint8_t RSNMfpCapable = 0; |
| 5556 | #endif |
| 5557 | u8 bssid[ETH_ALEN]; /* MAC address of assoc peer */ |
| 5558 | /* MAC address of assoc peer */ |
| 5559 | /* But, this routine is only called when we are NOT associated. */ |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5560 | qdf_mem_copy(bssid, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5561 | pWextState->roamProfile.BSSIDs.bssid, |
| 5562 | sizeof(bssid)); |
| 5563 | if (pWextState->WPARSNIE[0] == DOT11F_EID_RSN |
| 5564 | || pWextState->WPARSNIE[0] == DOT11F_EID_WPA) { |
| 5565 | /* continue */ |
| 5566 | } else { |
| 5567 | return 0; |
| 5568 | } |
| 5569 | /* The actual processing may eventually be more extensive than this. */ |
| 5570 | /* Right now, just consume any PMKIDs that are sent in by the app. */ |
| 5571 | status = hdd_process_genie(pAdapter, bssid, |
| 5572 | &RSNEncryptType, |
| 5573 | &mcRSNEncryptType, RSNAuthType, |
| 5574 | #ifdef WLAN_FEATURE_11W |
| 5575 | &RSNMfpRequired, &RSNMfpCapable, |
| 5576 | #endif |
| 5577 | pWextState->WPARSNIE[1] + 2, |
| 5578 | pWextState->WPARSNIE); |
| 5579 | if (status == 0) { |
| 5580 | /* |
| 5581 | * Now copy over all the security attributes |
| 5582 | * you have parsed out. |
| 5583 | */ |
| 5584 | pWextState->roamProfile.EncryptionType.numEntries = 1; |
| 5585 | pWextState->roamProfile.mcEncryptionType.numEntries = 1; |
| 5586 | |
| 5587 | pWextState->roamProfile.EncryptionType.encryptionType[0] = RSNEncryptType; /* Use the cipher type in the RSN IE */ |
| 5588 | pWextState->roamProfile.mcEncryptionType.encryptionType[0] = |
| 5589 | mcRSNEncryptType; |
| 5590 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5591 | if ((QDF_IBSS_MODE == pAdapter->device_mode) && |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5592 | ((eCSR_ENCRYPT_TYPE_AES == mcRSNEncryptType) || |
Mukul Sharma | 05504ac | 2017-06-08 12:35:53 +0530 | [diff] [blame] | 5593 | (eCSR_ENCRYPT_TYPE_AES_GCMP == mcRSNEncryptType) || |
| 5594 | (eCSR_ENCRYPT_TYPE_AES_GCMP_256 == mcRSNEncryptType) || |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5595 | (eCSR_ENCRYPT_TYPE_TKIP == mcRSNEncryptType))) { |
| 5596 | /* |
| 5597 | * For wpa none supplicant sends the WPA IE with unicast |
| 5598 | * cipher as eCSR_ENCRYPT_TYPE_NONE ,where as the |
| 5599 | * multicast cipher as either AES/TKIP based on group |
| 5600 | * cipher configuration mentioned in the |
| 5601 | * wpa_supplicant.conf. |
| 5602 | */ |
| 5603 | |
| 5604 | /* Set the unicast cipher same as multicast cipher */ |
| 5605 | pWextState->roamProfile.EncryptionType.encryptionType[0] |
| 5606 | = mcRSNEncryptType; |
| 5607 | } |
| 5608 | #ifdef WLAN_FEATURE_11W |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5609 | hdd_debug("RSNMfpRequired = %d, RSNMfpCapable = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5610 | RSNMfpRequired, RSNMfpCapable); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5611 | pWextState->roamProfile.MFPRequired = RSNMfpRequired; |
| 5612 | pWextState->roamProfile.MFPCapable = RSNMfpCapable; |
| 5613 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5614 | hdd_debug("CSR AuthType = %d, EncryptionType = %d mcEncryptionType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5615 | *RSNAuthType, RSNEncryptType, mcRSNEncryptType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5616 | } |
| 5617 | return 0; |
| 5618 | } |
| 5619 | |
| 5620 | /** |
| 5621 | * hdd_set_csr_auth_type() - set csr auth type |
| 5622 | * @pAdapter: pointer to adapter |
| 5623 | * @RSNAuthType: auth type |
| 5624 | * |
| 5625 | * Return: 0 on success, error number otherwise |
| 5626 | */ |
| 5627 | int hdd_set_csr_auth_type(hdd_adapter_t *pAdapter, eCsrAuthType RSNAuthType) |
| 5628 | { |
| 5629 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5630 | tCsrRoamProfile *pRoamProfile = &(pWextState->roamProfile); |
| 5631 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5632 | |
| 5633 | pRoamProfile->AuthType.numEntries = 1; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5634 | hdd_debug("pHddStaCtx->conn_info.authType = %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5635 | pHddStaCtx->conn_info.authType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5636 | |
| 5637 | switch (pHddStaCtx->conn_info.authType) { |
| 5638 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 5639 | #ifdef FEATURE_WLAN_ESE |
| 5640 | case eCSR_AUTH_TYPE_CCKM_WPA: |
| 5641 | case eCSR_AUTH_TYPE_CCKM_RSN: |
| 5642 | #endif |
| 5643 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_DISABLED) { |
| 5644 | |
| 5645 | pRoamProfile->AuthType.authType[0] = |
| 5646 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 5647 | } else if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA) { |
| 5648 | |
| 5649 | #ifdef FEATURE_WLAN_ESE |
| 5650 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) && |
| 5651 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5652 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5653 | hdd_debug("set authType to CCKM WPA. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5654 | pRoamProfile->AuthType.authType[0] = |
| 5655 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5656 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_WPA) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5657 | hdd_debug("Last chance to set authType to CCKM WPA."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5658 | pRoamProfile->AuthType.authType[0] = |
| 5659 | eCSR_AUTH_TYPE_CCKM_WPA; |
| 5660 | } else |
| 5661 | #endif |
| 5662 | if ((pWextState-> |
| 5663 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5664 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5665 | pRoamProfile->AuthType.authType[0] = |
| 5666 | eCSR_AUTH_TYPE_WPA; |
| 5667 | } else |
| 5668 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5669 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5670 | pRoamProfile->AuthType.authType[0] = |
| 5671 | eCSR_AUTH_TYPE_WPA_PSK; |
| 5672 | } else { |
| 5673 | pRoamProfile->AuthType.authType[0] = |
| 5674 | eCSR_AUTH_TYPE_WPA_NONE; |
| 5675 | } |
| 5676 | } |
| 5677 | if (pWextState->wpaVersion & IW_AUTH_WPA_VERSION_WPA2) { |
| 5678 | #ifdef FEATURE_WLAN_ESE |
| 5679 | if ((RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) && |
| 5680 | ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5681 | == IW_AUTH_KEY_MGMT_802_1X)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5682 | hdd_debug("set authType to CCKM RSN. AKM also 802.1X."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5683 | pRoamProfile->AuthType.authType[0] = |
| 5684 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5685 | } else if (RSNAuthType == eCSR_AUTH_TYPE_CCKM_RSN) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5686 | hdd_debug("Last chance to set authType to CCKM RSN."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5687 | pRoamProfile->AuthType.authType[0] = |
| 5688 | eCSR_AUTH_TYPE_CCKM_RSN; |
| 5689 | } else |
| 5690 | #endif |
| 5691 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5692 | if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN) && |
| 5693 | ((pWextState-> |
| 5694 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5695 | == IW_AUTH_KEY_MGMT_802_1X)) { |
| 5696 | pRoamProfile->AuthType.authType[0] = |
| 5697 | eCSR_AUTH_TYPE_FT_RSN; |
| 5698 | } else if ((RSNAuthType == eCSR_AUTH_TYPE_FT_RSN_PSK) |
| 5699 | && |
| 5700 | ((pWextState-> |
| 5701 | authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5702 | == IW_AUTH_KEY_MGMT_PSK)) { |
| 5703 | pRoamProfile->AuthType.authType[0] = |
| 5704 | eCSR_AUTH_TYPE_FT_RSN_PSK; |
| 5705 | } else |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5706 | |
| 5707 | #ifdef WLAN_FEATURE_11W |
| 5708 | if (RSNAuthType == eCSR_AUTH_TYPE_RSN_PSK_SHA256) { |
| 5709 | pRoamProfile->AuthType.authType[0] = |
| 5710 | eCSR_AUTH_TYPE_RSN_PSK_SHA256; |
| 5711 | } else if (RSNAuthType == |
| 5712 | eCSR_AUTH_TYPE_RSN_8021X_SHA256) { |
| 5713 | pRoamProfile->AuthType.authType[0] = |
| 5714 | eCSR_AUTH_TYPE_RSN_8021X_SHA256; |
| 5715 | } else |
| 5716 | #endif |
| 5717 | |
| 5718 | if ((pWextState-> |
| 5719 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X) |
| 5720 | == IW_AUTH_KEY_MGMT_802_1X) { |
| 5721 | pRoamProfile->AuthType.authType[0] = |
| 5722 | eCSR_AUTH_TYPE_RSN; |
| 5723 | } else |
| 5724 | if ((pWextState->authKeyMgmt & IW_AUTH_KEY_MGMT_PSK) |
| 5725 | == IW_AUTH_KEY_MGMT_PSK) { |
| 5726 | pRoamProfile->AuthType.authType[0] = |
| 5727 | eCSR_AUTH_TYPE_RSN_PSK; |
| 5728 | } else { |
| 5729 | pRoamProfile->AuthType.authType[0] = |
| 5730 | eCSR_AUTH_TYPE_UNKNOWN; |
| 5731 | } |
| 5732 | } |
| 5733 | break; |
| 5734 | |
| 5735 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 5736 | |
| 5737 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_SHARED_KEY; |
| 5738 | break; |
| 5739 | default: |
| 5740 | |
| 5741 | #ifdef FEATURE_WLAN_ESE |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5742 | hdd_debug("In default, unknown auth type."); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5743 | #endif /* FEATURE_WLAN_ESE */ |
| 5744 | pRoamProfile->AuthType.authType[0] = eCSR_AUTH_TYPE_UNKNOWN; |
| 5745 | break; |
| 5746 | } |
| 5747 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5748 | hdd_debug("Set roam Authtype to %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5749 | pWextState->roamProfile.AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5750 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5751 | return 0; |
| 5752 | } |
| 5753 | |
| 5754 | /** |
| 5755 | * __iw_set_essid() - This function sets the ssid received from wpa_supplicant |
| 5756 | * to the CSR roam profile. |
| 5757 | * |
| 5758 | * @dev: Pointer to the net device. |
| 5759 | * @info: Pointer to the iw_request_info. |
| 5760 | * @wrqu: Pointer to the iwreq_data. |
| 5761 | * @extra: Pointer to the data. |
| 5762 | * |
| 5763 | * Return: 0 for success, error number on failure |
| 5764 | */ |
| 5765 | static int __iw_set_essid(struct net_device *dev, |
| 5766 | struct iw_request_info *info, |
| 5767 | union iwreq_data *wrqu, char *extra) |
| 5768 | { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5769 | uint32_t status = 0; |
| 5770 | hdd_wext_state_t *pWextState; |
| 5771 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5772 | hdd_context_t *hdd_ctx; |
| 5773 | uint32_t roamId; |
| 5774 | tCsrRoamProfile *pRoamProfile; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5775 | eCsrAuthType RSNAuthType; |
| 5776 | tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5777 | int ret; |
| 5778 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 5779 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5780 | |
| 5781 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 5782 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5783 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5784 | return ret; |
| 5785 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 5786 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 5787 | if (0 != ret) |
| 5788 | return ret; |
| 5789 | |
Krunal Soni | be766b0 | 2016-03-10 13:00:44 -0800 | [diff] [blame] | 5790 | if (pAdapter->device_mode != QDF_STA_MODE && |
Jeff Johnson | d6e4b63 | 2016-10-03 13:49:27 -0700 | [diff] [blame] | 5791 | pAdapter->device_mode != QDF_IBSS_MODE && |
| 5792 | pAdapter->device_mode != QDF_P2P_CLIENT_MODE) { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5793 | hdd_warn("device mode %s(%d) is not allowed", |
| 5794 | hdd_device_mode_to_string(pAdapter->device_mode), |
| 5795 | pAdapter->device_mode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5796 | return -EINVAL; |
| 5797 | } |
| 5798 | |
| 5799 | pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 5800 | |
| 5801 | if (pWextState->mTKIPCounterMeasures == TKIP_COUNTER_MEASURE_STARTED) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5802 | hdd_warn("Counter measure is in progress"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5803 | return -EBUSY; |
| 5804 | } |
| 5805 | if (SIR_MAC_MAX_SSID_LENGTH < wrqu->essid.length) |
| 5806 | return -EINVAL; |
| 5807 | |
| 5808 | pRoamProfile = &pWextState->roamProfile; |
Agrawal Ashish | 3d000b4 | 2017-02-07 13:44:50 +0530 | [diff] [blame] | 5809 | /*Try disconnecting if already in connected state*/ |
| 5810 | status = wlan_hdd_try_disconnect(pAdapter); |
| 5811 | if (0 > status) { |
| 5812 | hdd_err("Failed to disconnect the existing connection"); |
| 5813 | return -EALREADY; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5814 | } |
| 5815 | |
| 5816 | /* |
| 5817 | * when cfg80211 defined, wpa_supplicant wext driver uses |
| 5818 | * zero-length, null-string ssid for force disconnection. |
| 5819 | * after disconnection (if previously connected) and cleaning ssid, |
| 5820 | * driver MUST return success. |
| 5821 | */ |
| 5822 | if (0 == wrqu->essid.length) |
| 5823 | return 0; |
| 5824 | |
| 5825 | status = hdd_wmm_get_uapsd_mask(pAdapter, |
| 5826 | &pWextState->roamProfile.uapsd_mask); |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 5827 | if (QDF_STATUS_SUCCESS != status) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5828 | pWextState->roamProfile.uapsd_mask = 0; |
| 5829 | |
| 5830 | pWextState->roamProfile.SSIDs.numOfSSIDs = 1; |
| 5831 | |
| 5832 | pWextState->roamProfile.SSIDs.SSIDList->SSID.length = |
| 5833 | wrqu->essid.length; |
| 5834 | |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5835 | qdf_mem_zero(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5836 | sizeof(pWextState->roamProfile.SSIDs.SSIDList->SSID.ssId)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 5837 | qdf_mem_copy((void *)(pWextState->roamProfile.SSIDs.SSIDList->SSID. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5838 | ssId), extra, wrqu->essid.length); |
| 5839 | if (IW_AUTH_WPA_VERSION_WPA == pWextState->wpaVersion |
| 5840 | || IW_AUTH_WPA_VERSION_WPA2 == pWextState->wpaVersion) { |
| 5841 | |
| 5842 | /* set gen ie */ |
| 5843 | hdd_set_genie_to_csr(pAdapter, &RSNAuthType); |
| 5844 | |
| 5845 | /* set auth */ |
| 5846 | hdd_set_csr_auth_type(pAdapter, RSNAuthType); |
| 5847 | } |
| 5848 | #ifdef FEATURE_WLAN_WAPI |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5849 | hdd_debug("Setting WAPI AUTH Type and Encryption Mode values"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5850 | if (pAdapter->wapi_info.nWapiMode) { |
| 5851 | switch (pAdapter->wapi_info.wapiAuthMode) { |
| 5852 | case WAPI_AUTH_MODE_PSK: |
| 5853 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5854 | hdd_debug("WAPI AUTH TYPE: PSK: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5855 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5856 | pRoamProfile->AuthType.numEntries = 1; |
| 5857 | pRoamProfile->AuthType.authType[0] = |
| 5858 | eCSR_AUTH_TYPE_WAPI_WAI_PSK; |
| 5859 | break; |
| 5860 | } |
| 5861 | case WAPI_AUTH_MODE_CERT: |
| 5862 | { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5863 | hdd_debug("WAPI AUTH TYPE: CERT: %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 5864 | pAdapter->wapi_info.wapiAuthMode); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5865 | pRoamProfile->AuthType.numEntries = 1; |
| 5866 | pRoamProfile->AuthType.authType[0] = |
| 5867 | eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE; |
| 5868 | break; |
| 5869 | } |
| 5870 | } /* End of switch */ |
| 5871 | if (pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_PSK || |
| 5872 | pAdapter->wapi_info.wapiAuthMode == WAPI_AUTH_MODE_CERT) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5873 | hdd_debug("WAPI PAIRWISE/GROUP ENCRYPTION: WPI"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5874 | pRoamProfile->EncryptionType.numEntries = 1; |
| 5875 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 5876 | eCSR_ENCRYPT_TYPE_WPI; |
| 5877 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 5878 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 5879 | eCSR_ENCRYPT_TYPE_WPI; |
| 5880 | } |
| 5881 | } |
| 5882 | #endif /* FEATURE_WLAN_WAPI */ |
| 5883 | /* if previous genIE is not NULL, update AssocIE */ |
| 5884 | if (0 != pWextState->genIE.length) { |
| 5885 | memset(&pWextState->assocAddIE, 0, |
| 5886 | sizeof(pWextState->assocAddIE)); |
| 5887 | memcpy(pWextState->assocAddIE.addIEdata, |
| 5888 | pWextState->genIE.addIEdata, pWextState->genIE.length); |
| 5889 | pWextState->assocAddIE.length = pWextState->genIE.length; |
| 5890 | pWextState->roamProfile.pAddIEAssoc = |
| 5891 | pWextState->assocAddIE.addIEdata; |
| 5892 | pWextState->roamProfile.nAddIEAssocLength = |
| 5893 | pWextState->assocAddIE.length; |
| 5894 | |
| 5895 | /* clear previous genIE after use it */ |
| 5896 | memset(&pWextState->genIE, 0, sizeof(pWextState->genIE)); |
| 5897 | } |
| 5898 | |
| 5899 | /* |
| 5900 | * Assumes it is not WPS Association by default, except when |
| 5901 | * pAddIEAssoc has WPS IE. |
| 5902 | */ |
| 5903 | pWextState->roamProfile.bWPSAssociation = false; |
| 5904 | |
| 5905 | if (NULL != wlan_hdd_get_wps_ie_ptr(pWextState->roamProfile.pAddIEAssoc, |
| 5906 | pWextState->roamProfile. |
| 5907 | nAddIEAssocLength)) |
| 5908 | pWextState->roamProfile.bWPSAssociation = true; |
| 5909 | |
| 5910 | /* Disable auto BMPS entry by PMC until DHCP is done */ |
| 5911 | sme_set_dhcp_till_power_active_flag(WLAN_HDD_GET_HAL_CTX(pAdapter), |
| 5912 | true); |
| 5913 | |
| 5914 | pWextState->roamProfile.csrPersona = pAdapter->device_mode; |
| 5915 | |
| 5916 | if (eCSR_BSS_TYPE_START_IBSS == pRoamProfile->BSSType) { |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5917 | pRoamProfile->ch_params.ch_width = 0; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5918 | hdd_select_cbmode(pAdapter, |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5919 | (WLAN_HDD_GET_CTX(pAdapter))->config->AdHocChannel5G, |
| 5920 | &pRoamProfile->ch_params); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5921 | } |
Naveen Rawat | c77e6e7 | 2016-08-05 15:19:03 -0700 | [diff] [blame] | 5922 | |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5923 | /* |
| 5924 | * Change conn_state to connecting before sme_roam_connect(), |
| 5925 | * because sme_roam_connect() has a direct path to call |
| 5926 | * hdd_sme_roam_callback(), which will change the conn_state |
| 5927 | * If direct path, conn_state will be accordingly changed to |
| 5928 | * NotConnected or Associated by either |
| 5929 | * hdd_association_completion_handler() or hdd_dis_connect_handler() |
| 5930 | * in sme_RoamCallback()if sme_RomConnect is to be queued, |
| 5931 | * Connecting state will remain until it is completed. |
| 5932 | * |
| 5933 | * If connection state is not changed, |
| 5934 | * connection state will remain in eConnectionState_NotConnected state. |
| 5935 | * In hdd_association_completion_handler, "hddDisconInProgress" is |
| 5936 | * set to true if conn state is eConnectionState_NotConnected. |
| 5937 | * If "hddDisconInProgress" is set to true then cfg80211 layer is not |
| 5938 | * informed of connect result indication which is an issue. |
| 5939 | */ |
| 5940 | if (QDF_STA_MODE == pAdapter->device_mode || |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 5941 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode) |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5942 | hdd_conn_set_connection_state(pAdapter, |
| 5943 | eConnectionState_Connecting); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5944 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5945 | status = sme_roam_connect(hHal, pAdapter->sessionId, |
| 5946 | &(pWextState->roamProfile), &roamId); |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5947 | if ((QDF_STATUS_SUCCESS != status) && |
| 5948 | (QDF_STA_MODE == pAdapter->device_mode || |
| 5949 | QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 5950 | hdd_err("sme_roam_connect failed session_id: %d status %d -> NotConnected", |
Agrawal Ashish | 6b01576 | 2016-05-05 11:22:18 +0530 | [diff] [blame] | 5951 | pAdapter->sessionId, status); |
| 5952 | /* change back to NotAssociated */ |
| 5953 | hdd_conn_set_connection_state(pAdapter, |
| 5954 | eConnectionState_NotConnected); |
| 5955 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 5956 | pRoamProfile->ChannelInfo.ChannelList = NULL; |
| 5957 | pRoamProfile->ChannelInfo.numOfChannels = 0; |
| 5958 | |
| 5959 | EXIT(); |
| 5960 | return status; |
| 5961 | } |
| 5962 | |
| 5963 | /** |
| 5964 | * iw_set_essid() - set essid handler function |
| 5965 | * @dev: Pointer to the net device. |
| 5966 | * @info: Pointer to the iw_request_info. |
| 5967 | * @wrqu: Pointer to the iwreq_data. |
| 5968 | * @extra: Pointer to the data. |
| 5969 | * |
| 5970 | * Return: 0 for success, error number on failure |
| 5971 | */ |
| 5972 | int iw_set_essid(struct net_device *dev, |
| 5973 | struct iw_request_info *info, |
| 5974 | union iwreq_data *wrqu, char *extra) |
| 5975 | { |
| 5976 | int ret; |
| 5977 | |
| 5978 | cds_ssr_protect(__func__); |
| 5979 | ret = __iw_set_essid(dev, info, wrqu, extra); |
| 5980 | cds_ssr_unprotect(__func__); |
| 5981 | |
| 5982 | return ret; |
| 5983 | } |
| 5984 | |
| 5985 | /** |
| 5986 | * __iw_get_essid() - This function returns the essid to the wpa_supplicant |
| 5987 | * @dev: pointer to the net device |
| 5988 | * @info: pointer to the iw request info |
| 5989 | * @dwrq: pointer to iw_point |
| 5990 | * @extra: pointer to the data |
| 5991 | * |
| 5992 | * Return: 0 on success, error number otherwise |
| 5993 | */ |
| 5994 | static int __iw_get_essid(struct net_device *dev, |
| 5995 | struct iw_request_info *info, |
| 5996 | struct iw_point *dwrq, char *extra) |
| 5997 | { |
| 5998 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 5999 | hdd_context_t *hdd_ctx; |
| 6000 | hdd_wext_state_t *wextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6001 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6002 | int ret; |
| 6003 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6004 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6005 | |
| 6006 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6007 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6008 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6009 | return ret; |
| 6010 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6011 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6012 | if (0 != ret) |
| 6013 | return ret; |
| 6014 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6015 | if ((pHddStaCtx->conn_info.connState == eConnectionState_Associated && |
| 6016 | wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0) || |
| 6017 | ((pHddStaCtx->conn_info.connState == eConnectionState_IbssConnected |
| 6018 | || pHddStaCtx->conn_info.connState == |
| 6019 | eConnectionState_IbssDisconnected) |
| 6020 | && wextBuf->roamProfile.SSIDs.SSIDList->SSID.length > 0)) { |
| 6021 | dwrq->length = pHddStaCtx->conn_info.SSID.SSID.length; |
| 6022 | memcpy(extra, pHddStaCtx->conn_info.SSID.SSID.ssId, |
| 6023 | dwrq->length); |
| 6024 | dwrq->flags = 1; |
| 6025 | } else { |
| 6026 | memset(extra, 0, dwrq->length); |
| 6027 | dwrq->length = 0; |
| 6028 | dwrq->flags = 0; |
| 6029 | } |
| 6030 | EXIT(); |
| 6031 | return 0; |
| 6032 | } |
| 6033 | |
| 6034 | /** |
| 6035 | * iw_get_essid() - get essid handler function |
| 6036 | * @dev: Pointer to the net device. |
| 6037 | * @info: Pointer to the iw_request_info. |
| 6038 | * @wrqu: Pointer to the iwreq_data. |
| 6039 | * @extra: Pointer to the data. |
| 6040 | * |
| 6041 | * Return: 0 for success, error number on failure |
| 6042 | */ |
| 6043 | int iw_get_essid(struct net_device *dev, |
| 6044 | struct iw_request_info *info, |
| 6045 | struct iw_point *wrqu, char *extra) |
| 6046 | { |
| 6047 | int ret; |
| 6048 | |
| 6049 | cds_ssr_protect(__func__); |
| 6050 | ret = __iw_get_essid(dev, info, wrqu, extra); |
| 6051 | cds_ssr_unprotect(__func__); |
| 6052 | |
| 6053 | return ret; |
| 6054 | } |
| 6055 | |
| 6056 | /** |
| 6057 | * __iw_set_auth() - |
| 6058 | * This function sets the auth type received from the wpa_supplicant |
| 6059 | * @dev: pointer to the net device |
| 6060 | * @info: pointer to the iw request info |
| 6061 | * @wrqu: pointer to iwreq_data |
| 6062 | * @extra: pointer to the data |
| 6063 | * |
| 6064 | * Return: 0 on success, error number otherwise |
| 6065 | */ |
| 6066 | static int __iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6067 | union iwreq_data *wrqu, char *extra) |
| 6068 | { |
| 6069 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6070 | hdd_context_t *hdd_ctx; |
| 6071 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6072 | hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); |
| 6073 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6074 | eCsrEncryptionType mcEncryptionType; |
| 6075 | eCsrEncryptionType ucEncryptionType; |
| 6076 | int ret; |
| 6077 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6078 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6079 | |
| 6080 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6081 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6082 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6083 | return ret; |
| 6084 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6085 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6086 | if (0 != ret) |
| 6087 | return ret; |
| 6088 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6089 | switch (wrqu->param.flags & IW_AUTH_INDEX) { |
| 6090 | case IW_AUTH_WPA_VERSION: |
| 6091 | pWextState->wpaVersion = wrqu->param.value; |
| 6092 | break; |
| 6093 | |
| 6094 | case IW_AUTH_CIPHER_PAIRWISE: |
| 6095 | { |
| 6096 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6097 | ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6098 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6099 | ucEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6100 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6101 | ucEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6102 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6103 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6104 | == |
| 6105 | (pWextState-> |
| 6106 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6107 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6108 | pHddStaCtx->conn_info.authType)) |
| 6109 | /*Dynamic WEP key */ |
| 6110 | ucEncryptionType = |
| 6111 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6112 | else |
| 6113 | /*Static WEP key */ |
| 6114 | ucEncryptionType = |
| 6115 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6116 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6117 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6118 | == |
| 6119 | (pWextState-> |
| 6120 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6121 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6122 | pHddStaCtx->conn_info.authType)) |
| 6123 | /*Dynamic WEP key */ |
| 6124 | ucEncryptionType = |
| 6125 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6126 | else |
| 6127 | /*Static WEP key */ |
| 6128 | ucEncryptionType = |
| 6129 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6130 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6131 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
| 6132 | wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6133 | return -EINVAL; |
| 6134 | } |
| 6135 | |
| 6136 | pRoamProfile->EncryptionType.numEntries = 1; |
| 6137 | pRoamProfile->EncryptionType.encryptionType[0] = |
| 6138 | ucEncryptionType; |
| 6139 | } |
| 6140 | break; |
| 6141 | case IW_AUTH_CIPHER_GROUP: |
| 6142 | { |
| 6143 | if (wrqu->param.value & IW_AUTH_CIPHER_NONE) { |
| 6144 | mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE; |
| 6145 | } else if (wrqu->param.value & IW_AUTH_CIPHER_TKIP) { |
| 6146 | mcEncryptionType = eCSR_ENCRYPT_TYPE_TKIP; |
| 6147 | } else if (wrqu->param.value & IW_AUTH_CIPHER_CCMP) { |
| 6148 | mcEncryptionType = eCSR_ENCRYPT_TYPE_AES; |
| 6149 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP40) { |
| 6150 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6151 | == |
| 6152 | (pWextState-> |
| 6153 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6154 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6155 | pHddStaCtx->conn_info.authType)) |
| 6156 | mcEncryptionType = |
| 6157 | eCSR_ENCRYPT_TYPE_WEP40; |
| 6158 | else |
| 6159 | mcEncryptionType = |
| 6160 | eCSR_ENCRYPT_TYPE_WEP40_STATICKEY; |
| 6161 | } else if (wrqu->param.value & IW_AUTH_CIPHER_WEP104) { |
| 6162 | /* Dynamic WEP keys won't work with shared keys */ |
| 6163 | if ((IW_AUTH_KEY_MGMT_802_1X |
| 6164 | == |
| 6165 | (pWextState-> |
| 6166 | authKeyMgmt & IW_AUTH_KEY_MGMT_802_1X)) |
| 6167 | && (eCSR_AUTH_TYPE_OPEN_SYSTEM == |
| 6168 | pHddStaCtx->conn_info.authType)) { |
| 6169 | mcEncryptionType = |
| 6170 | eCSR_ENCRYPT_TYPE_WEP104; |
| 6171 | } else { |
| 6172 | mcEncryptionType = |
| 6173 | eCSR_ENCRYPT_TYPE_WEP104_STATICKEY; |
| 6174 | } |
| 6175 | } else { |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6176 | hdd_warn("value %d UNKNOWN IW_AUTH_CIPHER", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6177 | wrqu->param.value); |
| 6178 | return -EINVAL; |
| 6179 | } |
| 6180 | |
| 6181 | pRoamProfile->mcEncryptionType.numEntries = 1; |
| 6182 | pRoamProfile->mcEncryptionType.encryptionType[0] = |
| 6183 | mcEncryptionType; |
| 6184 | } |
| 6185 | break; |
| 6186 | |
| 6187 | case IW_AUTH_80211_AUTH_ALG: |
| 6188 | { |
Jeff Johnson | 5a06237 | 2017-01-12 09:51:25 -0800 | [diff] [blame] | 6189 | /* Save the auth algo here and set auth type to SME |
| 6190 | * Roam profile in the iw_set_ap_address |
| 6191 | */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6192 | if (wrqu->param.value & IW_AUTH_ALG_OPEN_SYSTEM) |
| 6193 | pHddStaCtx->conn_info.authType = |
| 6194 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6195 | |
| 6196 | else if (wrqu->param.value & IW_AUTH_ALG_SHARED_KEY) |
| 6197 | pHddStaCtx->conn_info.authType = |
| 6198 | eCSR_AUTH_TYPE_SHARED_KEY; |
| 6199 | |
| 6200 | else if (wrqu->param.value & IW_AUTH_ALG_LEAP) |
| 6201 | /*Not supported */ |
| 6202 | pHddStaCtx->conn_info.authType = |
| 6203 | eCSR_AUTH_TYPE_OPEN_SYSTEM; |
| 6204 | pWextState->roamProfile.AuthType.authType[0] = |
| 6205 | pHddStaCtx->conn_info.authType; |
| 6206 | } |
| 6207 | break; |
| 6208 | |
| 6209 | case IW_AUTH_KEY_MGMT: |
| 6210 | { |
| 6211 | #ifdef FEATURE_WLAN_ESE |
| 6212 | #define IW_AUTH_KEY_MGMT_CCKM 8 /* Should be in linux/wireless.h */ |
| 6213 | /*Check for CCKM AKM type */ |
| 6214 | if (wrqu->param.value & IW_AUTH_KEY_MGMT_CCKM) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6215 | hdd_debug("CCKM AKM Set %d", wrqu->param.value); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6216 | /* Set the CCKM bit in authKeyMgmt */ |
| 6217 | /* |
| 6218 | * Right now, this breaks all ref to authKeyMgmt because |
| 6219 | * our code doesn't realize it is a "bitfield" |
| 6220 | */ |
Jeff Johnson | d084adb | 2017-08-16 11:19:52 -0700 | [diff] [blame] | 6221 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_CCKM; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6222 | } else if (wrqu->param.value & IW_AUTH_KEY_MGMT_PSK) { |
| 6223 | /* Save the key management */ |
| 6224 | pWextState->authKeyMgmt |= IW_AUTH_KEY_MGMT_PSK; |
Jeff Johnson | 3474602 | 2017-02-07 16:32:57 -0800 | [diff] [blame] | 6225 | } else if (!(wrqu->param.value & IW_AUTH_KEY_MGMT_802_1X)) { |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6226 | /* Save the key management anyway */ |
| 6227 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6228 | } else { /* It must be IW_AUTH_KEY_MGMT_802_1X */ |
| 6229 | /* Save the key management */ |
| 6230 | pWextState->authKeyMgmt |= |
| 6231 | IW_AUTH_KEY_MGMT_802_1X; |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6232 | } |
| 6233 | #else |
| 6234 | /* Save the key management */ |
| 6235 | pWextState->authKeyMgmt = wrqu->param.value; |
| 6236 | #endif /* FEATURE_WLAN_ESE */ |
| 6237 | } |
| 6238 | break; |
| 6239 | |
| 6240 | case IW_AUTH_TKIP_COUNTERMEASURES: |
| 6241 | { |
| 6242 | if (wrqu->param.value) { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6243 | hdd_debug("Counter Measure started %d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6244 | wrqu->param.value); |
| 6245 | pWextState->mTKIPCounterMeasures = |
| 6246 | TKIP_COUNTER_MEASURE_STARTED; |
| 6247 | } else { |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6248 | hdd_debug("Counter Measure stopped=%d", |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6249 | wrqu->param.value); |
| 6250 | pWextState->mTKIPCounterMeasures = |
| 6251 | TKIP_COUNTER_MEASURE_STOPED; |
| 6252 | } |
| 6253 | } |
| 6254 | break; |
| 6255 | case IW_AUTH_DROP_UNENCRYPTED: |
| 6256 | case IW_AUTH_WPA_ENABLED: |
| 6257 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
| 6258 | case IW_AUTH_ROAMING_CONTROL: |
| 6259 | case IW_AUTH_PRIVACY_INVOKED: |
| 6260 | |
| 6261 | default: |
| 6262 | |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6263 | hdd_warn("called with unsupported auth type %d", |
| 6264 | wrqu->param.flags & IW_AUTH_INDEX); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6265 | break; |
| 6266 | } |
| 6267 | |
| 6268 | EXIT(); |
| 6269 | return 0; |
| 6270 | } |
| 6271 | |
| 6272 | /** |
| 6273 | * iw_set_auth() - set auth callback function |
| 6274 | * @dev: Pointer to the net device. |
| 6275 | * @info: Pointer to the iw_request_info. |
| 6276 | * @wrqu: Pointer to the iwreq_data. |
| 6277 | * @extra: Pointer to the data. |
| 6278 | * |
| 6279 | * Return: 0 for success, error number on failure. |
| 6280 | */ |
| 6281 | int iw_set_auth(struct net_device *dev, struct iw_request_info *info, |
| 6282 | union iwreq_data *wrqu, char *extra) |
| 6283 | { |
| 6284 | int ret; |
| 6285 | |
| 6286 | cds_ssr_protect(__func__); |
| 6287 | ret = __iw_set_auth(dev, info, wrqu, extra); |
| 6288 | cds_ssr_unprotect(__func__); |
| 6289 | |
| 6290 | return ret; |
| 6291 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6292 | /** |
| 6293 | * __iw_get_auth() - |
| 6294 | * This function returns the auth type to the wpa_supplicant |
| 6295 | * @dev: pointer to the net device |
| 6296 | * @info: pointer to the iw request info |
| 6297 | * @wrqu: pointer to iwreq_data |
| 6298 | * @extra: pointer to the data |
| 6299 | * |
| 6300 | * Return: 0 on success, error number otherwise |
| 6301 | */ |
| 6302 | static int __iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6303 | union iwreq_data *wrqu, char *extra) |
| 6304 | { |
| 6305 | hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6306 | hdd_context_t *hdd_ctx; |
| 6307 | hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); |
| 6308 | tCsrRoamProfile *pRoamProfile = &pWextState->roamProfile; |
| 6309 | int ret; |
| 6310 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6311 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6312 | |
| 6313 | hdd_ctx = WLAN_HDD_GET_CTX(pAdapter); |
| 6314 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6315 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6316 | return ret; |
| 6317 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6318 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6319 | if (0 != ret) |
| 6320 | return ret; |
| 6321 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6322 | switch (pRoamProfile->negotiatedAuthType) { |
| 6323 | case eCSR_AUTH_TYPE_WPA_NONE: |
| 6324 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6325 | wrqu->param.value = IW_AUTH_WPA_VERSION_DISABLED; |
| 6326 | break; |
| 6327 | case eCSR_AUTH_TYPE_WPA: |
| 6328 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6329 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA; |
| 6330 | break; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6331 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6332 | case eCSR_AUTH_TYPE_FT_RSN: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6333 | case eCSR_AUTH_TYPE_RSN: |
| 6334 | wrqu->param.flags = IW_AUTH_WPA_VERSION; |
| 6335 | wrqu->param.value = IW_AUTH_WPA_VERSION_WPA2; |
| 6336 | break; |
| 6337 | case eCSR_AUTH_TYPE_OPEN_SYSTEM: |
| 6338 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6339 | break; |
| 6340 | case eCSR_AUTH_TYPE_SHARED_KEY: |
| 6341 | wrqu->param.value = IW_AUTH_ALG_SHARED_KEY; |
| 6342 | break; |
| 6343 | case eCSR_AUTH_TYPE_UNKNOWN: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6344 | hdd_debug("called with unknown auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6345 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6346 | break; |
| 6347 | case eCSR_AUTH_TYPE_AUTOSWITCH: |
| 6348 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6349 | break; |
| 6350 | case eCSR_AUTH_TYPE_WPA_PSK: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6351 | hdd_debug("called with WPA PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6352 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6353 | return -EIO; |
Deepak Dhamdhere | 9f09e75 | 2016-01-09 23:17:25 -0800 | [diff] [blame] | 6354 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6355 | case eCSR_AUTH_TYPE_FT_RSN_PSK: |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6356 | case eCSR_AUTH_TYPE_RSN_PSK: |
| 6357 | #ifdef WLAN_FEATURE_11W |
| 6358 | case eCSR_AUTH_TYPE_RSN_PSK_SHA256: |
| 6359 | case eCSR_AUTH_TYPE_RSN_8021X_SHA256: |
| 6360 | #endif |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6361 | hdd_debug("called with RSN PSK auth type"); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6362 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6363 | return -EIO; |
| 6364 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6365 | hdd_warn("Unknown auth type: %d", |
| 6366 | pRoamProfile->negotiatedAuthType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6367 | wrqu->param.value = IW_AUTH_ALG_OPEN_SYSTEM; |
| 6368 | return -EIO; |
| 6369 | } |
| 6370 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_PAIRWISE)) { |
| 6371 | switch (pRoamProfile->negotiatedUCEncryptionType) { |
| 6372 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6373 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6374 | break; |
| 6375 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6376 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6377 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6378 | break; |
| 6379 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6380 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6381 | break; |
| 6382 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6383 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6384 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6385 | break; |
| 6386 | case eCSR_ENCRYPT_TYPE_AES: |
| 6387 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6388 | break; |
| 6389 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6390 | hdd_warn("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6391 | pRoamProfile->negotiatedUCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6392 | return -EIO; |
| 6393 | } |
| 6394 | } |
| 6395 | |
| 6396 | if (((wrqu->param.flags & IW_AUTH_INDEX) == IW_AUTH_CIPHER_GROUP)) { |
| 6397 | switch (pRoamProfile->negotiatedMCEncryptionType) { |
| 6398 | case eCSR_ENCRYPT_TYPE_NONE: |
| 6399 | wrqu->param.value = IW_AUTH_CIPHER_NONE; |
| 6400 | break; |
| 6401 | case eCSR_ENCRYPT_TYPE_WEP40: |
| 6402 | case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY: |
| 6403 | wrqu->param.value = IW_AUTH_CIPHER_WEP40; |
| 6404 | break; |
| 6405 | case eCSR_ENCRYPT_TYPE_TKIP: |
| 6406 | wrqu->param.value = IW_AUTH_CIPHER_TKIP; |
| 6407 | break; |
| 6408 | case eCSR_ENCRYPT_TYPE_WEP104: |
| 6409 | case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY: |
| 6410 | wrqu->param.value = IW_AUTH_CIPHER_WEP104; |
| 6411 | break; |
| 6412 | case eCSR_ENCRYPT_TYPE_AES: |
| 6413 | wrqu->param.value = IW_AUTH_CIPHER_CCMP; |
| 6414 | break; |
| 6415 | default: |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6416 | hdd_err("called with unknown auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6417 | pRoamProfile->negotiatedMCEncryptionType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6418 | return -EIO; |
| 6419 | } |
| 6420 | } |
| 6421 | |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6422 | hdd_debug("called with auth type %d", |
Archana Ramachandran | 75c1ca7 | 2016-08-22 17:20:25 -0700 | [diff] [blame] | 6423 | pRoamProfile->AuthType.authType[0]); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6424 | EXIT(); |
| 6425 | return 0; |
| 6426 | } |
| 6427 | |
| 6428 | /** |
| 6429 | * iw_get_auth() - get auth callback function |
| 6430 | * @dev: Pointer to the net device. |
| 6431 | * @info: Pointer to the iw_request_info. |
| 6432 | * @wrqu: Pointer to the iwreq_data. |
| 6433 | * @extra: Pointer to the data. |
| 6434 | * |
| 6435 | * Return: 0 for success, error number on failure. |
| 6436 | */ |
| 6437 | int iw_get_auth(struct net_device *dev, struct iw_request_info *info, |
| 6438 | union iwreq_data *wrqu, char *extra) |
| 6439 | { |
| 6440 | int ret; |
| 6441 | |
| 6442 | cds_ssr_protect(__func__); |
| 6443 | ret = __iw_get_auth(dev, info, wrqu, extra); |
| 6444 | cds_ssr_unprotect(__func__); |
| 6445 | |
| 6446 | return ret; |
| 6447 | } |
| 6448 | |
| 6449 | /** |
| 6450 | * __iw_set_ap_address() - set ap address |
| 6451 | * @dev: pointer to the net device |
| 6452 | * @info: pointer to the iw request info |
| 6453 | * @wrqu: pointer to iwreq_data |
| 6454 | * @extra: pointer to the data |
| 6455 | * |
| 6456 | * This function updates the HDD global station context connection info |
| 6457 | * BSSID with the MAC address received from the wpa_supplicant. |
| 6458 | * |
| 6459 | * Return: 0 on success, error number otherwise |
| 6460 | */ |
| 6461 | static int __iw_set_ap_address(struct net_device *dev, |
| 6462 | struct iw_request_info *info, |
| 6463 | union iwreq_data *wrqu, char *extra) |
| 6464 | { |
| 6465 | |
| 6466 | hdd_adapter_t *adapter; |
| 6467 | hdd_context_t *hdd_ctx; |
| 6468 | hdd_station_ctx_t *pHddStaCtx = |
| 6469 | WLAN_HDD_GET_STATION_CTX_PTR(WLAN_HDD_GET_PRIV_PTR(dev)); |
| 6470 | uint8_t *pMacAddress = NULL; |
| 6471 | int ret; |
| 6472 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6473 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6474 | |
| 6475 | adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6476 | |
| 6477 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6478 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6479 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6480 | return ret; |
| 6481 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6482 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6483 | if (0 != ret) |
| 6484 | return ret; |
| 6485 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6486 | pMacAddress = (uint8_t *) wrqu->ap_addr.sa_data; |
Srinivas Girigowda | 6c8769d | 2017-03-19 22:54:18 -0700 | [diff] [blame] | 6487 | hdd_debug(" " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMacAddress)); |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6488 | qdf_mem_copy(pHddStaCtx->conn_info.bssId.bytes, pMacAddress, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6489 | sizeof(struct qdf_mac_addr)); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6490 | EXIT(); |
| 6491 | |
| 6492 | return 0; |
| 6493 | } |
| 6494 | |
| 6495 | /** |
| 6496 | * iw_set_ap_address() - set ap addresses callback function |
| 6497 | * @dev: Pointer to the net device. |
| 6498 | * @info: Pointer to the iw_request_info. |
| 6499 | * @wrqu: Pointer to the iwreq_data. |
| 6500 | * @extra: Pointer to the data. |
| 6501 | * |
| 6502 | * Return: 0 for success, error number on failure. |
| 6503 | */ |
| 6504 | int iw_set_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6505 | union iwreq_data *wrqu, char *extra) |
| 6506 | { |
| 6507 | int ret; |
| 6508 | |
| 6509 | cds_ssr_protect(__func__); |
| 6510 | ret = __iw_set_ap_address(dev, info, wrqu, extra); |
| 6511 | cds_ssr_unprotect(__func__); |
| 6512 | |
| 6513 | return ret; |
| 6514 | } |
| 6515 | |
| 6516 | /** |
| 6517 | * __iw_get_ap_address() - get ap address |
| 6518 | * @dev: pointer to the net device |
| 6519 | * @info: pointer to the iw request info |
| 6520 | * @wrqu: pointer to iwreq_data |
| 6521 | * @extra: pointer to the data |
| 6522 | * |
| 6523 | * This function returns currently associated BSSID. |
| 6524 | * |
| 6525 | * Return: 0 on success, error number otherwise |
| 6526 | */ |
| 6527 | static int __iw_get_ap_address(struct net_device *dev, |
| 6528 | struct iw_request_info *info, |
| 6529 | union iwreq_data *wrqu, char *extra) |
| 6530 | { |
| 6531 | hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); |
| 6532 | hdd_context_t *hdd_ctx; |
| 6533 | hdd_station_ctx_t *pHddStaCtx = |
| 6534 | WLAN_HDD_GET_STATION_CTX_PTR(adapter); |
| 6535 | int ret; |
| 6536 | |
Jeff Johnson | b25dcb1 | 2016-02-11 17:46:42 -0800 | [diff] [blame] | 6537 | ENTER_DEV(dev); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6538 | |
| 6539 | hdd_ctx = WLAN_HDD_GET_CTX(adapter); |
| 6540 | ret = wlan_hdd_validate_context(hdd_ctx); |
Abhishek Singh | 23edd1c | 2016-05-05 11:56:06 +0530 | [diff] [blame] | 6541 | if (ret) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6542 | return ret; |
| 6543 | |
Jeff Johnson | 441e1f7 | 2017-02-07 08:50:49 -0800 | [diff] [blame] | 6544 | ret = hdd_check_standard_wext_control(hdd_ctx, info); |
| 6545 | if (0 != ret) |
| 6546 | return ret; |
| 6547 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6548 | if (pHddStaCtx->conn_info.connState == eConnectionState_Associated || |
| 6549 | eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState) { |
Anurag Chouhan | 600c3a0 | 2016-03-01 10:33:54 +0530 | [diff] [blame] | 6550 | qdf_mem_copy(wrqu->ap_addr.sa_data, |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6551 | pHddStaCtx->conn_info.bssId.bytes, |
Anurag Chouhan | 6d76066 | 2016-02-20 16:05:43 +0530 | [diff] [blame] | 6552 | QDF_MAC_ADDR_SIZE); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 6553 | } else { |
| 6554 | memset(wrqu->ap_addr.sa_data, 0, sizeof(wrqu->ap_addr.sa_data)); |
| 6555 | } |
| 6556 | EXIT(); |
| 6557 | return 0; |
| 6558 | } |
| 6559 | |
| 6560 | /** |
| 6561 | * iw_get_ap_address() - get ap addresses callback function |
| 6562 | * @dev: Pointer to the net device. |
| 6563 | * @info: Pointer to the iw_request_info. |
| 6564 | * @wrqu: Pointer to the iwreq_data. |
| 6565 | * @extra: Pointer to the data. |
| 6566 | * |
| 6567 | * Return: 0 for success, error number on failure. |
| 6568 | */ |
| 6569 | int iw_get_ap_address(struct net_device *dev, struct iw_request_info *info, |
| 6570 | union iwreq_data *wrqu, char *extra) |
| 6571 | { |
| 6572 | int ret; |
| 6573 | |
| 6574 | cds_ssr_protect(__func__); |
| 6575 | ret = __iw_get_ap_address(dev, info, wrqu, extra); |
| 6576 | cds_ssr_unprotect(__func__); |
| 6577 | |
| 6578 | return ret; |
| 6579 | } |